@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | "<a href=\"$webserverURL/redirect.php?go=".htmlentities(urlencode('http://www.egroupware.org')).'">' |
23 | 23 | */ |
24 | 24 | |
25 | - if(!function_exists('html_entity_decode')) |
|
25 | + if (!function_exists('html_entity_decode')) |
|
26 | 26 | { |
27 | 27 | function html_entity_decode($given_html, $quote_style = ENT_QUOTES) |
28 | 28 | { |
29 | - $trans_table = array_flip(get_html_translation_table( HTML_SPECIALCHARS, $quote_style)); |
|
29 | + $trans_table = array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)); |
|
30 | 30 | $trans_table['''] = "'"; |
31 | 31 | return(strtr($given_html, $trans_table)); |
32 | 32 | } |
@@ -45,17 +45,17 @@ discard block |
||
45 | 45 | |
46 | 46 | /* Only allow redirects from inside this eGroupware installation. */ |
47 | 47 | $valid_referer = array(); |
48 | - $path = preg_replace('/\/[^\/]*$/','',$_SERVER['PHP_SELF']) . '/'; |
|
48 | + $path = preg_replace('/\/[^\/]*$/', '', $_SERVER['PHP_SELF']).'/'; |
|
49 | 49 | array_push($valid_referer, $path); |
50 | - array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_ADDR'] . $path); |
|
51 | - array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $path); |
|
50 | + array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_ADDR'].$path); |
|
51 | + array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_NAME'].$path); |
|
52 | 52 | |
53 | 53 | $referrer = trim($_SERVER['HTTP_REFERER']); |
54 | 54 | if ((!isset($_SERVER['HTTP_REFERER'])) || (empty($referrer))) |
55 | 55 | { |
56 | 56 | echo "Only usable from within eGroupware.\n"; |
57 | 57 | } |
58 | - else if($_GET['go']) |
|
58 | + else if ($_GET['go']) |
|
59 | 59 | { |
60 | 60 | $allow = false; |
61 | 61 | foreach ($valid_referer as $urlRoot) |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | } |
70 | 70 | if ($allow) |
71 | 71 | { |
72 | - $url= html_entity_decode(urldecode($_GET['go'])); |
|
72 | + $url = html_entity_decode(urldecode($_GET['go'])); |
|
73 | 73 | unset($_GET['go']); |
74 | 74 | /* Only add "&" if there is something to append. */ |
75 | 75 | if (!empty($_GET)) |
76 | 76 | { |
77 | - $url=$url."&".http_build_query($_GET); |
|
77 | + $url = $url."&".http_build_query($_GET); |
|
78 | 78 | } |
79 | 79 | |
80 | - Header('Location: ' . html_entity_decode(urldecode($url))); |
|
80 | + Header('Location: '.html_entity_decode(urldecode($url))); |
|
81 | 81 | exit; |
82 | 82 | } |
83 | 83 | else |
@@ -20,7 +20,7 @@ |
||
20 | 20 | 'name' => 'Ralf Becker', |
21 | 21 | 'email' => '[email protected]' |
22 | 22 | ); |
23 | -$setup_info['filemanager']['license'] = 'GPL'; |
|
23 | +$setup_info['filemanager']['license'] = 'GPL'; |
|
24 | 24 | |
25 | 25 | /* The hooks this app includes, needed for hooks registration */ |
26 | 26 | $setup_info['filemanager']['hooks']['settings'] = 'filemanager_hooks::settings'; |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | * @param array $content=null |
79 | 79 | * @param string $msg='' |
80 | 80 | */ |
81 | - public function index(array $content=null, $msg='', $msg_type=null) |
|
81 | + public function index(array $content = null, $msg = '', $msg_type = null) |
|
82 | 82 | { |
83 | 83 | if (is_array($content)) |
84 | 84 | { |
85 | 85 | //_debug_array($content); |
86 | 86 | if ($content['sudo']) |
87 | 87 | { |
88 | - $msg = $this->sudo($content['user'],$content['password'],self::$is_setup) ? |
|
88 | + $msg = $this->sudo($content['user'], $content['password'], self::$is_setup) ? |
|
89 | 89 | lang('Root access granted.') : lang('Wrong username or password!'); |
90 | 90 | $msg_type = Vfs::$is_root ? 'success' : 'error'; |
91 | 91 | } |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | $backup = Vfs::$is_root; |
97 | 97 | Vfs::$is_root = true; |
98 | 98 | $msg = Vfs::mount($url, $path) ? |
99 | - lang('Successful mounted %1 on %2.',$url,$path) : lang('Error mounting %1 on %2!',$url,$path); |
|
99 | + lang('Successful mounted %1 on %2.', $url, $path) : lang('Error mounting %1 on %2!', $url, $path); |
|
100 | 100 | Vfs::$is_root = $backup; |
101 | 101 | } |
102 | 102 | elseif (Vfs::$is_root) |
103 | 103 | { |
104 | 104 | if ($content['logout']) |
105 | 105 | { |
106 | - $msg = $this->sudo('','',self::$is_setup) ? 'Logout failed!' : lang('Root access stopped.'); |
|
106 | + $msg = $this->sudo('', '', self::$is_setup) ? 'Logout failed!' : lang('Root access stopped.'); |
|
107 | 107 | $msg_type = !Vfs::$is_root ? 'success' : 'error'; |
108 | 108 | } |
109 | 109 | if ($content['mounts']['disable'] || self::$is_setup && $content['mounts']['umount']) |
@@ -119,18 +119,18 @@ discard block |
||
119 | 119 | if (!in_array($path, self::$protected_path) && $path != '/') |
120 | 120 | { |
121 | 121 | $msg = Vfs::umount($path) ? |
122 | - lang('%1 successful unmounted.',$path) : lang('Error unmounting %1!',$path); |
|
122 | + lang('%1 successful unmounted.', $path) : lang('Error unmounting %1!', $path); |
|
123 | 123 | } |
124 | 124 | else // re-mount / with sqlFS, to disable versioning |
125 | 125 | { |
126 | - $msg = Vfs::mount($url=Vfs\Sqlfs\StreamWrapper::SCHEME.'://default'.$path,$path) ? |
|
127 | - lang('Successful mounted %1 on %2.',$url,$path) : lang('Error mounting %1 on %2!',$url,$path); |
|
126 | + $msg = Vfs::mount($url = Vfs\Sqlfs\StreamWrapper::SCHEME.'://default'.$path, $path) ? |
|
127 | + lang('Successful mounted %1 on %2.', $url, $path) : lang('Error mounting %1 on %2!', $url, $path); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | if (($path = $content['mounts']['path']) && |
131 | 131 | ($content['mounts']['enable'] || self::$is_setup && $content['mounts']['mount'])) |
132 | 132 | { |
133 | - $url = str_replace('$path',$path,$content['mounts']['url']); |
|
133 | + $url = str_replace('$path', $path, $content['mounts']['url']); |
|
134 | 134 | if (empty($url) && $this->versioning) $url = Versioning\StreamWrapper::PREFIX.$path; |
135 | 135 | |
136 | 136 | if ($content['mounts']['enable'] && !$this->versioning) |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | elseif (!Vfs::file_exists($path) || !Vfs::is_dir($path)) |
142 | 142 | { |
143 | - $msg = lang('Path %1 not found or not a directory!',$path); |
|
143 | + $msg = lang('Path %1 not found or not a directory!', $path); |
|
144 | 144 | $msg_type = 'error'; |
145 | 145 | } |
146 | 146 | // dont allow to change mount of /apps or /templates (eg. switching on versioning) |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | } |
152 | 152 | else |
153 | 153 | { |
154 | - $msg = Vfs::mount($url,$path) ? |
|
155 | - lang('Successful mounted %1 on %2.',$url,$path) : lang('Error mounting %1 on %2!',$url,$path); |
|
154 | + $msg = Vfs::mount($url, $path) ? |
|
155 | + lang('Successful mounted %1 on %2.', $url, $path) : lang('Error mounting %1 on %2!', $url, $path); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | if ($content['allow_delete_versions'] != $GLOBALS['egw_info']['server']['allow_delete_versions']) |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | 'hidden' => true, |
198 | 198 | 'depth' => true, |
199 | 199 | 'path_preg' => '#/\.(attic|versions)/#', |
200 | - )+(!(int)$content['mtime'] ? array() : array( |
|
201 | - 'mtime' => ($content['mtime']<0?'-':'+').(int)$content['mtime'], |
|
200 | + ) + (!(int)$content['mtime'] ? array() : array( |
|
201 | + 'mtime' => ($content['mtime'] < 0 ? '-' : '+').(int)$content['mtime'], |
|
202 | 202 | )), function($path) use (&$deleted, &$errors) |
203 | 203 | { |
204 | 204 | if (($is_dir = Vfs::is_dir($path)) && Vfs::rmdir($path) || |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | }); |
214 | 214 | } |
215 | - $time = number_format(microtime(true)-$starttime, 1); |
|
215 | + $time = number_format(microtime(true) - $starttime, 1); |
|
216 | 216 | $msg = ($errors ? lang('%1 errors deleting!', $errors)."\n\n" : ''). |
217 | 217 | lang('%1 files or directories deleted in %2 seconds.', $deleted, $time); |
218 | 218 | $msg_type = $errors ? 'error' : 'info'; |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | { |
236 | 236 | // statistical information |
237 | 237 | $content += Versioning\StreamWrapper::summary(); |
238 | - if ($content['total_files']) $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%'; |
|
239 | - if ($content['total_size']) $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%'; |
|
238 | + if ($content['total_files']) $content['percent_files'] = number_format(100.0 * $content['version_files'] / $content['total_files'], 1).'%'; |
|
239 | + if ($content['total_size']) $content['percent_size'] = number_format(100.0 * $content['version_size'] / $content['total_size'], 1).'%'; |
|
240 | 240 | } |
241 | - if (!($content['is_root']=Vfs::$is_root)) |
|
241 | + if (!($content['is_root'] = Vfs::$is_root)) |
|
242 | 242 | { |
243 | 243 | if (empty($msg)) |
244 | 244 | { |
@@ -254,16 +254,16 @@ discard block |
||
254 | 254 | |
255 | 255 | $n = 2; |
256 | 256 | $content['mounts'] = array(); |
257 | - foreach(Vfs::mount() as $path => $url) |
|
257 | + foreach (Vfs::mount() as $path => $url) |
|
258 | 258 | { |
259 | 259 | $content['mounts'][$n++] = array( |
260 | 260 | 'path' => $path, |
261 | 261 | 'url' => $url, |
262 | 262 | ); |
263 | 263 | $readonlys["disable[$path]"] = !$this->versioning || !Vfs::$is_root || |
264 | - Vfs::parse_url($url,PHP_URL_SCHEME) != $this->versioning; |
|
264 | + Vfs::parse_url($url, PHP_URL_SCHEME) != $this->versioning; |
|
265 | 265 | } |
266 | - $readonlys['umount[/]'] = $readonlys['umount[/apps]'] = true; // do not allow to unmount / or /apps |
|
266 | + $readonlys['umount[/]'] = $readonlys['umount[/apps]'] = true; // do not allow to unmount / or /apps |
|
267 | 267 | $readonlys['url'] = !self::$is_setup; |
268 | 268 | |
269 | 269 | $sel_options['allow_delete_versions'] = array( |
@@ -274,13 +274,13 @@ discard block |
||
274 | 274 | ); |
275 | 275 | // show [Mount /etemplates] button for admin, if not already mounted and available |
276 | 276 | $readonlys['etemplates'] = !class_exists('\EGroupware\Stylite\Vfs\Merge\StreamWrapper') || |
277 | - ($fs_tab=Vfs::mount($url)) && isset($fs_tab['/etemplates']) || |
|
277 | + ($fs_tab = Vfs::mount($url)) && isset($fs_tab['/etemplates']) || |
|
278 | 278 | !isset($GLOBALS['egw_info']['user']['apps']['admin']); |
279 | 279 | //_debug_array($content); |
280 | 280 | |
281 | 281 | $tpl = new Etemplate('filemanager.admin'); |
282 | 282 | $GLOBALS['egw_info']['flags']['app_header'] = lang('VFS mounts and versioning'); |
283 | - $tpl->exec('filemanager.filemanager_admin.index',$content,$sel_options,$readonlys); |
|
283 | + $tpl->exec('filemanager.filemanager_admin.index', $content, $sel_options, $readonlys); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -300,10 +300,10 @@ discard block |
||
300 | 300 | } |
301 | 301 | $content = '<p>'.implode("</p>\n<p>", (array)$msgs)."</p>\n"; |
302 | 302 | |
303 | - $content .= Api\Html::form('<p>'.($check_only&&is_array($msgs) ? |
|
303 | + $content .= Api\Html::form('<p>'.($check_only && is_array($msgs) ? |
|
304 | 304 | Api\Html::submit_button('fix', lang('Fix reported problems')) : ''). |
305 | 305 | Api\Html::submit_button('cancel', lang('Cancel')).'</p>', |
306 | - '','/index.php',array('menuaction'=>'filemanager.filemanager_admin.fsck')); |
|
306 | + '', '/index.php', array('menuaction'=>'filemanager.filemanager_admin.fsck')); |
|
307 | 307 | |
308 | 308 | $GLOBALS['egw']->framework->render($content, lang('Admin').' - '.lang('Check virtual filesystem'), true); |
309 | 309 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @param array $content |
67 | 67 | */ |
68 | - function select(array $content=null) |
|
68 | + function select(array $content = null) |
|
69 | 69 | { |
70 | 70 | if (!is_array($content)) |
71 | 71 | { |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | $content['msg'] = $_GET['msg']; |
77 | 77 | $_GET['mode'] = 'open'; |
78 | 78 | $_GET['method'] = 'ckeditor_return'; |
79 | - $_GET['CKEditorFuncNum'] = Api\Cache::getSession('filemanager','ckeditorfuncnum'); |
|
79 | + $_GET['CKEditorFuncNum'] = Api\Cache::getSession('filemanager', 'ckeditorfuncnum'); |
|
80 | 80 | } |
81 | 81 | $content['mode'] = $_GET['mode']; |
82 | - if (!in_array($content['mode'],array('open','open-multiple','saveas','select-dir'))) |
|
82 | + if (!in_array($content['mode'], array('open', 'open-multiple', 'saveas', 'select-dir'))) |
|
83 | 83 | { |
84 | 84 | throw new Api\Exception\WrongParameter("Wrong or unset required mode parameter!"); |
85 | 85 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | { |
95 | 95 | if (isset($_GET['CKEditorFuncNum']) && is_numeric($_GET['CKEditorFuncNum'])) |
96 | 96 | { |
97 | - Api\Cache::setSession('filemanager','ckeditorfuncnum', |
|
97 | + Api\Cache::setSession('filemanager', 'ckeditorfuncnum', |
|
98 | 98 | $content['ckeditorfuncnum'] = $_GET['CKEditorFuncNum']); |
99 | 99 | } |
100 | 100 | else |
@@ -102,20 +102,20 @@ discard block |
||
102 | 102 | throw new Api\Exception\WrongParameter("chkeditor_return has been specified as a method but some parameters are missing or invalid."); |
103 | 103 | } |
104 | 104 | } |
105 | - $content['id'] = $_GET['id']; |
|
105 | + $content['id'] = $_GET['id']; |
|
106 | 106 | $content['label'] = isset($_GET['label']) ? $_GET['label'] : lang('Open'); |
107 | 107 | if (($content['options-mime'] = isset($_GET['mime']))) |
108 | 108 | { |
109 | 109 | $sel_options['mime'] = array(); |
110 | - foreach((array)$_GET['mime'] as $key => $value) |
|
110 | + foreach ((array)$_GET['mime'] as $key => $value) |
|
111 | 111 | { |
112 | 112 | if (is_numeric($key)) |
113 | 113 | { |
114 | - $sel_options['mime'][$value] = lang('%1 files',strtoupper(Api\MimeMagic::mime2ext($value))).' ('.$value.')'; |
|
114 | + $sel_options['mime'][$value] = lang('%1 files', strtoupper(Api\MimeMagic::mime2ext($value))).' ('.$value.')'; |
|
115 | 115 | } |
116 | 116 | else |
117 | 117 | { |
118 | - $sel_options['mime'][$key] = lang('%1 files',strtoupper($value)).' ('.$key.')'; |
|
118 | + $sel_options['mime'][$key] = lang('%1 files', strtoupper($value)).' ('.$key.')'; |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | error_log(array2string($content['options-mime'])); |
124 | 124 | } |
125 | 125 | } |
126 | - elseif(isset($content['button'])) |
|
126 | + elseif (isset($content['button'])) |
|
127 | 127 | { |
128 | 128 | list($button) = each($content['button']); |
129 | 129 | unset($content['button']); |
130 | - switch($button) |
|
130 | + switch ($button) |
|
131 | 131 | { |
132 | 132 | case 'home': |
133 | 133 | $content['path'] = filemanager_ui::get_home_dir(); |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | //Set the "content" name filed accordingly to the uploaded file |
140 | 140 | // encode chars which special meaning in url/vfs (some like / get removed!) |
141 | 141 | $content['name'] = Vfs::encodePathComponent($content['file_upload']['name']); |
142 | - $to_path = Vfs::concat($content['path'],$content['name']); |
|
142 | + $to_path = Vfs::concat($content['path'], $content['name']); |
|
143 | 143 | |
144 | 144 | $copy_result = (Vfs::is_writable($content['path']) || Vfs::is_writable($to_path)) && |
145 | - copy($content['file_upload']['tmp_name'],Vfs::PREFIX.$to_path); |
|
145 | + copy($content['file_upload']['tmp_name'], Vfs::PREFIX.$to_path); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | //Break on an error condition |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | break; |
162 | 162 | } |
163 | 163 | |
164 | - switch($content['mode']) |
|
164 | + switch ($content['mode']) |
|
165 | 165 | { |
166 | 166 | case 'open-multiple': |
167 | - foreach((array)$content['dir']['selected'] as $name) |
|
167 | + foreach ((array)$content['dir']['selected'] as $name) |
|
168 | 168 | { |
169 | - $files[] = Vfs::concat($content['path'],$name); |
|
169 | + $files[] = Vfs::concat($content['path'], $name); |
|
170 | 170 | } |
171 | 171 | //Add an uploaded file to the files result array2string |
172 | 172 | if ($copy_result === true) $files[] = $to_path; |
@@ -182,33 +182,33 @@ discard block |
||
182 | 182 | // Fall through |
183 | 183 | |
184 | 184 | default: |
185 | - $files = Vfs::concat($content['path'],$content['name']); |
|
185 | + $files = Vfs::concat($content['path'], $content['name']); |
|
186 | 186 | break; |
187 | 187 | } |
188 | 188 | |
189 | 189 | if ($content['method'] && $content['method'] != 'ckeditor_return') |
190 | 190 | { |
191 | - $js = ExecMethod2($content['method'],$content['id'],$files); |
|
191 | + $js = ExecMethod2($content['method'], $content['id'], $files); |
|
192 | 192 | } |
193 | 193 | else if ($content['method'] == 'ckeditor_return') |
194 | 194 | { |
195 | - $download_url = Vfs::download_url(Vfs::concat($content['path'],$content['name'])); |
|
195 | + $download_url = Vfs::download_url(Vfs::concat($content['path'], $content['name'])); |
|
196 | 196 | if ($download_url[0] == '/') $download_url = Egw::link($download_url); |
197 | 197 | $js = "window.opener.CKEDITOR.tools.callFunction(". |
198 | 198 | $content['ckeditorfuncnum'].",'". |
199 | 199 | htmlspecialchars($download_url)."',". |
200 | 200 | "'');\negw(window).close();"; |
201 | 201 | } |
202 | - if(Api\Json\Response::isJSONResponse() && !($content['method'] == 'ckeditor_return')) |
|
202 | + if (Api\Json\Response::isJSONResponse() && !($content['method'] == 'ckeditor_return')) |
|
203 | 203 | { |
204 | 204 | $response = Api\Json\Response::get(); |
205 | - if($js) |
|
205 | + if ($js) |
|
206 | 206 | { |
207 | 207 | $response->script($js); |
208 | 208 | } |
209 | 209 | // Ahh! |
210 | 210 | // The vfs-select widget looks for this |
211 | - $response->script('this.selected_files = '.json_encode($files) . '; egw(this).close();'); |
|
211 | + $response->script('this.selected_files = '.json_encode($files).'; egw(this).close();'); |
|
212 | 212 | } |
213 | 213 | else |
214 | 214 | { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | |
221 | 221 | $sel_options['mime'] = $content['options-mime']; |
222 | 222 | } |
223 | - elseif(isset($content['apps'])) |
|
223 | + elseif (isset($content['apps'])) |
|
224 | 224 | { |
225 | 225 | list($app) = each($content['apps']); |
226 | 226 | if ($app == 'home') $content['path'] = filemanager_ui::get_home_dir(); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | //Deactivate the opload field if the current directory is not writeable or |
230 | 230 | //we're currently not in the single file open mode. |
231 | 231 | $content['no_upload'] = !Vfs::is_writable($content['path']) || |
232 | - !in_array($content['mode'],array('open')); |
|
232 | + !in_array($content['mode'], array('open')); |
|
233 | 233 | |
234 | 234 | $content['apps'] = array_keys(self::get_apps()); |
235 | 235 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | |
241 | 241 | // Set a flag for easy detection as we go |
242 | - $favorites_flag = substr($content['path'],0,strlen('/apps/favorites')) == '/apps/favorites'; |
|
242 | + $favorites_flag = substr($content['path'], 0, strlen('/apps/favorites')) == '/apps/favorites'; |
|
243 | 243 | |
244 | 244 | if (!$favorites_flag && (!$content['path'] || !Vfs::is_dir($content['path']))) |
245 | 245 | { |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | $files = array(); |
254 | 254 | $favorites = Framework\Favorites::get_favorites('filemanager'); |
255 | 255 | $n = 0; |
256 | - foreach($favorites as $favorite) |
|
256 | + foreach ($favorites as $favorite) |
|
257 | 257 | { |
258 | 258 | $path = $favorite['state']['path']; |
259 | 259 | // Just directories |
260 | - if(!$path) continue; |
|
261 | - if ($path == $content['path']) continue; // remove directory itself |
|
260 | + if (!$path) continue; |
|
261 | + if ($path == $content['path']) continue; // remove directory itself |
|
262 | 262 | |
263 | 263 | $mime = Vfs::mime_content_type($path); |
264 | 264 | $content['dir'][$n] = array( |
@@ -274,29 +274,29 @@ discard block |
||
274 | 274 | ++$n; |
275 | 275 | } |
276 | 276 | } |
277 | - else if (!($files = Vfs::find($content['path'],array( |
|
277 | + else if (!($files = Vfs::find($content['path'], array( |
|
278 | 278 | 'dirsontop' => true, |
279 | 279 | 'order' => 'name', |
280 | 280 | 'sort' => 'ASC', |
281 | 281 | 'maxdepth' => 1, |
282 | 282 | )))) |
283 | 283 | { |
284 | - $content['msg'] = lang("Can't open directory %1!",$content['path']); |
|
284 | + $content['msg'] = lang("Can't open directory %1!", $content['path']); |
|
285 | 285 | } |
286 | 286 | else |
287 | 287 | { |
288 | 288 | $n = 0; |
289 | 289 | $content['dir'] = array('mode' => $content['mode']); |
290 | - foreach($files as $path) |
|
290 | + foreach ($files as $path) |
|
291 | 291 | { |
292 | - if ($path == $content['path']) continue; // remove directory itself |
|
292 | + if ($path == $content['path']) continue; // remove directory itself |
|
293 | 293 | |
294 | 294 | $name = Vfs::basename($path); |
295 | 295 | $is_dir = Vfs::is_dir($path); |
296 | 296 | $mime = Vfs::mime_content_type($path); |
297 | 297 | if ($content['mime'] && !$is_dir && $mime != $content['mime']) |
298 | 298 | { |
299 | - continue; // does not match mime-filter --> ignore |
|
299 | + continue; // does not match mime-filter --> ignore |
|
300 | 300 | } |
301 | 301 | $content['dir'][$n] = array( |
302 | 302 | 'name' => $name, |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | } |
311 | 311 | ++$n; |
312 | 312 | } |
313 | - if (!$n) $readonlys['selected[]'] = true; // remove checkbox from empty line |
|
313 | + if (!$n) $readonlys['selected[]'] = true; // remove checkbox from empty line |
|
314 | 314 | } |
315 | 315 | $readonlys['button[createdir]'] = !Vfs::is_writable($content['path']); |
316 | 316 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | { |
338 | 338 | Api\Header\ContentSecurityPolicy::add('script-src', 'unsafe-inline'); |
339 | 339 | } |
340 | - $tpl->exec('filemanager.filemanager_select.select',$content,$sel_options,$readonlys,$preserve,2); |
|
340 | + $tpl->exec('filemanager.filemanager_select.select', $content, $sel_options, $readonlys, $preserve, 2); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -347,11 +347,11 @@ discard block |
||
347 | 347 | */ |
348 | 348 | static function get_apps() |
349 | 349 | { |
350 | - $apps = array(false); // index starting from 1 |
|
350 | + $apps = array(false); // index starting from 1 |
|
351 | 351 | if (isset($GLOBALS['egw_info']['apps']['stylite'])) $apps = array('favorites' => lang('Favorites')); |
352 | 352 | $apps += Link::app_list('query'); |
353 | 353 | |
354 | - unset($apps['mydms']); // they do NOT support adding files to VFS |
|
354 | + unset($apps['mydms']); // they do NOT support adding files to VFS |
|
355 | 355 | unset($apps['wiki']); |
356 | 356 | unset($apps['api-accounts']); |
357 | 357 | unset($apps['addressbook-email']); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | { |
61 | 61 | parent::__construct(); |
62 | 62 | |
63 | - if($_dir) |
|
63 | + if ($_dir) |
|
64 | 64 | { |
65 | 65 | $this->dir = $_dir; |
66 | 66 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param string &$content=null content to create some replacements only if they are use |
77 | 77 | * @return array|boolean |
78 | 78 | */ |
79 | - protected function get_replacements($id,&$content=null) |
|
79 | + protected function get_replacements($id, &$content = null) |
|
80 | 80 | { |
81 | 81 | if (!($replacements = $this->filemanager_replacements($id, '', $content))) |
82 | 82 | { |
@@ -92,27 +92,27 @@ discard block |
||
92 | 92 | * @param string $prefix='' prefix like eg. 'erole' |
93 | 93 | * @return array|boolean |
94 | 94 | */ |
95 | - public function filemanager_replacements($id,$prefix='', &$content = null) |
|
95 | + public function filemanager_replacements($id, $prefix = '', &$content = null) |
|
96 | 96 | { |
97 | 97 | $info = array(); |
98 | - $file = Vfs::lstat($id,true); |
|
98 | + $file = Vfs::lstat($id, true); |
|
99 | 99 | |
100 | 100 | $file['mtime'] = Api\DateTime::to($file['mtime']); |
101 | 101 | $file['ctime'] = Api\DateTime::to($file['ctime']); |
102 | 102 | |
103 | 103 | $file['name'] = Vfs::basename($id); |
104 | 104 | $file['dir'] = Vfs::decodePath(Vfs::dirname($id)); |
105 | - $dirlist = explode('/',$file['dir']); |
|
105 | + $dirlist = explode('/', $file['dir']); |
|
106 | 106 | $file['folder'] = array_pop($dirlist); |
107 | - $file['folder_file'] = $file['folder'] . '/'.$file['name']; |
|
107 | + $file['folder_file'] = $file['folder'].'/'.$file['name']; |
|
108 | 108 | $file['path'] = $id; |
109 | 109 | $file['rel_path'] = str_replace($this->dir.'/', '', $id); |
110 | 110 | $file['hsize'] = Vfs::hsize($file['size']); |
111 | 111 | $file['mime'] = Vfs::mime_content_type($id); |
112 | - $file['gid'] *= -1; // our widgets use negative gid's |
|
112 | + $file['gid'] *= -1; // our widgets use negative gid's |
|
113 | 113 | if (($props = Vfs::propfind($id))) |
114 | 114 | { |
115 | - foreach($props as $prop) |
|
115 | + foreach ($props as $prop) |
|
116 | 116 | { |
117 | 117 | $file[$prop['name']] = $prop['val']; |
118 | 118 | } |
@@ -122,22 +122,22 @@ discard block |
||
122 | 122 | $file['symlink'] = Vfs::readlink($id); |
123 | 123 | } |
124 | 124 | // Custom fields |
125 | - if($content && strpos($content, '#') !== 0) |
|
125 | + if ($content && strpos($content, '#') !== 0) |
|
126 | 126 | { |
127 | 127 | // Expand link-to custom fields |
128 | 128 | $this->cf_link_to_expand($file, $content, $info); |
129 | 129 | |
130 | - foreach(Api\Storage\Customfields::get('filemanager') as $name => $field) |
|
130 | + foreach (Api\Storage\Customfields::get('filemanager') as $name => $field) |
|
131 | 131 | { |
132 | 132 | // Set any missing custom fields, or the marker will stay |
133 | - if(!$file['#'.$name]) |
|
133 | + if (!$file['#'.$name]) |
|
134 | 134 | { |
135 | 135 | $file['#'.$name] = ''; |
136 | 136 | continue; |
137 | 137 | } |
138 | 138 | |
139 | 139 | // Format date cfs per user Api\Preferences |
140 | - if($field['type'] == 'date' || $field['type'] == 'date-time') |
|
140 | + if ($field['type'] == 'date' || $field['type'] == 'date-time') |
|
141 | 141 | { |
142 | 142 | $this->date_fields[] = '#'.$name; |
143 | 143 | $file['#'.$name] = Api\DateTime::to($file['#'.$name], $field['type'] == 'date' ? true : ''); |
@@ -146,51 +146,51 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | // If in apps folder, try for app-specific placeholders |
149 | - if($dirlist[1] == 'apps' && count($dirlist) > 1) |
|
149 | + if ($dirlist[1] == 'apps' && count($dirlist) > 1) |
|
150 | 150 | { |
151 | 151 | // Try this first - a normal path /apps/appname/id/file |
152 | - list($app, $app_id) = explode('/', substr($file['path'], strpos($file['path'], 'apps/')+5)); |
|
152 | + list($app, $app_id) = explode('/', substr($file['path'], strpos($file['path'], 'apps/') + 5)); |
|
153 | 153 | // Symlink? |
154 | - if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
154 | + if (!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
155 | 155 | // Try resolving just app + ID - /apps/App Name/Record Title/file |
156 | - $resolved = Vfs::resolve_url_symlinks(implode('/',array_slice(explode('/',$file['dir']),0,4))); |
|
157 | - list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
|
156 | + $resolved = Vfs::resolve_url_symlinks(implode('/', array_slice(explode('/', $file['dir']), 0, 4))); |
|
157 | + list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/') + 5)); |
|
158 | 158 | |
159 | - if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
159 | + if (!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
160 | 160 | // Get rid of any virtual folders (eg: All$) and symlinks |
161 | 161 | $resolved = Vfs::resolve_url_symlinks($file['path']); |
162 | - list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
|
162 | + list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/') + 5)); |
|
163 | 163 | } |
164 | 164 | } |
165 | - if($app && $app_id) |
|
165 | + if ($app && $app_id) |
|
166 | 166 | { |
167 | - if($app && $GLOBALS['egw_info']['user']['apps'][$app]) |
|
167 | + if ($app && $GLOBALS['egw_info']['user']['apps'][$app]) |
|
168 | 168 | { |
169 | 169 | $app_merge = null; |
170 | 170 | try |
171 | 171 | { |
172 | - $classname = $app .'_merge'; |
|
173 | - if(class_exists($classname)) |
|
172 | + $classname = $app.'_merge'; |
|
173 | + if (class_exists($classname)) |
|
174 | 174 | { |
175 | 175 | $app_merge = new $classname(); |
176 | - if($app_merge && method_exists($app_merge, 'get_replacements')) |
|
176 | + if ($app_merge && method_exists($app_merge, 'get_replacements')) |
|
177 | 177 | { |
178 | 178 | $app_placeholders = $app_merge->get_replacements($app_id, $content); |
179 | 179 | } |
180 | 180 | } |
181 | 181 | } |
182 | 182 | // Silently discard & continue |
183 | - catch(Exception $e) { |
|
184 | - unset($e); // not used |
|
183 | + catch (Exception $e) { |
|
184 | + unset($e); // not used |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | } |
188 | 188 | } |
189 | 189 | $link = Link::mime_open($file['url'], $file['mime']); |
190 | - if(is_array($link)) |
|
190 | + if (is_array($link)) |
|
191 | 191 | { |
192 | 192 | // Directories have their internal protocol in path here |
193 | - if($link['path'] && strpos($link['path'], '://') !== false) $link['path'] = $file['path']; |
|
193 | + if ($link['path'] && strpos($link['path'], '://') !== false) $link['path'] = $file['path']; |
|
194 | 194 | $link = Api\Session::link('/index.php', $link); |
195 | 195 | } |
196 | 196 | else |
@@ -209,12 +209,12 @@ discard block |
||
209 | 209 | $file['url'] = $link; |
210 | 210 | |
211 | 211 | // Add markers |
212 | - foreach($file as $key => &$value) |
|
212 | + foreach ($file as $key => &$value) |
|
213 | 213 | { |
214 | - if(!$value) $value = ''; |
|
215 | - $info['$$'.($prefix ? $prefix.'/':'').$key.'$$'] = $value; |
|
214 | + if (!$value) $value = ''; |
|
215 | + $info['$$'.($prefix ? $prefix.'/' : '').$key.'$$'] = $value; |
|
216 | 216 | } |
217 | - if($app_placeholders) |
|
217 | + if ($app_placeholders) |
|
218 | 218 | { |
219 | 219 | $info = array_merge($app_placeholders, $info); |
220 | 220 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | 'hsize' => 'Size', |
251 | 251 | 'size' => 'Size (in bytes)', |
252 | 252 | ); |
253 | - foreach($fields as $name => $label) |
|
253 | + foreach ($fields as $name => $label) |
|
254 | 254 | { |
255 | 255 | if (!($n&1)) echo '<tr>'; |
256 | 256 | echo '<td>{{'.$name.'}}</td><td>'.lang($label).'</td>'; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | echo '<tr><td colspan="4"><h3>'.lang('Custom fields').":</h3></td></tr>"; |
262 | - foreach(Api\Storage\Customfields::get('filemanager') as $name => $field) |
|
262 | + foreach (Api\Storage\Customfields::get('filemanager') as $name => $field) |
|
263 | 263 | { |
264 | 264 | echo '<tr><td>{{#'.$name.'}}</td><td colspan="3">'.$field['label']."</td></tr>\n"; |
265 | 265 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | echo '<tr><td colspan="4">'.lang('For files linked to an application entry (inside /apps/appname/id/) the placeholders for that application are also available. See the specific application for a list of available placeholders.').'</td></tr>'; |
269 | 269 | |
270 | 270 | echo '<tr><td colspan="4"><h3>'.lang('General fields:')."</h3></td></tr>"; |
271 | - foreach(array( |
|
271 | + foreach (array( |
|
272 | 272 | 'date' => lang('Date'), |
273 | 273 | 'user/n_fn' => lang('Name of current user, all other contact fields are valid too'), |
274 | 274 | 'user/account_lid' => lang('Username'), |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $readonlys = null; |
90 | 90 | $total = Sharing::so()->get_rows($query, $rows, $readonlys); |
91 | 91 | |
92 | - foreach($rows as &$row) |
|
92 | + foreach ($rows as &$row) |
|
93 | 93 | { |
94 | 94 | if (substr($row['share_path'], 0, strlen(self::$tmp_dir)) === self::$tmp_dir) |
95 | 95 | { |
@@ -130,21 +130,21 @@ discard block |
||
130 | 130 | * @param array $content=null |
131 | 131 | * @param string $msg='' |
132 | 132 | */ |
133 | - public function index(array $content=null) |
|
133 | + public function index(array $content = null) |
|
134 | 134 | { |
135 | 135 | if (!is_array($content)) |
136 | 136 | { |
137 | 137 | $content = array( |
138 | 138 | 'nm' => array( |
139 | - 'get_rows' => 'filemanager.filemanager_shares.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
140 | - 'no_filter' => True, // current dir only |
|
141 | - 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
142 | - 'no_cat' => True, // I disable the cat-selectbox |
|
143 | - 'lettersearch' => false, // I show a lettersearch |
|
144 | - 'searchletter' => false, // I0 active letter of the lettersearch or false for [all] |
|
145 | - 'start' => 0, // IO position in list |
|
146 | - 'order' => 'share_created', // IO name of the column to sort after (optional for the sortheaders) |
|
147 | - 'sort' => 'DESC', // IO direction of the sort: 'ASC' or 'DESC' |
|
139 | + 'get_rows' => 'filemanager.filemanager_shares.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
140 | + 'no_filter' => True, // current dir only |
|
141 | + 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
142 | + 'no_cat' => True, // I disable the cat-selectbox |
|
143 | + 'lettersearch' => false, // I show a lettersearch |
|
144 | + 'searchletter' => false, // I0 active letter of the lettersearch or false for [all] |
|
145 | + 'start' => 0, // IO position in list |
|
146 | + 'order' => 'share_created', // IO name of the column to sort after (optional for the sortheaders) |
|
147 | + 'sort' => 'DESC', // IO direction of the sort: 'ASC' or 'DESC' |
|
148 | 148 | //'default_cols' => '!', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns |
149 | 149 | 'csv_fields' => false, // I false=disable csv export, true or unset=enable it with auto-detected fieldnames, |
150 | 150 | //or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type) |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } |
157 | 157 | elseif ($content['nm']['action']) |
158 | 158 | { |
159 | - switch($content['nm']['action']) |
|
159 | + switch ($content['nm']['action']) |
|
160 | 160 | { |
161 | 161 | case 'delete': |
162 | 162 | $where = array('share_owner' => $GLOBALS['egw_info']['user']['account_id']); |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | $context['appname'] = 'filemanager'; |
29 | 29 | |
30 | 30 | // Let parent handle the basic stuff |
31 | - parent::__construct($context,$need_reload); |
|
31 | + parent::__construct($context, $need_reload); |
|
32 | 32 | |
33 | 33 | $this->nm_settings += array( |
34 | 34 | 'get_rows' => 'filemanager.filemanager_favorite_portlet.get_rows', |
35 | 35 | 'csv_export' => true, |
36 | 36 | // Use a different template so it can be accessed from client side |
37 | - 'template' => ($this->nm_settings['view'] == 'tile' ? 'filemanager.tile' : 'filemanager.home.rows' ), |
|
37 | + 'template' => ($this->nm_settings['view'] == 'tile' ? 'filemanager.tile' : 'filemanager.home.rows'), |
|
38 | 38 | // Filemanager needs this header, it's an important component for actions, but we reduce it to the minimum |
39 | 39 | 'header_left' => 'filemanager.home.header_left', |
40 | 40 | // Use a reduced column set for home, user can change if needed |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | 'parent_id' => 'dir', |
47 | 47 | 'is_parent' => 'mime', |
48 | 48 | 'is_parent_value'=> Vfs::DIR_MIME_TYPE, |
49 | - 'placeholder_actions' => array('mkdir','file_drop_mail','file_drop_move','file_drop_copy','file_drop_symlink') |
|
49 | + 'placeholder_actions' => array('mkdir', 'file_drop_mail', 'file_drop_move', 'file_drop_copy', 'file_drop_symlink') |
|
50 | 50 | ); |
51 | 51 | } |
52 | 52 | |
53 | - public function exec($id = null, Etemplate &$etemplate = null) |
|
53 | + public function exec($id = null, Etemplate&$etemplate = null) |
|
54 | 54 | { |
55 | 55 | |
56 | 56 | $this->context['sel_options']['filter'] = array( |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $ui = new filemanager_ui(); |
81 | 81 | $total = $ui->get_rows($query, $rows, $readonlys); |
82 | 82 | // Change template to match selected view |
83 | - if($query['view']) |
|
83 | + if ($query['view']) |
|
84 | 84 | { |
85 | 85 | $query['template'] = ($query['view'] == 'row' ? 'filemanager.home.rows' : 'filemanager.tile'); |
86 | 86 | } |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | // the etemplate exec to fire again. |
104 | 104 | if ($content['nm']['action']) |
105 | 105 | { |
106 | - $msg = filemanager_ui::action($content['nm']['action'],$content['nm']['selected'],$content['nm']['path']); |
|
107 | - if($msg) Api\Json\Response::get()->apply('egw.message',array($msg)); |
|
108 | - foreach($content['nm']['selected'] as &$id) |
|
106 | + $msg = filemanager_ui::action($content['nm']['action'], $content['nm']['selected'], $content['nm']['path']); |
|
107 | + if ($msg) Api\Json\Response::get()->apply('egw.message', array($msg)); |
|
108 | + foreach ($content['nm']['selected'] as &$id) |
|
109 | 109 | { |
110 | 110 | $id = 'filemanager::'.$id; |
111 | 111 | } |
112 | 112 | // Directly request an update - this will get filemanager tab too |
113 | - Api\Json\Response::get()->apply('egw.dataRefreshUIDs',array($content['nm']['selected'])); |
|
113 | + Api\Json\Response::get()->apply('egw.dataRefreshUIDs', array($content['nm']['selected'])); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | } |
117 | 117 | \ No newline at end of file |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | ); |
19 | 19 | include('../header.inc.php'); |
20 | 20 | |
21 | -if (!($path = Api\Cache::getSession('filemanger','test'))) |
|
21 | +if (!($path = Api\Cache::getSession('filemanger', 'test'))) |
|
22 | 22 | { |
23 | 23 | $path = '/home/'.$GLOBALS['egw_info']['user']['account_lid']; |
24 | 24 | } |
25 | 25 | if (isset($_REQUEST['path'])) $path = $_REQUEST['path']; |
26 | -echo Api\Html::form("<p>Path: ".Api\Html::input('path',$path,'text','size="40"'). |
|
27 | - Api\Html::submit_button('',lang('Submit'))."</p>\n",array(),'','','','','GET'); |
|
26 | +echo Api\Html::form("<p>Path: ".Api\Html::input('path', $path, 'text', 'size="40"'). |
|
27 | + Api\Html::submit_button('', lang('Submit'))."</p>\n", array(), '', '', '', '', 'GET'); |
|
28 | 28 | |
29 | 29 | if (isset($path) && !empty($path)) |
30 | 30 | { |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | { |
33 | 33 | throw new Api\Exception\WrongUserinput('Not an absolute path!'); |
34 | 34 | } |
35 | - Api\Cache::setSession('filemanger','test',$path); |
|
35 | + Api\Cache::setSession('filemanger', 'test', $path); |
|
36 | 36 | |
37 | 37 | echo "<h2>"; |
38 | - foreach(explode('/',$path) as $n => $part) |
|
38 | + foreach (explode('/', $path) as $n => $part) |
|
39 | 39 | { |
40 | 40 | $p .= ($p != '/' ? '/' : '').$part; |
41 | - echo ($n > 1 ? ' / ' : '').Api\Html::a_href($n ? $part : ' / ','/filemanager/test.php',array('path'=>$p)); |
|
41 | + echo ($n > 1 ? ' / ' : '').Api\Html::a_href($n ? $part : ' / ', '/filemanager/test.php', array('path'=>$p)); |
|
42 | 42 | } |
43 | 43 | echo "</h2>\n"; |
44 | 44 | |
@@ -50,29 +50,29 @@ discard block |
||
50 | 50 | |
51 | 51 | $time = microtime(true); |
52 | 52 | $stat = Vfs::stat($path); |
53 | - $stime = number_format(1000*(microtime(true)-$time),1); |
|
53 | + $stime = number_format(1000 * (microtime(true) - $time), 1); |
|
54 | 54 | |
55 | 55 | $time2 = microtime(true); |
56 | 56 | if ($is_dir)// && ($d = Vfs::opendir($path))) |
57 | 57 | { |
58 | 58 | $files = array(); |
59 | 59 | //while(($file = readdir($d))) |
60 | - foreach(Vfs::scandir($path) as $file) |
|
60 | + foreach (Vfs::scandir($path) as $file) |
|
61 | 61 | { |
62 | - if (Vfs::is_readable($fpath=Vfs::concat($path,$file))) |
|
62 | + if (Vfs::is_readable($fpath = Vfs::concat($path, $file))) |
|
63 | 63 | { |
64 | - $file = Api\Html::a_href($file,'/filemanager/test.php',array('path'=>$fpath)); |
|
64 | + $file = Api\Html::a_href($file, '/filemanager/test.php', array('path'=>$fpath)); |
|
65 | 65 | } |
66 | 66 | $file .= ' ('.Vfs::mime_content_type($fpath).')'; |
67 | 67 | $files[] = $file; |
68 | 68 | } |
69 | 69 | //closedir($d); |
70 | - $time2f = number_format(1000*(microtime(true)-$time2),1); |
|
70 | + $time2f = number_format(1000 * (microtime(true) - $time2), 1); |
|
71 | 71 | echo "<p>".($files ? 'Directory' : 'Empty directory')." took $time2f ms</p>\n"; |
72 | - if($files) echo '<ol><li>'.implode("</li>\n<li>",$files).'</ol>'."\n"; |
|
72 | + if ($files) echo '<ol><li>'.implode("</li>\n<li>", $files).'</ol>'."\n"; |
|
73 | 73 | } |
74 | 74 | |
75 | - echo "<p><b>stat('$path')</b> took $stime ms (mode = ".(isset($stat['mode'])?sprintf('%o',$stat['mode']).' = '.Vfs::int2mode($stat['mode']):'NULL').')'; |
|
75 | + echo "<p><b>stat('$path')</b> took $stime ms (mode = ".(isset($stat['mode']) ? sprintf('%o', $stat['mode']).' = '.Vfs::int2mode($stat['mode']) : 'NULL').')'; |
|
76 | 76 | if (is_array($stat)) |
77 | 77 | { |
78 | 78 | _debug_array($stat); |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | echo "<p><b>readlink('$path')</b>=".array2string(Vfs::readlink($path))."</p>\n"; |
90 | 90 | $time3 = microtime(true); |
91 | 91 | $lstat = Vfs::lstat($path); |
92 | - $time3f = number_format(1000*(microtime(true)-$time3),1); |
|
93 | - echo "<p><b>lstat('$path')</b> took $time3f ms (mode = ".(isset($lstat['mode'])?sprintf('%o',$lstat['mode']).' = '.Vfs::int2mode($lstat['mode']):'NULL').')'; |
|
92 | + $time3f = number_format(1000 * (microtime(true) - $time3), 1); |
|
93 | + echo "<p><b>lstat('$path')</b> took $time3f ms (mode = ".(isset($lstat['mode']) ? sprintf('%o', $lstat['mode']).' = '.Vfs::int2mode($lstat['mode']) : 'NULL').')'; |
|
94 | 94 | if (is_array($lstat)) |
95 | 95 | { |
96 | 96 | _debug_array($lstat); |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | } |
37 | 37 | //print_r($config); exit; |
38 | 38 | |
39 | -$uglify =& $config['uglify']; |
|
39 | +$uglify = & $config['uglify']; |
|
40 | 40 | |
41 | -foreach(Bundle::all() as $name => $files) |
|
41 | +foreach (Bundle::all() as $name => $files) |
|
42 | 42 | { |
43 | - if ($name == '.ts') continue; // ignore timestamp |
|
43 | + if ($name == '.ts') continue; // ignore timestamp |
|
44 | 44 | |
45 | 45 | // remove leading / from file-names |
46 | 46 | array_walk($files, function(&$path) |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | // add css for all templates and themes |
82 | -$cssmin =& $config['cssmin']; |
|
83 | -$GLOBALS['egw_info']['flags']['currentapp'] = '*grunt*'; // to no find any app.css files |
|
84 | -$GLOBALS['egw_info']['server']['debug_minify'] = 'True'; // otherwise we would only get minified file |
|
85 | -foreach(array('pixelegg','jdots')/*array_keys(Framework::list_templates())*/ as $template) |
|
82 | +$cssmin = & $config['cssmin']; |
|
83 | +$GLOBALS['egw_info']['flags']['currentapp'] = '*grunt*'; // to no find any app.css files |
|
84 | +$GLOBALS['egw_info']['server']['debug_minify'] = 'True'; // otherwise we would only get minified file |
|
85 | +foreach (array('pixelegg', 'jdots')/*array_keys(Framework::list_templates())*/ as $template) |
|
86 | 86 | { |
87 | 87 | $GLOBALS['egw_info']['server']['template_set'] = $template; |
88 | 88 | $tpl = Framework::factory(); |
89 | 89 | $themes = $tpl->list_themes(); |
90 | - if ($template == 'pixelegg') $themes[] = 'fw_mobile'; // this is for mobile devices |
|
91 | - foreach($themes as $theme) |
|
90 | + if ($template == 'pixelegg') $themes[] = 'fw_mobile'; // this is for mobile devices |
|
91 | + foreach ($themes as $theme) |
|
92 | 92 | { |
93 | 93 | // skip not working cssmin of pixelegg/traditional: Broken @import declaration of "../../etemplate/templates/default/etemplate2.css" |
94 | 94 | if ($template == 'pixelegg' && $theme == 'traditional') continue; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $new_json = str_replace("\n", "\n\t", |
115 | 115 | preg_replace_callback('/^( *)/m', function($matches) |
116 | 116 | { |
117 | - return str_repeat("\t", strlen($matches[1])/4); |
|
117 | + return str_repeat("\t", strlen($matches[1]) / 4); |
|
118 | 118 | }, json_encode($config, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES))); |
119 | 119 | |
120 | 120 | $new_content = preg_replace('/^(\s*)"([a-z0-9]+)":/mi', '$1$2:', $new_json); |