@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $sitemenu['site'] = array( |
22 | 22 | 'site', |
23 | 23 | 'main', |
24 | - '<i class="fa fa-home"></i>' . $_lang['home'], |
|
24 | + '<i class="fa fa-home"></i>'.$_lang['home'], |
|
25 | 25 | 'index.php?a=2', |
26 | 26 | $_lang['home'], |
27 | 27 | '', |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | 'active' |
33 | 33 | ); |
34 | 34 | |
35 | -if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) { |
|
35 | +if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) { |
|
36 | 36 | $sitemenu['elements'] = array( |
37 | 37 | 'elements', |
38 | 38 | 'main', |
39 | - '<i class="fa fa-th"></i>' . $_lang['elements'], |
|
39 | + '<i class="fa fa-th"></i>'.$_lang['elements'], |
|
40 | 40 | 'javascript:;', |
41 | 41 | $_lang['elements'], |
42 | 42 | ' return false;', |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | ); |
49 | 49 | } |
50 | 50 | |
51 | -if($modx->hasPermission('exec_module')) { |
|
51 | +if ($modx->hasPermission('exec_module')) { |
|
52 | 52 | $sitemenu['modules'] = array( |
53 | 53 | 'modules', |
54 | 54 | 'main', |
55 | - '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['modules'], |
|
55 | + '<i class="'.$_style['icons_modules'].'"></i>'.$_lang['modules'], |
|
56 | 56 | 'javascript:;', |
57 | 57 | $_lang['modules'], |
58 | 58 | ' return false;', |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | ); |
65 | 65 | } |
66 | 66 | |
67 | -if($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) { |
|
67 | +if ($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) { |
|
68 | 68 | $sitemenu['users'] = array( |
69 | 69 | 'users', |
70 | 70 | 'main', |
71 | - '<i class="fa fa-users"></i>' . $_lang['users'], |
|
71 | + '<i class="fa fa-users"></i>'.$_lang['users'], |
|
72 | 72 | 'javascript:;', |
73 | 73 | $_lang['users'], |
74 | 74 | ' return false;', |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | ); |
81 | 81 | } |
82 | 82 | |
83 | -if($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) { |
|
83 | +if ($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) { |
|
84 | 84 | $sitemenu['tools'] = array( |
85 | 85 | 'tools', |
86 | 86 | 'main', |
87 | - '<i class="fa fa-wrench"></i>' . $_lang['tools'], |
|
87 | + '<i class="fa fa-wrench"></i>'.$_lang['tools'], |
|
88 | 88 | 'javascript:;', |
89 | 89 | $_lang['tools'], |
90 | 90 | ' return false;', |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | $tab = 0; |
100 | -if($modx->hasPermission('edit_template')) { |
|
100 | +if ($modx->hasPermission('edit_template')) { |
|
101 | 101 | $sitemenu['element_templates'] = array( |
102 | 102 | 'element_templates', |
103 | 103 | 'elements', |
104 | - '<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>', |
|
105 | - 'index.php?a=76&tab=' . $tab++, |
|
104 | + '<i class="fa fa-newspaper-o"></i>'.$_lang['manage_templates'].'<i class="fa fa-angle-right toggle"></i>', |
|
105 | + 'index.php?a=76&tab='.$tab++, |
|
106 | 106 | $_lang['manage_templates'], |
107 | 107 | '', |
108 | 108 | 'new_template,edit_template', |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | 'dropdown-toggle' |
113 | 113 | ); |
114 | 114 | } |
115 | -if($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
|
115 | +if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
|
116 | 116 | $sitemenu['element_tplvars'] = array( |
117 | 117 | 'element_tplvars', |
118 | 118 | 'elements', |
119 | - '<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>', |
|
120 | - 'index.php?a=76&tab=' . $tab++, |
|
119 | + '<i class="fa fa-list-alt"></i>'.$_lang['tmplvars'].'<i class="fa fa-angle-right toggle"></i>', |
|
120 | + 'index.php?a=76&tab='.$tab++, |
|
121 | 121 | $_lang['tmplvars'], |
122 | 122 | '', |
123 | 123 | 'new_template,edit_template', |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | 'dropdown-toggle' |
128 | 128 | ); |
129 | 129 | } |
130 | -if($modx->hasPermission('edit_chunk')) { |
|
130 | +if ($modx->hasPermission('edit_chunk')) { |
|
131 | 131 | $sitemenu['element_htmlsnippets'] = array( |
132 | 132 | 'element_htmlsnippets', |
133 | 133 | 'elements', |
134 | - '<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
135 | - 'index.php?a=76&tab=' . $tab++, |
|
134 | + '<i class="fa fa-th-large"></i>'.$_lang['manage_htmlsnippets'].'<i class="fa fa-angle-right toggle"></i>', |
|
135 | + 'index.php?a=76&tab='.$tab++, |
|
136 | 136 | $_lang['manage_htmlsnippets'], |
137 | 137 | '', |
138 | 138 | 'new_chunk,edit_chunk', |
@@ -142,12 +142,12 @@ discard block |
||
142 | 142 | 'dropdown-toggle' |
143 | 143 | ); |
144 | 144 | } |
145 | -if($modx->hasPermission('edit_snippet')) { |
|
145 | +if ($modx->hasPermission('edit_snippet')) { |
|
146 | 146 | $sitemenu['element_snippets'] = array( |
147 | 147 | 'element_snippets', |
148 | 148 | 'elements', |
149 | - '<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
150 | - 'index.php?a=76&tab=' . $tab++, |
|
149 | + '<i class="fa fa-code"></i>'.$_lang['manage_snippets'].'<i class="fa fa-angle-right toggle"></i>', |
|
150 | + 'index.php?a=76&tab='.$tab++, |
|
151 | 151 | $_lang['manage_snippets'], |
152 | 152 | '', |
153 | 153 | 'new_snippet,edit_snippet', |
@@ -157,12 +157,12 @@ discard block |
||
157 | 157 | 'dropdown-toggle' |
158 | 158 | ); |
159 | 159 | } |
160 | -if($modx->hasPermission('edit_plugin')) { |
|
160 | +if ($modx->hasPermission('edit_plugin')) { |
|
161 | 161 | $sitemenu['element_plugins'] = array( |
162 | 162 | 'element_plugins', |
163 | 163 | 'elements', |
164 | - '<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>', |
|
165 | - 'index.php?a=76&tab=' . $tab++, |
|
164 | + '<i class="fa fa-plug"></i>'.$_lang['manage_plugins'].'<i class="fa fa-angle-right toggle"></i>', |
|
165 | + 'index.php?a=76&tab='.$tab++, |
|
166 | 166 | $_lang['manage_plugins'], |
167 | 167 | '', |
168 | 168 | 'new_plugin,edit_plugin', |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | } |
175 | 175 | //$sitemenu['element_categories'] = array('element_categories','elements',$_lang['element_categories'],'index.php?a=76&tab=5',$_lang['element_categories'],'','new_template,edit_template,new_snippet,edit_snippet,new_chunk,edit_chunk,new_plugin,edit_plugin','main',1,60,''); |
176 | 176 | |
177 | -if($modx->hasPermission('file_manager')) { |
|
177 | +if ($modx->hasPermission('file_manager')) { |
|
178 | 178 | $sitemenu['manage_files'] = array( |
179 | 179 | 'manage_files', |
180 | 180 | 'elements', |
181 | - '<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'], |
|
181 | + '<i class="fa fa-folder-open-o"></i>'.$_lang['manage_files'], |
|
182 | 182 | 'index.php?a=31', |
183 | 183 | $_lang['manage_files'], |
184 | 184 | '', |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | '' |
190 | 190 | ); |
191 | 191 | } |
192 | -if($modx->hasPermission('category_manager')) { |
|
192 | +if ($modx->hasPermission('category_manager')) { |
|
193 | 193 | $sitemenu['manage_categories'] = array( |
194 | 194 | 'manage_categories', |
195 | 195 | 'elements', |
196 | - '<i class="fa fa-object-group"></i>' . $_lang['manage_categories'], |
|
196 | + '<i class="fa fa-object-group"></i>'.$_lang['manage_categories'], |
|
197 | 197 | 'index.php?a=120', |
198 | 198 | $_lang['manage_categories'], |
199 | 199 | '', |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | } |
207 | 207 | |
208 | 208 | // Modules Menu Items |
209 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) { |
|
209 | +if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) { |
|
210 | 210 | $sitemenu['new_module'] = array( |
211 | 211 | 'new_module', |
212 | 212 | 'modules', |
213 | - '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'], |
|
213 | + '<i class="'.$_style['icons_modules'].'"></i>'.$_lang['module_management'], |
|
214 | 214 | 'index.php?a=106', |
215 | 215 | $_lang['module_management'], |
216 | 216 | '', |
@@ -222,24 +222,24 @@ discard block |
||
222 | 222 | ); |
223 | 223 | } |
224 | 224 | |
225 | -if($modx->hasPermission('exec_module')) { |
|
226 | - if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) { |
|
225 | +if ($modx->hasPermission('exec_module')) { |
|
226 | + if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) { |
|
227 | 227 | $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member |
228 | - FROM ' . $modx->getFullTableName('site_modules') . ' AS sm |
|
229 | - LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id |
|
230 | - LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group |
|
231 | - WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1 |
|
228 | + FROM ' . $modx->getFullTableName('site_modules').' AS sm |
|
229 | + LEFT JOIN ' . $modx->getFullTableName('site_module_access').' AS sma ON sma.module = sm.id |
|
230 | + LEFT JOIN ' . $modx->getFullTableName('member_groups').' AS mg ON sma.usergroup = mg.user_group |
|
231 | + WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID().') AND sm.disabled != 1 AND sm.locked != 1 |
|
232 | 232 | ORDER BY sm.name'); |
233 | 233 | } else { |
234 | 234 | $rs = $modx->db->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name'); |
235 | 235 | } |
236 | - if($modx->db->getRecordCount($rs)) { |
|
236 | + if ($modx->db->getRecordCount($rs)) { |
|
237 | 237 | while ($row = $modx->db->getRow($rs)) { |
238 | - $sitemenu['module' . $row['id']] = array( |
|
239 | - 'module' . $row['id'], |
|
238 | + $sitemenu['module'.$row['id']] = array( |
|
239 | + 'module'.$row['id'], |
|
240 | 240 | 'modules', |
241 | - ($row['icon'] != '' ? '<i class="'.$row['icon'].'"></i>' : '<i class="'.$_style['icons_module'].'"></i>') . $row['name'], |
|
242 | - 'index.php?a=112&id=' . $row['id'], |
|
241 | + ($row['icon'] != '' ? '<i class="'.$row['icon'].'"></i>' : '<i class="'.$_style['icons_module'].'"></i>').$row['name'], |
|
242 | + 'index.php?a=112&id='.$row['id'], |
|
243 | 243 | $row['name'], |
244 | 244 | '', |
245 | 245 | '', |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | |
255 | 255 | // security menu items (users) |
256 | 256 | |
257 | -if($modx->hasPermission('edit_user')) { |
|
257 | +if ($modx->hasPermission('edit_user')) { |
|
258 | 258 | $sitemenu['user_management_title'] = array( |
259 | 259 | 'user_management_title', |
260 | 260 | 'users', |
261 | - '<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
261 | + '<i class="fa fa fa-user"></i>'.$_lang['user_management_title'].'<i class="fa fa-angle-right toggle"></i>', |
|
262 | 262 | 'index.php?a=75', |
263 | 263 | $_lang['user_management_title'], |
264 | 264 | '', |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | ); |
271 | 271 | } |
272 | 272 | |
273 | -if($modx->hasPermission('edit_web_user')) { |
|
273 | +if ($modx->hasPermission('edit_web_user')) { |
|
274 | 274 | $sitemenu['web_user_management_title'] = array( |
275 | 275 | 'web_user_management_title', |
276 | 276 | 'users', |
277 | - '<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
277 | + '<i class="fa fa-users"></i>'.$_lang['web_user_management_title'].'<i class="fa fa-angle-right toggle"></i>', |
|
278 | 278 | 'index.php?a=99', |
279 | 279 | $_lang['web_user_management_title'], |
280 | 280 | '', |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | ); |
287 | 287 | } |
288 | 288 | |
289 | -if($modx->hasPermission('edit_role')) { |
|
289 | +if ($modx->hasPermission('edit_role')) { |
|
290 | 290 | $sitemenu['role_management_title'] = array( |
291 | 291 | 'role_management_title', |
292 | 292 | 'users', |
293 | - '<i class="fa fa-legal"></i>' . $_lang['role_management_title'], |
|
293 | + '<i class="fa fa-legal"></i>'.$_lang['role_management_title'], |
|
294 | 294 | 'index.php?a=86', |
295 | 295 | $_lang['role_management_title'], |
296 | 296 | '', |
@@ -302,11 +302,11 @@ discard block |
||
302 | 302 | ); |
303 | 303 | } |
304 | 304 | |
305 | -if($modx->hasPermission('access_permissions')) { |
|
305 | +if ($modx->hasPermission('access_permissions')) { |
|
306 | 306 | $sitemenu['manager_permissions'] = array( |
307 | 307 | 'manager_permissions', |
308 | 308 | 'users', |
309 | - '<i class="fa fa-male"></i>' . $_lang['manager_permissions'], |
|
309 | + '<i class="fa fa-male"></i>'.$_lang['manager_permissions'], |
|
310 | 310 | 'index.php?a=40', |
311 | 311 | $_lang['manager_permissions'], |
312 | 312 | '', |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | ); |
319 | 319 | } |
320 | 320 | |
321 | -if($modx->hasPermission('web_access_permissions')) { |
|
321 | +if ($modx->hasPermission('web_access_permissions')) { |
|
322 | 322 | $sitemenu['web_permissions'] = array( |
323 | 323 | 'web_permissions', |
324 | 324 | 'users', |
325 | - '<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'], |
|
325 | + '<i class="fa fa-universal-access"></i>'.$_lang['web_permissions'], |
|
326 | 326 | 'index.php?a=91', |
327 | 327 | $_lang['web_permissions'], |
328 | 328 | '', |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $sitemenu['refresh_site'] = array( |
340 | 340 | 'refresh_site', |
341 | 341 | 'tools', |
342 | - '<i class="fa fa-recycle"></i>' . $_lang['refresh_site'], |
|
342 | + '<i class="fa fa-recycle"></i>'.$_lang['refresh_site'], |
|
343 | 343 | 'index.php?a=26', |
344 | 344 | $_lang['refresh_site'], |
345 | 345 | '', |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | 'a', // tag |
354 | 354 | 'javascript:;', // href |
355 | 355 | 'btn btn-secondary', // class or btn-success |
356 | - 'modx.popup({url:\'index.php?a=26\', title:\'' . $_lang['refresh_site'] . '\', icon: \'fa-recycle\', iframe: \'ajax\', selector: \'.tab-page>.container\', position: \'right top\', width: \'auto\', maxheight: \'50%\', wrap: \'body\' })', // onclick |
|
356 | + 'modx.popup({url:\'index.php?a=26\', title:\''.$_lang['refresh_site'].'\', icon: \'fa-recycle\', iframe: \'ajax\', selector: \'.tab-page>.container\', position: \'right top\', width: \'auto\', maxheight: \'50%\', wrap: \'body\' })', // onclick |
|
357 | 357 | $_lang['refresh_site'], // title |
358 | 358 | '<i class="fa fa-recycle"></i>' // innerHTML |
359 | 359 | ) |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $sitemenu['search'] = array( |
364 | 364 | 'search', |
365 | 365 | 'tools', |
366 | - '<i class="fa fa-search"></i>' . $_lang['search'], |
|
366 | + '<i class="fa fa-search"></i>'.$_lang['search'], |
|
367 | 367 | 'index.php?a=71', |
368 | 368 | $_lang['search'], |
369 | 369 | '', |
@@ -374,11 +374,11 @@ discard block |
||
374 | 374 | '' |
375 | 375 | ); |
376 | 376 | |
377 | -if($modx->hasPermission('bk_manager')) { |
|
377 | +if ($modx->hasPermission('bk_manager')) { |
|
378 | 378 | $sitemenu['bk_manager'] = array( |
379 | 379 | 'bk_manager', |
380 | 380 | 'tools', |
381 | - '<i class="fa fa-database"></i>' . $_lang['bk_manager'], |
|
381 | + '<i class="fa fa-database"></i>'.$_lang['bk_manager'], |
|
382 | 382 | 'index.php?a=93', |
383 | 383 | $_lang['bk_manager'], |
384 | 384 | '', |
@@ -390,11 +390,11 @@ discard block |
||
390 | 390 | ); |
391 | 391 | } |
392 | 392 | |
393 | -if($modx->hasPermission('remove_locks')) { |
|
393 | +if ($modx->hasPermission('remove_locks')) { |
|
394 | 394 | $sitemenu['remove_locks'] = array( |
395 | 395 | 'remove_locks', |
396 | 396 | 'tools', |
397 | - '<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'], |
|
397 | + '<i class="fa fa-hourglass"></i>'.$_lang['remove_locks'], |
|
398 | 398 | 'javascript:modx.removeLocks();', |
399 | 399 | $_lang['remove_locks'], |
400 | 400 | '', |
@@ -406,11 +406,11 @@ discard block |
||
406 | 406 | ); |
407 | 407 | } |
408 | 408 | |
409 | -if($modx->hasPermission('import_static')) { |
|
409 | +if ($modx->hasPermission('import_static')) { |
|
410 | 410 | $sitemenu['import_site'] = array( |
411 | 411 | 'import_site', |
412 | 412 | 'tools', |
413 | - '<i class="fa fa-upload"></i>' . $_lang['import_site'], |
|
413 | + '<i class="fa fa-upload"></i>'.$_lang['import_site'], |
|
414 | 414 | 'index.php?a=95', |
415 | 415 | $_lang['import_site'], |
416 | 416 | '', |
@@ -422,11 +422,11 @@ discard block |
||
422 | 422 | ); |
423 | 423 | } |
424 | 424 | |
425 | -if($modx->hasPermission('export_static')) { |
|
425 | +if ($modx->hasPermission('export_static')) { |
|
426 | 426 | $sitemenu['export_site'] = array( |
427 | 427 | 'export_site', |
428 | 428 | 'tools', |
429 | - '<i class="fa fa-download"></i>' . $_lang['export_site'], |
|
429 | + '<i class="fa fa-download"></i>'.$_lang['export_site'], |
|
430 | 430 | 'index.php?a=83', |
431 | 431 | $_lang['export_site'], |
432 | 432 | '', |
@@ -439,20 +439,20 @@ discard block |
||
439 | 439 | } |
440 | 440 | |
441 | 441 | $menu = $modx->invokeEvent("OnManagerMenuPrerender", array('menu' => $sitemenu)); |
442 | -if(is_array($menu)) { |
|
442 | +if (is_array($menu)) { |
|
443 | 443 | $newmenu = array(); |
444 | - foreach($menu as $item){ |
|
445 | - if(is_array(unserialize($item))){ |
|
444 | + foreach ($menu as $item) { |
|
445 | + if (is_array(unserialize($item))) { |
|
446 | 446 | $newmenu = array_merge($newmenu, unserialize($item)); |
447 | 447 | } |
448 | 448 | } |
449 | - if(count($newmenu)> 0) $sitemenu = $newmenu; |
|
449 | + if (count($newmenu) > 0) $sitemenu = $newmenu; |
|
450 | 450 | } |
451 | 451 | |
452 | -if(file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php')) { |
|
453 | - include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php'); |
|
452 | +if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/includes/menu.class.inc.php')) { |
|
453 | + include_once(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/includes/menu.class.inc.php'); |
|
454 | 454 | } else { |
455 | - include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php'); |
|
455 | + include_once(MODX_MANAGER_PATH.'includes/menu.class.inc.php'); |
|
456 | 456 | } |
457 | 457 | $menu = new EVOmenu(); |
458 | 458 | $menu->Build($sitemenu, array( |
@@ -12,9 +12,9 @@ |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class type_img { |
|
15 | +class type_img{ |
|
16 | 16 | |
17 | - public function checkFile($file, array $config) { |
|
17 | + public function checkFile($file, array $config){ |
|
18 | 18 | |
19 | 19 | $driver = isset($config['imageDriversPriority']) |
20 | 20 | ? image::getDriver(explode(" ", $config['imageDriversPriority'])) : "gd"; |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class type_mime { |
|
15 | +class type_mime{ |
|
16 | 16 | |
17 | - public function checkFile($file, array $config) { |
|
17 | + public function checkFile($file, array $config){ |
|
18 | 18 | if (!class_exists("finfo")) |
19 | 19 | return "Fileinfo PECL extension is missing."; |
20 | 20 | |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | $mimes = $config['params']; |
34 | 34 | if (substr($mimes, 0, 1) == "!") { |
35 | 35 | $mimes = trim(substr($mimes, 1)); |
36 | - return in_array($type , explode(" ", $mimes)) |
|
36 | + return in_array($type, explode(" ", $mimes)) |
|
37 | 37 | ? "You can't upload such files." |
38 | 38 | : true; |
39 | 39 | } |
40 | 40 | |
41 | - return !in_array($type , explode(" ", $mimes)) |
|
41 | + return !in_array($type, explode(" ", $mimes)) |
|
42 | 42 | ? "You can't upload such files." |
43 | 43 | : true; |
44 | 44 | } |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class browser extends uploader { |
|
15 | +class browser extends uploader{ |
|
16 | 16 | protected $action; |
17 | 17 | protected $thumbsDir; |
18 | 18 | protected $thumbsTypeDir; |
19 | 19 | |
20 | - public function __construct($modx) { |
|
20 | + public function __construct($modx){ |
|
21 | 21 | parent::__construct($modx); |
22 | 22 | |
23 | 23 | if (isset($this->post['dir'])) { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $this->get['dir'] = $dir; |
33 | 33 | } |
34 | 34 | |
35 | - $thumbsDir = $this->config['uploadDir'] . "/" . $this->config['thumbsDir']; |
|
35 | + $thumbsDir = $this->config['uploadDir']."/".$this->config['thumbsDir']; |
|
36 | 36 | if (( |
37 | 37 | !is_dir($thumbsDir) && |
38 | 38 | !@mkdir($thumbsDir, $this->config['dirPerms']) |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | $this->config['theme'] = $this->get['theme']; |
71 | 71 | } |
72 | 72 | |
73 | - public function action() { |
|
73 | + public function action(){ |
|
74 | 74 | $act = isset($this->get['act']) ? $this->get['act'] : "browser"; |
75 | - if(!preg_match('@^[0-9a-zA-Z_]+$@', $act)) $this->errorMsg("Unknown error."); |
|
75 | + if (!preg_match('@^[0-9a-zA-Z_]+$@', $act)) $this->errorMsg("Unknown error."); |
|
76 | 76 | if (!method_exists($this, "act_$act")) |
77 | 77 | $act = "browser"; |
78 | 78 | $this->action = $act; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $this->session['dir'] = $this->type; |
95 | 95 | else { |
96 | 96 | $type = $this->getTypeFromPath($this->session['dir']); |
97 | - $dir = $this->config['uploadDir'] . "/" . $this->session['dir']; |
|
97 | + $dir = $this->config['uploadDir']."/".$this->session['dir']; |
|
98 | 98 | if (($type != $this->type) || !is_dir($dir) || !is_readable($dir)) |
99 | 99 | $this->session['dir'] = $this->type; |
100 | 100 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | : $return; |
116 | 116 | } |
117 | 117 | |
118 | - protected function act_browser() { |
|
118 | + protected function act_browser(){ |
|
119 | 119 | if (isset($this->get['dir']) && |
120 | 120 | is_dir("{$this->typeDir}/{$this->get['dir']}") && |
121 | 121 | is_readable("{$this->typeDir}/{$this->get['dir']}") |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | return $this->output(); |
126 | 126 | } |
127 | 127 | |
128 | - protected function act_init() { |
|
128 | + protected function act_init(){ |
|
129 | 129 | $tree = $this->getDirInfo($this->typeDir); |
130 | 130 | $tree['dirs'] = $this->getTree($this->session['dir']); |
131 | 131 | if (!is_array($tree['dirs']) || !count($tree['dirs'])) |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | return json_encode($data); |
141 | 141 | } |
142 | 142 | |
143 | - protected function act_thumb() { |
|
143 | + protected function act_thumb(){ |
|
144 | 144 | $this->getDir($this->get['dir'], true); |
145 | 145 | if (!isset($this->get['file']) || !isset($this->get['dir'])) |
146 | 146 | $this->sendDefaultThumb(); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $this->sendDefaultThumb(); |
150 | 150 | $file = "{$this->thumbsDir}/{$this->type}/{$this->get['dir']}/$file"; |
151 | 151 | if (!is_file($file) || !is_readable($file)) { |
152 | - $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/" . basename($file); |
|
152 | + $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/".basename($file); |
|
153 | 153 | if (!is_file($file) || !is_readable($file)) |
154 | 154 | $this->sendDefaultThumb($file); |
155 | 155 | $image = image::factory($this->imageDriver, $file); |
@@ -171,13 +171,13 @@ discard block |
||
171 | 171 | httpCache::file($file, "image/jpeg"); |
172 | 172 | } |
173 | 173 | |
174 | - protected function act_expand() { |
|
174 | + protected function act_expand(){ |
|
175 | 175 | return json_encode(array('dirs' => $this->getDirs($this->postDir()))); |
176 | 176 | } |
177 | 177 | |
178 | - protected function act_chDir() { |
|
178 | + protected function act_chDir(){ |
|
179 | 179 | $this->postDir(); // Just for existing check |
180 | - $this->session['dir'] = $this->type . "/" . $this->post['dir']; |
|
180 | + $this->session['dir'] = $this->type."/".$this->post['dir']; |
|
181 | 181 | $dirWritable = dir::isWritable("{$this->config['uploadDir']}/{$this->session['dir']}"); |
182 | 182 | return json_encode(array( |
183 | 183 | 'files' => $this->getFiles($this->session['dir']), |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | )); |
186 | 186 | } |
187 | 187 | |
188 | - protected function act_newDir() { |
|
188 | + protected function act_newDir(){ |
|
189 | 189 | if (!$this->config['access']['dirs']['create'] || |
190 | 190 | !isset($this->post['dir']) || |
191 | 191 | !isset($this->post['newDir']) |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | return true; |
208 | 208 | } |
209 | 209 | |
210 | - protected function act_renameDir() { |
|
210 | + protected function act_renameDir(){ |
|
211 | 211 | if (!$this->config['access']['dirs']['rename'] || |
212 | 212 | !isset($this->post['dir']) || |
213 | 213 | !isset($this->post['newName']) |
@@ -222,15 +222,15 @@ discard block |
||
222 | 222 | $this->errorMsg("Unallowable characters in folder name."); |
223 | 223 | if (substr($newName, 0, 1) == ".") |
224 | 224 | $this->errorMsg("Folder name shouldn't begins with '.'"); |
225 | - if (!@rename($dir, dirname($dir) . "/$newName")) |
|
225 | + if (!@rename($dir, dirname($dir)."/$newName")) |
|
226 | 226 | $this->errorMsg("Cannot rename the folder."); |
227 | 227 | $thumbDir = "$this->thumbsTypeDir/{$this->post['dir']}"; |
228 | 228 | if (is_dir($thumbDir)) |
229 | - @rename($thumbDir, dirname($thumbDir) . "/$newName"); |
|
229 | + @rename($thumbDir, dirname($thumbDir)."/$newName"); |
|
230 | 230 | return json_encode(array('name' => $newName)); |
231 | 231 | } |
232 | 232 | |
233 | - protected function act_deleteDir() { |
|
233 | + protected function act_deleteDir(){ |
|
234 | 234 | if (!$this->config['access']['dirs']['delete'] || |
235 | 235 | !isset($this->post['dir']) || |
236 | 236 | !strlen(trim($this->post['dir'])) |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | return true; |
251 | 251 | } |
252 | 252 | |
253 | - protected function act_upload() { |
|
253 | + protected function act_upload(){ |
|
254 | 254 | if (!$this->config['access']['files']['upload'] || |
255 | 255 | !isset($this->post['dir']) |
256 | 256 | ) |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | return $this->moveUploadFile($this->file, $dir); |
276 | 276 | } |
277 | 277 | |
278 | - protected function act_download() { |
|
278 | + protected function act_download(){ |
|
279 | 279 | $dir = $this->postDir(); |
280 | 280 | if (!isset($this->post['dir']) || |
281 | 281 | !isset($this->post['file']) || |
282 | - strpos($this->post['file'],'../')!==false || |
|
282 | + strpos($this->post['file'], '../') !== false || |
|
283 | 283 | (false === ($file = "$dir/{$this->post['file']}")) || |
284 | 284 | !file_exists($file) || !is_readable($file) |
285 | 285 | ) |
@@ -290,19 +290,19 @@ discard block |
||
290 | 290 | header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
291 | 291 | header("Cache-Control: private", false); |
292 | 292 | header("Content-Type: application/octet-stream"); |
293 | - header('Content-Disposition: attachment; filename="' . str_replace('"', "_", $this->post['file']) . '"'); |
|
293 | + header('Content-Disposition: attachment; filename="'.str_replace('"', "_", $this->post['file']).'"'); |
|
294 | 294 | header("Content-Transfer-Encoding: binary"); |
295 | - header("Content-Length: " . filesize($file)); |
|
295 | + header("Content-Length: ".filesize($file)); |
|
296 | 296 | readfile($file); |
297 | 297 | die; |
298 | 298 | } |
299 | 299 | |
300 | - protected function act_rename() { |
|
300 | + protected function act_rename(){ |
|
301 | 301 | $dir = $this->postDir(); |
302 | 302 | if (!$this->config['access']['files']['rename'] || |
303 | 303 | !isset($this->post['dir']) || |
304 | 304 | !isset($this->post['file']) || |
305 | - strpos($this->post['file'],'../')!==false || |
|
305 | + strpos($this->post['file'], '../') !== false || |
|
306 | 306 | !isset($this->post['newName']) || |
307 | 307 | (false === ($file = "$dir/{$this->post['file']}")) || |
308 | 308 | !file_exists($file) || !is_readable($file) || !file::isWritable($file) |
@@ -337,16 +337,16 @@ discard block |
||
337 | 337 | $thumbFile = "$thumbDir/{$this->post['file']}"; |
338 | 338 | |
339 | 339 | if (file_exists($thumbFile)) |
340 | - @rename($thumbFile, "$thumbDir/" . basename($newName)); |
|
340 | + @rename($thumbFile, "$thumbDir/".basename($newName)); |
|
341 | 341 | return true; |
342 | 342 | } |
343 | 343 | |
344 | - protected function act_delete() { |
|
344 | + protected function act_delete(){ |
|
345 | 345 | $dir = $this->postDir(); |
346 | 346 | if (!$this->config['access']['files']['delete'] || |
347 | 347 | !isset($this->post['dir']) || |
348 | 348 | !isset($this->post['file']) || |
349 | - strpos($this->post['file'],'../')!==false || |
|
349 | + strpos($this->post['file'], '../') !== false || |
|
350 | 350 | (false === ($file = "$dir/{$this->post['file']}")) || |
351 | 351 | !file_exists($file) || !is_readable($file) || !file::isWritable($file) || |
352 | 352 | !@unlink($file) |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | return true; |
359 | 359 | } |
360 | 360 | |
361 | - protected function act_cp_cbd() { |
|
361 | + protected function act_cp_cbd(){ |
|
362 | 362 | $dir = $this->postDir(); |
363 | 363 | if (!$this->config['access']['files']['copy'] || |
364 | 364 | !isset($this->post['dir']) || |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $this->errorMsg("Unknown error."); |
370 | 370 | |
371 | 371 | $error = array(); |
372 | - foreach($this->post['files'] as $file) { |
|
372 | + foreach ($this->post['files'] as $file) { |
|
373 | 373 | $file = path::normalize($file); |
374 | 374 | if (substr($file, 0, 1) == ".") continue; |
375 | 375 | $type = explode("/", $file); |
@@ -382,11 +382,11 @@ discard block |
||
382 | 382 | if (!file_exists($path)) |
383 | 383 | $error[] = $this->label("The file '{file}' does not exist.", $replace); |
384 | 384 | elseif (substr($base, 0, 1) == ".") |
385 | - $error[] = "$base: " . $this->label("File name shouldn't begins with '.'"); |
|
385 | + $error[] = "$base: ".$this->label("File name shouldn't begins with '.'"); |
|
386 | 386 | elseif (!$this->validateExtension($ext, $type)) |
387 | - $error[] = "$base: " . $this->label("Denied file extension."); |
|
387 | + $error[] = "$base: ".$this->label("Denied file extension."); |
|
388 | 388 | elseif (file_exists("$dir/$base")) |
389 | - $error[] = "$base: " . $this->label("A file or folder with that name already exists."); |
|
389 | + $error[] = "$base: ".$this->label("A file or folder with that name already exists."); |
|
390 | 390 | elseif (!is_readable($path) || !is_file($path)) |
391 | 391 | $error[] = $this->label("Cannot read '{file}'.", $replace); |
392 | 392 | elseif (!@copy($path, "$dir/$base")) |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | return true; |
410 | 410 | } |
411 | 411 | |
412 | - protected function act_mv_cbd() { |
|
412 | + protected function act_mv_cbd(){ |
|
413 | 413 | $dir = $this->postDir(); |
414 | 414 | if (!$this->config['access']['files']['move'] || |
415 | 415 | !isset($this->post['dir']) || |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $this->errorMsg("Unknown error."); |
421 | 421 | |
422 | 422 | $error = array(); |
423 | - foreach($this->post['files'] as $file) { |
|
423 | + foreach ($this->post['files'] as $file) { |
|
424 | 424 | $file = path::normalize($file); |
425 | 425 | if (substr($file, 0, 1) == ".") continue; |
426 | 426 | $type = explode("/", $file); |
@@ -433,11 +433,11 @@ discard block |
||
433 | 433 | if (!file_exists($path)) |
434 | 434 | $error[] = $this->label("The file '{file}' does not exist.", $replace); |
435 | 435 | elseif (substr($base, 0, 1) == ".") |
436 | - $error[] = "$base: " . $this->label("File name shouldn't begins with '.'"); |
|
436 | + $error[] = "$base: ".$this->label("File name shouldn't begins with '.'"); |
|
437 | 437 | elseif (!$this->validateExtension($ext, $type)) |
438 | - $error[] = "$base: " . $this->label("Denied file extension."); |
|
438 | + $error[] = "$base: ".$this->label("Denied file extension."); |
|
439 | 439 | elseif (file_exists("$dir/$base")) |
440 | - $error[] = "$base: " . $this->label("A file or folder with that name already exists."); |
|
440 | + $error[] = "$base: ".$this->label("A file or folder with that name already exists."); |
|
441 | 441 | elseif (!is_readable($path) || !is_file($path)) |
442 | 442 | $error[] = $this->label("Cannot read '{file}'.", $replace); |
443 | 443 | elseif (!file::isWritable($path) || !@rename($path, "$dir/$base")) |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | return true; |
461 | 461 | } |
462 | 462 | |
463 | - protected function act_rm_cbd() { |
|
463 | + protected function act_rm_cbd(){ |
|
464 | 464 | if (!$this->config['access']['files']['delete'] || |
465 | 465 | !isset($this->post['files']) || |
466 | 466 | !is_array($this->post['files']) || |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $this->errorMsg("Unknown error."); |
470 | 470 | |
471 | 471 | $error = array(); |
472 | - foreach($this->post['files'] as $file) { |
|
472 | + foreach ($this->post['files'] as $file) { |
|
473 | 473 | $file = path::normalize($file); |
474 | 474 | if (substr($file, 0, 1) == ".") continue; |
475 | 475 | $type = explode("/", $file); |
@@ -492,25 +492,25 @@ discard block |
||
492 | 492 | return true; |
493 | 493 | } |
494 | 494 | |
495 | - protected function act_downloadDir() { |
|
495 | + protected function act_downloadDir(){ |
|
496 | 496 | $dir = $this->postDir(); |
497 | 497 | if (!isset($this->post['dir']) || $this->config['denyZipDownload']) |
498 | 498 | $this->errorMsg("Unknown error."); |
499 | - $filename = basename($dir) . ".zip"; |
|
499 | + $filename = basename($dir).".zip"; |
|
500 | 500 | do { |
501 | - $file = md5(time() . session_id()); |
|
501 | + $file = md5(time().session_id()); |
|
502 | 502 | $file = "{$this->config['uploadDir']}/$file.zip"; |
503 | 503 | } while (file_exists($file)); |
504 | 504 | new zipFolder($file, $dir); |
505 | 505 | header("Content-Type: application/x-zip"); |
506 | - header('Content-Disposition: attachment; filename="' . str_replace('"', "_", $filename) . '"'); |
|
507 | - header("Content-Length: " . filesize($file)); |
|
506 | + header('Content-Disposition: attachment; filename="'.str_replace('"', "_", $filename).'"'); |
|
507 | + header("Content-Length: ".filesize($file)); |
|
508 | 508 | readfile($file); |
509 | 509 | unlink($file); |
510 | 510 | die; |
511 | 511 | } |
512 | 512 | |
513 | - protected function act_downloadSelected() { |
|
513 | + protected function act_downloadSelected(){ |
|
514 | 514 | $dir = $this->postDir(); |
515 | 515 | if (!isset($this->post['dir']) || |
516 | 516 | !isset($this->post['files']) || |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | } |
532 | 532 | |
533 | 533 | do { |
534 | - $file = md5(time() . session_id()); |
|
534 | + $file = md5(time().session_id()); |
|
535 | 535 | $file = "{$this->config['uploadDir']}/$file.zip"; |
536 | 536 | } while (file_exists($file)); |
537 | 537 | |
@@ -543,14 +543,14 @@ discard block |
||
543 | 543 | $zip->close(); |
544 | 544 | } |
545 | 545 | header("Content-Type: application/x-zip"); |
546 | - header('Content-Disposition: attachment; filename="selected_files_' . basename($file) . '"'); |
|
547 | - header("Content-Length: " . filesize($file)); |
|
546 | + header('Content-Disposition: attachment; filename="selected_files_'.basename($file).'"'); |
|
547 | + header("Content-Length: ".filesize($file)); |
|
548 | 548 | readfile($file); |
549 | 549 | unlink($file); |
550 | 550 | die; |
551 | 551 | } |
552 | 552 | |
553 | - protected function act_downloadClipboard() { |
|
553 | + protected function act_downloadClipboard(){ |
|
554 | 554 | if (!isset($this->post['files']) || |
555 | 555 | !is_array($this->post['files']) || |
556 | 556 | $this->config['denyZipDownload'] |
@@ -566,14 +566,14 @@ discard block |
||
566 | 566 | $type = $type[0]; |
567 | 567 | if ($type != $this->type) |
568 | 568 | continue; |
569 | - $file = $this->config['uploadDir'] . "/$file"; |
|
569 | + $file = $this->config['uploadDir']."/$file"; |
|
570 | 570 | if (!is_file($file) || !is_readable($file)) |
571 | 571 | continue; |
572 | 572 | $zipFiles[] = $file; |
573 | 573 | } |
574 | 574 | |
575 | 575 | do { |
576 | - $file = md5(time() . session_id()); |
|
576 | + $file = md5(time().session_id()); |
|
577 | 577 | $file = "{$this->config['uploadDir']}/$file.zip"; |
578 | 578 | } while (file_exists($file)); |
579 | 579 | |
@@ -585,14 +585,14 @@ discard block |
||
585 | 585 | $zip->close(); |
586 | 586 | } |
587 | 587 | header("Content-Type: application/x-zip"); |
588 | - header('Content-Disposition: attachment; filename="clipboard_' . basename($file) . '"'); |
|
589 | - header("Content-Length: " . filesize($file)); |
|
588 | + header('Content-Disposition: attachment; filename="clipboard_'.basename($file).'"'); |
|
589 | + header("Content-Length: ".filesize($file)); |
|
590 | 590 | readfile($file); |
591 | 591 | unlink($file); |
592 | 592 | die; |
593 | 593 | } |
594 | 594 | |
595 | - protected function act_check4Update() { |
|
595 | + protected function act_check4Update(){ |
|
596 | 596 | if ($this->config['denyUpdateCheck']) |
597 | 597 | return json_encode(array('version' => false)); |
598 | 598 | |
@@ -632,24 +632,24 @@ discard block |
||
632 | 632 | // Curl extension |
633 | 633 | ) {} elseif ( |
634 | 634 | function_exists("curl_init") && |
635 | - (false !== ( $curl = @curl_init($url) )) && |
|
636 | - ( @ob_start() || (@curl_close($curl) && false)) && |
|
637 | - ( @curl_exec($curl) || (@curl_close($curl) && false)) && |
|
638 | - ((false !== ( $ver = @ob_get_clean() )) || (@curl_close($curl) && false)) && |
|
639 | - ( @curl_close($curl) || true ) && |
|
635 | + (false !== ($curl = @curl_init($url))) && |
|
636 | + (@ob_start() || (@curl_close($curl) && false)) && |
|
637 | + (@curl_exec($curl) || (@curl_close($curl) && false)) && |
|
638 | + ((false !== ($ver = @ob_get_clean())) || (@curl_close($curl) && false)) && |
|
639 | + (@curl_close($curl) || true) && |
|
640 | 640 | preg_match($pattern, $ver) |
641 | 641 | |
642 | 642 | // Socket extension |
643 | 643 | ) {} elseif (function_exists('socket_create')) { |
644 | 644 | $cmd = |
645 | - "GET $path " . strtoupper($protocol) . "/1.1\r\n" . |
|
646 | - "Host: $host\r\n" . |
|
645 | + "GET $path ".strtoupper($protocol)."/1.1\r\n". |
|
646 | + "Host: $host\r\n". |
|
647 | 647 | "Connection: Close\r\n\r\n"; |
648 | 648 | |
649 | - if ((false !== ( $socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP) )) && |
|
650 | - (false !== @socket_connect($socket, $host, $port) ) && |
|
651 | - (false !== @socket_write($socket, $cmd, strlen($cmd)) ) && |
|
652 | - (false !== ( $ver = @socket_read($socket, 2048) )) && |
|
649 | + if ((false !== ($socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) && |
|
650 | + (false !== @socket_connect($socket, $host, $port)) && |
|
651 | + (false !== @socket_write($socket, $cmd, strlen($cmd))) && |
|
652 | + (false !== ($ver = @socket_read($socket, 2048))) && |
|
653 | 653 | preg_match($responsePattern, $ver, $match) |
654 | 654 | ) |
655 | 655 | $ver = $match[2]; |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | return json_encode(array('version' => false)); |
667 | 667 | } |
668 | 668 | |
669 | - protected function moveUploadFile($file, $dir) { |
|
669 | + protected function moveUploadFile($file, $dir){ |
|
670 | 670 | $message = $this->checkUploadedFile($file); |
671 | 671 | |
672 | 672 | if ($message !== true) { |
@@ -676,28 +676,28 @@ discard block |
||
676 | 676 | } |
677 | 677 | |
678 | 678 | $filename = $this->normalizeFilename($file['name']); |
679 | - $target = "$dir/" . file::getInexistantFilename($filename, $dir); |
|
679 | + $target = "$dir/".file::getInexistantFilename($filename, $dir); |
|
680 | 680 | |
681 | 681 | if (!@move_uploaded_file($file['tmp_name'], $target) && |
682 | 682 | !@rename($file['tmp_name'], $target) && |
683 | 683 | !@copy($file['tmp_name'], $target) |
684 | 684 | ) { |
685 | 685 | @unlink($file['tmp_name']); |
686 | - return "{$file['name']}: " . $this->label("Cannot move uploaded file to target folder."); |
|
686 | + return "{$file['name']}: ".$this->label("Cannot move uploaded file to target folder."); |
|
687 | 687 | } elseif (function_exists('chmod')) |
688 | 688 | chmod($target, $this->config['filePerms']); |
689 | 689 | |
690 | - $this->modx->invokeEvent('OnFileBrowserUpload',array( |
|
690 | + $this->modx->invokeEvent('OnFileBrowserUpload', array( |
|
691 | 691 | 'filepath'=>realpath($dir), |
692 | - 'filename'=>str_replace("/","",str_replace($dir,"",realpath($target))) |
|
692 | + 'filename'=>str_replace("/", "", str_replace($dir, "", realpath($target))) |
|
693 | 693 | )); |
694 | 694 | |
695 | 695 | $this->makeThumb($target); |
696 | 696 | |
697 | - return "/" . basename($target); |
|
697 | + return "/".basename($target); |
|
698 | 698 | } |
699 | 699 | |
700 | - protected function sendDefaultThumb($file=null) { |
|
700 | + protected function sendDefaultThumb($file = null){ |
|
701 | 701 | if ($file !== null) { |
702 | 702 | $ext = file::getExtension($file); |
703 | 703 | $thumb = "themes/{$this->config['theme']}/img/files/big/$ext.png"; |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | die; |
710 | 710 | } |
711 | 711 | |
712 | - protected function getFiles($dir) { |
|
712 | + protected function getFiles($dir){ |
|
713 | 713 | $thumbDir = "{$this->config['uploadDir']}/{$this->config['thumbsDir']}/$dir"; |
714 | 714 | $dir = "{$this->config['uploadDir']}/$dir"; |
715 | 715 | $return = array(); |
@@ -720,10 +720,10 @@ discard block |
||
720 | 720 | foreach ($files as $file) { |
721 | 721 | $ext = file::getExtension($file); |
722 | 722 | $smallThumb = false; |
723 | - if (in_array(strtolower($ext), array('png', 'jpg', 'gif', 'jpeg' )) ) { |
|
723 | + if (in_array(strtolower($ext), array('png', 'jpg', 'gif', 'jpeg'))) { |
|
724 | 724 | $size = @getimagesize($file); |
725 | 725 | if (is_array($size) && count($size)) { |
726 | - $thumb_file = "$thumbDir/" . basename($file); |
|
726 | + $thumb_file = "$thumbDir/".basename($file); |
|
727 | 727 | if (!is_file($thumb_file) || filemtime($file) > filemtime($thumb_file)) |
728 | 728 | $this->makeThumb($file); |
729 | 729 | $smallThumb = |
@@ -736,9 +736,9 @@ discard block |
||
736 | 736 | if ($stat === false) continue; |
737 | 737 | $name = basename($file); |
738 | 738 | $types = $this->config['types']; |
739 | - $types = explode(' ',$types['images'].' '.$types['image']); |
|
740 | - if (substr($name,0,1) == '.' && !$this->config['showHiddenFiles']) continue; |
|
741 | - if ($this->type == 'images' && !in_array(strtolower($ext),$types)) continue; |
|
739 | + $types = explode(' ', $types['images'].' '.$types['image']); |
|
740 | + if (substr($name, 0, 1) == '.' && !$this->config['showHiddenFiles']) continue; |
|
741 | + if ($this->type == 'images' && !in_array(strtolower($ext), $types)) continue; |
|
742 | 742 | $bigIcon = file_exists("themes/{$this->config['theme']}/img/files/big/$ext.png"); |
743 | 743 | $smallIcon = file_exists("themes/{$this->config['theme']}/img/files/small/$ext.png"); |
744 | 744 | $thumb = file_exists("$thumbDir/$name"); |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | return $return; |
759 | 759 | } |
760 | 760 | |
761 | - protected function getTree($dir, $index=0) { |
|
761 | + protected function getTree($dir, $index = 0){ |
|
762 | 762 | $path = explode("/", $dir); |
763 | 763 | |
764 | 764 | $pdir = ""; |
@@ -793,25 +793,25 @@ discard block |
||
793 | 793 | return $dirs; |
794 | 794 | } |
795 | 795 | |
796 | - protected function postDir($existent=true) { |
|
796 | + protected function postDir($existent = true){ |
|
797 | 797 | $dir = $this->typeDir; |
798 | 798 | if (isset($this->post['dir'])) |
799 | - $dir .= "/" . $this->post['dir']; |
|
799 | + $dir .= "/".$this->post['dir']; |
|
800 | 800 | if ($existent && (!is_dir($dir) || !is_readable($dir))) |
801 | 801 | $this->errorMsg("Inexistant or inaccessible folder."); |
802 | 802 | return $dir; |
803 | 803 | } |
804 | 804 | |
805 | - protected function getDir($existent=true) { |
|
805 | + protected function getDir($existent = true){ |
|
806 | 806 | $dir = $this->typeDir; |
807 | 807 | if (isset($this->get['dir'])) |
808 | - $dir .= "/" . $this->get['dir']; |
|
808 | + $dir .= "/".$this->get['dir']; |
|
809 | 809 | if ($existent && (!is_dir($dir) || !is_readable($dir))) |
810 | 810 | $this->errorMsg("Inexistant or inaccessible folder."); |
811 | 811 | return $dir; |
812 | 812 | } |
813 | 813 | |
814 | - protected function getDirs($dir) { |
|
814 | + protected function getDirs($dir){ |
|
815 | 815 | $dirs = dir::content($dir, array('types' => "dir")); |
816 | 816 | $return = array(); |
817 | 817 | if (is_array($dirs)) { |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | return $return; |
827 | 827 | } |
828 | 828 | |
829 | - protected function getDirInfo($dir, $removable=false) { |
|
829 | + protected function getDirInfo($dir, $removable = false){ |
|
830 | 830 | if ((substr(basename($dir), 0, 1) == ".") || !is_dir($dir) || !is_readable($dir)) |
831 | 831 | return false; |
832 | 832 | $dirs = dir::content($dir, array('types' => "dir")); |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | return $info; |
854 | 854 | } |
855 | 855 | |
856 | - protected function output($data=null, $template=null) { |
|
856 | + protected function output($data = null, $template = null){ |
|
857 | 857 | if (!is_array($data)) $data = array(); |
858 | 858 | if ($template === null) |
859 | 859 | $template = $this->action; |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | return ""; |
874 | 874 | } |
875 | 875 | |
876 | - protected function errorMsg($message, array $data=null) { |
|
876 | + protected function errorMsg($message, array $data = null){ |
|
877 | 877 | if (in_array($this->action, array("thumb", "upload", "download", "downloadDir"))) |
878 | 878 | die($this->label($message, $data)); |
879 | 879 | if (($this->action === null) || ($this->action == "browser")) |
@@ -1,2 +1,2 @@ |
||
1 | -<link href="css.php?type=<?php echo $this->type ?><?php echo ($this->cms ? "&cms={$this->cms}" : "" ) ?>" rel="stylesheet" type="text/css" /> |
|
1 | +<link href="css.php?type=<?php echo $this->type ?><?php echo ($this->cms ? "&cms={$this->cms}" : "") ?>" rel="stylesheet" type="text/css" /> |
|
2 | 2 | <link href="themes/<?php echo $this->config['theme'] ?>/style.css" rel="stylesheet" type="text/css" /> |
@@ -9,8 +9,8 @@ |
||
9 | 9 | |
10 | 10 | $lang = array( |
11 | 11 | |
12 | - '_locale' => "pt_BR.UTF-8", // UNIX localization code |
|
13 | - '_charset' => "utf-8", // Browser charset |
|
12 | + '_locale' => "pt_BR.UTF-8", // UNIX localization code |
|
13 | + '_charset' => "utf-8", // Browser charset |
|
14 | 14 | |
15 | 15 | // Date time formats. See http://www.php.net/manual/en/function.strftime.php |
16 | 16 | '_dateTimeFull' => "%A, %e %B, %Y %H:%M", |
@@ -6,8 +6,8 @@ |
||
6 | 6 | |
7 | 7 | $lang = array( |
8 | 8 | |
9 | - '_locale' => "de_DE.UTF-8", // UNIX localization code |
|
10 | - '_charset' => "utf-8", // Browser charset |
|
9 | + '_locale' => "de_DE.UTF-8", // UNIX localization code |
|
10 | + '_charset' => "utf-8", // Browser charset |
|
11 | 11 | |
12 | 12 | // Date time formats. See http://www.php.net/manual/en/function.strftime.php |
13 | 13 | '_dateTimeFull' => "%A, %e.%B.%Y %I:%M %p", |
@@ -7,8 +7,8 @@ |
||
7 | 7 | |
8 | 8 | $lang = array( |
9 | 9 | |
10 | - '_locale' => "uk_UA.UTF-8", // UNIX localization code |
|
11 | - '_charset' => "utf-8", // Browser charset |
|
10 | + '_locale' => "uk_UA.UTF-8", // UNIX localization code |
|
11 | + '_charset' => "utf-8", // Browser charset |
|
12 | 12 | |
13 | 13 | // Date time formats. See http://www.php.net/manual/en/function.strftime.php |
14 | 14 | '_dateTimeFull' => "%A, %e %B, %Y %H:%M", |
@@ -11,8 +11,8 @@ |
||
11 | 11 | |
12 | 12 | $lang = array( |
13 | 13 | |
14 | - '_locale' => "ja_JP.UTF-8", // UNIX localization code |
|
15 | - '_charset' => "utf-8", // Browser charset |
|
14 | + '_locale' => "ja_JP.UTF-8", // UNIX localization code |
|
15 | + '_charset' => "utf-8", // Browser charset |
|
16 | 16 | |
17 | 17 | // Date time formats. See http://www.php.net/manual/en/function.strftime.php |
18 | 18 | '_dateTimeFull' => "%Y/%m/%d %H:%M", |