@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | $self = 'install/cli-install.php'; |
8 | -$path = dirname(__FILE__) . '/'; |
|
9 | -$base_path = str_replace($self,'',str_replace('\\','/', __FILE__)); |
|
8 | +$path = dirname(__FILE__).'/'; |
|
9 | +$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__)); |
|
10 | 10 | define('MODX_API_MODE', true); |
11 | 11 | define('MODX_BASE_PATH', $base_path); |
12 | 12 | define('MODX_SITE_URL', '/'); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | if (is_file($base_path."assets/cache/siteManager.php")) { |
20 | 20 | include_once($base_path."assets/cache/siteManager.php"); |
21 | 21 | } |
22 | -if(!defined('MGR_DIR') && is_dir($base_path."manager")) { |
|
22 | +if (!defined('MGR_DIR') && is_dir($base_path."manager")) { |
|
23 | 23 | define('MGR_DIR', 'manager'); |
24 | 24 | } |
25 | 25 | |
@@ -33,43 +33,43 @@ discard block |
||
33 | 33 | $moduleSQLDataFile = $path."setup.data.sql"; |
34 | 34 | $moduleSQLResetFile = $path."setup.data.reset.sql"; |
35 | 35 | |
36 | -$moduleChunks = array (); // chunks - array : name, description, type - 0:file or 1:content, file or content |
|
37 | -$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content |
|
38 | -$moduleSnippets = array (); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties |
|
39 | -$modulePlugins = array (); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid |
|
40 | -$moduleModules = array (); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid |
|
41 | -$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content,properties |
|
42 | -$moduleTVs = array (); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties |
|
36 | +$moduleChunks = array(); // chunks - array : name, description, type - 0:file or 1:content, file or content |
|
37 | +$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content |
|
38 | +$moduleSnippets = array(); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties |
|
39 | +$modulePlugins = array(); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid |
|
40 | +$moduleModules = array(); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid |
|
41 | +$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content,properties |
|
42 | +$moduleTVs = array(); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties |
|
43 | 43 | $moduleDependencies = array(); // module depedencies - array : module, table, column, type, name |
44 | -$errors= 0; |
|
44 | +$errors = 0; |
|
45 | 45 | |
46 | 46 | |
47 | -$installMode= 0; |
|
47 | +$installMode = 0; |
|
48 | 48 | $installData = 0; |
49 | 49 | $tableprefixauto = base_convert(rand(10, 20), 10, 36).substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), rand(0, 33), 3).'_'; |
50 | 50 | |
51 | 51 | $args = array_slice($argv, 1); |
52 | 52 | |
53 | -if ( empty($args) ){ |
|
53 | +if (empty($args)) { |
|
54 | 54 | echo 'Install Evolution CMS'.PHP_EOL; |
55 | 55 | //$installYes = readline("Type 'y' to continue: "); |
56 | 56 | //if ($installYes != 'y') return; |
57 | 57 | |
58 | 58 | //set param manual |
59 | - $databasehost = readline($_lang['connection_screen_database_host']. ' [localhost] '); |
|
60 | - $databaseloginname = readline($_lang['connection_screen_database_login']. ' '); |
|
61 | - $databaseloginpassword = readline($_lang['connection_screen_database_pass']. ' '); |
|
62 | - $database_name = readline($_lang['connection_screen_database_name']. ' '); |
|
63 | - $tableprefix = readline($_lang['connection_screen_table_prefix']. ' ['.$tableprefixauto.'] '); |
|
64 | - $database_connection_method = readline($_lang['connection_screen_connection_method']. ' [SET CHARACTER SET] '); |
|
65 | - $database_collation = readline($_lang['connection_screen_collation']. ' [utf8_general_ci] '); |
|
66 | - $cmsadmin = readline($_lang['connection_screen_default_admin_login']. ' [admin] '); |
|
67 | - $cmsadminemail = readline($_lang['connection_screen_default_admin_email']. ' '); |
|
68 | - $cmspassword = readline($_lang['connection_screen_default_admin_password']. ' '); |
|
69 | - $managerlanguage = readline('Мanager language:' . ' [en] '); |
|
70 | - $installData = readline('Instal demo-site (y/n):' . ' [n] '); |
|
59 | + $databasehost = readline($_lang['connection_screen_database_host'].' [localhost] '); |
|
60 | + $databaseloginname = readline($_lang['connection_screen_database_login'].' '); |
|
61 | + $databaseloginpassword = readline($_lang['connection_screen_database_pass'].' '); |
|
62 | + $database_name = readline($_lang['connection_screen_database_name'].' '); |
|
63 | + $tableprefix = readline($_lang['connection_screen_table_prefix'].' ['.$tableprefixauto.'] '); |
|
64 | + $database_connection_method = readline($_lang['connection_screen_connection_method'].' [SET CHARACTER SET] '); |
|
65 | + $database_collation = readline($_lang['connection_screen_collation'].' [utf8_general_ci] '); |
|
66 | + $cmsadmin = readline($_lang['connection_screen_default_admin_login'].' [admin] '); |
|
67 | + $cmsadminemail = readline($_lang['connection_screen_default_admin_email'].' '); |
|
68 | + $cmspassword = readline($_lang['connection_screen_default_admin_password'].' '); |
|
69 | + $managerlanguage = readline('Мanager language:'.' [en] '); |
|
70 | + $installData = readline('Instal demo-site (y/n):'.' [n] '); |
|
71 | 71 | |
72 | -}else{ |
|
72 | +} else { |
|
73 | 73 | |
74 | 74 | $cli_variables = []; |
75 | 75 | foreach ($args as $arg) { |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | |
103 | -if ($databasehost == '') { $databasehost= 'localhost'; } |
|
104 | -if ($tableprefix == ''){ $tableprefix = $tableprefixauto; } |
|
103 | +if ($databasehost == '') { $databasehost = 'localhost'; } |
|
104 | +if ($tableprefix == '') { $tableprefix = $tableprefixauto; } |
|
105 | 105 | if ($database_connection_method == '') { $database_connection_method = 'SET CHARACTER SET'; } |
106 | 106 | if ($database_collation == '') { $database_collation = 'utf8_general_ci'; } |
107 | -if ($cmsadmin == ''){ $cmsadmin = 'admin'; } |
|
107 | +if ($cmsadmin == '') { $cmsadmin = 'admin'; } |
|
108 | 108 | if ($managerlanguage == '') { $managerlanguage = 'en'; } |
109 | -if ($installData == 'y') { $installData = 1;} |
|
110 | -if ($mode == 'upgrade') { $installMode = 1;} |
|
109 | +if ($installData == 'y') { $installData = 1; } |
|
110 | +if ($mode == 'upgrade') { $installMode = 1; } |
|
111 | 111 | |
112 | 112 | //добавить обработку языка |
113 | 113 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | ////////////////////////////////////////////////////////////////////////////////////// |
126 | -if( ! function_exists('f_owc')){ |
|
126 | +if (!function_exists('f_owc')) { |
|
127 | 127 | /** |
128 | 128 | * @param $path |
129 | 129 | * @param $data |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | fwrite($hnd, $data); |
137 | 137 | fclose($hnd); |
138 | 138 | |
139 | - if(null !== $mode) chmod($path, $mode); |
|
140 | - }catch(Exception $e){ |
|
139 | + if (null !== $mode) chmod($path, $mode); |
|
140 | + } catch (Exception $e) { |
|
141 | 141 | // Nothing, this is NOT normal |
142 | 142 | unset($e); |
143 | 143 | } |
@@ -147,24 +147,24 @@ discard block |
||
147 | 147 | // check PHP version |
148 | 148 | define('PHP_MIN_VERSION', '5.4.0'); |
149 | 149 | $phpMinVersion = PHP_MIN_VERSION; // Maybe not necessary. For backward compatibility |
150 | -echo PHP_EOL . $_lang['checking_php_version']; |
|
150 | +echo PHP_EOL.$_lang['checking_php_version']; |
|
151 | 151 | // -1 if left is less, 0 if equal, +1 if left is higher |
152 | 152 | if (version_compare(phpversion(), PHP_MIN_VERSION) < 0) { |
153 | 153 | $errors++; |
154 | - $tmp = $_lang['you_running_php'] . phpversion() . str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
155 | - echo $_lang['failed'] . ' ' . $tmp . PHP_EOL; |
|
154 | + $tmp = $_lang['you_running_php'].phpversion().str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
155 | + echo $_lang['failed'].' '.$tmp.PHP_EOL; |
|
156 | 156 | } else { |
157 | - echo $_lang['ok'] . PHP_EOL; |
|
157 | + echo $_lang['ok'].PHP_EOL; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | // check directories |
161 | 161 | // cache exists? |
162 | 162 | echo strip_tags($_lang['checking_if_cache_exist']); |
163 | 163 | if (!file_exists($path."../assets/cache") || !file_exists($path."../assets/cache/rss")) { |
164 | - echo $_lang['failed'] . PHP_EOL; |
|
164 | + echo $_lang['failed'].PHP_EOL; |
|
165 | 165 | $errors++; |
166 | 166 | } else { |
167 | - echo $_lang['ok'] . PHP_EOL; |
|
167 | + echo $_lang['ok'].PHP_EOL; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | |
@@ -172,82 +172,82 @@ discard block |
||
172 | 172 | echo strip_tags($_lang['checking_if_cache_writable']); |
173 | 173 | if (!is_writable($path."../assets/cache")) { |
174 | 174 | $errors++; |
175 | - echo $_lang['failed'] . PHP_EOL; |
|
175 | + echo $_lang['failed'].PHP_EOL; |
|
176 | 176 | } else { |
177 | - echo $_lang['ok'] . PHP_EOL; |
|
177 | + echo $_lang['ok'].PHP_EOL; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
181 | 181 | // cache files writable? |
182 | 182 | echo strip_tags($_lang['checking_if_cache_file_writable']); |
183 | 183 | $tmp = $path."../assets/cache/siteCache.idx.php"; |
184 | -if ( ! file_exists($tmp)) { |
|
184 | +if (!file_exists($tmp)) { |
|
185 | 185 | f_owc($tmp, "<?php //EVO site cache file ?>"); |
186 | 186 | } |
187 | -if ( ! is_writable($tmp)) { |
|
187 | +if (!is_writable($tmp)) { |
|
188 | 188 | $errors++; |
189 | - echo $_lang['failed'] . PHP_EOL; |
|
189 | + echo $_lang['failed'].PHP_EOL; |
|
190 | 190 | } else { |
191 | - echo $_lang['ok'] . PHP_EOL; |
|
191 | + echo $_lang['ok'].PHP_EOL; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | |
195 | 195 | echo strip_tags($_lang['checking_if_cache_file2_writable']); |
196 | -if ( ! is_writable($path."../assets/cache/sitePublishing.idx.php")) { |
|
196 | +if (!is_writable($path."../assets/cache/sitePublishing.idx.php")) { |
|
197 | 197 | $errors++; |
198 | - echo $_lang['failed'] . PHP_EOL; |
|
198 | + echo $_lang['failed'].PHP_EOL; |
|
199 | 199 | } else { |
200 | - echo $_lang['ok'] . PHP_EOL; |
|
200 | + echo $_lang['ok'].PHP_EOL; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
204 | 204 | // File Browser directories exists? |
205 | 205 | echo strip_tags($_lang['checking_if_images_exist']); |
206 | -switch(true){ |
|
206 | +switch (true) { |
|
207 | 207 | case !file_exists($path."../assets/images"): |
208 | 208 | case !file_exists($path."../assets/files"): |
209 | 209 | case !file_exists($path."../assets/backup"): |
210 | 210 | //case !file_exists("../assets/.thumbs"): |
211 | 211 | $errors++; |
212 | - echo $_lang['failed'] . PHP_EOL; |
|
212 | + echo $_lang['failed'].PHP_EOL; |
|
213 | 213 | break; |
214 | 214 | default: |
215 | - echo $_lang['ok'] . PHP_EOL; |
|
215 | + echo $_lang['ok'].PHP_EOL; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
219 | 219 | // File Browser directories writable? |
220 | 220 | echo strip_tags($_lang['checking_if_images_writable']); |
221 | -switch(true){ |
|
221 | +switch (true) { |
|
222 | 222 | case !is_writable($path."../assets/images"): |
223 | 223 | case !is_writable($path."../assets/files"): |
224 | 224 | case !is_writable($path."../assets/backup"): |
225 | 225 | //case !is_writable("../assets/.thumbs"): |
226 | 226 | $errors++; |
227 | - echo $_lang['failed'] . PHP_EOL; |
|
227 | + echo $_lang['failed'].PHP_EOL; |
|
228 | 228 | break; |
229 | 229 | default: |
230 | - echo $_lang['ok'] . PHP_EOL; |
|
230 | + echo $_lang['ok'].PHP_EOL; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | |
234 | 234 | // export exists? |
235 | 235 | echo strip_tags($_lang['checking_if_export_exists']); |
236 | 236 | if (!file_exists($path."../assets/export")) { |
237 | - echo $_lang['failed'] . PHP_EOL; |
|
237 | + echo $_lang['failed'].PHP_EOL; |
|
238 | 238 | $errors++; |
239 | 239 | } else { |
240 | - echo $_lang['ok'] . PHP_EOL; |
|
240 | + echo $_lang['ok'].PHP_EOL; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
244 | 244 | // export writable? |
245 | 245 | echo strip_tags($_lang['checking_if_export_writable']); |
246 | 246 | if (!is_writable($path."../assets/export")) { |
247 | - echo $_lang['failed'] . PHP_EOL; |
|
247 | + echo $_lang['failed'].PHP_EOL; |
|
248 | 248 | $errors++; |
249 | 249 | } else { |
250 | - echo $_lang['ok'] . PHP_EOL; |
|
250 | + echo $_lang['ok'].PHP_EOL; |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | $isWriteable = is_writable($tmp); |
263 | 263 | if (!$isWriteable) { |
264 | 264 | $errors++; |
265 | - echo $_lang['failed'] . PHP_EOL; |
|
265 | + echo $_lang['failed'].PHP_EOL; |
|
266 | 266 | } else { |
267 | - echo $_lang['ok'] . PHP_EOL; |
|
267 | + echo $_lang['ok'].PHP_EOL; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1); |
281 | 281 | $database_connection_charset = $database_collation; |
282 | 282 | $database_connection_method = $database_connection_method; |
283 | - $dbase = '`' . $database_name . '`'; |
|
283 | + $dbase = '`'.$database_name.'`'; |
|
284 | 284 | $table_prefix = $tableprefix; |
285 | 285 | } |
286 | 286 | echo $_lang['creating_database_connection']; |
@@ -320,33 +320,33 @@ discard block |
||
320 | 320 | |
321 | 321 | // check table prefix |
322 | 322 | if ($conn && $installMode == 0) { |
323 | - echo $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
324 | - if ($rs= mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
325 | - echo $_lang['failed'] . ' ' . $_lang['table_prefix_already_inuse_note'] . PHP_EOL; |
|
323 | + echo $_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
324 | + if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
325 | + echo $_lang['failed'].' '.$_lang['table_prefix_already_inuse_note'].PHP_EOL; |
|
326 | 326 | $errors++; |
327 | 327 | |
328 | 328 | } else { |
329 | - echo $_lang['ok'] . PHP_EOL; |
|
329 | + echo $_lang['ok'].PHP_EOL; |
|
330 | 330 | } |
331 | 331 | } elseif ($conn && $installMode == 2) { |
332 | - echo $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
333 | - if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
334 | - echo $_lang['failed'] . ' ' . $_lang['table_prefix_not_exist'] . PHP_EOL; |
|
332 | + echo $_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
333 | + if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
334 | + echo $_lang['failed'].' '.$_lang['table_prefix_not_exist'].PHP_EOL; |
|
335 | 335 | $errors++; |
336 | 336 | |
337 | 337 | } else { |
338 | - echo $_lang['ok'] . PHP_EOL; |
|
338 | + echo $_lang['ok'].PHP_EOL; |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | |
342 | 342 | // check mysql version |
343 | 343 | if ($conn) { |
344 | 344 | echo $_lang['checking_mysql_version']; |
345 | - if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) { |
|
346 | - echo $_lang['warning'] . ' ' . $_lang['mysql_5051'] . PHP_EOL; |
|
347 | - echo $_lang['mysql_5051_warning'] . PHP_EOL; |
|
345 | + if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) { |
|
346 | + echo $_lang['warning'].' '.$_lang['mysql_5051'].PHP_EOL; |
|
347 | + echo $_lang['mysql_5051_warning'].PHP_EOL; |
|
348 | 348 | } else { |
349 | - echo $_lang['ok'] . ' ' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . PHP_EOL; |
|
349 | + echo $_lang['ok'].' '.$_lang['mysql_version_is'].mysqli_get_server_info($conn).PHP_EOL; |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
@@ -354,20 +354,20 @@ discard block |
||
354 | 354 | if ($conn) { |
355 | 355 | echo $_lang['checking_mysql_strict_mode']; |
356 | 356 | $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode"); |
357 | - if (mysqli_num_rows($mysqlmode) > 0){ |
|
357 | + if (mysqli_num_rows($mysqlmode) > 0) { |
|
358 | 358 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
359 | 359 | //$modes = array("STRICT_TRANS_TABLES"); // for testing |
360 | 360 | // print_r($modes); |
361 | 361 | foreach ($modes as $mode) { |
362 | 362 | if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) { |
363 | - echo $_lang['warning'] . ' ' . $_lang['strict_mode'] . PHP_EOL; |
|
364 | - echo $_lang['strict_mode_error'] . PHP_EOL; |
|
363 | + echo $_lang['warning'].' '.$_lang['strict_mode'].PHP_EOL; |
|
364 | + echo $_lang['strict_mode_error'].PHP_EOL; |
|
365 | 365 | } else { |
366 | - echo $_lang['ok'] . PHP_EOL; |
|
366 | + echo $_lang['ok'].PHP_EOL; |
|
367 | 367 | } |
368 | 368 | } |
369 | 369 | } else { |
370 | - echo $_lang['ok'] . PHP_EOL; |
|
370 | + echo $_lang['ok'].PHP_EOL; |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | // Version and strict mode check end |
@@ -383,17 +383,17 @@ discard block |
||
383 | 383 | f_owc($path."../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>'); |
384 | 384 | } |
385 | 385 | |
386 | -if($installMode > 0 && $_POST['installdata'] == "1") { |
|
387 | - echo $_lang['sample_web_site'] . ': ' . $_lang['sample_web_site_note'] . PHP_EOL; |
|
386 | +if ($installMode > 0 && $_POST['installdata'] == "1") { |
|
387 | + echo $_lang['sample_web_site'].': '.$_lang['sample_web_site_note'].PHP_EOL; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | if ($errors > 0) { |
391 | - echo $_lang['setup_cannot_continue'] . ' '; |
|
391 | + echo $_lang['setup_cannot_continue'].' '; |
|
392 | 392 | |
393 | - if($errors > 1){ |
|
394 | - echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural']; |
|
395 | - }else{ |
|
396 | - echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']. PHP_EOL; |
|
393 | + if ($errors > 1) { |
|
394 | + echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural']; |
|
395 | + } else { |
|
396 | + echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again'].PHP_EOL; |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | die(); |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
423 | 423 | $database_connection_charset = $database_charset; |
424 | 424 | $database_connection_method = $database_connection_method; |
425 | - $dbase = "`" .$database_name. "`"; |
|
425 | + $dbase = "`".$database_name."`"; |
|
426 | 426 | $table_prefix = $tableprefix; |
427 | 427 | $adminname = $cmsadmin; |
428 | 428 | $adminemail = $cmsadminemail; |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | |
434 | 434 | // set session name variable |
435 | 435 | if (!isset ($site_sessionname)) { |
436 | - $site_sessionname = 'SN' . uniqid(''); |
|
436 | + $site_sessionname = 'SN'.uniqid(''); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | // get base path and url |
@@ -447,8 +447,8 @@ discard block |
||
447 | 447 | array_pop($a); |
448 | 448 | $pth = implode("install", $a); |
449 | 449 | unset ($a); |
450 | -$base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
|
451 | -$base_path = $pth . (substr($pth, -1) != "/" ? "/" : ""); |
|
450 | +$base_url = $url.(substr($url, -1) != "/" ? "/" : ""); |
|
451 | +$base_path = $pth.(substr($pth, -1) != "/" ? "/" : ""); |
|
452 | 452 | |
453 | 453 | // connect to the database |
454 | 454 | echo $_lang['setup_database_create_connection'].': '; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | } |
461 | 461 | |
462 | 462 | // select database |
463 | -echo $_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: "; |
|
463 | +echo $_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: "; |
|
464 | 464 | if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) { |
465 | 465 | echo $_lang['setup_database_selection_failed']." ".$_lang['setup_database_selection_failed_note'].PHP_EOL; |
466 | 466 | $create = true; |
@@ -472,16 +472,16 @@ discard block |
||
472 | 472 | |
473 | 473 | // try to create the database |
474 | 474 | if ($create) { |
475 | - echo $_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: "; |
|
475 | + echo $_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: "; |
|
476 | 476 | // if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) { |
477 | - if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
477 | + if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
478 | 478 | echo $_lang['setup_database_creation_failed']." ".$_lang['setup_database_creation_failed_note'].PHP_EOL; |
479 | 479 | $errors += 1; |
480 | 480 | |
481 | - echo 'database charset: ' . $database_charset . PHP_EOL; |
|
482 | - echo 'database collation: ' . $database_collation . PHP_EOL; |
|
481 | + echo 'database charset: '.$database_charset.PHP_EOL; |
|
482 | + echo 'database collation: '.$database_collation.PHP_EOL; |
|
483 | 483 | |
484 | - echo $_lang['setup_database_creation_failed_note2'] . PHP_EOL; |
|
484 | + echo $_lang['setup_database_creation_failed_note2'].PHP_EOL; |
|
485 | 485 | |
486 | 486 | die(); |
487 | 487 | |
@@ -492,18 +492,18 @@ discard block |
||
492 | 492 | |
493 | 493 | // check table prefix |
494 | 494 | if ($installMode == 0) { |
495 | - echo $_lang['checking_table_prefix'] . $table_prefix . "`: "; |
|
496 | - if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
497 | - echo $_lang['failed'] . " " . $_lang['table_prefix_already_inuse'] . PHP_EOL; |
|
495 | + echo $_lang['checking_table_prefix'].$table_prefix."`: "; |
|
496 | + if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
497 | + echo $_lang['failed']." ".$_lang['table_prefix_already_inuse'].PHP_EOL; |
|
498 | 498 | $errors += 1; |
499 | - echo $_lang['table_prefix_already_inuse_note'] . PHP_EOL; |
|
499 | + echo $_lang['table_prefix_already_inuse_note'].PHP_EOL; |
|
500 | 500 | return; |
501 | 501 | } else { |
502 | 502 | echo $_lang['ok'].PHP_EOL; |
503 | 503 | } |
504 | 504 | } |
505 | 505 | |
506 | -if(!function_exists('parseProperties')) { |
|
506 | +if (!function_exists('parseProperties')) { |
|
507 | 507 | /** |
508 | 508 | * parses a resource property string and returns the result as an array |
509 | 509 | * duplicate of method in documentParser class |
@@ -511,20 +511,20 @@ discard block |
||
511 | 511 | * @param string $propertyString |
512 | 512 | * @return array |
513 | 513 | */ |
514 | - function parseProperties($propertyString) { |
|
515 | - $parameter= array (); |
|
514 | + function parseProperties($propertyString){ |
|
515 | + $parameter = array(); |
|
516 | 516 | if (!empty ($propertyString)) { |
517 | - $tmpParams= explode("&", $propertyString); |
|
517 | + $tmpParams = explode("&", $propertyString); |
|
518 | 518 | $countParams = count($tmpParams); |
519 | - for ($x= 0; $x < $countParams; $x++) { |
|
519 | + for ($x = 0; $x < $countParams; $x++) { |
|
520 | 520 | if (strpos($tmpParams[$x], '=', 0)) { |
521 | - $pTmp= explode("=", $tmpParams[$x]); |
|
522 | - $pvTmp= explode(";", trim($pTmp[1])); |
|
521 | + $pTmp = explode("=", $tmpParams[$x]); |
|
522 | + $pvTmp = explode(";", trim($pTmp[1])); |
|
523 | 523 | if ($pvTmp[1] == 'list' && $pvTmp[3] != "") |
524 | - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default |
|
524 | + $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default |
|
525 | 525 | else |
526 | 526 | if ($pvTmp[1] != 'list' && $pvTmp[2] != "") |
527 | - $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
527 | + $parameter[trim($pTmp[0])] = $pvTmp[2]; |
|
528 | 528 | } |
529 | 529 | } |
530 | 530 | } |
@@ -535,20 +535,20 @@ discard block |
||
535 | 535 | // check status of Inherit Parent Template plugin |
536 | 536 | $auto_template_logic = 'parent'; |
537 | 537 | if ($installMode != 0) { |
538 | - $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'"); |
|
538 | + $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'"); |
|
539 | 539 | $row = mysqli_fetch_row($rs); |
540 | - if(!$row) { |
|
540 | + if (!$row) { |
|
541 | 541 | // not installed |
542 | 542 | $auto_template_logic = 'system'; |
543 | 543 | } else { |
544 | - if($row[1] == 1) { |
|
544 | + if ($row[1] == 1) { |
|
545 | 545 | // installed but disabled |
546 | 546 | $auto_template_logic = 'system'; |
547 | 547 | } else { |
548 | 548 | // installed, enabled .. see how it's configured |
549 | 549 | $properties = parseProperties($row[0]); |
550 | - if(isset($properties['inheritTemplate'])) { |
|
551 | - if($properties['inheritTemplate'] == 'From First Sibling') { |
|
550 | + if (isset($properties['inheritTemplate'])) { |
|
551 | + if ($properties['inheritTemplate'] == 'From First Sibling') { |
|
552 | 552 | $auto_template_logic = 'sibling'; |
553 | 553 | } |
554 | 554 | } |
@@ -570,17 +570,16 @@ discard block |
||
570 | 570 | |
571 | 571 | // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category |
572 | 572 | $mt = &$moduleTemplates; |
573 | -if(is_dir($templatePath) && is_readable($templatePath)) { |
|
573 | +if (is_dir($templatePath) && is_readable($templatePath)) { |
|
574 | 574 | $d = dir($templatePath); |
575 | 575 | while (false !== ($tplfile = $d->read())) |
576 | 576 | { |
577 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
577 | + if (substr($tplfile, -4) != '.tpl') continue; |
|
578 | 578 | $params = parse_docblock($templatePath, $tplfile); |
579 | - if(is_array($params) && (count($params)>0)) |
|
579 | + if (is_array($params) && (count($params) > 0)) |
|
580 | 580 | { |
581 | 581 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
582 | - $mt[] = array |
|
583 | - ( |
|
582 | + $mt[] = array( |
|
584 | 583 | $params['name'], |
585 | 584 | $description, |
586 | 585 | // Don't think this is gonna be used ... but adding it just in case 'type' |
@@ -598,12 +597,12 @@ discard block |
||
598 | 597 | |
599 | 598 | // setup Template Variable template files |
600 | 599 | $mtv = &$moduleTVs; |
601 | -if(is_dir($tvPath) && is_readable($tvPath)) { |
|
600 | +if (is_dir($tvPath) && is_readable($tvPath)) { |
|
602 | 601 | $d = dir($tvPath); |
603 | 602 | while (false !== ($tplfile = $d->read())) { |
604 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
603 | + if (substr($tplfile, -4) != '.tpl') continue; |
|
605 | 604 | $params = parse_docblock($tvPath, $tplfile); |
606 | - if(is_array($params) && (count($params)>0)) { |
|
605 | + if (is_array($params) && (count($params) > 0)) { |
|
607 | 606 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
608 | 607 | $mtv[] = array( |
609 | 608 | $params['name'], |
@@ -615,9 +614,9 @@ discard block |
||
615 | 614 | $params['output_widget'], |
616 | 615 | $params['output_widget_params'], |
617 | 616 | "$templatePath/{$params['filename']}", /* not currently used */ |
618 | - $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */ |
|
617 | + $params['template_assignments'] != "*" ? $params['template_assignments'] : implode(",", array_map(create_function('$v', 'return $v[0];'), $mt)), /* comma-separated list of template names */ |
|
619 | 618 | $params['modx_category'], |
620 | - $params['lock_tv'], /* value should be 1 or 0 */ |
|
619 | + $params['lock_tv'], /* value should be 1 or 0 */ |
|
621 | 620 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
622 | 621 | ); |
623 | 622 | } |
@@ -627,14 +626,14 @@ discard block |
||
627 | 626 | |
628 | 627 | // setup chunks template files - array : name, description, type - 0:file or 1:content, file or content |
629 | 628 | $mc = &$moduleChunks; |
630 | -if(is_dir($chunkPath) && is_readable($chunkPath)) { |
|
629 | +if (is_dir($chunkPath) && is_readable($chunkPath)) { |
|
631 | 630 | $d = dir($chunkPath); |
632 | 631 | while (false !== ($tplfile = $d->read())) { |
633 | - if(substr($tplfile, -4) != '.tpl') { |
|
632 | + if (substr($tplfile, -4) != '.tpl') { |
|
634 | 633 | continue; |
635 | 634 | } |
636 | 635 | $params = parse_docblock($chunkPath, $tplfile); |
637 | - if(is_array($params) && count($params) > 0) { |
|
636 | + if (is_array($params) && count($params) > 0) { |
|
638 | 637 | $mc[] = array( |
639 | 638 | $params['name'], |
640 | 639 | $params['description'], |
@@ -650,14 +649,14 @@ discard block |
||
650 | 649 | |
651 | 650 | // setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties |
652 | 651 | $ms = &$moduleSnippets; |
653 | -if(is_dir($snippetPath) && is_readable($snippetPath)) { |
|
652 | +if (is_dir($snippetPath) && is_readable($snippetPath)) { |
|
654 | 653 | $d = dir($snippetPath); |
655 | 654 | while (false !== ($tplfile = $d->read())) { |
656 | - if(substr($tplfile, -4) != '.tpl') { |
|
655 | + if (substr($tplfile, -4) != '.tpl') { |
|
657 | 656 | continue; |
658 | 657 | } |
659 | 658 | $params = parse_docblock($snippetPath, $tplfile); |
660 | - if(is_array($params) && count($params) > 0) { |
|
659 | + if (is_array($params) && count($params) > 0) { |
|
661 | 660 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
662 | 661 | $ms[] = array( |
663 | 662 | $params['name'], |
@@ -674,14 +673,14 @@ discard block |
||
674 | 673 | |
675 | 674 | // setup plugins template files - array : name, description, type - 0:file or 1:content, file or content,properties |
676 | 675 | $mp = &$modulePlugins; |
677 | -if(is_dir($pluginPath) && is_readable($pluginPath)) { |
|
676 | +if (is_dir($pluginPath) && is_readable($pluginPath)) { |
|
678 | 677 | $d = dir($pluginPath); |
679 | 678 | while (false !== ($tplfile = $d->read())) { |
680 | - if(substr($tplfile, -4) != '.tpl') { |
|
679 | + if (substr($tplfile, -4) != '.tpl') { |
|
681 | 680 | continue; |
682 | 681 | } |
683 | 682 | $params = parse_docblock($pluginPath, $tplfile); |
684 | - if(is_array($params) && count($params) > 0) { |
|
683 | + if (is_array($params) && count($params) > 0) { |
|
685 | 684 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
686 | 685 | $mp[] = array( |
687 | 686 | $params['name'], |
@@ -693,7 +692,7 @@ discard block |
||
693 | 692 | $params['modx_category'], |
694 | 693 | $params['legacy_names'], |
695 | 694 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false, |
696 | - (int)$params['disabled'] |
|
695 | + (int) $params['disabled'] |
|
697 | 696 | ); |
698 | 697 | } |
699 | 698 | } |
@@ -703,14 +702,14 @@ discard block |
||
703 | 702 | // setup modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid,enable_sharedparams |
704 | 703 | $mm = &$moduleModules; |
705 | 704 | $mdp = &$moduleDependencies; |
706 | -if(is_dir($modulePath) && is_readable($modulePath)) { |
|
705 | +if (is_dir($modulePath) && is_readable($modulePath)) { |
|
707 | 706 | $d = dir($modulePath); |
708 | 707 | while (false !== ($tplfile = $d->read())) { |
709 | - if(substr($tplfile, -4) != '.tpl') { |
|
708 | + if (substr($tplfile, -4) != '.tpl') { |
|
710 | 709 | continue; |
711 | 710 | } |
712 | 711 | $params = parse_docblock($modulePath, $tplfile); |
713 | - if(is_array($params) && count($params) > 0) { |
|
712 | + if (is_array($params) && count($params) > 0) { |
|
714 | 713 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
715 | 714 | $mm[] = array( |
716 | 715 | $params['name'], |
@@ -718,12 +717,12 @@ discard block |
||
718 | 717 | "$modulePath/{$params['filename']}", |
719 | 718 | $params['properties'], |
720 | 719 | $params['guid'], |
721 | - (int)$params['shareparams'], |
|
720 | + (int) $params['shareparams'], |
|
722 | 721 | $params['modx_category'], |
723 | 722 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
724 | 723 | ); |
725 | 724 | } |
726 | - if ((int)$params['shareparams'] || !empty($params['dependencies'])) { |
|
725 | + if ((int) $params['shareparams'] || !empty($params['dependencies'])) { |
|
727 | 726 | $dependencies = explode(',', $params['dependencies']); |
728 | 727 | foreach ($dependencies as $dependency) { |
729 | 728 | $dependency = explode(':', $dependency); |
@@ -794,103 +793,103 @@ discard block |
||
794 | 793 | // setup callback function |
795 | 794 | $callBackFnc = "clean_up"; |
796 | 795 | |
797 | -function clean_up($sqlParser) { |
|
796 | +function clean_up($sqlParser){ |
|
798 | 797 | $ids = array(); |
799 | 798 | |
800 | 799 | // secure web documents - privateweb |
801 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
802 | - $sql = "SELECT DISTINCT sc.id |
|
800 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
801 | + $sql = "SELECT DISTINCT sc.id |
|
803 | 802 | FROM `".$sqlParser->prefix."site_content` sc |
804 | 803 | LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
805 | 804 | LEFT JOIN `".$sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group |
806 | 805 | WHERE wga.id>0"; |
807 | - $ds = mysqli_query($sqlParser->conn,$sql); |
|
808 | - if(!$ds) { |
|
806 | + $ds = mysqli_query($sqlParser->conn, $sql); |
|
807 | + if (!$ds) { |
|
809 | 808 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
810 | 809 | } |
811 | 810 | else { |
812 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
813 | - if(count($ids)>0) { |
|
814 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")"); |
|
811 | + while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"]; |
|
812 | + if (count($ids) > 0) { |
|
813 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ", $ids).")"); |
|
815 | 814 | unset($ids); |
816 | 815 | } |
817 | 816 | } |
818 | 817 | |
819 | 818 | // secure manager documents privatemgr |
820 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
821 | - $sql = "SELECT DISTINCT sc.id |
|
819 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
820 | + $sql = "SELECT DISTINCT sc.id |
|
822 | 821 | FROM `".$sqlParser->prefix."site_content` sc |
823 | 822 | LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
824 | 823 | LEFT JOIN `".$sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group |
825 | 824 | WHERE mga.id>0"; |
826 | - $ds = mysqli_query($sqlParser->conn,$sql); |
|
827 | - if(!$ds) { |
|
825 | + $ds = mysqli_query($sqlParser->conn, $sql); |
|
826 | + if (!$ds) { |
|
828 | 827 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
829 | 828 | } |
830 | 829 | else { |
831 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
832 | - if(count($ids)>0) { |
|
833 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")"); |
|
830 | + while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"]; |
|
831 | + if (count($ids) > 0) { |
|
832 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ", $ids).")"); |
|
834 | 833 | unset($ids); |
835 | 834 | } |
836 | 835 | } |
837 | 836 | } |
838 | 837 | |
839 | -function parse_docblock($element_dir, $filename) { |
|
838 | +function parse_docblock($element_dir, $filename){ |
|
840 | 839 | $params = array(); |
841 | - $fullpath = $element_dir . '/' . $filename; |
|
842 | - if(is_readable($fullpath)) { |
|
840 | + $fullpath = $element_dir.'/'.$filename; |
|
841 | + if (is_readable($fullpath)) { |
|
843 | 842 | $tpl = @fopen($fullpath, "r"); |
844 | - if($tpl) { |
|
843 | + if ($tpl) { |
|
845 | 844 | $params['filename'] = $filename; |
846 | 845 | $docblock_start_found = false; |
847 | 846 | $name_found = false; |
848 | 847 | $description_found = false; |
849 | 848 | |
850 | - while(!feof($tpl)) { |
|
849 | + while (!feof($tpl)) { |
|
851 | 850 | $line = fgets($tpl); |
852 | - if(!$docblock_start_found) { |
|
851 | + if (!$docblock_start_found) { |
|
853 | 852 | // find docblock start |
854 | - if(strpos($line, '/**') !== false) { |
|
853 | + if (strpos($line, '/**') !== false) { |
|
855 | 854 | $docblock_start_found = true; |
856 | 855 | } |
857 | 856 | continue; |
858 | - } elseif(!$name_found) { |
|
857 | + } elseif (!$name_found) { |
|
859 | 858 | // find name |
860 | 859 | $ma = null; |
861 | - if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
860 | + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
862 | 861 | $params['name'] = trim($ma[1]); |
863 | 862 | $name_found = !empty($params['name']); |
864 | 863 | } |
865 | 864 | continue; |
866 | - } elseif(!$description_found) { |
|
865 | + } elseif (!$description_found) { |
|
867 | 866 | // find description |
868 | 867 | $ma = null; |
869 | - if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
868 | + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
870 | 869 | $params['description'] = trim($ma[1]); |
871 | 870 | $description_found = !empty($params['description']); |
872 | 871 | } |
873 | 872 | continue; |
874 | 873 | } else { |
875 | 874 | $ma = null; |
876 | - if(preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { |
|
875 | + if (preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { |
|
877 | 876 | $param = trim($ma[1]); |
878 | 877 | $val = trim($ma[2]); |
879 | - if(!empty($param) && !empty($val)) { |
|
880 | - if($param == 'internal') { |
|
878 | + if (!empty($param) && !empty($val)) { |
|
879 | + if ($param == 'internal') { |
|
881 | 880 | $ma = null; |
882 | - if(preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { |
|
881 | + if (preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { |
|
883 | 882 | $param = trim($ma[1]); |
884 | 883 | $val = trim($ma[2]); |
885 | 884 | } |
886 | 885 | //if($val !== '0' && (empty($param) || empty($val))) { |
887 | - if(empty($param)) { |
|
886 | + if (empty($param)) { |
|
888 | 887 | continue; |
889 | 888 | } |
890 | 889 | } |
891 | 890 | $params[$param] = $val; |
892 | 891 | } |
893 | - } elseif(preg_match("/^\s*\*\/\s*$/", $line)) { |
|
892 | + } elseif (preg_match("/^\s*\*\/\s*$/", $line)) { |
|
894 | 893 | break; |
895 | 894 | } |
896 | 895 | } |
@@ -921,13 +920,13 @@ discard block |
||
921 | 920 | // display database results |
922 | 921 | if ($sqlParser->installFailed == true) { |
923 | 922 | $errors += 1; |
924 | - echo $_lang['database_alerts'] . PHP_EOL; |
|
925 | - echo $_lang['setup_couldnt_install'] . PHP_EOL; |
|
926 | - echo $_lang['installation_error_occured'] . PHP_EOL; |
|
923 | + echo $_lang['database_alerts'].PHP_EOL; |
|
924 | + echo $_lang['setup_couldnt_install'].PHP_EOL; |
|
925 | + echo $_lang['installation_error_occured'].PHP_EOL; |
|
927 | 926 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
928 | - echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL; |
|
927 | + echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL; |
|
929 | 928 | } |
930 | - echo $_lang['some_tables_not_updated'] . PHP_EOL; |
|
929 | + echo $_lang['some_tables_not_updated'].PHP_EOL; |
|
931 | 930 | die(); |
932 | 931 | } else { |
933 | 932 | echo $_lang['ok'].PHP_EOL; |
@@ -937,7 +936,7 @@ discard block |
||
937 | 936 | // custom or not |
938 | 937 | if (file_exists($path."../assets/cache/siteManager.php")) { |
939 | 938 | $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");'; |
940 | -}else{ |
|
939 | +} else { |
|
941 | 940 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
942 | 941 | } |
943 | 942 | |
@@ -974,16 +973,16 @@ discard block |
||
974 | 973 | $chmodSuccess = @chmod($filename, 0404); |
975 | 974 | |
976 | 975 | if ($configFileFailed == true) { |
977 | - echo $_lang['failed'] . PHP_EOL; |
|
976 | + echo $_lang['failed'].PHP_EOL; |
|
978 | 977 | $errors += 1; |
979 | 978 | |
980 | - echo $_lang['cant_write_config_file'] . ' ' . MGR_DIR .'/includes/config.inc.php' .PHP_EOL; |
|
979 | + echo $_lang['cant_write_config_file'].' '.MGR_DIR.'/includes/config.inc.php'.PHP_EOL; |
|
981 | 980 | echo ' '.PHP_EOL; |
982 | 981 | echo ' '.PHP_EOL; |
983 | 982 | echo $configString; |
984 | 983 | echo ' '.PHP_EOL; |
985 | 984 | echo ' '.PHP_EOL; |
986 | - echo $_lang['cant_write_config_file_note'] . PHP_EOL; |
|
985 | + echo $_lang['cant_write_config_file_note'].PHP_EOL; |
|
987 | 986 | die(); |
988 | 987 | |
989 | 988 | } else { |
@@ -993,16 +992,16 @@ discard block |
||
993 | 992 | // generate new site_id and set manager theme to default |
994 | 993 | if ($installMode == 0) { |
995 | 994 | $siteid = uniqid(''); |
996 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
995 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
997 | 996 | } else { |
998 | 997 | // update site_id if missing |
999 | - $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"); |
|
998 | + $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'"); |
|
1000 | 999 | if ($ds) { |
1001 | 1000 | $r = mysqli_fetch_assoc($ds); |
1002 | 1001 | $siteid = $r['setting_value']; |
1003 | 1002 | if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') { |
1004 | 1003 | $siteid = uniqid(''); |
1005 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
1004 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
1006 | 1005 | } |
1007 | 1006 | } |
1008 | 1007 | } |
@@ -1014,29 +1013,29 @@ discard block |
||
1014 | 1013 | // display database results |
1015 | 1014 | if ($sqlParser->installFailed == true) { |
1016 | 1015 | $errors += 1; |
1017 | - echo $_lang['database_alerts'] . PHP_EOL; |
|
1018 | - echo $_lang['setup_couldnt_install'] . PHP_EOL; |
|
1019 | - echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL; |
|
1016 | + echo $_lang['database_alerts'].PHP_EOL; |
|
1017 | + echo $_lang['setup_couldnt_install'].PHP_EOL; |
|
1018 | + echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL; |
|
1020 | 1019 | /* |
1021 | 1020 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
1022 | 1021 | echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
1023 | 1022 | } |
1024 | 1023 | echo "</p>";*/ |
1025 | - echo $_lang['some_tables_not_updated'] . PHP_EOL; |
|
1024 | + echo $_lang['some_tables_not_updated'].PHP_EOL; |
|
1026 | 1025 | die(); |
1027 | 1026 | } else { |
1028 | - echo $_lang['ok'] . PHP_EOL; |
|
1027 | + echo $_lang['ok'].PHP_EOL; |
|
1029 | 1028 | } |
1030 | 1029 | } |
1031 | 1030 | |
1032 | 1031 | // Install Templates |
1033 | 1032 | $moduleTemplate = $mt; |
1034 | 1033 | if (!empty($moduleTemplate) || $installData) { |
1035 | - echo PHP_EOL . $_lang['templates'] . ":" . PHP_EOL; |
|
1034 | + echo PHP_EOL.$_lang['templates'].":".PHP_EOL; |
|
1036 | 1035 | //$selTemplates = $_POST['template']; |
1037 | 1036 | foreach ($moduleTemplates as $k=>$moduleTemplate) { |
1038 | 1037 | $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1; |
1039 | - if($installSample || is_array($moduleTemplate)) { |
|
1038 | + if ($installSample || is_array($moduleTemplate)) { |
|
1040 | 1039 | $name = mysqli_real_escape_string($conn, $moduleTemplate[0]); |
1041 | 1040 | $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]); |
1042 | 1041 | $category = mysqli_real_escape_string($conn, $moduleTemplate[4]); |
@@ -1044,7 +1043,7 @@ discard block |
||
1044 | 1043 | $filecontent = $moduleTemplate[3]; |
1045 | 1044 | $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site |
1046 | 1045 | if (!file_exists($filecontent)) { |
1047 | - echo " $name: " . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1046 | + echo " $name: ".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1048 | 1047 | } else { |
1049 | 1048 | // Create the category if it does not already exist |
1050 | 1049 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -1054,31 +1053,31 @@ discard block |
||
1054 | 1053 | $template = mysqli_real_escape_string($conn, $template); |
1055 | 1054 | |
1056 | 1055 | // See if the template already exists |
1057 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'"); |
|
1056 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'"); |
|
1058 | 1057 | |
1059 | 1058 | if (mysqli_num_rows($rs)) { |
1060 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;")) { |
|
1059 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;")) { |
|
1061 | 1060 | $errors += 1; |
1062 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1061 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1063 | 1062 | return; |
1064 | 1063 | } |
1065 | - if(!is_null($save_sql_id_as)) { |
|
1064 | + if (!is_null($save_sql_id_as)) { |
|
1066 | 1065 | $sql_id = @mysqli_insert_id($sqlParser->conn); |
1067 | - if(!$sql_id) { |
|
1068 | - $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
1066 | + if (!$sql_id) { |
|
1067 | + $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
1069 | 1068 | $sql_id = $idQuery['id']; |
1070 | 1069 | } |
1071 | 1070 | $custom_placeholders[$save_sql_id_as] = $sql_id; |
1072 | 1071 | } |
1073 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1072 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1074 | 1073 | } else { |
1075 | - if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
1074 | + if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
1076 | 1075 | $errors += 1; |
1077 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1076 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1078 | 1077 | die(); |
1079 | 1078 | } |
1080 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
1081 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1079 | + if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
1080 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1082 | 1081 | } |
1083 | 1082 | } |
1084 | 1083 | } |
@@ -1088,11 +1087,11 @@ discard block |
||
1088 | 1087 | // Install Template Variables |
1089 | 1088 | $moduleTVs = $mtv; |
1090 | 1089 | if (is_array($moduleTVs) || $installData) { |
1091 | - echo PHP_EOL . $_lang['tvs'].': '.PHP_EOL; |
|
1090 | + echo PHP_EOL.$_lang['tvs'].': '.PHP_EOL; |
|
1092 | 1091 | //$selTVs = $_POST['tv']; |
1093 | 1092 | foreach ($moduleTVs as $k=>$moduleTV) { |
1094 | 1093 | $installSample = in_array('sample', $moduleTV[12]) && $installData == 1; |
1095 | - if($installSample || is_array($moduleTVs)) { |
|
1094 | + if ($installSample || is_array($moduleTVs)) { |
|
1096 | 1095 | $name = mysqli_real_escape_string($conn, $moduleTV[0]); |
1097 | 1096 | $caption = mysqli_real_escape_string($conn, $moduleTV[1]); |
1098 | 1097 | $desc = mysqli_real_escape_string($conn, $moduleTV[2]); |
@@ -1110,24 +1109,24 @@ discard block |
||
1110 | 1109 | // Create the category if it does not already exist |
1111 | 1110 | $category = getCreateDbCategory($category, $sqlParser); |
1112 | 1111 | |
1113 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'"); |
|
1112 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'"); |
|
1114 | 1113 | if (mysqli_num_rows($rs)) { |
1115 | 1114 | $insert = true; |
1116 | - while($row = mysqli_fetch_assoc($rs)) { |
|
1117 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) { |
|
1118 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1115 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
1116 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) { |
|
1117 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1119 | 1118 | return; |
1120 | 1119 | } |
1121 | 1120 | $insert = false; |
1122 | 1121 | } |
1123 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1122 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1124 | 1123 | } else { |
1125 | - $q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
|
1124 | + $q = "INSERT INTO $dbase.`".$table_prefix."site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
|
1126 | 1125 | if (!mysqli_query($sqlParser->conn, $q)) { |
1127 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1126 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1128 | 1127 | return; |
1129 | 1128 | } |
1130 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1129 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1131 | 1130 | } |
1132 | 1131 | |
1133 | 1132 | // add template assignments |
@@ -1136,10 +1135,10 @@ discard block |
||
1136 | 1135 | if (count($assignments) > 0) { |
1137 | 1136 | |
1138 | 1137 | // remove existing tv -> template assignments |
1139 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
1138 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
1140 | 1139 | $row = mysqli_fetch_assoc($ds); |
1141 | 1140 | $id = $row["id"]; |
1142 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\''); |
|
1141 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\''); |
|
1143 | 1142 | |
1144 | 1143 | // add tv -> template assignments |
1145 | 1144 | foreach ($assignments as $assignment) { |
@@ -1148,7 +1147,7 @@ discard block |
||
1148 | 1147 | if ($ds && $ts) { |
1149 | 1148 | $tRow = mysqli_fetch_assoc($ts); |
1150 | 1149 | $templateId = $tRow['id']; |
1151 | - mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
1150 | + mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
1152 | 1151 | } |
1153 | 1152 | } |
1154 | 1153 | } |
@@ -1159,12 +1158,12 @@ discard block |
||
1159 | 1158 | |
1160 | 1159 | $moduleChunks = $mc; |
1161 | 1160 | // Install Chunks |
1162 | -if (is_array ($moduleChunks) || $installData) { |
|
1163 | - echo PHP_EOL . $_lang['chunks'] . ": " . PHP_EOL; |
|
1161 | +if (is_array($moduleChunks) || $installData) { |
|
1162 | + echo PHP_EOL.$_lang['chunks'].": ".PHP_EOL; |
|
1164 | 1163 | foreach ($moduleChunks as $k=>$moduleChunk) { |
1165 | 1164 | $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1; |
1166 | 1165 | $count_new_name = 0; |
1167 | - if($installSample || is_array ($moduleChunks)) { |
|
1166 | + if ($installSample || is_array($moduleChunks)) { |
|
1168 | 1167 | |
1169 | 1168 | $name = mysqli_real_escape_string($conn, $moduleChunk[0]); |
1170 | 1169 | $desc = mysqli_real_escape_string($conn, $moduleChunk[1]); |
@@ -1173,7 +1172,7 @@ discard block |
||
1173 | 1172 | $filecontent = $moduleChunk[2]; |
1174 | 1173 | |
1175 | 1174 | if (!file_exists($filecontent)) |
1176 | - echo " $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1175 | + echo " $name: ".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1177 | 1176 | else { |
1178 | 1177 | |
1179 | 1178 | // Create the category if it does not already exist |
@@ -1181,31 +1180,31 @@ discard block |
||
1181 | 1180 | |
1182 | 1181 | $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1); |
1183 | 1182 | $chunk = mysqli_real_escape_string($conn, $chunk); |
1184 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"); |
|
1183 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'"); |
|
1185 | 1184 | $count_original_name = mysqli_num_rows($rs); |
1186 | - if($overwrite == 'false') { |
|
1187 | - $newname = $name . '-' . str_replace('.', '_', $modx_version); |
|
1188 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"); |
|
1185 | + if ($overwrite == 'false') { |
|
1186 | + $newname = $name.'-'.str_replace('.', '_', $modx_version); |
|
1187 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'"); |
|
1189 | 1188 | $count_new_name = mysqli_num_rows($rs); |
1190 | 1189 | } |
1191 | 1190 | $update = $count_original_name > 0 && $overwrite == 'true'; |
1192 | 1191 | if ($update) { |
1193 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
1192 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
1194 | 1193 | $errors += 1; |
1195 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1194 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1196 | 1195 | return; |
1197 | 1196 | } |
1198 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1199 | - } elseif($count_new_name == 0) { |
|
1200 | - if($count_original_name > 0 && $overwrite == 'false') { |
|
1197 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1198 | + } elseif ($count_new_name == 0) { |
|
1199 | + if ($count_original_name > 0 && $overwrite == 'false') { |
|
1201 | 1200 | $name = $newname; |
1202 | 1201 | } |
1203 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
1202 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
1204 | 1203 | $errors += 1; |
1205 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1204 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1206 | 1205 | return; |
1207 | 1206 | } |
1208 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1207 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1209 | 1208 | } |
1210 | 1209 | } |
1211 | 1210 | } |
@@ -1215,11 +1214,11 @@ discard block |
||
1215 | 1214 | // Install Modules |
1216 | 1215 | $moduleModules = $mm; |
1217 | 1216 | if (is_array($moduleModules) || $installData) { |
1218 | - echo PHP_EOL . $_lang['modules'] . ":" . PHP_EOL; |
|
1217 | + echo PHP_EOL.$_lang['modules'].":".PHP_EOL; |
|
1219 | 1218 | //$selModules = $_POST['module']; |
1220 | 1219 | foreach ($moduleModules as $k=>$moduleModule) { |
1221 | 1220 | $installSample = in_array('sample', $moduleModule[7]) && $installData == 1; |
1222 | - if($installSample || is_array($moduleModules)) { |
|
1221 | + if ($installSample || is_array($moduleModules)) { |
|
1223 | 1222 | $name = mysqli_real_escape_string($conn, $moduleModule[0]); |
1224 | 1223 | $desc = mysqli_real_escape_string($conn, $moduleModule[1]); |
1225 | 1224 | $filecontent = $moduleModule[2]; |
@@ -1228,7 +1227,7 @@ discard block |
||
1228 | 1227 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
1229 | 1228 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
1230 | 1229 | if (!file_exists($filecontent)) |
1231 | - echo " $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1230 | + echo " $name: ".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1232 | 1231 | else { |
1233 | 1232 | |
1234 | 1233 | // Create the category if it does not already exist |
@@ -1237,24 +1236,24 @@ discard block |
||
1237 | 1236 | $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
1238 | 1237 | // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab |
1239 | 1238 | $module = mysqli_real_escape_string($conn, $module); |
1240 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'"); |
|
1239 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'"); |
|
1241 | 1240 | if (mysqli_num_rows($rs)) { |
1242 | 1241 | $row = mysqli_fetch_assoc($rs); |
1243 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
1244 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
1245 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1242 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
1243 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
1244 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1246 | 1245 | return; |
1247 | 1246 | } |
1248 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1247 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1249 | 1248 | } else { |
1250 | - if ($properties != NULL ){ |
|
1249 | + if ($properties != NULL) { |
|
1251 | 1250 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
1252 | 1251 | } |
1253 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) { |
|
1254 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
1252 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) { |
|
1253 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
1255 | 1254 | return; |
1256 | 1255 | } |
1257 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1256 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1258 | 1257 | } |
1259 | 1258 | } |
1260 | 1259 | } |
@@ -1264,11 +1263,11 @@ discard block |
||
1264 | 1263 | // Install Plugins |
1265 | 1264 | $modulePlugins = $mp; |
1266 | 1265 | if (is_array($modulePlugins) || $installData) { |
1267 | - echo PHP_EOL . $_lang['plugins'] . ":" . PHP_EOL; |
|
1266 | + echo PHP_EOL.$_lang['plugins'].":".PHP_EOL; |
|
1268 | 1267 | $selPlugs = $_POST['plugin']; |
1269 | 1268 | foreach ($modulePlugins as $k=>$modulePlugin) { |
1270 | 1269 | //$installSample = in_array('sample', $modulePlugin[8]) && $installData == 1; |
1271 | - if($installSample || is_array($modulePlugins)) { |
|
1270 | + if ($installSample || is_array($modulePlugins)) { |
|
1272 | 1271 | $name = mysqli_real_escape_string($conn, $modulePlugin[0]); |
1273 | 1272 | $desc = mysqli_real_escape_string($conn, $modulePlugin[1]); |
1274 | 1273 | $filecontent = $modulePlugin[2]; |
@@ -1278,17 +1277,17 @@ discard block |
||
1278 | 1277 | $category = mysqli_real_escape_string($conn, $modulePlugin[6]); |
1279 | 1278 | $leg_names = ''; |
1280 | 1279 | $disabled = $modulePlugin[9]; |
1281 | - if(array_key_exists(7, $modulePlugin)) { |
|
1280 | + if (array_key_exists(7, $modulePlugin)) { |
|
1282 | 1281 | // parse comma-separated legacy names and prepare them for sql IN clause |
1283 | - $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
|
1282 | + $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'"; |
|
1284 | 1283 | } |
1285 | 1284 | if (!file_exists($filecontent)) |
1286 | - echo " $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1285 | + echo " $name: ".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1287 | 1286 | else { |
1288 | 1287 | |
1289 | 1288 | // disable legacy versions based on legacy_names provided |
1290 | - if(!empty($leg_names)) { |
|
1291 | - $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
1289 | + if (!empty($leg_names)) { |
|
1290 | + $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
1292 | 1291 | $rs = mysqli_query($sqlParser->conn, $update_query); |
1293 | 1292 | } |
1294 | 1293 | |
@@ -1298,52 +1297,52 @@ discard block |
||
1298 | 1297 | $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
1299 | 1298 | $plugin = removeDocblock($plugin, 'plugin'); |
1300 | 1299 | $plugin = mysqli_real_escape_string($conn, $plugin); |
1301 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'"); |
|
1300 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'"); |
|
1302 | 1301 | if (mysqli_num_rows($rs)) { |
1303 | 1302 | $insert = true; |
1304 | - while($row = mysqli_fetch_assoc($rs)) { |
|
1305 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
1306 | - if($row['description'] == $desc){ |
|
1307 | - if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
1308 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1303 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
1304 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
1305 | + if ($row['description'] == $desc) { |
|
1306 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
1307 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1309 | 1308 | return; |
1310 | 1309 | } |
1311 | 1310 | $insert = false; |
1312 | 1311 | } else { |
1313 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
1312 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
1314 | 1313 | echo mysqli_error($sqlParser->conn).PHP_EOL; |
1315 | 1314 | return; |
1316 | 1315 | } |
1317 | 1316 | } |
1318 | 1317 | } |
1319 | - if($insert === true) { |
|
1320 | - $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
1321 | - if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) { |
|
1318 | + if ($insert === true) { |
|
1319 | + $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
1320 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) { |
|
1322 | 1321 | echo mysqli_error($sqlParser->conn).PHP_EOL; |
1323 | 1322 | return; |
1324 | 1323 | } |
1325 | 1324 | } |
1326 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1325 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1327 | 1326 | } else { |
1328 | - if ($properties != NULL ){ |
|
1327 | + if ($properties != NULL) { |
|
1329 | 1328 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
1330 | 1329 | } |
1331 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) { |
|
1332 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1330 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) { |
|
1331 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1333 | 1332 | return; |
1334 | 1333 | } |
1335 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1334 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1336 | 1335 | } |
1337 | 1336 | // add system events |
1338 | 1337 | if (count($events) > 0) { |
1339 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
1338 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
1340 | 1339 | if ($ds) { |
1341 | 1340 | $row = mysqli_fetch_assoc($ds); |
1342 | 1341 | $id = $row["id"]; |
1343 | 1342 | // remove existing events |
1344 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\''); |
|
1343 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\''); |
|
1345 | 1344 | // add new events |
1346 | - mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`" . $table_prefix . "system_eventnames` se WHERE name IN ('" . implode("','", $events) . "')"); |
|
1345 | + mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`".$table_prefix."system_eventnames` se WHERE name IN ('".implode("','", $events)."')"); |
|
1347 | 1346 | } |
1348 | 1347 | } |
1349 | 1348 | } |
@@ -1354,18 +1353,18 @@ discard block |
||
1354 | 1353 | // Install Snippets |
1355 | 1354 | $moduleSnippet = $ms; |
1356 | 1355 | if (is_array($moduleSnippet) || $installData) { |
1357 | - echo PHP_EOL . $_lang['snippets'] . ":" . PHP_EOL; |
|
1356 | + echo PHP_EOL.$_lang['snippets'].":".PHP_EOL; |
|
1358 | 1357 | //$selSnips = $_POST['snippet']; |
1359 | 1358 | foreach ($moduleSnippets as $k=>$moduleSnippet) { |
1360 | 1359 | $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1; |
1361 | - if($installSample || is_array($moduleSnippet)) { |
|
1360 | + if ($installSample || is_array($moduleSnippet)) { |
|
1362 | 1361 | $name = mysqli_real_escape_string($conn, $moduleSnippet[0]); |
1363 | 1362 | $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]); |
1364 | 1363 | $filecontent = $moduleSnippet[2]; |
1365 | 1364 | $properties = $moduleSnippet[3]; |
1366 | 1365 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
1367 | 1366 | if (!file_exists($filecontent)) |
1368 | - echo " $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL; |
|
1367 | + echo " $name: ".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].PHP_EOL; |
|
1369 | 1368 | else { |
1370 | 1369 | |
1371 | 1370 | // Create the category if it does not already exist |
@@ -1374,24 +1373,24 @@ discard block |
||
1374 | 1373 | $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent))); |
1375 | 1374 | $snippet = removeDocblock($snippet, 'snippet'); |
1376 | 1375 | $snippet = mysqli_real_escape_string($conn, $snippet); |
1377 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'"); |
|
1376 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'"); |
|
1378 | 1377 | if (mysqli_num_rows($rs)) { |
1379 | 1378 | $row = mysqli_fetch_assoc($rs); |
1380 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
1381 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
1382 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1379 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
1380 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
1381 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1383 | 1382 | return; |
1384 | 1383 | } |
1385 | - echo " $name: " . $_lang['upgraded'] . PHP_EOL; |
|
1384 | + echo " $name: ".$_lang['upgraded'].PHP_EOL; |
|
1386 | 1385 | } else { |
1387 | - if ($properties != NULL ){ |
|
1386 | + if ($properties != NULL) { |
|
1388 | 1387 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
1389 | 1388 | } |
1390 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
1391 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1389 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
1390 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1392 | 1391 | return; |
1393 | 1392 | } |
1394 | - echo " $name: " . $_lang['installed'] . PHP_EOL; |
|
1393 | + echo " $name: ".$_lang['installed'].PHP_EOL; |
|
1395 | 1394 | } |
1396 | 1395 | } |
1397 | 1396 | } |
@@ -1400,24 +1399,24 @@ discard block |
||
1400 | 1399 | |
1401 | 1400 | // Install demo-site |
1402 | 1401 | if ($installData && $moduleSQLDataFile) { |
1403 | - echo PHP_EOL . $_lang['installing_demo_site']; |
|
1402 | + echo PHP_EOL.$_lang['installing_demo_site']; |
|
1404 | 1403 | $sqlParser->process($moduleSQLDataFile); |
1405 | 1404 | // display database results |
1406 | 1405 | if ($sqlParser->installFailed == true) { |
1407 | 1406 | $errors += 1; |
1408 | - echo $_lang['database_alerts'] . PHP_EOL; |
|
1409 | - echo $_lang['setup_couldnt_install'] . PHP_EOL; |
|
1410 | - echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL; |
|
1407 | + echo $_lang['database_alerts'].PHP_EOL; |
|
1408 | + echo $_lang['setup_couldnt_install'].PHP_EOL; |
|
1409 | + echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL; |
|
1411 | 1410 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
1412 | - echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL; |
|
1411 | + echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL; |
|
1413 | 1412 | } |
1414 | 1413 | |
1415 | - echo $_lang['some_tables_not_updated'] . PHP_EOL; |
|
1414 | + echo $_lang['some_tables_not_updated'].PHP_EOL; |
|
1416 | 1415 | return; |
1417 | 1416 | } else { |
1418 | 1417 | $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix); |
1419 | 1418 | $rs = mysqli_query($sqlParser->conn, $sql); |
1420 | - if(mysqli_num_rows($rs)) { |
|
1419 | + if (mysqli_num_rows($rs)) { |
|
1421 | 1420 | $row = mysqli_fetch_assoc($rs); |
1422 | 1421 | $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']); |
1423 | 1422 | mysqli_query($sqlParser->conn, $sql); |
@@ -1429,9 +1428,9 @@ discard block |
||
1429 | 1428 | // Install Dependencies |
1430 | 1429 | $moduleDependencies = $mdp; |
1431 | 1430 | foreach ($moduleDependencies as $dependency) { |
1432 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"'); |
|
1431 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"'); |
|
1433 | 1432 | if (!$ds) { |
1434 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1433 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1435 | 1434 | return; |
1436 | 1435 | } else { |
1437 | 1436 | $row = mysqli_fetch_assoc($ds); |
@@ -1439,37 +1438,37 @@ discard block |
||
1439 | 1438 | $moduleGuid = $row["guid"]; |
1440 | 1439 | } |
1441 | 1440 | // get extra id |
1442 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"'); |
|
1441 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"'); |
|
1443 | 1442 | if (!$ds) { |
1444 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1443 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1445 | 1444 | return; |
1446 | 1445 | } else { |
1447 | 1446 | $row = mysqli_fetch_assoc($ds); |
1448 | 1447 | $extraId = $row["id"]; |
1449 | 1448 | } |
1450 | 1449 | // setup extra as module dependency |
1451 | - $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1'); |
|
1450 | + $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1'); |
|
1452 | 1451 | if (!$ds) { |
1453 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1452 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1454 | 1453 | return; |
1455 | 1454 | } else { |
1456 | 1455 | if (mysqli_num_rows($ds) === 0) { |
1457 | - mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')'); |
|
1458 | - echo $dependency['module'] . ' Module: ' . $_lang['depedency_create'] . PHP_EOL; |
|
1456 | + mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')'); |
|
1457 | + echo $dependency['module'].' Module: '.$_lang['depedency_create'].PHP_EOL; |
|
1459 | 1458 | } else { |
1460 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']); |
|
1461 | - echo $dependency['module'] . ' Module: ' . $_lang['depedency_update'] . PHP_EOL; |
|
1459 | + mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` SET module = '.$moduleId.', resource = '.$extraId.', type = '.$dependency['type'].' WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type']); |
|
1460 | + echo $dependency['module'].' Module: '.$_lang['depedency_update'].PHP_EOL; |
|
1462 | 1461 | } |
1463 | 1462 | if ($dependency['type'] == 30 || $dependency['type'] == 40) { |
1464 | 1463 | // set extra guid for plugins and snippets |
1465 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1'); |
|
1464 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1'); |
|
1466 | 1465 | if (!$ds) { |
1467 | - echo mysqli_error($sqlParser->conn) . PHP_EOL; |
|
1466 | + echo mysqli_error($sqlParser->conn).PHP_EOL; |
|
1468 | 1467 | return; |
1469 | 1468 | } else { |
1470 | 1469 | if (mysqli_num_rows($ds) != 0) { |
1471 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId); |
|
1472 | - echo $dependency['name'] . ': ' . $_lang['guid_set'] . PHP_EOL; |
|
1470 | + mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId); |
|
1471 | + echo $dependency['name'].': '.$_lang['guid_set'].PHP_EOL; |
|
1473 | 1472 | } |
1474 | 1473 | } |
1475 | 1474 | } |
@@ -1478,7 +1477,7 @@ discard block |
||
1478 | 1477 | |
1479 | 1478 | // call back function |
1480 | 1479 | if ($callBackFnc != "") |
1481 | - $callBackFnc ($sqlParser); |
|
1480 | + $callBackFnc($sqlParser); |
|
1482 | 1481 | |
1483 | 1482 | // Setup the MODX API -- needed for the cache processor |
1484 | 1483 | if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
@@ -1511,17 +1510,17 @@ discard block |
||
1511 | 1510 | } |
1512 | 1511 | |
1513 | 1512 | // setup completed! |
1514 | -echo PHP_EOL . $_lang['installation_successful'] . PHP_EOL . PHP_EOL; |
|
1513 | +echo PHP_EOL.$_lang['installation_successful'].PHP_EOL.PHP_EOL; |
|
1515 | 1514 | //echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>"; |
1516 | 1515 | if ($installMode == 0) { |
1517 | - echo strip_tags($_lang['installation_note']) . PHP_EOL; |
|
1516 | + echo strip_tags($_lang['installation_note']).PHP_EOL; |
|
1518 | 1517 | } else { |
1519 | - echo strip_tags($_lang['upgrade_note']) . PHP_EOL; |
|
1518 | + echo strip_tags($_lang['upgrade_note']).PHP_EOL; |
|
1520 | 1519 | } |
1521 | 1520 | |
1522 | 1521 | |
1523 | -if ( empty($args) ){ |
|
1524 | - echo PHP_EOL . 'Remove install folder?'.PHP_EOL; |
|
1522 | +if (empty($args)) { |
|
1523 | + echo PHP_EOL.'Remove install folder?'.PHP_EOL; |
|
1525 | 1524 | $removeInstall = readline("Type 'y' or 'n' to continue: "); |
1526 | 1525 | } |
1527 | 1526 | //remove installFolder |
@@ -1529,7 +1528,7 @@ discard block |
||
1529 | 1528 | removeFolder($path); |
1530 | 1529 | removeFolder($base_path.'.tx'); |
1531 | 1530 | unlink($base_path.'README.md'); |
1532 | - echo 'Install folder deleted!'. PHP_EOL . PHP_EOL; |
|
1531 | + echo 'Install folder deleted!'.PHP_EOL.PHP_EOL; |
|
1533 | 1532 | } |
1534 | 1533 | |
1535 | 1534 | /** |
@@ -1568,11 +1567,11 @@ discard block |
||
1568 | 1567 | * @param string $old |
1569 | 1568 | * @return string |
1570 | 1569 | */ |
1571 | -function propUpdate($new,$old){ |
|
1570 | +function propUpdate($new, $old){ |
|
1572 | 1571 | $newArr = parseProperties($new); |
1573 | 1572 | $oldArr = parseProperties($old); |
1574 | - foreach ($oldArr as $k => $v){ |
|
1575 | - if (isset($v['0']['options'])){ |
|
1573 | + foreach ($oldArr as $k => $v) { |
|
1574 | + if (isset($v['0']['options'])) { |
|
1576 | 1575 | $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; |
1577 | 1576 | } |
1578 | 1577 | } |
@@ -1587,30 +1586,30 @@ discard block |
||
1587 | 1586 | * @param bool|mixed $json |
1588 | 1587 | * @return string |
1589 | 1588 | */ |
1590 | -function parseProperties($propertyString, $json=false) { |
|
1591 | - $propertyString = str_replace('{}', '', $propertyString ); |
|
1592 | - $propertyString = str_replace('} {', ',', $propertyString ); |
|
1589 | +function parseProperties($propertyString, $json = false){ |
|
1590 | + $propertyString = str_replace('{}', '', $propertyString); |
|
1591 | + $propertyString = str_replace('} {', ',', $propertyString); |
|
1593 | 1592 | |
1594 | - if(empty($propertyString)) return array(); |
|
1595 | - if($propertyString=='{}' || $propertyString=='[]') return array(); |
|
1593 | + if (empty($propertyString)) return array(); |
|
1594 | + if ($propertyString == '{}' || $propertyString == '[]') return array(); |
|
1596 | 1595 | |
1597 | 1596 | $jsonFormat = isJson($propertyString, true); |
1598 | 1597 | $property = array(); |
1599 | 1598 | // old format |
1600 | - if ( $jsonFormat === false) { |
|
1601 | - $props= explode('&', $propertyString); |
|
1599 | + if ($jsonFormat === false) { |
|
1600 | + $props = explode('&', $propertyString); |
|
1602 | 1601 | foreach ($props as $prop) { |
1603 | 1602 | $prop = trim($prop); |
1604 | - if($prop === '') { |
|
1603 | + if ($prop === '') { |
|
1605 | 1604 | continue; |
1606 | 1605 | } |
1607 | 1606 | |
1608 | 1607 | $arr = explode(';', $prop); |
1609 | - if( ! is_array($arr)) { |
|
1608 | + if (!is_array($arr)) { |
|
1610 | 1609 | $arr = array(); |
1611 | 1610 | } |
1612 | 1611 | $key = explode('=', isset($arr[0]) ? $arr[0] : ''); |
1613 | - if( ! is_array($key) || empty($key[0])) { |
|
1612 | + if (!is_array($key) || empty($key[0])) { |
|
1614 | 1613 | continue; |
1615 | 1614 | } |
1616 | 1615 | |
@@ -1634,7 +1633,7 @@ discard block |
||
1634 | 1633 | |
1635 | 1634 | } |
1636 | 1635 | // new json-format |
1637 | - } else if(!empty($jsonFormat)){ |
|
1636 | + } else if (!empty($jsonFormat)) { |
|
1638 | 1637 | $property = $jsonFormat; |
1639 | 1638 | } |
1640 | 1639 | if ($json) { |
@@ -1649,7 +1648,7 @@ discard block |
||
1649 | 1648 | * @param bool $returnData |
1650 | 1649 | * @return bool|mixed |
1651 | 1650 | */ |
1652 | -function isJson($string, $returnData=false) { |
|
1651 | +function isJson($string, $returnData = false){ |
|
1653 | 1652 | $data = json_decode($string, true); |
1654 | 1653 | return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; |
1655 | 1654 | } |
@@ -1659,20 +1658,20 @@ discard block |
||
1659 | 1658 | * @param SqlParser $sqlParser |
1660 | 1659 | * @return int |
1661 | 1660 | */ |
1662 | -function getCreateDbCategory($category, $sqlParser) { |
|
1661 | +function getCreateDbCategory($category, $sqlParser){ |
|
1663 | 1662 | $dbase = $sqlParser->dbname; |
1664 | - $dbase = '`' . trim($dbase,'`') . '`'; |
|
1663 | + $dbase = '`'.trim($dbase, '`').'`'; |
|
1665 | 1664 | $table_prefix = $sqlParser->prefix; |
1666 | 1665 | $category_id = 0; |
1667 | - if(!empty($category)) { |
|
1666 | + if (!empty($category)) { |
|
1668 | 1667 | $category = mysqli_real_escape_string($sqlParser->conn, $category); |
1669 | 1668 | $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'"); |
1670 | - if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
1669 | + if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) { |
|
1671 | 1670 | $category_id = $row['id']; |
1672 | 1671 | } else { |
1673 | 1672 | $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');"; |
1674 | 1673 | $rs = mysqli_query($sqlParser->conn, $q); |
1675 | - if($rs) { |
|
1674 | + if ($rs) { |
|
1676 | 1675 | $category_id = mysqli_insert_id($sqlParser->conn); |
1677 | 1676 | } |
1678 | 1677 | } |
@@ -1687,12 +1686,12 @@ discard block |
||
1687 | 1686 | * @param string $type |
1688 | 1687 | * @return string |
1689 | 1688 | */ |
1690 | -function removeDocblock($code, $type) { |
|
1689 | +function removeDocblock($code, $type){ |
|
1691 | 1690 | |
1692 | 1691 | $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1); |
1693 | 1692 | |
1694 | 1693 | // Procedure taken from plugin.filesource.php |
1695 | - switch($type) { |
|
1694 | + switch ($type) { |
|
1696 | 1695 | case 'snippet': |
1697 | 1696 | $elm_name = 'snippets'; |
1698 | 1697 | $include = 'return require'; |
@@ -1708,7 +1707,7 @@ discard block |
||
1708 | 1707 | default: |
1709 | 1708 | return $cleaned; |
1710 | 1709 | }; |
1711 | - if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
1710 | + if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
1712 | 1711 | return $cleaned; |
1713 | 1712 | |
1714 | 1713 | // fileBinding not found - return code incl docblock |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('file_manager')) { |
@@ -9,15 +9,15 @@ discard block |
||
9 | 9 | $newToken = makeToken(); |
10 | 10 | |
11 | 11 | // settings |
12 | -$theme_image_path = $modx->config['site_manager_url'] . 'media/style/' . $modx->config['manager_theme'] . '/images/'; |
|
12 | +$theme_image_path = $modx->config['site_manager_url'].'media/style/'.$modx->config['manager_theme'].'/images/'; |
|
13 | 13 | $excludes = array( |
14 | 14 | '.', |
15 | 15 | '..', |
16 | 16 | '.svn' |
17 | 17 | ); |
18 | -$alias_suffix = (!empty($friendly_url_suffix)) ? ',' . ltrim($friendly_url_suffix, '.') : ''; |
|
19 | -$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix); |
|
20 | -$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix); |
|
18 | +$alias_suffix = (!empty($friendly_url_suffix)) ? ','.ltrim($friendly_url_suffix, '.') : ''; |
|
19 | +$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix); |
|
20 | +$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix); |
|
21 | 21 | $viewablefiles = explode(',', 'jpg,gif,png,ico'); |
22 | 22 | |
23 | 23 | $editablefiles = add_dot($editablefiles); |
@@ -30,31 +30,31 @@ discard block |
||
30 | 30 | { |
31 | 31 | */ |
32 | 32 | $protected_path[] = $modx->config['site_manager_path']; |
33 | -$protected_path[] = $modx->config['base_path'] . 'temp/backup'; |
|
34 | -$protected_path[] = $modx->config['base_path'] . 'assets/backup'; |
|
33 | +$protected_path[] = $modx->config['base_path'].'temp/backup'; |
|
34 | +$protected_path[] = $modx->config['base_path'].'assets/backup'; |
|
35 | 35 | |
36 | 36 | if (!$modx->hasPermission('save_plugin')) { |
37 | - $protected_path[] = $modx->config['base_path'] . 'assets/plugins'; |
|
37 | + $protected_path[] = $modx->config['base_path'].'assets/plugins'; |
|
38 | 38 | } |
39 | 39 | if (!$modx->hasPermission('save_snippet')) { |
40 | - $protected_path[] = $modx->config['base_path'] . 'assets/snippets'; |
|
40 | + $protected_path[] = $modx->config['base_path'].'assets/snippets'; |
|
41 | 41 | } |
42 | 42 | if (!$modx->hasPermission('save_template')) { |
43 | - $protected_path[] = $modx->config['base_path'] . 'assets/templates'; |
|
43 | + $protected_path[] = $modx->config['base_path'].'assets/templates'; |
|
44 | 44 | } |
45 | 45 | if (!$modx->hasPermission('save_module')) { |
46 | - $protected_path[] = $modx->config['base_path'] . 'assets/modules'; |
|
46 | + $protected_path[] = $modx->config['base_path'].'assets/modules'; |
|
47 | 47 | } |
48 | 48 | if (!$modx->hasPermission('empty_cache')) { |
49 | - $protected_path[] = $modx->config['base_path'] . 'assets/cache'; |
|
49 | + $protected_path[] = $modx->config['base_path'].'assets/cache'; |
|
50 | 50 | } |
51 | 51 | if (!$modx->hasPermission('import_static')) { |
52 | - $protected_path[] = $modx->config['base_path'] . 'temp/import'; |
|
53 | - $protected_path[] = $modx->config['base_path'] . 'assets/import'; |
|
52 | + $protected_path[] = $modx->config['base_path'].'temp/import'; |
|
53 | + $protected_path[] = $modx->config['base_path'].'assets/import'; |
|
54 | 54 | } |
55 | 55 | if (!$modx->hasPermission('export_static')) { |
56 | - $protected_path[] = $modx->config['base_path'] . 'temp/export'; |
|
57 | - $protected_path[] = $modx->config['base_path'] . 'assets/export'; |
|
56 | + $protected_path[] = $modx->config['base_path'].'temp/export'; |
|
57 | + $protected_path[] = $modx->config['base_path'].'assets/export'; |
|
58 | 58 | } |
59 | 59 | /* |
60 | 60 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | { |
84 | 84 | $count = count($array); |
85 | 85 | for ($i = 0; $i < $count; $i++) { |
86 | - $array[$i] = '.' . strtolower(trim($array[$i])); // add a dot :) |
|
86 | + $array[$i] = '.'.strtolower(trim($array[$i])); // add a dot :) |
|
87 | 87 | } |
88 | 88 | return $array; |
89 | 89 | } |
@@ -108,15 +108,15 @@ discard block |
||
108 | 108 | $rw = realpath('../'); |
109 | 109 | $webstart_path = str_replace('\\', '/', str_replace($rw, '', $rf)); |
110 | 110 | if (substr($webstart_path, 0, 1) == '/') { |
111 | - $webstart_path = '..' . $webstart_path; |
|
111 | + $webstart_path = '..'.$webstart_path; |
|
112 | 112 | } else { |
113 | - $webstart_path = '../' . $webstart_path; |
|
113 | + $webstart_path = '../'.$webstart_path; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | ?> |
117 | 117 | <script type="text/javascript"> |
118 | 118 | |
119 | - var current_path = '<?= $startpath;?>'; |
|
119 | + var current_path = '<?= $startpath; ?>'; |
|
120 | 120 | |
121 | 121 | function viewfile (url) |
122 | 122 | { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | function unzipFile (file) |
153 | 153 | { |
154 | 154 | if (confirmUnzip()) { |
155 | - window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken;?>"; |
|
155 | + window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken; ?>"; |
|
156 | 156 | return false; |
157 | 157 | } |
158 | 158 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | function deleteFolder (folder, status) |
175 | 175 | { |
176 | 176 | if (confirmDeleteFolder(status)) { |
177 | - window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken;?>"; |
|
177 | + window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken; ?>"; |
|
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | function deleteFile (file) |
183 | 183 | { |
184 | 184 | if (confirmDelete()) { |
185 | - window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken;?>"; |
|
185 | + window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken; ?>"; |
|
186 | 186 | return false; |
187 | 187 | } |
188 | 188 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | { |
192 | 192 | var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
193 | 193 | if (newFilename !== null && newFilename !== file) { |
194 | - window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
194 | + window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | { |
200 | 200 | var newDirname = prompt("<?= $_lang["files_dynamic_new_folder_name"] ?>", dir); |
201 | 201 | if (newDirname !== null && newDirname !== dir) { |
202 | - window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken;?>"; |
|
202 | + window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken; ?>"; |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | { |
208 | 208 | var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
209 | 209 | if (newFilename !== null && newFilename !== file) { |
210 | - window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
210 | + window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | <?php endif ?> |
227 | 227 | <?php |
228 | 228 | if (isset($_GET['mode']) && $_GET['mode'] !== 'drill') { |
229 | - $href = 'a=31&path=' . urlencode($_REQUEST['path']); |
|
229 | + $href = 'a=31&path='.urlencode($_REQUEST['path']); |
|
230 | 230 | } else { |
231 | 231 | $href = 'a=2'; |
232 | 232 | } |
@@ -236,12 +236,12 @@ discard block |
||
236 | 236 | $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFolderName(this);"><i class="[+image+]"></i><span>[+subject+]</span></a>'; |
237 | 237 | $ph['image'] = $_style['files_folder-open']; |
238 | 238 | $ph['subject'] = $_lang['add_folder']; |
239 | - $ph['href'] = 'index.php?a=31&mode=newfolder&path=' . urlencode($startpath) . '&name='; |
|
239 | + $ph['href'] = 'index.php?a=31&mode=newfolder&path='.urlencode($startpath).'&name='; |
|
240 | 240 | $_ = parsePlaceholder($tpl, $ph); |
241 | 241 | |
242 | - $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>' . $_lang['files.dynamic.php1'] . '</span></a>'; |
|
242 | + $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>'.$_lang['files.dynamic.php1'].'</span></a>'; |
|
243 | 243 | $ph['image'] = $_style['files_page_html']; |
244 | - $ph['href'] = 'index.php?a=31&mode=newfile&path=' . urlencode($startpath) . '&name='; |
|
244 | + $ph['href'] = 'index.php?a=31&mode=newfile&path='.urlencode($startpath).'&name='; |
|
245 | 245 | $_ .= parsePlaceholder($tpl, $ph); |
246 | 246 | echo $_; |
247 | 247 | } |
@@ -271,12 +271,12 @@ discard block |
||
271 | 271 | $ph = array(); |
272 | 272 | $ph['style_path'] = $theme_image_path; |
273 | 273 | // To Top Level with folder icon to the left |
274 | - if ($startpath == $filemanager_path || $startpath . '/' == $filemanager_path) { |
|
275 | - $ph['image'] = '' . $_style['files_top'] . ''; |
|
274 | + if ($startpath == $filemanager_path || $startpath.'/' == $filemanager_path) { |
|
275 | + $ph['image'] = ''.$_style['files_top'].''; |
|
276 | 276 | $ph['subject'] = '<span>Top</span>'; |
277 | 277 | } else { |
278 | - $ph['image'] = '' . $_style['files_top'] . ''; |
|
279 | - $ph['subject'] = '<a href="index.php?a=31&mode=drill&path=' . $filemanager_path . '">Top</a>/'; |
|
278 | + $ph['image'] = ''.$_style['files_top'].''; |
|
279 | + $ph['subject'] = '<a href="index.php?a=31&mode=drill&path='.$filemanager_path.'">Top</a>/'; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | echo parsePlaceholder($tpl, $ph); |
@@ -293,12 +293,12 @@ discard block |
||
293 | 293 | if (empty($v)) { |
294 | 294 | continue; |
295 | 295 | } |
296 | - $path .= rtrim($v, '/') . '/'; |
|
296 | + $path .= rtrim($v, '/').'/'; |
|
297 | 297 | if (1 < $count) { |
298 | - $href = 'index.php?a=31&mode=drill&path=' . urlencode($filemanager_path . $path); |
|
299 | - $pieces[$i] = '<a href="' . $href . '">' . trim($v, '/') . '</a>'; |
|
298 | + $href = 'index.php?a=31&mode=drill&path='.urlencode($filemanager_path.$path); |
|
299 | + $pieces[$i] = '<a href="'.$href.'">'.trim($v, '/').'</a>'; |
|
300 | 300 | } else { |
301 | - $pieces[$i] = '<span>' . trim($v, '/') . '</span>'; |
|
301 | + $pieces[$i] = '<span>'.trim($v, '/').'</span>'; |
|
302 | 302 | } |
303 | 303 | $count--; |
304 | 304 | } |
@@ -311,16 +311,16 @@ discard block |
||
311 | 311 | </div> |
312 | 312 | <?php |
313 | 313 | // check to see user isn't trying to move below the document_root |
314 | - if (substr(strtolower(str_replace('//', '/', $startpath . "/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path . '/'))) { |
|
314 | + if (substr(strtolower(str_replace('//', '/', $startpath."/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path.'/'))) { |
|
315 | 315 | $modx->webAlertAndQuit($_lang["files_access_denied"]); |
316 | 316 | } |
317 | 317 | |
318 | 318 | // Unzip .zip files - by Raymond |
319 | 319 | if ($enablefileunzip && $_REQUEST['mode'] == 'unzip' && is_writable($startpath)) { |
320 | - if (!$err = unzip(realpath("{$startpath}/" . $_REQUEST['file']), realpath($startpath))) { |
|
321 | - echo '<span class="warning"><b>' . $_lang['file_unzip_fail'] . ($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '') . '</b></span><br /><br />'; |
|
320 | + if (!$err = unzip(realpath("{$startpath}/".$_REQUEST['file']), realpath($startpath))) { |
|
321 | + echo '<span class="warning"><b>'.$_lang['file_unzip_fail'].($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '').'</b></span><br /><br />'; |
|
322 | 322 | } else { |
323 | - echo '<span class="success"><b>' . $_lang['file_unzip'] . '</b></span><br /><br />'; |
|
323 | + echo '<span class="success"><b>'.$_lang['file_unzip'].'</b></span><br /><br />'; |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | // End Unzip - Raymond |
@@ -332,9 +332,9 @@ discard block |
||
332 | 332 | if ($_REQUEST['mode'] == 'deletefolder') { |
333 | 333 | $folder = $_REQUEST['folderpath']; |
334 | 334 | if (!$token_check || !@rrmdir($folder)) { |
335 | - echo '<span class="warning"><b>' . $_lang['file_folder_not_deleted'] . '</b></span><br /><br />'; |
|
335 | + echo '<span class="warning"><b>'.$_lang['file_folder_not_deleted'].'</b></span><br /><br />'; |
|
336 | 336 | } else { |
337 | - echo '<span class="success"><b>' . $_lang['file_folder_deleted'] . '</b></span><br /><br />'; |
|
337 | + echo '<span class="success"><b>'.$_lang['file_folder_deleted'].'</b></span><br /><br />'; |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
@@ -345,10 +345,10 @@ discard block |
||
345 | 345 | if (!mkdirs("{$startpath}/{$foldername}", 0777)) { |
346 | 346 | echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
347 | 347 | } else { |
348 | - if (!@chmod($startpath . '/' . $foldername, $newfolderaccessmode)) { |
|
349 | - echo '<span class="warning"><b>' . $_lang['file_folder_chmod_error'] . '</b></span><br /><br />'; |
|
348 | + if (!@chmod($startpath.'/'.$foldername, $newfolderaccessmode)) { |
|
349 | + echo '<span class="warning"><b>'.$_lang['file_folder_chmod_error'].'</b></span><br /><br />'; |
|
350 | 350 | } else { |
351 | - echo '<span class="success"><b>' . $_lang['file_folder_created'] . '</b></span><br /><br />'; |
|
351 | + echo '<span class="success"><b>'.$_lang['file_folder_created'].'</b></span><br /><br />'; |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | umask($old_umask); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $filename = $modx->db->escape($filename); |
361 | 361 | |
362 | 362 | if (!checkExtension($filename)) { |
363 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
363 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
364 | 364 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $filename) !== 0) { |
365 | 365 | echo $_lang['files.dynamic.php3']; |
366 | 366 | } else { |
@@ -382,11 +382,11 @@ discard block |
||
382 | 382 | $newFilename = $modx->db->escape($newFilename); |
383 | 383 | |
384 | 384 | if (!checkExtension($newFilename)) { |
385 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
385 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
386 | 386 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
387 | 387 | echo $_lang['files.dynamic.php3']; |
388 | 388 | } else { |
389 | - if (!copy($filename, MODX_BASE_PATH . $newFilename)) { |
|
389 | + if (!copy($filename, MODX_BASE_PATH.$newFilename)) { |
|
390 | 390 | echo $_lang['files.dynamic.php5']; |
391 | 391 | } |
392 | 392 | umask($old_umask); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | // Rename folder here |
396 | 396 | if ($_REQUEST['mode'] == 'renameFolder') { |
397 | 397 | $old_umask = umask(0); |
398 | - $dirname = $_REQUEST['path'] . '/' . $_REQUEST['dirname']; |
|
398 | + $dirname = $_REQUEST['path'].'/'.$_REQUEST['dirname']; |
|
399 | 399 | $dirname = $modx->db->escape($dirname); |
400 | 400 | $newDirname = str_replace(array( |
401 | 401 | '..\\', |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | |
408 | 408 | if (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newDirname) !== 0) { |
409 | 409 | echo $_lang['files.dynamic.php3']; |
410 | - } else if (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) { |
|
410 | + } else if (!rename($dirname, $_REQUEST['path'].'/'.$newDirname)) { |
|
411 | 411 | echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
412 | 412 | } |
413 | 413 | umask($old_umask); |
@@ -427,11 +427,11 @@ discard block |
||
427 | 427 | $newFilename = $modx->db->escape($newFilename); |
428 | 428 | |
429 | 429 | if (!checkExtension($newFilename)) { |
430 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
430 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
431 | 431 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
432 | 432 | echo $_lang['files.dynamic.php3']; |
433 | 433 | } else { |
434 | - if (!rename($filename, $path . '/' . $newFilename)) { |
|
434 | + if (!rename($filename, $path.'/'.$newFilename)) { |
|
435 | 435 | echo $_lang['files.dynamic.php5']; |
436 | 436 | } |
437 | 437 | umask($old_umask); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | ls($startpath); |
465 | 465 | echo "\n\n\n"; |
466 | 466 | if ($folders == 0 && $files == 0) { |
467 | - echo '<tr><td colspan="4"><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> ' . $_lang['files_directory_is_empty'] . ' </span></td></tr>'; |
|
467 | + echo '<tr><td colspan="4"><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> '.$_lang['files_directory_is_empty'].' </span></td></tr>'; |
|
468 | 468 | } |
469 | 469 | ?> |
470 | 470 | </table> |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | <div class="container"> |
474 | 474 | <p> |
475 | 475 | <?php |
476 | - echo $_lang['files_directories'] . ': <b>' . $folders . '</b> '; |
|
477 | - echo $_lang['files_files'] . ': <b>' . $files . '</b> '; |
|
478 | - echo $_lang['files_data'] . ': <b><span dir="ltr">' . $modx->nicesize($filesizes) . '</span></b> '; |
|
479 | - echo $_lang['files_dirwritable'] . ' <b>' . (is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no']) . '.</b>' |
|
476 | + echo $_lang['files_directories'].': <b>'.$folders.'</b> '; |
|
477 | + echo $_lang['files_files'].': <b>'.$files.'</b> '; |
|
478 | + echo $_lang['files_data'].': <b><span dir="ltr">'.$modx->nicesize($filesizes).'</span></b> '; |
|
479 | + echo $_lang['files_dirwritable'].' <b>'.(is_writable($startpath) == 1 ? $_lang['yes'].'.' : $_lang['no']).'.</b>' |
|
480 | 480 | ?> |
481 | 481 | </p> |
482 | 482 | |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | </form> |
502 | 502 | <?php |
503 | 503 | } else { |
504 | - echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>"; |
|
504 | + echo "<p>".$_lang['files_upload_inhibited_msg']."</p>"; |
|
505 | 505 | } |
506 | 506 | ?> |
507 | 507 | <div id="imageviewer"></div> |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | if ($file == $selFile) { |
587 | 587 | $icon = isset($icons[$mode]) ? $icons[$mode] : $icons['default']; |
588 | 588 | } |
589 | - return '<i class="' . $icon . ' FilesPage"></i>'; |
|
589 | + return '<i class="'.$icon.' FilesPage"></i>'; |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | /** |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | ); |
605 | 605 | if ($file == $selFile) { |
606 | 606 | $class = isset($classNames[$mode]) ? $classNames[$mode] : $classNames['default']; |
607 | - return ' class="' . $class . '"'; |
|
607 | + return ' class="'.$class.'"'; |
|
608 | 608 | } |
609 | 609 | return ''; |
610 | 610 | } |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | global $excludes, $protected_path, $editablefiles, $inlineviewablefiles, $viewablefiles, $enablefileunzip, $enablefiledownload, $uploadablefiles, $folders, $files, $filesizes, $len, $dirs_array, $files_array, $webstart_path, $modx; |
619 | 619 | $dircounter = 0; |
620 | 620 | $filecounter = 0; |
621 | - $curpath = str_replace('//', '/', $curpath . '/'); |
|
621 | + $curpath = str_replace('//', '/', $curpath.'/'); |
|
622 | 622 | |
623 | 623 | if (!is_dir($curpath)) { |
624 | 624 | echo 'Invalid path "', $curpath, '"<br />'; |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | // first, get info |
630 | 630 | foreach ($dir as $file) { |
631 | - $newpath = $curpath . $file; |
|
631 | + $newpath = $curpath.$file; |
|
632 | 632 | if ($file === '..' || $file === '.') { |
633 | 633 | continue; |
634 | 634 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | if ($file === '..' || $file === '.') { |
639 | 639 | continue; |
640 | 640 | } elseif (!in_array($file, $excludes) && !in_array($newpath, $protected_path)) { |
641 | - $dirs_array[$dircounter]['text'] = '<i class="' . $_style['files_folder'] . ' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path=' . urlencode($newpath) . '"><b>' . $file . '</b></a>'; |
|
641 | + $dirs_array[$dircounter]['text'] = '<i class="'.$_style['files_folder'].' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path='.urlencode($newpath).'"><b>'.$file.'</b></a>'; |
|
642 | 642 | |
643 | 643 | $dfiles = scandir($newpath); |
644 | 644 | foreach ($dfiles as $i => $infile) { |
@@ -651,13 +651,13 @@ discard block |
||
651 | 651 | } |
652 | 652 | $file_exists = (0 < count($dfiles)) ? 'file_exists' : ''; |
653 | 653 | |
654 | - $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\'' . urlencode($file) . '\',\'' . $file_exists . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></a>' : ''; |
|
654 | + $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\''.urlencode($file).'\',\''.$file_exists.'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></a>' : ''; |
|
655 | 655 | } else { |
656 | - $dirs_array[$dircounter]['text'] = '<span><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> ' . $file . '</span>'; |
|
657 | - $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></span>' : ''; |
|
656 | + $dirs_array[$dircounter]['text'] = '<span><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> '.$file.'</span>'; |
|
657 | + $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></span>' : ''; |
|
658 | 658 | } |
659 | 659 | |
660 | - $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" title="' . $_lang['rename'] . '"></i></a> ' : ''; |
|
660 | + $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" title="'.$_lang['rename'].'"></i></a> ' : ''; |
|
661 | 661 | |
662 | 662 | // increment the counter |
663 | 663 | $dircounter++; |
@@ -665,14 +665,14 @@ discard block |
||
665 | 665 | $type = getExtension($newpath); |
666 | 666 | $files_array[$filecounter]['file'] = $newpath; |
667 | 667 | $files_array[$filecounter]['stats'] = lstat($newpath); |
668 | - $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']) . ' ' . $file; |
|
669 | - $files_array[$filecounter]['view'] = (in_array($type, $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\'' . $webstart_path . substr($newpath, $len, strlen($newpath)) . '\');"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : (($enablefiledownload && in_array($type, $uploadablefiles)) ? '<a href="' . $webstart_path . implode('/', array_map('rawurlencode', explode('/', substr($newpath, $len, strlen($newpath))))) . '" style="cursor:pointer;"><i class="' . $_style['files_download'] . '" title="' . $_lang['file_download_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></span>'); |
|
670 | - $files_array[$filecounter]['view'] = (in_array($type, $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path=' . urlencode($newpath) . '"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : $files_array[$filecounter]['view']; |
|
671 | - $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_unzip'] . '" title="' . $_lang['file_download_unzip'] . '"></i></a>' : ''; |
|
672 | - $files_array[$filecounter]['edit'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path=' . urlencode($newpath) . '#file_editfile"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></span>'; |
|
673 | - $files_array[$filecounter]['duplicate'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_duplicate'] . '" title="' . $_lang['duplicate'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_duplicate'] . '" align="absmiddle" title="' . $_lang['duplicate'] . '"></i></span>'; |
|
674 | - $files_array[$filecounter]['rename'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></span>'; |
|
675 | - $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></span>'; |
|
668 | + $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'], $_REQUEST['mode']).' '.$file; |
|
669 | + $files_array[$filecounter]['view'] = (in_array($type, $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\''.$webstart_path.substr($newpath, $len, strlen($newpath)).'\');"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : (($enablefiledownload && in_array($type, $uploadablefiles)) ? '<a href="'.$webstart_path.implode('/', array_map('rawurlencode', explode('/', substr($newpath, $len, strlen($newpath))))).'" style="cursor:pointer;"><i class="'.$_style['files_download'].'" title="'.$_lang['file_download_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></span>'); |
|
670 | + $files_array[$filecounter]['view'] = (in_array($type, $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path='.urlencode($newpath).'"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : $files_array[$filecounter]['view']; |
|
671 | + $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\''.urlencode($file).'\');"><i class="'.$_style['files_unzip'].'" title="'.$_lang['file_download_unzip'].'"></i></a>' : ''; |
|
672 | + $files_array[$filecounter]['edit'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path='.urlencode($newpath).'#file_editfile"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></span>'; |
|
673 | + $files_array[$filecounter]['duplicate'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\''.urlencode($file).'\');"><i class="'.$_style['files_duplicate'].'" title="'.$_lang['duplicate'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_duplicate'].'" align="absmiddle" title="'.$_lang['duplicate'].'"></i></span>'; |
|
674 | + $files_array[$filecounter]['rename'] = (in_array($type, $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></span>'; |
|
675 | + $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\''.urlencode($file).'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></span>'; |
|
676 | 676 | |
677 | 677 | // increment the counter |
678 | 678 | $filecounter++; |
@@ -685,9 +685,9 @@ discard block |
||
685 | 685 | for ($i = 0; $i < $folders; $i++) { |
686 | 686 | $filesizes += $dirs_array[$i]['stats']['7']; |
687 | 687 | echo '<tr>'; |
688 | - echo '<td>' . $dirs_array[$i]['text'] . '</td>'; |
|
689 | - echo '<td class="text-nowrap">' . $modx->toDateFormat($dirs_array[$i]['stats']['9']) . '</td>'; |
|
690 | - echo '<td class="text-right">' . $modx->nicesize($dirs_array[$i]['stats']['7']) . '</td>'; |
|
688 | + echo '<td>'.$dirs_array[$i]['text'].'</td>'; |
|
689 | + echo '<td class="text-nowrap">'.$modx->toDateFormat($dirs_array[$i]['stats']['9']).'</td>'; |
|
690 | + echo '<td class="text-right">'.$modx->nicesize($dirs_array[$i]['stats']['7']).'</td>'; |
|
691 | 691 | echo '<td class="actions text-right">'; |
692 | 692 | echo $dirs_array[$i]['rename']; |
693 | 693 | echo $dirs_array[$i]['delete']; |
@@ -700,10 +700,10 @@ discard block |
||
700 | 700 | sort($files_array); // sorting the array alphabetically (Thanks pxl8r!) |
701 | 701 | for ($i = 0; $i < $files; $i++) { |
702 | 702 | $filesizes += $files_array[$i]['stats']['7']; |
703 | - echo '<tr ' . markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']) . '>'; |
|
704 | - echo '<td>' . $files_array[$i]['text'] . '</td>'; |
|
705 | - echo '<td class="text-nowrap">' . $modx->toDateFormat($files_array[$i]['stats']['9']) . '</td>'; |
|
706 | - echo '<td class="text-right">' . $modx->nicesize($files_array[$i]['stats']['7']) . '</td>'; |
|
703 | + echo '<tr '.markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']).'>'; |
|
704 | + echo '<td>'.$files_array[$i]['text'].'</td>'; |
|
705 | + echo '<td class="text-nowrap">'.$modx->toDateFormat($files_array[$i]['stats']['9']).'</td>'; |
|
706 | + echo '<td class="text-right">'.$modx->nicesize($files_array[$i]['stats']['7']).'</td>'; |
|
707 | 707 | echo '<td class="actions text-right">'; |
708 | 708 | echo $files_array[$i]['unzip']; |
709 | 709 | echo $files_array[$i]['view']; |
@@ -840,17 +840,17 @@ discard block |
||
840 | 840 | $zip = zip_open($file); |
841 | 841 | if ($zip) { |
842 | 842 | $old_umask = umask(0); |
843 | - $path = rtrim($path, '/') . '/'; |
|
843 | + $path = rtrim($path, '/').'/'; |
|
844 | 844 | while ($zip_entry = zip_read($zip)) { |
845 | 845 | if (zip_entry_filesize($zip_entry) > 0) { |
846 | 846 | // str_replace must be used under windows to convert "/" into "\" |
847 | 847 | $zip_entry_name = zip_entry_name($zip_entry); |
848 | - $complete_path = $path . str_replace('\\', '/', dirname($zip_entry_name)); |
|
849 | - $complete_name = $path . str_replace('\\', '/', $zip_entry_name); |
|
848 | + $complete_path = $path.str_replace('\\', '/', dirname($zip_entry_name)); |
|
849 | + $complete_name = $path.str_replace('\\', '/', $zip_entry_name); |
|
850 | 850 | if (!file_exists($complete_path)) { |
851 | 851 | $tmp = ''; |
852 | 852 | foreach (explode('/', $complete_path) AS $k) { |
853 | - $tmp .= $k . '/'; |
|
853 | + $tmp .= $k.'/'; |
|
854 | 854 | if (!is_dir($tmp)) { |
855 | 855 | mkdir($tmp, 0777); |
856 | 856 | } |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | */ |
876 | 876 | function rrmdir($dir) |
877 | 877 | { |
878 | - foreach (glob($dir . '/*') as $file) { |
|
878 | + foreach (glob($dir.'/*') as $file) { |
|
879 | 879 | if (is_dir($file)) { |
880 | 880 | rrmdir($file); |
881 | 881 | } else { |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | $msg = ''; |
895 | 895 | foreach ($_FILES['userfile']['name'] as $i => $name) { |
896 | 896 | if (empty($_FILES['userfile']['tmp_name'][$i])) continue; |
897 | - $userfile= array(); |
|
897 | + $userfile = array(); |
|
898 | 898 | |
899 | 899 | $userfile['tmp_name'] = $_FILES['userfile']['tmp_name'][$i]; |
900 | 900 | $userfile['error'] = $_FILES['userfile']['error'][$i]; |
@@ -911,12 +911,12 @@ discard block |
||
911 | 911 | $userfile['type'] = $_FILES['userfile']['type'][$i]; |
912 | 912 | |
913 | 913 | // this seems to be an upload action. |
914 | - $path = $modx->config['site_url'] . substr($startpath, strlen($filemanager_path), strlen($startpath)); |
|
915 | - $path = rtrim($path, '/') . '/' . $userfile['name']; |
|
914 | + $path = $modx->config['site_url'].substr($startpath, strlen($filemanager_path), strlen($startpath)); |
|
915 | + $path = rtrim($path, '/').'/'.$userfile['name']; |
|
916 | 916 | $msg .= $path; |
917 | 917 | if ($userfile['error'] == 0) { |
918 | - $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="' . $path . '" height="75" />' : ''; |
|
919 | - $msg .= "<p>" . $_lang['files_file_type'] . $userfile['type'] . ", " . $modx->nicesize(filesize($userfile['tmp_name'])) . $img . '</p>'; |
|
918 | + $img = (strpos($userfile['type'], 'image') !== false) ? '<br /><img src="'.$path.'" height="75" />' : ''; |
|
919 | + $msg .= "<p>".$_lang['files_file_type'].$userfile['type'].", ".$modx->nicesize(filesize($userfile['tmp_name'])).$img.'</p>'; |
|
920 | 920 | } |
921 | 921 | |
922 | 922 | $userfilename = $userfile['tmp_name']; |
@@ -924,15 +924,15 @@ discard block |
||
924 | 924 | if (is_uploaded_file($userfilename)) { |
925 | 925 | // file is uploaded file, process it! |
926 | 926 | if (!checkExtension($userfile['name'])) { |
927 | - $msg .= '<p><span class="warning">' . $_lang['files_filetype_notok'] . '</span></p>'; |
|
927 | + $msg .= '<p><span class="warning">'.$_lang['files_filetype_notok'].'</span></p>'; |
|
928 | 928 | } else { |
929 | - if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'] . '/' . $userfile['name'])) { |
|
929 | + if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'].'/'.$userfile['name'])) { |
|
930 | 930 | // Ryan: Repair broken permissions issue with file manager |
931 | 931 | if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { |
932 | - @chmod($_POST['path'] . "/" . $userfile['name'], $new_file_permissions); |
|
932 | + @chmod($_POST['path']."/".$userfile['name'], $new_file_permissions); |
|
933 | 933 | } |
934 | 934 | // Ryan: End |
935 | - $msg .= '<p><span class="success">' . $_lang['files_upload_ok'] . '</span></p><hr/>'; |
|
935 | + $msg .= '<p><span class="success">'.$_lang['files_upload_ok'].'</span></p><hr/>'; |
|
936 | 936 | |
937 | 937 | // invoke OnFileManagerUpload event |
938 | 938 | $modx->invokeEvent('OnFileManagerUpload', array( |
@@ -940,13 +940,13 @@ discard block |
||
940 | 940 | 'filename' => $userfile['name'] |
941 | 941 | )); |
942 | 942 | // Log the change |
943 | - logFileChange('upload', $_POST['path'] . '/' . $userfile['name']); |
|
943 | + logFileChange('upload', $_POST['path'].'/'.$userfile['name']); |
|
944 | 944 | } else { |
945 | - $msg .= '<p><span class="warning">' . $_lang['files_upload_copyfailed'] . '</span> ' . $_lang["files_upload_permissions_error"] . '</p>'; |
|
945 | + $msg .= '<p><span class="warning">'.$_lang['files_upload_copyfailed'].'</span> '.$_lang["files_upload_permissions_error"].'</p>'; |
|
946 | 946 | } |
947 | 947 | } |
948 | 948 | } else { |
949 | - $msg .= '<br /><span class="warning"><b>' . $_lang['files_upload_error'] . ':</b>'; |
|
949 | + $msg .= '<br /><span class="warning"><b>'.$_lang['files_upload_error'].':</b>'; |
|
950 | 950 | switch ($userfile['error']) { |
951 | 951 | case 0: //no error; possible file attack! |
952 | 952 | $msg .= $_lang['files_upload_error0']; |
@@ -970,7 +970,7 @@ discard block |
||
970 | 970 | $msg .= '</span><br />'; |
971 | 971 | } |
972 | 972 | } |
973 | - return $msg . '<br/>'; |
|
973 | + return $msg.'<br/>'; |
|
974 | 974 | } |
975 | 975 | |
976 | 976 | /** |
@@ -986,9 +986,9 @@ discard block |
||
986 | 986 | |
987 | 987 | // Write $content to our opened file. |
988 | 988 | if (file_put_contents($filename, $content) === false) { |
989 | - $msg .= '<span class="warning"><b>' . $_lang['file_not_saved'] . '</b></span><br /><br />'; |
|
989 | + $msg .= '<span class="warning"><b>'.$_lang['file_not_saved'].'</b></span><br /><br />'; |
|
990 | 990 | } else { |
991 | - $msg .= '<span class="success"><b>' . $_lang['file_saved'] . '</b></span><br /><br />'; |
|
991 | + $msg .= '<span class="success"><b>'.$_lang['file_saved'].'</b></span><br /><br />'; |
|
992 | 992 | $_REQUEST['mode'] = 'edit'; |
993 | 993 | } |
994 | 994 | // Log the change |
@@ -1007,9 +1007,9 @@ discard block |
||
1007 | 1007 | |
1008 | 1008 | $file = $_REQUEST['path']; |
1009 | 1009 | if (!$token_check || !@unlink($file)) { |
1010 | - $msg .= '<span class="warning"><b>' . $_lang['file_not_deleted'] . '</b></span><br /><br />'; |
|
1010 | + $msg .= '<span class="warning"><b>'.$_lang['file_not_deleted'].'</b></span><br /><br />'; |
|
1011 | 1011 | } else { |
1012 | - $msg .= '<span class="success"><b>' . $_lang['file_deleted'] . '</b></span><br /><br />'; |
|
1012 | + $msg .= '<span class="success"><b>'.$_lang['file_deleted'].'</b></span><br /><br />'; |
|
1013 | 1013 | } |
1014 | 1014 | |
1015 | 1015 | // Log the change |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | function __call($method_name, $arguments) |
207 | 207 | { |
208 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
208 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
209 | 209 | if (method_exists($this->old, $method_name)) { |
210 | 210 | $error_type = 1; |
211 | 211 | } else { |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | $info = debug_backtrace(); |
224 | 224 | $m[] = $msg; |
225 | 225 | if (!empty($this->currentSnippet)) { |
226 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
226 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
227 | 227 | } elseif (!empty($this->event->activePlugin)) { |
228 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
228 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
229 | 229 | } |
230 | 230 | $m[] = $this->decoded_request_uri; |
231 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
231 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
232 | 232 | $msg = implode('<br />', $m); |
233 | 233 | $this->logEvent(0, $error_type, $msg, $title); |
234 | 234 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | $flag = false; |
247 | 247 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
248 | - $flag = (bool)$this->{$connector}->conn; |
|
248 | + $flag = (bool) $this->{$connector}->conn; |
|
249 | 249 | } |
250 | 250 | return $flag; |
251 | 251 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | if (!$out && $flag) { |
274 | 274 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
275 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
275 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
276 | 276 | $out = is_file($filename) ? include $filename : false; |
277 | 277 | } |
278 | 278 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | public function getMicroTime() |
290 | 290 | { |
291 | 291 | list ($usec, $sec) = explode(' ', microtime()); |
292 | - return ((float)$usec + (float)$sec); |
|
292 | + return ((float) $usec + (float) $sec); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | // append the redirect count string to the url |
314 | 314 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
315 | 315 | if ($currentNumberOfRedirects > 3) { |
316 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
316 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
317 | 317 | } else { |
318 | 318 | $currentNumberOfRedirects += 1; |
319 | 319 | if (strpos($url, "?") > 0) { |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | } |
325 | 325 | } |
326 | 326 | if ($type == 'REDIRECT_REFRESH') { |
327 | - $header = 'Refresh: 0;URL=' . $url; |
|
327 | + $header = 'Refresh: 0;URL='.$url; |
|
328 | 328 | } elseif ($type == 'REDIRECT_META') { |
329 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
329 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
330 | 330 | echo $header; |
331 | 331 | exit; |
332 | 332 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | global $base_url, $site_url; |
335 | 335 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
336 | 336 | // append $site_url to make it work with Location: |
337 | - $url = $site_url . substr($url, strlen($base_url)); |
|
337 | + $url = $site_url.substr($url, strlen($base_url)); |
|
338 | 338 | } |
339 | 339 | if (strpos($url, "\n") === false) { |
340 | - $header = 'Location: ' . $url; |
|
340 | + $header = 'Location: '.$url; |
|
341 | 341 | } else { |
342 | 342 | $this->messageQuit('No newline allowed in redirect url.'); |
343 | 343 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | header($responseCode); |
347 | 347 | } |
348 | 348 | |
349 | - if(!empty($header)) { |
|
349 | + if (!empty($header)) { |
|
350 | 350 | header($header); |
351 | 351 | } |
352 | 352 | |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | |
452 | 452 | private function recoverySiteCache() |
453 | 453 | { |
454 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
455 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
454 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
455 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
456 | 456 | |
457 | 457 | if (is_file($site_cache_path)) { |
458 | 458 | include($site_cache_path); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | return; |
462 | 462 | } |
463 | 463 | |
464 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
464 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
465 | 465 | $cache = new synccache(); |
466 | 466 | $cache->setCachepath($site_cache_dir); |
467 | 467 | $cache->setReport(false); |
@@ -513,8 +513,8 @@ discard block |
||
513 | 513 | $this->invokeEvent("OnBeforeManagerPageInit"); |
514 | 514 | } |
515 | 515 | |
516 | - if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
517 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
516 | + if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { |
|
517 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
518 | 518 | } else { |
519 | 519 | if ($usrType == 'web') { |
520 | 520 | $from = $tbl_web_user_settings; |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
535 | 535 | } |
536 | 536 | if (isset ($usrType)) { |
537 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
537 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
538 | 538 | } // store user settings in session |
539 | 539 | } |
540 | 540 | } |
@@ -679,10 +679,10 @@ discard block |
||
679 | 679 | $suf = $this->config['friendly_url_suffix']; |
680 | 680 | $pre = preg_quote($pre, '/'); |
681 | 681 | $suf = preg_quote($suf, '/'); |
682 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
682 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
683 | 683 | $q = $_[1]; |
684 | 684 | } |
685 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
685 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
686 | 686 | $q = $_[1]; |
687 | 687 | } |
688 | 688 | |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */ |
705 | 705 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
706 | 706 | if ($this->config['use_alias_path'] == 1) { |
707 | - if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
|
707 | + if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
|
708 | 708 | $this->documentMethod = 'id'; |
709 | 709 | return $q; |
710 | 710 | } else { /* not a valid id in terms of virtualDir, treat as alias */ |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | */ |
739 | 739 | public function getHashFile($key) |
740 | 740 | { |
741 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
741 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | /** |
@@ -749,9 +749,9 @@ discard block |
||
749 | 749 | $hash = $id; |
750 | 750 | $tmp = null; |
751 | 751 | $params = array(); |
752 | - if(!empty($this->systemCacheKey)){ |
|
752 | + if (!empty($this->systemCacheKey)) { |
|
753 | 753 | $hash = $this->systemCacheKey; |
754 | - }else { |
|
754 | + } else { |
|
755 | 755 | if (!empty($_GET)) { |
756 | 756 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
757 | 757 | $params = $_GET; |
@@ -759,8 +759,8 @@ discard block |
||
759 | 759 | $hash .= '_'.md5(http_build_query($params)); |
760 | 760 | } |
761 | 761 | } |
762 | - $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
|
763 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
762 | + $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
|
763 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
764 | 764 | $tmp = array_pop($evtOut); |
765 | 765 | } |
766 | 766 | return empty($tmp) ? $hash : $tmp; |
@@ -902,12 +902,12 @@ discard block |
||
902 | 902 | if ($js = $this->getRegisteredClientStartupScripts()) { |
903 | 903 | // change to just before closing </head> |
904 | 904 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
905 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
905 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | // Insert jscripts & html block into template - template must have a </body> tag |
909 | 909 | if ($js = $this->getRegisteredClientScripts()) { |
910 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
910 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
911 | 911 | } |
912 | 912 | // End fix by sirlancelot |
913 | 913 | |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | // send out content-type and content-disposition headers |
919 | 919 | if (IN_PARSER_MODE == "true") { |
920 | 920 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
921 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
921 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
922 | 922 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
923 | 923 | // header('HTTP/1.0 404 Not Found'); |
924 | 924 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | $name = preg_replace('|-+|', '-', $name); |
937 | 937 | $name = trim($name, '-'); |
938 | 938 | } |
939 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
939 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
940 | 940 | header($header); |
941 | 941 | } |
942 | 942 | } |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | |
945 | 945 | $stats = $this->getTimerStats($this->tstart); |
946 | 946 | |
947 | - $out =& $this->documentOutput; |
|
947 | + $out = & $this->documentOutput; |
|
948 | 948 | $out = str_replace("[^q^]", $stats['queries'], $out); |
949 | 949 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
950 | 950 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -983,17 +983,17 @@ discard block |
||
983 | 983 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
984 | 984 | $tt += $t; |
985 | 985 | } |
986 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
986 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; |
|
987 | 987 | echo $this->snippetsCode; |
988 | 988 | } |
989 | 989 | if ($this->dumpPlugins) { |
990 | 990 | $ps = ""; |
991 | 991 | $tt = 0; |
992 | 992 | foreach ($this->pluginsTime as $s => $t) { |
993 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
993 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
994 | 994 | $tt += $t; |
995 | 995 | } |
996 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
996 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
997 | 997 | echo $this->pluginsCode; |
998 | 998 | } |
999 | 999 | |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | $srcTags = explode(',', $tags); |
1020 | 1020 | $repTags = array(); |
1021 | 1021 | foreach ($srcTags as $tag) { |
1022 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
1022 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
1023 | 1023 | } |
1024 | 1024 | return array($srcTags, $repTags); |
1025 | 1025 | } |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
1042 | 1042 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
1043 | 1043 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
1044 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
1044 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
1045 | 1045 | |
1046 | 1046 | return $stats; |
1047 | 1047 | } |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | { |
1075 | 1075 | $cacheRefreshTime = 0; |
1076 | 1076 | $recent_update = 0; |
1077 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
1077 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
1078 | 1078 | $this->recentUpdate = $recent_update; |
1079 | 1079 | |
1080 | 1080 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1128,8 +1128,8 @@ discard block |
||
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | $docObjSerial = serialize($this->documentObject); |
1131 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
1132 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
1131 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
1132 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
1133 | 1133 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
1134 | 1134 | } |
1135 | 1135 | } |
@@ -1171,16 +1171,16 @@ discard block |
||
1171 | 1171 | return array(); |
1172 | 1172 | } |
1173 | 1173 | $spacer = md5('<<<EVO>>>'); |
1174 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1175 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1176 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1177 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1174 | + if ($left === '{{' && strpos($content, ';}}') !== false) $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); |
|
1175 | + if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); |
|
1176 | + if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); |
|
1177 | + if ($left === '[[' && strpos($content, ']]]') !== false) $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); |
|
1178 | 1178 | |
1179 | 1179 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
1180 | 1180 | $pos[']]>'] = strpos($content, ']]>'); |
1181 | 1181 | |
1182 | 1182 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
1183 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
1183 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | $lp = explode($left, $content); |
@@ -1244,8 +1244,8 @@ discard block |
||
1244 | 1244 | } |
1245 | 1245 | } |
1246 | 1246 | } |
1247 | - foreach($tags as $i=>$tag) { |
|
1248 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1247 | + foreach ($tags as $i=>$tag) { |
|
1248 | + if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1249 | 1249 | } |
1250 | 1250 | return $tags; |
1251 | 1251 | } |
@@ -1285,7 +1285,7 @@ discard block |
||
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | foreach ($matches[1] as $i => $key) { |
1288 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1288 | + if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1289 | 1289 | if (substr($key, 0, 1) == '#') { |
1290 | 1290 | $key = substr($key, 1); |
1291 | 1291 | } // remove # for QuickEdit format |
@@ -1305,8 +1305,8 @@ discard block |
||
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | if (is_array($value)) { |
1308 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
1309 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
1308 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
1309 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
1310 | 1310 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
1311 | 1311 | } |
1312 | 1312 | |
@@ -1317,8 +1317,8 @@ discard block |
||
1317 | 1317 | |
1318 | 1318 | if (strpos($content, $s) !== false) { |
1319 | 1319 | $content = str_replace($s, $value, $content); |
1320 | - } elseif($this->debug) { |
|
1321 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1320 | + } elseif ($this->debug) { |
|
1321 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1322 | 1322 | } |
1323 | 1323 | } |
1324 | 1324 | |
@@ -1485,8 +1485,8 @@ discard block |
||
1485 | 1485 | $s = &$matches[0][$i]; |
1486 | 1486 | if (strpos($content, $s) !== false) { |
1487 | 1487 | $content = str_replace($s, $value, $content); |
1488 | - } elseif($this->debug) { |
|
1489 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1488 | + } elseif ($this->debug) { |
|
1489 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1490 | 1490 | } |
1491 | 1491 | } |
1492 | 1492 | return $content; |
@@ -1539,7 +1539,7 @@ discard block |
||
1539 | 1539 | } |
1540 | 1540 | |
1541 | 1541 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
1542 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1542 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1543 | 1543 | if ($this->config['enable_at_syntax']) { |
1544 | 1544 | $value = $this->mergeConditionalTagsContent($value); |
1545 | 1545 | } |
@@ -1554,8 +1554,8 @@ discard block |
||
1554 | 1554 | $s = &$matches[0][$i]; |
1555 | 1555 | if (strpos($content, $s) !== false) { |
1556 | 1556 | $content = str_replace($s, $value, $content); |
1557 | - } elseif($this->debug) { |
|
1558 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1557 | + } elseif ($this->debug) { |
|
1558 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1559 | 1559 | } |
1560 | 1560 | } |
1561 | 1561 | return $content; |
@@ -1613,8 +1613,8 @@ discard block |
||
1613 | 1613 | $s = &$matches[0][$i]; |
1614 | 1614 | if (strpos($content, $s) !== false) { |
1615 | 1615 | $content = str_replace($s, $value, $content); |
1616 | - } elseif($this->debug) { |
|
1617 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1616 | + } elseif ($this->debug) { |
|
1617 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1618 | 1618 | } |
1619 | 1619 | } |
1620 | 1620 | return $content; |
@@ -1638,7 +1638,7 @@ discard block |
||
1638 | 1638 | return $content; |
1639 | 1639 | } |
1640 | 1640 | |
1641 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
1641 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
1642 | 1642 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); |
1643 | 1643 | |
1644 | 1644 | $pieces = explode('<@IF:', $content); |
@@ -1649,7 +1649,7 @@ discard block |
||
1649 | 1649 | } |
1650 | 1650 | list($cmd, $text) = explode('>', $split, 2); |
1651 | 1651 | $cmd = str_replace("'", "\'", $cmd); |
1652 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1652 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1653 | 1653 | $content .= $text; |
1654 | 1654 | } |
1655 | 1655 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1660,13 +1660,13 @@ discard block |
||
1660 | 1660 | } |
1661 | 1661 | list($cmd, $text) = explode('>', $split, 2); |
1662 | 1662 | $cmd = str_replace("'", "\'", $cmd); |
1663 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1663 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1664 | 1664 | $content .= $text; |
1665 | 1665 | } |
1666 | 1666 | |
1667 | 1667 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
1668 | 1668 | ob_start(); |
1669 | - $content = eval('?>' . $content); |
|
1669 | + $content = eval('?>'.$content); |
|
1670 | 1670 | $content = ob_get_clean(); |
1671 | 1671 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); |
1672 | 1672 | |
@@ -1791,7 +1791,7 @@ discard block |
||
1791 | 1791 | $matches = $this->getTagsFromContent($content, $left, $right); |
1792 | 1792 | if (!empty($matches)) { |
1793 | 1793 | foreach ($matches[0] as $i => $v) { |
1794 | - $addBreakMatches[$i] = $v . "\n"; |
|
1794 | + $addBreakMatches[$i] = $v."\n"; |
|
1795 | 1795 | } |
1796 | 1796 | $content = str_replace($addBreakMatches, '', $content); |
1797 | 1797 | if (strpos($content, $left) !== false) { |
@@ -1824,8 +1824,8 @@ discard block |
||
1824 | 1824 | $s = &$matches[0][$i]; |
1825 | 1825 | if (strpos($content, $s) !== false) { |
1826 | 1826 | $content = str_replace($s, $v, $content); |
1827 | - } elseif($this->debug) { |
|
1828 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1827 | + } elseif ($this->debug) { |
|
1828 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1829 | 1829 | } |
1830 | 1830 | } |
1831 | 1831 | return $content; |
@@ -1889,7 +1889,7 @@ discard block |
||
1889 | 1889 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg; |
1890 | 1890 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); |
1891 | 1891 | if ($this->isBackend()) { |
1892 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
1892 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
1893 | 1893 | } |
1894 | 1894 | } |
1895 | 1895 | } else { |
@@ -1935,7 +1935,7 @@ discard block |
||
1935 | 1935 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo; |
1936 | 1936 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); |
1937 | 1937 | if ($this->isBackend()) { |
1938 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
1938 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
1939 | 1939 | } |
1940 | 1940 | } |
1941 | 1941 | } |
@@ -1943,7 +1943,7 @@ discard block |
||
1943 | 1943 | if (is_array($return) || is_object($return)) { |
1944 | 1944 | return $return; |
1945 | 1945 | } else { |
1946 | - return $echo . $return; |
|
1946 | + return $echo.$return; |
|
1947 | 1947 | } |
1948 | 1948 | } |
1949 | 1949 | |
@@ -1981,8 +1981,8 @@ discard block |
||
1981 | 1981 | } |
1982 | 1982 | if (strpos($content, $s) !== false) { |
1983 | 1983 | $content = str_replace($s, $value, $content); |
1984 | - } elseif($this->debug) { |
|
1985 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1984 | + } elseif ($this->debug) { |
|
1985 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1986 | 1986 | } |
1987 | 1987 | continue; |
1988 | 1988 | } |
@@ -1993,8 +1993,8 @@ discard block |
||
1993 | 1993 | |
1994 | 1994 | if (strpos($content, $s) !== false) { |
1995 | 1995 | $content = str_replace($s, $value, $content); |
1996 | - } elseif($this->debug) { |
|
1997 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1996 | + } elseif ($this->debug) { |
|
1997 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1998 | 1998 | } |
1999 | 1999 | } |
2000 | 2000 | |
@@ -2085,7 +2085,7 @@ discard block |
||
2085 | 2085 | $eventtime = sprintf('%2.2f ms', $eventtime * 1000); |
2086 | 2086 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
2087 | 2087 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
2088 | - $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
2088 | + $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
2089 | 2089 | $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', $snippetObject['name'], $eventtime, $piece, $print_r_params, $code); |
2090 | 2090 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
2091 | 2091 | } |
@@ -2329,7 +2329,7 @@ discard block |
||
2329 | 2329 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
2330 | 2330 | $count = $this->db->getRecordCount($rs); |
2331 | 2331 | if (1 < $count) { |
2332 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
2332 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
2333 | 2333 | } |
2334 | 2334 | if ($count) { |
2335 | 2335 | $row = $this->db->getRow($rs); |
@@ -2355,7 +2355,7 @@ discard block |
||
2355 | 2355 | public function toAlias($text) |
2356 | 2356 | { |
2357 | 2357 | $suff = $this->config['friendly_url_suffix']; |
2358 | - return str_replace(array('.xml' . $suff, '.rss' . $suff, '.js' . $suff, '.css' . $suff, '.txt' . $suff, '.json' . $suff, '.pdf' . $suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text); |
|
2358 | + return str_replace(array('.xml'.$suff, '.rss'.$suff, '.js'.$suff, '.css'.$suff, '.txt'.$suff, '.json'.$suff, '.pdf'.$suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text); |
|
2359 | 2359 | } |
2360 | 2360 | |
2361 | 2361 | /** |
@@ -2387,7 +2387,7 @@ discard block |
||
2387 | 2387 | $suff = '/'; |
2388 | 2388 | } |
2389 | 2389 | |
2390 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
2390 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
2391 | 2391 | } |
2392 | 2392 | |
2393 | 2393 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2424,7 +2424,7 @@ discard block |
||
2424 | 2424 | preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); |
2425 | 2425 | $ids = implode(',', array_unique($match['1'])); |
2426 | 2426 | if ($ids) { |
2427 | - $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
2427 | + $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
2428 | 2428 | while ($row = $this->db->getRow($res)) { |
2429 | 2429 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
2430 | 2430 | $parent = $row['parent']; |
@@ -2435,7 +2435,7 @@ discard block |
||
2435 | 2435 | $parent = $this->aliasListing[$parent]['parent']; |
2436 | 2436 | } |
2437 | 2437 | |
2438 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
2438 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
2439 | 2439 | } else { |
2440 | 2440 | $aliases[$row['id']] = $row['alias']; |
2441 | 2441 | } |
@@ -2447,7 +2447,7 @@ discard block |
||
2447 | 2447 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2448 | 2448 | $pref = $this->config['friendly_url_prefix']; |
2449 | 2449 | $suff = $this->config['friendly_url_suffix']; |
2450 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2450 | + $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2451 | 2451 | global $modx; |
2452 | 2452 | $thealias = $aliases[$m[1]]; |
2453 | 2453 | $thefolder = $isfolder[$m[1]]; |
@@ -2463,7 +2463,7 @@ discard block |
||
2463 | 2463 | |
2464 | 2464 | } else { |
2465 | 2465 | $in = '!\[\~([0-9]+)\~\]!is'; |
2466 | - $out = "index.php?id=" . '\1'; |
|
2466 | + $out = "index.php?id=".'\1'; |
|
2467 | 2467 | $documentSource = preg_replace($in, $out, $documentSource); |
2468 | 2468 | } |
2469 | 2469 | |
@@ -2484,7 +2484,7 @@ discard block |
||
2484 | 2484 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
2485 | 2485 | $len_base_url = strlen($this->config['base_url']); |
2486 | 2486 | |
2487 | - $url_path = $q;//LANG |
|
2487 | + $url_path = $q; //LANG |
|
2488 | 2488 | |
2489 | 2489 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
2490 | 2490 | $url_path = substr($url_path, $len_base_url); |
@@ -2496,7 +2496,7 @@ discard block |
||
2496 | 2496 | $strictURL = substr($strictURL, $len_base_url); |
2497 | 2497 | } |
2498 | 2498 | $http_host = $_SERVER['HTTP_HOST']; |
2499 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
2499 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
2500 | 2500 | |
2501 | 2501 | $site_url = $this->config['site_url']; |
2502 | 2502 | $url_query_string = explode('?', $_SERVER['REQUEST_URI']); |
@@ -2514,7 +2514,7 @@ discard block |
||
2514 | 2514 | } |
2515 | 2515 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
2516 | 2516 | if (empty($_POST)) { |
2517 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
2517 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
2518 | 2518 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
2519 | 2519 | exit(0); |
2520 | 2520 | } |
@@ -2573,7 +2573,7 @@ discard block |
||
2573 | 2573 | $docgrp = implode(",", $docgrp); |
2574 | 2574 | } |
2575 | 2575 | // get document |
2576 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2576 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2577 | 2577 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
2578 | 2578 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
2579 | 2579 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2609,9 +2609,9 @@ discard block |
||
2609 | 2609 | } |
2610 | 2610 | if ($documentObject['template']) { |
2611 | 2611 | // load TVs and merge with document - Orig by Apodigm - Docvars |
2612 | - $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv |
|
2613 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
2614 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2612 | + $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv |
|
2613 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
2614 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2615 | 2615 | $tmplvars = array(); |
2616 | 2616 | while ($row = $this->db->getRow($rs)) { |
2617 | 2617 | $tmplvars[$row['name']] = array( |
@@ -2657,7 +2657,7 @@ discard block |
||
2657 | 2657 | $st = md5($source); |
2658 | 2658 | } |
2659 | 2659 | if ($this->dumpSnippets == 1) { |
2660 | - $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2660 | + $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2661 | 2661 | } |
2662 | 2662 | |
2663 | 2663 | // invoke OnParseDocument event |
@@ -2699,7 +2699,7 @@ discard block |
||
2699 | 2699 | */ |
2700 | 2700 | public function executeParser() |
2701 | 2701 | { |
2702 | - if(MODX_CLI) { |
|
2702 | + if (MODX_CLI) { |
|
2703 | 2703 | throw new RuntimeException('Call DocumentParser::executeParser on CLI mode'); |
2704 | 2704 | } |
2705 | 2705 | |
@@ -2745,7 +2745,7 @@ discard block |
||
2745 | 2745 | |
2746 | 2746 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
2747 | 2747 | if ($this->config['use_alias_path'] == 1) { |
2748 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
2748 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
2749 | 2749 | if (isset($this->documentListing[$alias])) { |
2750 | 2750 | $this->documentIdentifier = $this->documentListing[$alias]; |
2751 | 2751 | } else { |
@@ -2806,7 +2806,7 @@ discard block |
||
2806 | 2806 | } else { |
2807 | 2807 | $docAlias = $this->db->escape($this->documentIdentifier); |
2808 | 2808 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); |
2809 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
2809 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
2810 | 2810 | } |
2811 | 2811 | } |
2812 | 2812 | $this->documentMethod = 'id'; |
@@ -2863,7 +2863,7 @@ discard block |
||
2863 | 2863 | $_REQUEST[$n] = $_GET[$n] = $v; |
2864 | 2864 | } |
2865 | 2865 | } |
2866 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
2866 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
2867 | 2867 | $this->q = $qp['path']; |
2868 | 2868 | return $qp['path']; |
2869 | 2869 | } |
@@ -2957,7 +2957,7 @@ discard block |
||
2957 | 2957 | $this->sendErrorPage(); |
2958 | 2958 | } else { |
2959 | 2959 | // Inculde the necessary files to check document permissions |
2960 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
2960 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
2961 | 2961 | $udperms = new udperms(); |
2962 | 2962 | $udperms->user = $this->getLoginUserID(); |
2963 | 2963 | $udperms->document = $this->documentIdentifier; |
@@ -3011,7 +3011,7 @@ discard block |
||
3011 | 3011 | while ($id && $height--) { |
3012 | 3012 | $thisid = $id; |
3013 | 3013 | if ($this->config['aliaslistingfolder'] == 1) { |
3014 | - $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3014 | + $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3015 | 3015 | if (!$id || $id == '0') { |
3016 | 3016 | break; |
3017 | 3017 | } |
@@ -3062,15 +3062,15 @@ discard block |
||
3062 | 3062 | |
3063 | 3063 | if ($this->config['aliaslistingfolder'] == 1) { |
3064 | 3064 | |
3065 | - $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
3065 | + $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
3066 | 3066 | $idx = array(); |
3067 | 3067 | while ($row = $this->db->getRow($res)) { |
3068 | 3068 | $pAlias = ''; |
3069 | 3069 | if (isset($this->aliasListing[$row['parent']])) { |
3070 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
3071 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
3070 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
3071 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
3072 | 3072 | }; |
3073 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
3073 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
3074 | 3074 | if ($row['isfolder'] == 1) { |
3075 | 3075 | $idx[] = $row['id']; |
3076 | 3076 | } |
@@ -3102,7 +3102,7 @@ discard block |
||
3102 | 3102 | $depth--; |
3103 | 3103 | |
3104 | 3104 | foreach ($documentMap_cache[$id] as $childId) { |
3105 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
3105 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
3106 | 3106 | if (!strlen($pkey)) { |
3107 | 3107 | $pkey = "{$childId}"; |
3108 | 3108 | } |
@@ -3131,7 +3131,7 @@ discard block |
||
3131 | 3131 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
3132 | 3132 | $fnc = substr($url, 11); |
3133 | 3133 | } elseif ($url) { |
3134 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
3134 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
3135 | 3135 | } else { |
3136 | 3136 | $fnc = "history.back(-1);"; |
3137 | 3137 | } |
@@ -3140,7 +3140,7 @@ discard block |
||
3140 | 3140 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
3141 | 3141 | <script> |
3142 | 3142 | function __alertQuit() { |
3143 | - alert('" . addslashes($msg) . "'); |
|
3143 | + alert('".addslashes($msg)."'); |
|
3144 | 3144 | {$fnc} |
3145 | 3145 | } |
3146 | 3146 | window.setTimeout('__alertQuit();',100); |
@@ -3162,9 +3162,9 @@ discard block |
||
3162 | 3162 | $state = 0; |
3163 | 3163 | $pms = $_SESSION['mgrPermissions']; |
3164 | 3164 | if ($pms) { |
3165 | - $state = ((bool)$pms[$pm] === true); |
|
3165 | + $state = ((bool) $pms[$pm] === true); |
|
3166 | 3166 | } |
3167 | - return (int)$state; |
|
3167 | + return (int) $state; |
|
3168 | 3168 | } |
3169 | 3169 | |
3170 | 3170 | /** |
@@ -3177,8 +3177,8 @@ discard block |
||
3177 | 3177 | */ |
3178 | 3178 | public function elementIsLocked($type, $id, $includeThisUser = false) |
3179 | 3179 | { |
3180 | - $id = (int)$id; |
|
3181 | - $type = (int)$type; |
|
3180 | + $id = (int) $id; |
|
3181 | + $type = (int) $type; |
|
3182 | 3182 | if (!$type || !$id) { |
3183 | 3183 | return null; |
3184 | 3184 | } |
@@ -3228,7 +3228,7 @@ discard block |
||
3228 | 3228 | return $lockedElements; |
3229 | 3229 | } |
3230 | 3230 | |
3231 | - $type = (int)$type; |
|
3231 | + $type = (int) $type; |
|
3232 | 3232 | if (isset($lockedElements[$type])) { |
3233 | 3233 | return $lockedElements[$type]; |
3234 | 3234 | } else { |
@@ -3245,7 +3245,7 @@ discard block |
||
3245 | 3245 | $this->lockedElements = array(); |
3246 | 3246 | $this->cleanupExpiredLocks(); |
3247 | 3247 | |
3248 | - $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul |
|
3248 | + $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul |
|
3249 | 3249 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
3250 | 3250 | while ($row = $this->db->getRow($rs)) { |
3251 | 3251 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3268,7 +3268,7 @@ discard block |
||
3268 | 3268 | public function cleanupExpiredLocks() |
3269 | 3269 | { |
3270 | 3270 | // Clean-up active_user_sessions first |
3271 | - $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3271 | + $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3272 | 3272 | $validSessionTimeLimit = $this->time - $timeout; |
3273 | 3273 | $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}"); |
3274 | 3274 | |
@@ -3281,7 +3281,7 @@ discard block |
||
3281 | 3281 | foreach ($rs as $row) { |
3282 | 3282 | $userSids[] = $row['sid']; |
3283 | 3283 | } |
3284 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
3284 | + $userSids = "'".implode("','", $userSids)."'"; |
|
3285 | 3285 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
3286 | 3286 | } else { |
3287 | 3287 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3365,8 +3365,8 @@ discard block |
||
3365 | 3365 | public function lockElement($type, $id) |
3366 | 3366 | { |
3367 | 3367 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3368 | - $type = (int)$type; |
|
3369 | - $id = (int)$id; |
|
3368 | + $type = (int) $type; |
|
3369 | + $id = (int) $id; |
|
3370 | 3370 | if (!$type || !$id || !$userId) { |
3371 | 3371 | return false; |
3372 | 3372 | } |
@@ -3387,8 +3387,8 @@ discard block |
||
3387 | 3387 | public function unlockElement($type, $id, $includeAllUsers = false) |
3388 | 3388 | { |
3389 | 3389 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3390 | - $type = (int)$type; |
|
3391 | - $id = (int)$id; |
|
3390 | + $type = (int) $type; |
|
3391 | + $id = (int) $id; |
|
3392 | 3392 | if (!$type || !$id) { |
3393 | 3393 | return false; |
3394 | 3394 | } |
@@ -3455,8 +3455,8 @@ discard block |
||
3455 | 3455 | } |
3456 | 3456 | |
3457 | 3457 | $usertype = $this->isFrontend() ? 1 : 0; |
3458 | - $evtid = (int)$evtid; |
|
3459 | - $type = (int)$type; |
|
3458 | + $evtid = (int) $evtid; |
|
3459 | + $type = (int) $type; |
|
3460 | 3460 | |
3461 | 3461 | // Types: 1 = information, 2 = warning, 3 = error |
3462 | 3462 | if ($type < 1) { |
@@ -3478,8 +3478,8 @@ discard block |
||
3478 | 3478 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
3479 | 3479 | if ($this->config['send_errormail'] <= $type) { |
3480 | 3480 | $this->sendmail(array( |
3481 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
3482 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
3481 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
3482 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
3483 | 3483 | 'type' => 'text' |
3484 | 3484 | )); |
3485 | 3485 | } |
@@ -3527,7 +3527,7 @@ discard block |
||
3527 | 3527 | $p['fromname'] = $userinfo['username']; |
3528 | 3528 | } |
3529 | 3529 | if ($msg === '' && !isset($p['body'])) { |
3530 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
3530 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
3531 | 3531 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
3532 | 3532 | $p['body'] = $msg; |
3533 | 3533 | } |
@@ -3567,8 +3567,8 @@ discard block |
||
3567 | 3567 | $files = array(); |
3568 | 3568 | } |
3569 | 3569 | foreach ($files as $f) { |
3570 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
3571 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
3570 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
3571 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
3572 | 3572 | } |
3573 | 3573 | } |
3574 | 3574 | $rs = $this->mail->send(); |
@@ -3613,7 +3613,7 @@ discard block |
||
3613 | 3613 | */ |
3614 | 3614 | public function isFrontend() |
3615 | 3615 | { |
3616 | - return ! $this->isBackend(); |
|
3616 | + return !$this->isBackend(); |
|
3617 | 3617 | } |
3618 | 3618 | |
3619 | 3619 | /** |
@@ -3638,14 +3638,14 @@ discard block |
||
3638 | 3638 | $tblsc = $this->getFullTableName("site_content"); |
3639 | 3639 | $tbldg = $this->getFullTableName("document_groups"); |
3640 | 3640 | // modify field names to use sc. table reference |
3641 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3642 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3641 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3642 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3643 | 3643 | // get document groups for current user |
3644 | 3644 | if ($docgrp = $this->getUserDocGroups()) { |
3645 | 3645 | $docgrp = implode(",", $docgrp); |
3646 | 3646 | } |
3647 | 3647 | // build query |
3648 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3648 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3649 | 3649 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3650 | 3650 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3651 | 3651 | $resourceArray = $this->db->makeArray($result); |
@@ -3675,14 +3675,14 @@ discard block |
||
3675 | 3675 | $tbldg = $this->getFullTableName("document_groups"); |
3676 | 3676 | |
3677 | 3677 | // modify field names to use sc. table reference |
3678 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3679 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3678 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3679 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3680 | 3680 | // get document groups for current user |
3681 | 3681 | if ($docgrp = $this->getUserDocGroups()) { |
3682 | 3682 | $docgrp = implode(",", $docgrp); |
3683 | 3683 | } |
3684 | 3684 | // build query |
3685 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3685 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3686 | 3686 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3687 | 3687 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3688 | 3688 | $resourceArray = $this->db->makeArray($result); |
@@ -3717,16 +3717,16 @@ discard block |
||
3717 | 3717 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
3718 | 3718 | } |
3719 | 3719 | |
3720 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
3721 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
3720 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
3721 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
3722 | 3722 | |
3723 | 3723 | if ($where != '') { |
3724 | - $where = 'AND ' . $where; |
|
3724 | + $where = 'AND '.$where; |
|
3725 | 3725 | } |
3726 | 3726 | |
3727 | 3727 | // modify field names to use sc. table reference |
3728 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3729 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3728 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3729 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3730 | 3730 | |
3731 | 3731 | // get document groups for current user |
3732 | 3732 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3734,7 +3734,7 @@ discard block |
||
3734 | 3734 | } |
3735 | 3735 | |
3736 | 3736 | // build query |
3737 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3737 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3738 | 3738 | |
3739 | 3739 | $tblsc = $this->getFullTableName('site_content'); |
3740 | 3740 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3786,10 +3786,10 @@ discard block |
||
3786 | 3786 | return false; |
3787 | 3787 | } else { |
3788 | 3788 | // modify field names to use sc. table reference |
3789 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3790 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3789 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3790 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3791 | 3791 | if ($where != '') { |
3792 | - $where = 'AND ' . $where; |
|
3792 | + $where = 'AND '.$where; |
|
3793 | 3793 | } |
3794 | 3794 | |
3795 | 3795 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3800,13 +3800,13 @@ discard block |
||
3800 | 3800 | $docgrp = implode(',', $docgrp); |
3801 | 3801 | } |
3802 | 3802 | |
3803 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3803 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3804 | 3804 | |
3805 | 3805 | $tblsc = $this->getFullTableName('site_content'); |
3806 | 3806 | $tbldg = $this->getFullTableName('document_groups'); |
3807 | 3807 | |
3808 | 3808 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3809 | - LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
|
3809 | + LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
|
3810 | 3810 | |
3811 | 3811 | $resourceArray = $this->db->makeArray($result); |
3812 | 3812 | |
@@ -3911,12 +3911,12 @@ discard block |
||
3911 | 3911 | $tbldg = $this->getFullTableName("document_groups"); |
3912 | 3912 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
3913 | 3913 | // modify field names to use sc. table reference |
3914 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3914 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3915 | 3915 | // get document groups for current user |
3916 | 3916 | if ($docgrp = $this->getUserDocGroups()) { |
3917 | 3917 | $docgrp = implode(",", $docgrp); |
3918 | 3918 | } |
3919 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3919 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3920 | 3920 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
3921 | 3921 | $pageInfo = $this->db->getRow($result); |
3922 | 3922 | |
@@ -3963,7 +3963,7 @@ discard block |
||
3963 | 3963 | { |
3964 | 3964 | if ($this->currentSnippet) { |
3965 | 3965 | $tbl = $this->getFullTableName("site_snippets"); |
3966 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
3966 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
3967 | 3967 | if ($snippetId = $this->db->getValue($rs)) { |
3968 | 3968 | return $snippetId; |
3969 | 3969 | } |
@@ -3990,23 +3990,23 @@ discard block |
||
3990 | 3990 | */ |
3991 | 3991 | public function clearCache($type = '', $report = false) |
3992 | 3992 | { |
3993 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
3993 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
3994 | 3994 | if (is_array($type)) { |
3995 | 3995 | foreach ($type as $_) { |
3996 | 3996 | $this->clearCache($_, $report); |
3997 | 3997 | } |
3998 | 3998 | } elseif ($type == 'full') { |
3999 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
3999 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
4000 | 4000 | $sync = new synccache(); |
4001 | 4001 | $sync->setCachepath($cache_dir); |
4002 | 4002 | $sync->setReport($report); |
4003 | 4003 | $sync->emptyCache(); |
4004 | 4004 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
4005 | 4005 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
4006 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
4007 | - $cache_path = $cache_dir . $file_name; |
|
4006 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
4007 | + $cache_path = $cache_dir.$file_name; |
|
4008 | 4008 | $files = glob($cache_path); |
4009 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
4009 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
4010 | 4010 | foreach ($files as $file) { |
4011 | 4011 | if (!is_file($file)) { |
4012 | 4012 | continue; |
@@ -4014,7 +4014,7 @@ discard block |
||
4014 | 4014 | unlink($file); |
4015 | 4015 | } |
4016 | 4016 | } else { |
4017 | - $files = glob($cache_dir . '*'); |
|
4017 | + $files = glob($cache_dir.'*'); |
|
4018 | 4018 | foreach ($files as $file) { |
4019 | 4019 | $name = basename($file); |
4020 | 4020 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4083,7 +4083,7 @@ discard block |
||
4083 | 4083 | $f_url_suffix = '/'; |
4084 | 4084 | } |
4085 | 4085 | |
4086 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : ''; |
|
4086 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : ''; |
|
4087 | 4087 | |
4088 | 4088 | if ($al && $al['alias']) { |
4089 | 4089 | $alias = $al['alias']; |
@@ -4091,7 +4091,7 @@ discard block |
||
4091 | 4091 | |
4092 | 4092 | } |
4093 | 4093 | |
4094 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
4094 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
4095 | 4095 | $url = "{$alias}{$args}"; |
4096 | 4096 | } else { |
4097 | 4097 | $url = "index.php?id={$id}{$args}"; |
@@ -4110,7 +4110,7 @@ discard block |
||
4110 | 4110 | } |
4111 | 4111 | |
4112 | 4112 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
4113 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
4113 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
4114 | 4114 | } |
4115 | 4115 | |
4116 | 4116 | //fix strictUrl by Bumkaka |
@@ -4119,9 +4119,9 @@ discard block |
||
4119 | 4119 | } |
4120 | 4120 | |
4121 | 4121 | if ($this->config['xhtml_urls']) { |
4122 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
4122 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
4123 | 4123 | } else { |
4124 | - $url = $host . $virtualDir . $url; |
|
4124 | + $url = $host.$virtualDir.$url; |
|
4125 | 4125 | } |
4126 | 4126 | |
4127 | 4127 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4145,21 +4145,21 @@ discard block |
||
4145 | 4145 | if (isset($this->aliasListing[$id])) { |
4146 | 4146 | $out = $this->aliasListing[$id]; |
4147 | 4147 | } else { |
4148 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
4148 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
4149 | 4149 | if ($this->db->getRecordCount($q) == '1') { |
4150 | 4150 | $q = $this->db->getRow($q); |
4151 | 4151 | $this->aliasListing[$id] = array( |
4152 | - 'id' => (int)$q['id'], |
|
4152 | + 'id' => (int) $q['id'], |
|
4153 | 4153 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
4154 | - 'parent' => (int)$q['parent'], |
|
4155 | - 'isfolder' => (int)$q['isfolder'], |
|
4154 | + 'parent' => (int) $q['parent'], |
|
4155 | + 'isfolder' => (int) $q['isfolder'], |
|
4156 | 4156 | ); |
4157 | 4157 | if ($this->aliasListing[$id]['parent'] > 0) { |
4158 | 4158 | //fix alias_path_usage |
4159 | 4159 | if ($this->config['use_alias_path'] == '1') { |
4160 | 4160 | //&& $tmp['path'] != '' - fix error slash with epty path |
4161 | 4161 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
4162 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
4162 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
4163 | 4163 | } else { |
4164 | 4164 | $this->aliasListing[$id]['path'] = ''; |
4165 | 4165 | } |
@@ -4200,7 +4200,7 @@ discard block |
||
4200 | 4200 | $out = array(); |
4201 | 4201 | if (empty($this->version) || !is_array($this->version)) { |
4202 | 4202 | //include for compatibility modx version < 1.0.10 |
4203 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
4203 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
4204 | 4204 | $this->version = array(); |
4205 | 4205 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
4206 | 4206 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4222,18 +4222,18 @@ discard block |
||
4222 | 4222 | { |
4223 | 4223 | if (isset ($this->snippetCache[$snippetName])) { |
4224 | 4224 | $snippet = $this->snippetCache[$snippetName]; |
4225 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
4225 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
4226 | 4226 | } else { // not in cache so let's check the db |
4227 | - $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
|
4227 | + $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."' AND ss.disabled=0;"; |
|
4228 | 4228 | $result = $this->db->query($sql); |
4229 | 4229 | if ($this->db->getRecordCount($result) == 1) { |
4230 | 4230 | $row = $this->db->getRow($result); |
4231 | 4231 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
4232 | 4232 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties'])); |
4233 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
4233 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
4234 | 4234 | } else { |
4235 | 4235 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
4236 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
4236 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
4237 | 4237 | } |
4238 | 4238 | } |
4239 | 4239 | // load default params/properties |
@@ -4333,8 +4333,8 @@ discard block |
||
4333 | 4333 | } |
4334 | 4334 | if (strpos($tpl, $s) !== false) { |
4335 | 4335 | $tpl = str_replace($s, $value, $tpl); |
4336 | - } elseif($this->debug) { |
|
4337 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
4336 | + } elseif ($this->debug) { |
|
4337 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
4338 | 4338 | } |
4339 | 4339 | } |
4340 | 4340 | |
@@ -4383,7 +4383,7 @@ discard block |
||
4383 | 4383 | case 'CODE': |
4384 | 4384 | break; |
4385 | 4385 | case 'FILE': |
4386 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
4386 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
4387 | 4387 | break; |
4388 | 4388 | case 'CHUNK': |
4389 | 4389 | $template = $this->getChunk($template); |
@@ -4416,7 +4416,7 @@ discard block |
||
4416 | 4416 | if ($mode !== 'formatOnly' && empty($timestamp)) { |
4417 | 4417 | return '-'; |
4418 | 4418 | } |
4419 | - $timestamp = (int)$timestamp; |
|
4419 | + $timestamp = (int) $timestamp; |
|
4420 | 4420 | |
4421 | 4421 | switch ($this->config['datetime_format']) { |
4422 | 4422 | case 'YYYY/mm/dd': |
@@ -4436,7 +4436,7 @@ discard block |
||
4436 | 4436 | } |
4437 | 4437 | |
4438 | 4438 | if (empty($mode)) { |
4439 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
4439 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
4440 | 4440 | } elseif ($mode == 'dateOnly') { |
4441 | 4441 | $strTime = strftime($dateFormat, $timestamp); |
4442 | 4442 | } elseif ($mode == 'formatOnly') { |
@@ -4490,7 +4490,7 @@ discard block |
||
4490 | 4490 | $S = 0; |
4491 | 4491 | } |
4492 | 4492 | $timeStamp = mktime($H, $M, $S, $m, $d, $Y); |
4493 | - $timeStamp = (int)$timeStamp; |
|
4493 | + $timeStamp = (int) $timeStamp; |
|
4494 | 4494 | return $timeStamp; |
4495 | 4495 | } |
4496 | 4496 | |
@@ -4532,7 +4532,7 @@ discard block |
||
4532 | 4532 | if ($v === 'value') { |
4533 | 4533 | unset($_[$i]); |
4534 | 4534 | } else { |
4535 | - $_[$i] = 'tv.' . $v; |
|
4535 | + $_[$i] = 'tv.'.$v; |
|
4536 | 4536 | } |
4537 | 4537 | } |
4538 | 4538 | $fields = implode(',', $_); |
@@ -4541,12 +4541,12 @@ discard block |
||
4541 | 4541 | } |
4542 | 4542 | |
4543 | 4543 | if ($tvsort != '') { |
4544 | - $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4544 | + $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4545 | 4545 | } |
4546 | 4546 | if ($tvidnames == "*") { |
4547 | 4547 | $query = "tv.id<>0"; |
4548 | 4548 | } else { |
4549 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')"; |
|
4549 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')"; |
|
4550 | 4550 | } |
4551 | 4551 | |
4552 | 4552 | $this->getUserDocGroups(); |
@@ -4690,7 +4690,7 @@ discard block |
||
4690 | 4690 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
4691 | 4691 | } |
4692 | 4692 | |
4693 | - if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) { |
|
4693 | + if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) { |
|
4694 | 4694 | return false; |
4695 | 4695 | } else { |
4696 | 4696 | |
@@ -4708,23 +4708,23 @@ discard block |
||
4708 | 4708 | } |
4709 | 4709 | |
4710 | 4710 | // get user defined template variables |
4711 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4712 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4711 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4712 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4713 | 4713 | |
4714 | 4714 | if ($idnames == '*') { |
4715 | 4715 | $query = 'tv.id<>0'; |
4716 | 4716 | } else { |
4717 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
4717 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
4718 | 4718 | } |
4719 | 4719 | |
4720 | - $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv |
|
4721 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
4722 | - LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
|
4720 | + $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv |
|
4721 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
4722 | + LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
|
4723 | 4723 | |
4724 | 4724 | $result = $this->db->makeArray($rs); |
4725 | 4725 | |
4726 | 4726 | // get default/built-in template variables |
4727 | - if(is_array($docRow)){ |
|
4727 | + if (is_array($docRow)) { |
|
4728 | 4728 | ksort($docRow); |
4729 | 4729 | |
4730 | 4730 | foreach ($docRow as $key => $value) { |
@@ -4762,22 +4762,22 @@ discard block |
||
4762 | 4762 | */ |
4763 | 4763 | public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '') |
4764 | 4764 | { |
4765 | - if (is_array($idnames) && empty($idnames) ) { |
|
4765 | + if (is_array($idnames) && empty($idnames)) { |
|
4766 | 4766 | return false; |
4767 | 4767 | } else { |
4768 | 4768 | $output = array(); |
4769 | 4769 | $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames); |
4770 | 4770 | |
4771 | - $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier; |
|
4771 | + $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier; |
|
4772 | 4772 | // remove sort for speed |
4773 | 4773 | $result = $this->getTemplateVars($vars, '*', $docid, $published, '', ''); |
4774 | 4774 | |
4775 | 4775 | if ($result == false) { |
4776 | 4776 | return false; |
4777 | 4777 | } else { |
4778 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
4779 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
4780 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
4778 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
4779 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
4780 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
4781 | 4781 | |
4782 | 4782 | for ($i = 0; $i < count($result); $i++) { |
4783 | 4783 | $row = $result[$i]; |
@@ -4802,7 +4802,7 @@ discard block |
||
4802 | 4802 | */ |
4803 | 4803 | public function getFullTableName($tbl) |
4804 | 4804 | { |
4805 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
4805 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
4806 | 4806 | } |
4807 | 4807 | |
4808 | 4808 | /** |
@@ -4881,7 +4881,7 @@ discard block |
||
4881 | 4881 | public function getCachePath() |
4882 | 4882 | { |
4883 | 4883 | global $base_url; |
4884 | - $pth = $base_url . $this->getCacheFolder(); |
|
4884 | + $pth = $base_url.$this->getCacheFolder(); |
|
4885 | 4885 | return $pth; |
4886 | 4886 | } |
4887 | 4887 | |
@@ -4933,8 +4933,8 @@ discard block |
||
4933 | 4933 | $out = false; |
4934 | 4934 | |
4935 | 4935 | if (!empty($context)) { |
4936 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4937 | - $out = $_SESSION[$context . 'InternalKey']; |
|
4936 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4937 | + $out = $_SESSION[$context.'InternalKey']; |
|
4938 | 4938 | } |
4939 | 4939 | } else { |
4940 | 4940 | switch (true) { |
@@ -4962,8 +4962,8 @@ discard block |
||
4962 | 4962 | $out = false; |
4963 | 4963 | |
4964 | 4964 | if (!empty($context)) { |
4965 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4966 | - $out = $_SESSION[$context . 'Shortname']; |
|
4965 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4966 | + $out = $_SESSION[$context.'Shortname']; |
|
4967 | 4967 | } |
4968 | 4968 | } else { |
4969 | 4969 | switch (true) { |
@@ -5034,8 +5034,8 @@ discard block |
||
5034 | 5034 | */ |
5035 | 5035 | public function getWebUserInfo($uid) |
5036 | 5036 | { |
5037 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
5038 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5037 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
5038 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5039 | 5039 | if ($row = $this->db->getRow($rs)) { |
5040 | 5040 | if (!isset($row['usertype']) or !$row["usertype"]) { |
5041 | 5041 | $row["usertype"] = "web"; |
@@ -5071,7 +5071,7 @@ discard block |
||
5071 | 5071 | } else if (is_array($dg)) { |
5072 | 5072 | // resolve ids to names |
5073 | 5073 | $dgn = array(); |
5074 | - $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); |
|
5074 | + $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); |
|
5075 | 5075 | while ($row = $this->db->getRow($ds)) { |
5076 | 5076 | $dgn[] = $row['name']; |
5077 | 5077 | } |
@@ -5099,7 +5099,7 @@ discard block |
||
5099 | 5099 | $rt = false; |
5100 | 5100 | if ($_SESSION["webValidated"] == 1) { |
5101 | 5101 | $tbl = $this->getFullTableName("web_users"); |
5102 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5102 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
5103 | 5103 | if ($row = $this->db->getRow($ds)) { |
5104 | 5104 | if ($row["password"] == md5($oldPwd)) { |
5105 | 5105 | if (strlen($newPwd) < 6) { |
@@ -5109,7 +5109,7 @@ discard block |
||
5109 | 5109 | } else { |
5110 | 5110 | $this->db->update(array( |
5111 | 5111 | 'password' => $this->db->escape($newPwd), |
5112 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5112 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
5113 | 5113 | // invoke OnWebChangePassword event |
5114 | 5114 | $this->invokeEvent("OnWebChangePassword", array( |
5115 | 5115 | "userid" => $row["id"], |
@@ -5140,8 +5140,8 @@ discard block |
||
5140 | 5140 | // check cache |
5141 | 5141 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
5142 | 5142 | if (!is_array($grpNames)) { |
5143 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
5144 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
5143 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
5144 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
5145 | 5145 | $grpNames = $this->db->getColumn("name", $rs); |
5146 | 5146 | // save to cache |
5147 | 5147 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5174,7 +5174,7 @@ discard block |
||
5174 | 5174 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
5175 | 5175 | $this->sjscripts[$nextpos] = $src; |
5176 | 5176 | } else { |
5177 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
5177 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
5178 | 5178 | } |
5179 | 5179 | } |
5180 | 5180 | |
@@ -5253,7 +5253,7 @@ discard block |
||
5253 | 5253 | } |
5254 | 5254 | |
5255 | 5255 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
5256 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
5256 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
5257 | 5257 | } |
5258 | 5258 | if ($startup) { |
5259 | 5259 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5400,7 +5400,7 @@ discard block |
||
5400 | 5400 | $eventtime = $this->getMicroTime() - $eventtime; |
5401 | 5401 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
5402 | 5402 | foreach ($parameter as $k => $v) { |
5403 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
5403 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
5404 | 5404 | } |
5405 | 5405 | $this->pluginsCode .= '</fieldset><br />'; |
5406 | 5406 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5428,13 +5428,13 @@ discard block |
||
5428 | 5428 | $plugin = array(); |
5429 | 5429 | if (isset ($this->pluginCache[$pluginName])) { |
5430 | 5430 | $pluginCode = $this->pluginCache[$pluginName]; |
5431 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
5431 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
5432 | 5432 | } else { |
5433 | 5433 | $pluginName = $this->db->escape($pluginName); |
5434 | 5434 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
5435 | 5435 | if ($row = $this->db->getRow($result)) { |
5436 | 5436 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
5437 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
5437 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
5438 | 5438 | } else { |
5439 | 5439 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
5440 | 5440 | $pluginProperties = ''; |
@@ -5541,7 +5541,7 @@ discard block |
||
5541 | 5541 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
5542 | 5542 | { |
5543 | 5543 | $params = array(); |
5544 | - $fullpath = $element_dir . '/' . $filename; |
|
5544 | + $fullpath = $element_dir.'/'.$filename; |
|
5545 | 5545 | if (is_readable($fullpath)) { |
5546 | 5546 | $tpl = @fopen($fullpath, "r"); |
5547 | 5547 | if ($tpl) { |
@@ -5708,8 +5708,8 @@ discard block |
||
5708 | 5708 | $ph = array('site_url' => MODX_SITE_URL); |
5709 | 5709 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
5710 | 5710 | $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i'; |
5711 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
5712 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
5711 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
5712 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
5713 | 5713 | foreach ($parsed as $key => $val) { |
5714 | 5714 | if (is_array($val)) { |
5715 | 5715 | foreach ($val as $key2 => $val2) { |
@@ -5718,7 +5718,7 @@ discard block |
||
5718 | 5718 | $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); |
5719 | 5719 | } |
5720 | 5720 | if (preg_match($regexEmail, $val2, $url)) { |
5721 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
5721 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
5722 | 5722 | } |
5723 | 5723 | $parsed[$key][$key2] = $val2; |
5724 | 5724 | } |
@@ -5728,7 +5728,7 @@ discard block |
||
5728 | 5728 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
5729 | 5729 | } |
5730 | 5730 | if (preg_match($regexEmail, $val, $url)) { |
5731 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
5731 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
5732 | 5732 | } |
5733 | 5733 | $parsed[$key] = $val; |
5734 | 5734 | } |
@@ -5742,32 +5742,32 @@ discard block |
||
5742 | 5742 | ); |
5743 | 5743 | |
5744 | 5744 | $nl = "\n"; |
5745 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
5746 | - $list .= '<p>' . $nl; |
|
5747 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
5748 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
5749 | - $list .= '</p><br/>' . $nl; |
|
5750 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
5751 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
5752 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
5753 | - $list .= '<br/>' . $nl; |
|
5745 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
5746 | + $list .= '<p>'.$nl; |
|
5747 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
5748 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
5749 | + $list .= '</p><br/>'.$nl; |
|
5750 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
5751 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
5752 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
5753 | + $list .= '<br/>'.$nl; |
|
5754 | 5754 | $first = true; |
5755 | 5755 | foreach ($arrayParams as $param => $label) { |
5756 | 5756 | if (isset($parsed[$param])) { |
5757 | 5757 | if ($first) { |
5758 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
5759 | - $list .= '<ul class="docBlockList">' . $nl; |
|
5758 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
5759 | + $list .= '<ul class="docBlockList">'.$nl; |
|
5760 | 5760 | $first = false; |
5761 | 5761 | } |
5762 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
5763 | - $list .= ' <ul>' . $nl; |
|
5762 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
5763 | + $list .= ' <ul>'.$nl; |
|
5764 | 5764 | foreach ($parsed[$param] as $val) { |
5765 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
5765 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
5766 | 5766 | } |
5767 | - $list .= ' </ul></li>' . $nl; |
|
5767 | + $list .= ' </ul></li>'.$nl; |
|
5768 | 5768 | } |
5769 | 5769 | } |
5770 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
5770 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
5771 | 5771 | |
5772 | 5772 | return $list; |
5773 | 5773 | } |
@@ -5843,7 +5843,7 @@ discard block |
||
5843 | 5843 | */ |
5844 | 5844 | public function addSnippet($name, $phpCode) |
5845 | 5845 | { |
5846 | - $this->snippetCache['#' . $name] = $phpCode; |
|
5846 | + $this->snippetCache['#'.$name] = $phpCode; |
|
5847 | 5847 | } |
5848 | 5848 | |
5849 | 5849 | /** |
@@ -5852,7 +5852,7 @@ discard block |
||
5852 | 5852 | */ |
5853 | 5853 | public function addChunk($name, $text) |
5854 | 5854 | { |
5855 | - $this->chunkCache['#' . $name] = $text; |
|
5855 | + $this->chunkCache['#'.$name] = $text; |
|
5856 | 5856 | } |
5857 | 5857 | |
5858 | 5858 | /** |
@@ -5888,7 +5888,7 @@ discard block |
||
5888 | 5888 | } |
5889 | 5889 | |
5890 | 5890 | if (!$isSafe) { |
5891 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
5891 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
5892 | 5892 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
5893 | 5893 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
5894 | 5894 | return; |
@@ -5902,7 +5902,7 @@ discard block |
||
5902 | 5902 | return 'array()'; |
5903 | 5903 | } |
5904 | 5904 | |
5905 | - $output = $echo . $return; |
|
5905 | + $output = $echo.$return; |
|
5906 | 5906 | modx_sanitize_gpc($output); |
5907 | 5907 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
5908 | 5908 | } |
@@ -5920,8 +5920,8 @@ discard block |
||
5920 | 5920 | |
5921 | 5921 | $safe = explode(',', $safe_functions); |
5922 | 5922 | |
5923 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
5924 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
5923 | + $phpcode = rtrim($phpcode, ';').';'; |
|
5924 | + $tokens = token_get_all('<?php '.$phpcode); |
|
5925 | 5925 | foreach ($tokens as $i => $token) { |
5926 | 5926 | if (!is_array($token)) { |
5927 | 5927 | continue; |
@@ -5957,7 +5957,7 @@ discard block |
||
5957 | 5957 | public function atBindFileContent($str = '') |
5958 | 5958 | { |
5959 | 5959 | |
5960 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); |
|
5960 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); |
|
5961 | 5961 | |
5962 | 5962 | if (stripos($str, '@FILE') !== 0) { |
5963 | 5963 | return $str; |
@@ -5980,7 +5980,7 @@ discard block |
||
5980 | 5980 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
5981 | 5981 | |
5982 | 5982 | foreach ($search_path as $path) { |
5983 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
5983 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
5984 | 5984 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
5985 | 5985 | return $errorMsg; |
5986 | 5986 | } elseif (is_file($file_path)) { |
@@ -5994,7 +5994,7 @@ discard block |
||
5994 | 5994 | return $errorMsg; |
5995 | 5995 | } |
5996 | 5996 | |
5997 | - $content = (string)file_get_contents($file_path); |
|
5997 | + $content = (string) file_get_contents($file_path); |
|
5998 | 5998 | if ($content === false) { |
5999 | 5999 | return $errorMsg; |
6000 | 6000 | } |
@@ -6107,22 +6107,22 @@ discard block |
||
6107 | 6107 | |
6108 | 6108 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
6109 | 6109 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
6110 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
6110 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
6111 | 6111 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
6112 | 6112 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
6113 | 6113 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
6114 | 6114 | if ($is_error) { |
6115 | 6115 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
6116 | 6116 | if ($msg != 'PHP Parse Error') { |
6117 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
6117 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
6118 | 6118 | } |
6119 | 6119 | } else { |
6120 | 6120 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
6121 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
6121 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
6122 | 6122 | } |
6123 | 6123 | |
6124 | 6124 | if (!empty ($query)) { |
6125 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">' . $query . '</span></div>'; |
|
6125 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">'.$query.'</span></div>'; |
|
6126 | 6126 | } |
6127 | 6127 | |
6128 | 6128 | $errortype = array( |
@@ -6145,13 +6145,13 @@ discard block |
||
6145 | 6145 | |
6146 | 6146 | if (!empty($nr) || !empty($file)) { |
6147 | 6147 | if ($text != '') { |
6148 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
6148 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
6149 | 6149 | } |
6150 | 6150 | if ($output != '') { |
6151 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
6151 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
6152 | 6152 | } |
6153 | 6153 | if ($nr !== '') { |
6154 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
6154 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
6155 | 6155 | } |
6156 | 6156 | if ($file) { |
6157 | 6157 | $table[] = array('File', $file); |
@@ -6171,7 +6171,7 @@ discard block |
||
6171 | 6171 | } |
6172 | 6172 | |
6173 | 6173 | if (!empty($this->event->activePlugin)) { |
6174 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
6174 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
6175 | 6175 | } |
6176 | 6176 | |
6177 | 6177 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6181,17 +6181,17 @@ discard block |
||
6181 | 6181 | $table[] = array('REQUEST_URI', $request_uri); |
6182 | 6182 | |
6183 | 6183 | if ($this->manager->action) { |
6184 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
6184 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
6185 | 6185 | global $action_list; |
6186 | 6186 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
6187 | 6187 | |
6188 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
6188 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
6189 | 6189 | } |
6190 | 6190 | |
6191 | 6191 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
6192 | 6192 | $resource = $this->getDocumentObject('id', $this->documentIdentifier); |
6193 | 6193 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
6194 | - $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); |
|
6194 | + $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); |
|
6195 | 6195 | } |
6196 | 6196 | $table[] = array('Referer', $referer); |
6197 | 6197 | $table[] = array('User Agent', $ua); |
@@ -6212,7 +6212,7 @@ discard block |
||
6212 | 6212 | |
6213 | 6213 | $mem = memory_get_peak_usage(true); |
6214 | 6214 | $total_mem = $mem - $this->mstart; |
6215 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
6215 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
6216 | 6216 | |
6217 | 6217 | $queryTime = $this->queryTime; |
6218 | 6218 | $phpTime = $totalTime - $queryTime; |
@@ -6233,18 +6233,18 @@ discard block |
||
6233 | 6233 | $str .= $this->get_backtrace(debug_backtrace()); |
6234 | 6234 | // Log error |
6235 | 6235 | if (!empty($this->currentSnippet)) { |
6236 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
6236 | + $source = 'Snippet - '.$this->currentSnippet; |
|
6237 | 6237 | } elseif (!empty($this->event->activePlugin)) { |
6238 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
6238 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
6239 | 6239 | } elseif ($source !== '') { |
6240 | - $source = 'Parser - ' . $source; |
|
6240 | + $source = 'Parser - '.$source; |
|
6241 | 6241 | } elseif ($query !== '') { |
6242 | 6242 | $source = 'SQL Query'; |
6243 | 6243 | } else { |
6244 | 6244 | $source = 'Parser'; |
6245 | 6245 | } |
6246 | 6246 | if ($msg) { |
6247 | - $source .= ' / ' . $msg; |
|
6247 | + $source .= ' / '.$msg; |
|
6248 | 6248 | } |
6249 | 6249 | if (isset($actionName) && !empty($actionName)) { |
6250 | 6250 | $source .= $actionName; |
@@ -6276,12 +6276,12 @@ discard block |
||
6276 | 6276 | |
6277 | 6277 | // Display error |
6278 | 6278 | if (isset($_SESSION['mgrValidated'])) { |
6279 | - echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' » ' . $release_date . '</title> |
|
6279 | + echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' » '.$release_date.'</title> |
|
6280 | 6280 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6281 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
6281 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
6282 | 6282 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
6283 | 6283 | </head><body> |
6284 | - ' . $str . '</body></html>'; |
|
6284 | + ' . $str.'</body></html>'; |
|
6285 | 6285 | |
6286 | 6286 | } else { |
6287 | 6287 | echo 'Error'; |
@@ -6319,7 +6319,7 @@ discard block |
||
6319 | 6319 | switch ($val['type']) { |
6320 | 6320 | case '->': |
6321 | 6321 | case '::': |
6322 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
6322 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
6323 | 6323 | break; |
6324 | 6324 | default: |
6325 | 6325 | $functionName = $val['function']; |
@@ -6329,7 +6329,7 @@ discard block |
||
6329 | 6329 | $args = array_pad(array(), $_, '$var'); |
6330 | 6330 | $args = implode(", ", $args); |
6331 | 6331 | $modx = &$this; |
6332 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6332 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
6333 | 6333 | $arg = $val['args'][$tmp - 1]; |
6334 | 6334 | switch (true) { |
6335 | 6335 | case is_null($arg): { |
@@ -6341,7 +6341,7 @@ discard block |
||
6341 | 6341 | break; |
6342 | 6342 | } |
6343 | 6343 | case is_scalar($arg): { |
6344 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); |
|
6344 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); |
|
6345 | 6345 | break; |
6346 | 6346 | } |
6347 | 6347 | case is_bool($arg): { |
@@ -6349,23 +6349,23 @@ discard block |
||
6349 | 6349 | break; |
6350 | 6350 | } |
6351 | 6351 | case is_array($arg): { |
6352 | - $out = 'array $var' . $tmp; |
|
6352 | + $out = 'array $var'.$tmp; |
|
6353 | 6353 | break; |
6354 | 6354 | } |
6355 | 6355 | case is_object($arg): { |
6356 | - $out = get_class($arg) . ' $var' . $tmp; |
|
6356 | + $out = get_class($arg).' $var'.$tmp; |
|
6357 | 6357 | break; |
6358 | 6358 | } |
6359 | 6359 | default: { |
6360 | - $out = '$var' . $tmp; |
|
6360 | + $out = '$var'.$tmp; |
|
6361 | 6361 | } |
6362 | 6362 | } |
6363 | 6363 | $tmp++; |
6364 | 6364 | return $out; |
6365 | 6365 | }, $args); |
6366 | 6366 | $line = array( |
6367 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
6368 | - $path . " on line " . $val['line'] |
|
6367 | + "<strong>".$functionName."</strong>(".$args.")", |
|
6368 | + $path." on line ".$val['line'] |
|
6369 | 6369 | ); |
6370 | 6370 | $table[] = array(implode("<br />", $line)); |
6371 | 6371 | } |
@@ -6406,7 +6406,7 @@ discard block |
||
6406 | 6406 | $alias = strip_tags($alias); // strip HTML |
6407 | 6407 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
6408 | 6408 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
6409 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6409 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6410 | 6410 | $alias = trim($alias, '-'); // trim excess |
6411 | 6411 | return $alias; |
6412 | 6412 | } |
@@ -6422,7 +6422,7 @@ discard block |
||
6422 | 6422 | $precisions = count($sizes) - 1; |
6423 | 6423 | foreach ($sizes as $unit => $bytes) { |
6424 | 6424 | if ($size >= $bytes) { |
6425 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
6425 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
6426 | 6426 | } |
6427 | 6427 | $precisions--; |
6428 | 6428 | } |
@@ -6526,10 +6526,10 @@ discard block |
||
6526 | 6526 | |
6527 | 6527 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
6528 | 6528 | return false; |
6529 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
6530 | - $file_path = MODX_BASE_PATH . $str; |
|
6531 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
6532 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
6529 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
6530 | + $file_path = MODX_BASE_PATH.$str; |
|
6531 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
6532 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
6533 | 6533 | } else { |
6534 | 6534 | return false; |
6535 | 6535 | } |
@@ -6655,7 +6655,7 @@ discard block |
||
6655 | 6655 | $title = 'no title'; |
6656 | 6656 | } |
6657 | 6657 | if (is_array($msg)) { |
6658 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
6658 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
6659 | 6659 | } elseif ($msg === '') { |
6660 | 6660 | $msg = $_SERVER['REQUEST_URI']; |
6661 | 6661 | } |
@@ -6700,7 +6700,7 @@ discard block |
||
6700 | 6700 | if (is_array($SystemAlertMsgQueque)) { |
6701 | 6701 | $title = ''; |
6702 | 6702 | if ($this->name && $this->activePlugin) { |
6703 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
6703 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
6704 | 6704 | } |
6705 | 6705 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
6706 | 6706 | } |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | } |
19 | 19 | |
20 | 20 | // andrazk 20070416 - if installer is running, destroy active sessions |
21 | -if (file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) { |
|
22 | - include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
21 | +if (file_exists(MODX_BASE_PATH.'assets/cache/installProc.inc.php')) { |
|
22 | + include_once(MODX_BASE_PATH.'assets/cache/installProc.inc.php'); |
|
23 | 23 | if (isset($installStartTime)) { |
24 | 24 | if ((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard |
25 | 25 | unset($installStartTime); |
26 | - @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755); |
|
27 | - unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php'); |
|
26 | + @ chmod(MODX_BASE_PATH.'assets/cache/installProc.inc.php', 0755); |
|
27 | + unlink(MODX_BASE_PATH.'assets/cache/installProc.inc.php'); |
|
28 | 28 | } else { |
29 | 29 | if ($_SERVER['REQUEST_METHOD'] != 'POST') { |
30 | 30 | if (isset($_COOKIE[session_name()])) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | // setcookie(session_name(), '', 0, MODX_BASE_URL); |
51 | 51 | } |
52 | 52 | header('HTTP/1.0 307 Redirect'); |
53 | - header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2'); |
|
53 | + header('Location: '.MODX_MANAGER_URL.'index.php?installGoingOn=2'); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | // establish fallback to English default |
63 | 63 | include_once "lang/english.inc.php"; |
64 | 64 | // include localized overrides |
65 | - include_once "lang/" . $manager_language . ".inc.php"; |
|
65 | + include_once "lang/".$manager_language.".inc.php"; |
|
66 | 66 | } else { |
67 | 67 | include_once "lang/english.inc.php"; |
68 | 68 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $modx->setPlaceholder('modx_charset', $modx_manager_charset); |
71 | 71 | $modx->setPlaceholder('theme', $manager_theme); |
72 | 72 | $modx->setPlaceholder('favicon', |
73 | - (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico')); |
|
73 | + (file_exists(MODX_BASE_PATH.'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/'.$modx->config['manager_theme'].'/images/favicon.ico')); |
|
74 | 74 | |
75 | 75 | // invoke OnManagerLoginFormPrerender event |
76 | 76 | $evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender'); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]); |
83 | 83 | $modx->setPlaceholder('login_message', $_lang["login_message"]); |
84 | 84 | $modx->setPlaceholder('manager_theme_url', |
85 | - MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/'); |
|
85 | + MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/'); |
|
86 | 86 | $modx->setPlaceholder('year', date('Y')); |
87 | 87 | |
88 | 88 | switch ($modx->config['manager_theme_mode']) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | break; |
98 | 98 | case '4': |
99 | 99 | $modx->setPlaceholder('manager_theme_style', 'darkness'); |
100 | - break; } |
|
100 | + break; } |
|
101 | 101 | |
102 | 102 | |
103 | 103 | // andrazk 20070416 - notify user of install/update |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | switch ($installGoingOn) { |
109 | 109 | case 1 : |
110 | 110 | $modx->setPlaceholder('login_message', |
111 | - "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
111 | + "<p><span class=\"fail\">".$_lang["login_cancelled_install_in_progress"]."</p><p>".$_lang["login_message"]."</p>"); |
|
112 | 112 | break; |
113 | 113 | case 2 : |
114 | 114 | $modx->setPlaceholder('login_message', |
115 | - "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>"); |
|
115 | + "<p><span class=\"fail\">".$_lang["login_cancelled_site_was_updated"]."</p><p>".$_lang["login_message"]."</p>"); |
|
116 | 116 | break; |
117 | 117 | } |
118 | 118 | } |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | if ($modx->config['use_captcha'] == 1) { |
121 | 121 | $modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]); |
122 | 122 | $modx->setPlaceholder('captcha_image', |
123 | - '<a href="' . MODX_MANAGER_URL . '" class="loginCaptcha"><img id="captcha_image" src="' . MODX_MANAGER_URL . 'includes/veriword.php?rand=' . rand() . '" alt="' . $_lang["login_captcha_message"] . '" /></a>'); |
|
123 | + '<a href="'.MODX_MANAGER_URL.'" class="loginCaptcha"><img id="captcha_image" src="'.MODX_MANAGER_URL.'includes/veriword.php?rand='.rand().'" alt="'.$_lang["login_captcha_message"].'" /></a>'); |
|
124 | 124 | $modx->setPlaceholder('captcha_input', |
125 | - '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
125 | + '<label>'.$_lang["captcha_code"].'</label> <input type="text" name="captcha_code" tabindex="3" value="" />'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | // login info |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | // invoke OnManagerLoginFormRender event |
142 | 142 | $evtOut = $modx->invokeEvent('OnManagerLoginFormRender'); |
143 | - $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : ''; |
|
143 | + $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">'.implode('', $evtOut).'</div>' : ''; |
|
144 | 144 | $modx->setPlaceholder('OnManagerLoginFormRender', $html); |
145 | 145 | |
146 | 146 | // load template |
@@ -158,29 +158,29 @@ discard block |
||
158 | 158 | $login_tpl = file_get_contents($target); |
159 | 159 | } |
160 | 160 | } else { |
161 | - $theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/'; |
|
162 | - if (is_file($theme_path . 'style.php')) { |
|
163 | - include($theme_path . 'style.php'); |
|
161 | + $theme_path = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/'; |
|
162 | + if (is_file($theme_path.'style.php')) { |
|
163 | + include($theme_path.'style.php'); |
|
164 | 164 | } |
165 | 165 | $chunk = $modx->getChunk($target); |
166 | 166 | if ($chunk !== false && !empty($chunk)) { |
167 | 167 | $login_tpl = $chunk; |
168 | - } elseif (is_file(MODX_BASE_PATH . $target)) { |
|
169 | - $target = MODX_BASE_PATH . $target; |
|
168 | + } elseif (is_file(MODX_BASE_PATH.$target)) { |
|
169 | + $target = MODX_BASE_PATH.$target; |
|
170 | 170 | $login_tpl = file_get_contents($target); |
171 | 171 | } elseif (is_file($target)) { |
172 | 172 | $login_tpl = file_get_contents($target); |
173 | - } elseif (is_file($theme_path . 'login.tpl')) { |
|
174 | - $target = $theme_path . 'login.tpl'; |
|
173 | + } elseif (is_file($theme_path.'login.tpl')) { |
|
174 | + $target = $theme_path.'login.tpl'; |
|
175 | 175 | $login_tpl = file_get_contents($target); |
176 | - } elseif (is_file($theme_path . 'templates/actions/login.tpl')) { |
|
177 | - $target = $theme_path . 'templates/actions/login.tpl'; |
|
176 | + } elseif (is_file($theme_path.'templates/actions/login.tpl')) { |
|
177 | + $target = $theme_path.'templates/actions/login.tpl'; |
|
178 | 178 | $login_tpl = file_get_contents($target); |
179 | - } elseif (is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible |
|
180 | - $target = $theme_path . 'html/login.html'; |
|
179 | + } elseif (is_file($theme_path.'html/login.html')) { // ClipperCMS compatible |
|
180 | + $target = $theme_path.'html/login.html'; |
|
181 | 181 | $login_tpl = file_get_contents($target); |
182 | 182 | } else { |
183 | - $target = MODX_MANAGER_PATH . 'media/style/common/login.tpl'; |
|
183 | + $target = MODX_MANAGER_PATH.'media/style/common/login.tpl'; |
|
184 | 184 | $login_tpl = file_get_contents($target); |
185 | 185 | } |
186 | 186 | } |
@@ -200,17 +200,17 @@ discard block |
||
200 | 200 | $modx->updateValidatedUserSession(); |
201 | 201 | |
202 | 202 | // Update last action in table active_users |
203 | - $itemid = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
|
203 | + $itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; |
|
204 | 204 | $lasthittime = time(); |
205 | - $action = isset($_REQUEST['a']) ? (int)$_REQUEST['a'] : 1; |
|
205 | + $action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1; |
|
206 | 206 | |
207 | 207 | if ($action !== 1) { |
208 | - if ((int)$itemid <= 0) { |
|
208 | + if ((int) $itemid <= 0) { |
|
209 | 209 | $itemid = null; |
210 | 210 | } |
211 | 211 | $sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", |
212 | 212 | $modx->getFullTableName('active_users') // Table |
213 | - , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string)$action, |
|
213 | + , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action, |
|
214 | 214 | $itemid == null ? var_export(null, true) : $itemid); |
215 | 215 | $modx->db->query($sql); |
216 | 216 | } |
@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | $action = "", |
37 | 37 | $itemid = "", |
38 | 38 | $itemname = "" |
39 | - ) { |
|
39 | + ){ |
|
40 | 40 | global $modx; |
41 | 41 | $this->entry['msg'] = $msg; // writes testmessage to the object |
42 | - $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
42 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
43 | 43 | |
44 | 44 | // User Credentials |
45 | 45 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
46 | 46 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
47 | 47 | |
48 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
48 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
49 | 49 | if ($this->entry['itemId'] == 0) { |
50 | 50 | $this->entry['itemId'] = "-"; |
51 | 51 | } // to stop items having id 0 |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | |
96 | 96 | $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
97 | 97 | if (!$insert_id) { |
98 | - $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->db->getLastError()); |
|
98 | + $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
|
99 | 99 | } else { |
100 | - $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000; |
|
101 | - $trim = (isset($modx->config['manager_log_trim'])) ? (int)$modx->config['manager_log_trim'] : 100; |
|
100 | + $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000; |
|
101 | + $trim = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100; |
|
102 | 102 | if (($insert_id % $trim) === 0) { |
103 | 103 | $modx->rotate_log('manager_log', $limit, $trim); |
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - private function getUserIP() { |
|
109 | - if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) { |
|
110 | - if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) { |
|
111 | - $addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
108 | + private function getUserIP(){ |
|
109 | + if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
110 | + if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') > 0) { |
|
111 | + $addr = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']); |
|
112 | 112 | return trim($addr[0]); |
113 | 113 | } else { |
114 | 114 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | exit(); |
4 | 4 | } |
5 | 5 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | <?php |
42 | 42 | $rs = $modx->db->select('*', $modx->getFullTableName('site_templates')); |
43 | 43 | $option[] = '<option value="">No selected</option>'; |
44 | - $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int)$_REQUEST['templateid'] : ''; |
|
44 | + $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int) $_REQUEST['templateid'] : ''; |
|
45 | 45 | $selected = $templateid === 0 ? ' selected="selected"' : ''; |
46 | - $option[] = '<option value="0"' . $selected . '>(blank)</option>'; |
|
46 | + $option[] = '<option value="0"'.$selected.'>(blank)</option>'; |
|
47 | 47 | while ($row = $modx->db->getRow($rs)) { |
48 | 48 | $templatename = htmlspecialchars($row['templatename'], ENT_QUOTES, $modx->config['modx_charset']); |
49 | 49 | $selected = $row['id'] == $templateid ? ' selected="selected"' : ''; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $searchfields = htmlentities(trim($_POST['searchfields']), ENT_QUOTES, $modx_manager_charset); |
87 | 87 | $searchlongtitle = $modx->db->escape(trim($_REQUEST['searchfields'])); |
88 | 88 | $search_alias = $modx->db->escape(trim($_REQUEST['searchfields'])); |
89 | - $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int)$_REQUEST['templateid'] : ''; |
|
89 | + $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int) $_REQUEST['templateid'] : ''; |
|
90 | 90 | $searchcontent = $modx->db->escape($_REQUEST['content']); |
91 | 91 | |
92 | 92 | $fields = 'DISTINCT sc.id, contenttype, pagetitle, longtitle, description, introtext, menutitle, deleted, published, isfolder, type'; |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | $friendly_url_suffix = $modx->config['friendly_url_suffix']; |
101 | 101 | $base_url = $modx->config['base_url']; |
102 | 102 | $site_url = $modx->config['site_url']; |
103 | - $url = preg_replace('@' . $friendly_url_suffix . '$@', '', $url); |
|
103 | + $url = preg_replace('@'.$friendly_url_suffix.'$@', '', $url); |
|
104 | 104 | if ($url[0] === '/') { |
105 | - $url = preg_replace('@^' . $base_url . '@', '', $url); |
|
105 | + $url = preg_replace('@^'.$base_url.'@', '', $url); |
|
106 | 106 | } |
107 | 107 | if (substr($url, 0, 4) === 'http') { |
108 | - $url = preg_replace('@^' . $site_url . '@', '', $url); |
|
108 | + $url = preg_replace('@^'.$site_url.'@', '', $url); |
|
109 | 109 | } |
110 | 110 | $idFromAlias = $modx->getIdFromAlias($url); |
111 | 111 | } |
@@ -118,18 +118,18 @@ discard block |
||
118 | 118 | $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
119 | 119 | $articul_result = $modx->db->query($articul_query); |
120 | 120 | $articul_id_array = $modx->db->makeArray($articul_result); |
121 | - if(count($articul_id_array)>0){ |
|
121 | + if (count($articul_id_array) > 0) { |
|
122 | 122 | $articul_id = ''; |
123 | 123 | $i = 1; |
124 | - foreach( $articul_id_array as $articul ) { |
|
125 | - $articul_id.=$articul['contentid']; |
|
126 | - if($i !== count($articul_id_array)){ |
|
127 | - $articul_id.=','; |
|
124 | + foreach ($articul_id_array as $articul) { |
|
125 | + $articul_id .= $articul['contentid']; |
|
126 | + if ($i !== count($articul_id_array)) { |
|
127 | + $articul_id .= ','; |
|
128 | 128 | } |
129 | 129 | $i++; |
130 | 130 | } |
131 | 131 | $articul_id_query = " OR sc.id IN ({$articul_id})"; |
132 | - }else{ |
|
132 | + } else { |
|
133 | 133 | $articul_id_query = ''; |
134 | 134 | } |
135 | 135 | /*end search by TV*/ |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if (ctype_digit($searchfields)) { |
138 | 138 | $sqladd .= "sc.id='{$searchfields}'"; |
139 | 139 | if (strlen($searchfields) > 3) { |
140 | - $sqladd .= $articul_id_query;//search by TV |
|
140 | + $sqladd .= $articul_id_query; //search by TV |
|
141 | 141 | $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'"; |
142 | 142 | } |
143 | 143 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'"; |
158 | 158 | $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'"; |
159 | 159 | $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'"; |
160 | - $sqladd .= $articul_id_query;//search by TV |
|
160 | + $sqladd .= $articul_id_query; //search by TV |
|
161 | 161 | $sqladd .= ")"; |
162 | 162 | } |
163 | 163 | } else if ($idFromAlias) { |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
182 | 182 | $mgrRole = (isset ($_SESSION['mgrRole']) && $_SESSION['mgrRole'] == 1) ? 1 : 0; |
183 | 183 | $docgrp_cond = $docgrp ? " OR dg.document_group IN ({$docgrp})" : ''; |
184 | - $fields .= ', MAX(IF(1=' . $mgrRole . ' OR sc.privatemgr=0' . $docgrp_cond . ',1,0)) AS hasAccess'; |
|
185 | - $sqladd = '(' . $sqladd . ") AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
184 | + $fields .= ', MAX(IF(1='.$mgrRole.' OR sc.privatemgr=0'.$docgrp_cond.',1,0)) AS hasAccess'; |
|
185 | + $sqladd = '('.$sqladd.") AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | if ($sqladd) { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $where = $sqladd; |
193 | 193 | |
194 | 194 | if ($where) { |
195 | - $rs = $modx->db->select($fields, $tbl_site_content . ' AS sc LEFT JOIN ' . $tbldg . ' AS dg ON dg.document=sc.id', $where, 'sc.id'); |
|
195 | + $rs = $modx->db->select($fields, $tbl_site_content.' AS sc LEFT JOIN '.$tbldg.' AS dg ON dg.document=sc.id', $where, 'sc.id'); |
|
196 | 196 | $limit = $modx->db->getRecordCount($rs); |
197 | 197 | } else { |
198 | 198 | $limit = 0; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | if ($limit < 1) { |
212 | 212 | echo $_lang['search_empty']; |
213 | 213 | } else { |
214 | - printf('<p>' . $_lang['search_results_returned_msg'] . '</p>', $limit); |
|
214 | + printf('<p>'.$_lang['search_results_returned_msg'].'</p>', $limit); |
|
215 | 215 | ?> |
216 | 216 | <script type="text/javascript" src="media/script/tablesort.js"></script> |
217 | 217 | <table class="grid sortabletable sortable-onload-2 rowstyle-even" id="table-1"> |
@@ -271,14 +271,14 @@ discard block |
||
271 | 271 | if (function_exists('mb_strlen') && function_exists('mb_substr')) { |
272 | 272 | ?> |
273 | 273 | <td<?= $tdClass ?>> |
274 | - <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset) . "..." : $row['pagetitle'] ?></a> |
|
274 | + <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset)."..." : $row['pagetitle'] ?></a> |
|
275 | 275 | </td> |
276 | - <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset) . "..." : $row['description'] ?></td> |
|
276 | + <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset)."..." : $row['description'] ?></td> |
|
277 | 277 | <?php |
278 | 278 | } else { |
279 | 279 | ?> |
280 | - <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20) . '...' : $row['pagetitle'] ?></td> |
|
281 | - <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35) . '...' : $row['description'] ?></td> |
|
280 | + <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20).'...' : $row['pagetitle'] ?></td> |
|
281 | + <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35).'...' : $row['description'] ?></td> |
|
282 | 282 | <?php |
283 | 283 | } |
284 | 284 | ?> |
@@ -298,115 +298,115 @@ discard block |
||
298 | 298 | if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
299 | 299 | $docscounts = $modx->db->getRecordCount($rs); |
300 | 300 | if ($docscounts > 0) { |
301 | - $output .= '<li><b><i class="fa fa-sitemap"></i> ' . $_lang["manage_documents"] . ' (' . $docscounts . ')</b></li>'; |
|
301 | + $output .= '<li><b><i class="fa fa-sitemap"></i> '.$_lang["manage_documents"].' ('.$docscounts.')</b></li>'; |
|
302 | 302 | while ($row = $modx->db->getRow($rs)) { |
303 | - $output .= '<li' . addClassForItemList('', !$row['published'], $row['deleted']) . '><a href="index.php?a=27&id=' . $row['id'] . '" id="content_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['pagetitle'] . ' <small>(' . $row['id'] . ')</small>', $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
303 | + $output .= '<li'.addClassForItemList('', !$row['published'], $row['deleted']).'><a href="index.php?a=27&id='.$row['id'].'" id="content_'.$row['id'].'" target="main">'.highlightingCoincidence($row['pagetitle'].' <small>('.$row['id'].')</small>', $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | } |
307 | 307 | |
308 | 308 | //templates |
309 | 309 | if ($modx->hasPermission('edit_template')) { |
310 | - $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%" . $searchfields . "%' |
|
311 | - OR `templatename` like '%" . $searchfields . "%' |
|
312 | - OR `description` like '%" . $searchfields . "%' |
|
313 | - OR `content` like '%" . $searchfields . "%'"); |
|
310 | + $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%".$searchfields."%' |
|
311 | + OR `templatename` like '%" . $searchfields."%' |
|
312 | + OR `description` like '%" . $searchfields."%' |
|
313 | + OR `content` like '%" . $searchfields."%'"); |
|
314 | 314 | $templatecounts = $modx->db->getRecordCount($rs); |
315 | 315 | if ($templatecounts > 0) { |
316 | - $output .= '<li><b><i class="fa fa-newspaper-o"></i> ' . $_lang["manage_templates"] . ' (' . $templatecounts . ')</b></li>'; |
|
316 | + $output .= '<li><b><i class="fa fa-newspaper-o"></i> '.$_lang["manage_templates"].' ('.$templatecounts.')</b></li>'; |
|
317 | 317 | while ($row = $modx->db->getRow($rs)) { |
318 | - $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=16&id=' . $row['id'] . '" id="templates_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
318 | + $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=16&id='.$row['id'].'" id="templates_'.$row['id'].'" target="main">'.highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | 323 | //tvs |
324 | 324 | if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
325 | - $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%" . $searchfields . "%' |
|
326 | - OR `name` like '%" . $searchfields . "%' |
|
327 | - OR `description` like '%" . $searchfields . "%' |
|
328 | - OR `type` like '%" . $searchfields . "%' |
|
329 | - OR `elements` like '%" . $searchfields . "%' |
|
330 | - OR `display` like '%" . $searchfields . "%' |
|
331 | - OR `display_params` like '%" . $searchfields . "%' |
|
332 | - OR `default_text` like '%" . $searchfields . "%'"); |
|
325 | + $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%".$searchfields."%' |
|
326 | + OR `name` like '%" . $searchfields."%' |
|
327 | + OR `description` like '%" . $searchfields."%' |
|
328 | + OR `type` like '%" . $searchfields."%' |
|
329 | + OR `elements` like '%" . $searchfields."%' |
|
330 | + OR `display` like '%" . $searchfields."%' |
|
331 | + OR `display_params` like '%" . $searchfields."%' |
|
332 | + OR `default_text` like '%" . $searchfields."%'"); |
|
333 | 333 | $tvscounts = $modx->db->getRecordCount($rs); |
334 | 334 | if ($tvscounts > 0) { |
335 | - $output .= '<li><b><i class="fa fa-list-alt"></i> ' . $_lang["settings_templvars"] . ' (' . $tvscounts . ')</b></li>'; |
|
335 | + $output .= '<li><b><i class="fa fa-list-alt"></i> '.$_lang["settings_templvars"].' ('.$tvscounts.')</b></li>'; |
|
336 | 336 | while ($row = $modx->db->getRow($rs)) { |
337 | - $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=301&id=' . $row['id'] . '" id="tmplvars_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
337 | + $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=301&id='.$row['id'].'" id="tmplvars_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | } |
341 | 341 | |
342 | 342 | //Chunks |
343 | 343 | if ($modx->hasPermission('edit_chunk')) { |
344 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%" . $searchfields . "%' |
|
345 | - OR `name` like '%" . $searchfields . "%' |
|
346 | - OR `description` like '%" . $searchfields . "%' |
|
347 | - OR `snippet` like '%" . $searchfields . "%'"); |
|
344 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%".$searchfields."%' |
|
345 | + OR `name` like '%" . $searchfields."%' |
|
346 | + OR `description` like '%" . $searchfields."%' |
|
347 | + OR `snippet` like '%" . $searchfields."%'"); |
|
348 | 348 | $chunkscounts = $modx->db->getRecordCount($rs); |
349 | 349 | if ($chunkscounts > 0) { |
350 | - $output .= '<li><b><i class="fa fa-th-large"></i> ' . $_lang["manage_htmlsnippets"] . ' (' . $chunkscounts . ')</b></li>'; |
|
350 | + $output .= '<li><b><i class="fa fa-th-large"></i> '.$_lang["manage_htmlsnippets"].' ('.$chunkscounts.')</b></li>'; |
|
351 | 351 | while ($row = $modx->db->getRow($rs)) { |
352 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=78&id=' . $row['id'] . '" id="htmlsnippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
352 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=78&id='.$row['id'].'" id="htmlsnippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | } |
356 | 356 | |
357 | 357 | //Snippets |
358 | 358 | if ($modx->hasPermission('edit_snippet')) { |
359 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%" . $searchfields . "%' |
|
360 | - OR `name` like '%" . $searchfields . "%' |
|
361 | - OR `description` like '%" . $searchfields . "%' |
|
362 | - OR `snippet` like '%" . $searchfields . "%' |
|
363 | - OR `properties` like '%" . $searchfields . "%' |
|
364 | - OR `moduleguid` like '%" . $searchfields . "%'"); |
|
359 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%".$searchfields."%' |
|
360 | + OR `name` like '%" . $searchfields."%' |
|
361 | + OR `description` like '%" . $searchfields."%' |
|
362 | + OR `snippet` like '%" . $searchfields."%' |
|
363 | + OR `properties` like '%" . $searchfields."%' |
|
364 | + OR `moduleguid` like '%" . $searchfields."%'"); |
|
365 | 365 | $snippetscounts = $modx->db->getRecordCount($rs); |
366 | 366 | if ($snippetscounts > 0) { |
367 | - $output .= '<li><b><i class="fa fa-code"></i> ' . $_lang["manage_snippets"] . ' (' . $snippetscounts . ')</b></li>'; |
|
367 | + $output .= '<li><b><i class="fa fa-code"></i> '.$_lang["manage_snippets"].' ('.$snippetscounts.')</b></li>'; |
|
368 | 368 | while ($row = $modx->db->getRow($rs)) { |
369 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=22&id=' . $row['id'] . '" id="snippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
369 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=22&id='.$row['id'].'" id="snippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | 374 | //plugins |
375 | 375 | if ($modx->hasPermission('edit_plugin')) { |
376 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%" . $searchfields . "%' |
|
377 | - OR `name` like '%" . $searchfields . "%' |
|
378 | - OR `description` like '%" . $searchfields . "%' |
|
379 | - OR `plugincode` like '%" . $searchfields . "%' |
|
380 | - OR `properties` like '%" . $searchfields . "%' |
|
381 | - OR `moduleguid` like '%" . $searchfields . "%'"); |
|
376 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%".$searchfields."%' |
|
377 | + OR `name` like '%" . $searchfields."%' |
|
378 | + OR `description` like '%" . $searchfields."%' |
|
379 | + OR `plugincode` like '%" . $searchfields."%' |
|
380 | + OR `properties` like '%" . $searchfields."%' |
|
381 | + OR `moduleguid` like '%" . $searchfields."%'"); |
|
382 | 382 | $pluginscounts = $modx->db->getRecordCount($rs); |
383 | 383 | if ($pluginscounts > 0) { |
384 | - $output .= '<li><b><i class="fa fa-plug"></i> ' . $_lang["manage_plugins"] . ' (' . $pluginscounts . ')</b></li>'; |
|
384 | + $output .= '<li><b><i class="fa fa-plug"></i> '.$_lang["manage_plugins"].' ('.$pluginscounts.')</b></li>'; |
|
385 | 385 | while ($row = $modx->db->getRow($rs)) { |
386 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=102&id=' . $row['id'] . '" id="plugins_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
386 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=102&id='.$row['id'].'" id="plugins_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
387 | 387 | } |
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | 391 | //modules |
392 | 392 | if ($modx->hasPermission('edit_module')) { |
393 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%" . $searchfields . "%' |
|
394 | - OR `name` like '%" . $searchfields . "%' |
|
395 | - OR `description` like '%" . $searchfields . "%' |
|
396 | - OR `modulecode` like '%" . $searchfields . "%' |
|
397 | - OR `properties` like '%" . $searchfields . "%' |
|
398 | - OR `guid` like '%" . $searchfields . "%' |
|
399 | - OR `resourcefile` like '%" . $searchfields . "%'"); |
|
393 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%".$searchfields."%' |
|
394 | + OR `name` like '%" . $searchfields."%' |
|
395 | + OR `description` like '%" . $searchfields."%' |
|
396 | + OR `modulecode` like '%" . $searchfields."%' |
|
397 | + OR `properties` like '%" . $searchfields."%' |
|
398 | + OR `guid` like '%" . $searchfields."%' |
|
399 | + OR `resourcefile` like '%" . $searchfields."%'"); |
|
400 | 400 | $modulescounts = $modx->db->getRecordCount($rs); |
401 | 401 | if ($modulescounts > 0) { |
402 | - $output .= '<li><b><i class="fa fa-cogs"></i> ' . $_lang["modules"] . ' (' . $modulescounts . ')</b></li>'; |
|
402 | + $output .= '<li><b><i class="fa fa-cogs"></i> '.$_lang["modules"].' ('.$modulescounts.')</b></li>'; |
|
403 | 403 | while ($row = $modx->db->getRow($rs)) { |
404 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=108&id=' . $row['id'] . '" id="modules_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
404 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=108&id='.$row['id'].'" id="modules_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
405 | 405 | } |
406 | 406 | } |
407 | 407 | } |
408 | 408 | |
409 | - echo $output ? '<div class="ajaxSearchResults"><ul>' . $output . '</ul></div>' : '1'; |
|
409 | + echo $output ? '<div class="ajaxSearchResults"><ul>'.$output.'</ul></div>' : '1'; |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | ?> |
@@ -422,13 +422,13 @@ discard block |
||
422 | 422 | */ |
423 | 423 | function highlightingCoincidence($text, $search) |
424 | 424 | { |
425 | - $regexp = '!(' . str_replace(array( |
|
425 | + $regexp = '!('.str_replace(array( |
|
426 | 426 | '(', |
427 | 427 | ')' |
428 | 428 | ), array( |
429 | 429 | '\(', |
430 | 430 | '\)' |
431 | - ), trim($search)) . ')!isu'; |
|
431 | + ), trim($search)).')!isu'; |
|
432 | 432 | return preg_replace($regexp, '<span class="text-danger">$1</span>', $text); |
433 | 433 | } |
434 | 434 | |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | $class .= ' deleted'; |
452 | 452 | } |
453 | 453 | if ($class) { |
454 | - $class = ' class="' . trim($class) . '"'; |
|
454 | + $class = ' class="'.trim($class).'"'; |
|
455 | 455 | } |
456 | 456 | return $class; |
457 | 457 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | header("X-XSS-Protection: 0"); |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | |
48 | 48 | $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness'); |
49 | 49 | if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) { |
50 | - $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']]; |
|
50 | + $body_class .= ' '.$theme_modes[$_COOKIE['MODX_themeMode']]; |
|
51 | 51 | } elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) { |
52 | - $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']]; |
|
52 | + $body_class .= ' '.$theme_modes[$modx->config['manager_theme_mode']]; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -78,36 +78,36 @@ discard block |
||
78 | 78 | $user['which_browser'] = $modx->config['which_browser']; |
79 | 79 | } |
80 | 80 | |
81 | -$css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime; |
|
81 | +$css = 'media/style/'.$modx->config['manager_theme'].'/css/page.css?v='.$lastInstallTime; |
|
82 | 82 | |
83 | 83 | if ($modx->config['manager_theme'] == 'default') { |
84 | - if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
85 | - require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
|
84 | + if (!file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css') && is_writable(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css')) { |
|
85 | + require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php'; |
|
86 | 86 | $minifier = new Formatter\CSSMinify(); |
87 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
88 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
89 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css'); |
|
90 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css'); |
|
91 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css'); |
|
92 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css'); |
|
93 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css'); |
|
94 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css'); |
|
95 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css'); |
|
96 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css'); |
|
97 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css'); |
|
87 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
88 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
89 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css'); |
|
90 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css'); |
|
91 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css'); |
|
92 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css'); |
|
93 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css'); |
|
94 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css'); |
|
95 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css'); |
|
96 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css'); |
|
97 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css'); |
|
98 | 98 | $css = $minifier->minify(); |
99 | - file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
|
99 | + file_put_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css', $css); |
|
100 | 100 | } |
101 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
102 | - $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
|
101 | + if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) { |
|
102 | + $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | -$modx->config['global_tabs'] = (int)($modx->config['global_tabs'] && ($user['role'] == 1 || $modx->hasPermission('edit_template') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_plugin'))); |
|
106 | +$modx->config['global_tabs'] = (int) ($modx->config['global_tabs'] && ($user['role'] == 1 || $modx->hasPermission('edit_template') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_plugin'))); |
|
107 | 107 | |
108 | 108 | ?> |
109 | 109 | <!DOCTYPE html> |
110 | -<html <?= (isset($modx_textdir) && $modx_textdir ? 'dir="rtl" lang="' : 'lang="') . $mxla . '" xml:lang="' . $mxla . '"' ?>> |
|
110 | +<html <?= (isset($modx_textdir) && $modx_textdir ? 'dir="rtl" lang="' : 'lang="').$mxla.'" xml:lang="'.$mxla.'"' ?>> |
|
111 | 111 | <head> |
112 | 112 | <title><?= $site_name ?>- (EVO CMS Manager)</title> |
113 | 113 | <meta http-equiv="Content-Type" content="text/html; charset=<?= $modx_manager_charset ?>" /> |
@@ -138,21 +138,21 @@ discard block |
||
138 | 138 | MODX_SITE_URL: '<?= MODX_SITE_URL ?>', |
139 | 139 | MODX_MANAGER_URL: '<?= MODX_MANAGER_URL ?>', |
140 | 140 | user: { |
141 | - role: <?= (int)$user['role'] ?>, |
|
141 | + role: <?= (int) $user['role'] ?>, |
|
142 | 142 | username: '<?= $user['username'] ?>' |
143 | 143 | }, |
144 | 144 | config: { |
145 | 145 | mail_check_timeperiod: <?= $modx->config['mail_check_timeperiod'] ?>, |
146 | - menu_height: <?= (int)$menu_height ?>, |
|
147 | - tree_width: <?= (int)$tree_width ?>, |
|
148 | - tree_min_width: <?= (int)$tree_min_width ?>, |
|
149 | - session_timeout: <?= (int)$modx->config['session_timeout'] ?>, |
|
150 | - site_start: <?= (int)$modx->config['site_start'] ?>, |
|
151 | - tree_page_click: <?=(!empty($modx->config['tree_page_click']) ? (int)$modx->config['tree_page_click'] : 27) ?>, |
|
146 | + menu_height: <?= (int) $menu_height ?>, |
|
147 | + tree_width: <?= (int) $tree_width ?>, |
|
148 | + tree_min_width: <?= (int) $tree_min_width ?>, |
|
149 | + session_timeout: <?= (int) $modx->config['session_timeout'] ?>, |
|
150 | + site_start: <?= (int) $modx->config['site_start'] ?>, |
|
151 | + tree_page_click: <?=(!empty($modx->config['tree_page_click']) ? (int) $modx->config['tree_page_click'] : 27) ?>, |
|
152 | 152 | theme: '<?= $modx->config['manager_theme'] ?>', |
153 | 153 | theme_mode: '<?= $modx->config['manager_theme_mode'] ?>', |
154 | 154 | which_browser: '<?= $user['which_browser'] ?>', |
155 | - layout: <?= (int)$manager_layout ?>, |
|
155 | + layout: <?= (int) $manager_layout ?>, |
|
156 | 156 | textdir: '<?= $modx_textdir ?>', |
157 | 157 | global_tabs: <?= $modx->config['global_tabs'] ?> |
158 | 158 | |
@@ -237,11 +237,11 @@ discard block |
||
237 | 237 | delete a[b]; |
238 | 238 | }, |
239 | 239 | openedArray: [], |
240 | - lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE) . "\n" ?> |
|
240 | + lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)."\n" ?> |
|
241 | 241 | }; |
242 | 242 | <?php |
243 | 243 | $opened = array_filter(array_map('intval', explode('|', $_SESSION['openedArray']))); |
244 | - echo (empty($opened) ? '' : 'modx.openedArray[' . implode("] = 1;\n modx.openedArray[", $opened) . '] = 1;') . "\n"; |
|
244 | + echo (empty($opened) ? '' : 'modx.openedArray['.implode("] = 1;\n modx.openedArray[", $opened).'] = 1;')."\n"; |
|
245 | 245 | ?> |
246 | 246 | </script> |
247 | 247 | <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/modx.min.js?v=<?= $lastInstallTime ?>"></script> |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | <a href="javascript:;" class="dropdown-toggle" onclick="return false;"> |
324 | 324 | <span class="username"><?= $user['username'] ?></span> |
325 | 325 | <?php if ($user['photo']) { ?> |
326 | - <span class="icon photo" style="background-image: url(<?= MODX_SITE_URL . $user['photo'] ?>);"></span> |
|
326 | + <span class="icon photo" style="background-image: url(<?= MODX_SITE_URL.$user['photo'] ?>);"></span> |
|
327 | 327 | <?php } else { ?> |
328 | 328 | <span class="icon"><?= $_style['menu_user'] ?></span> |
329 | 329 | <?php } ?> |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $version = 'Evolution'; |
351 | 351 | ?> |
352 | 352 | <?php |
353 | - echo sprintf('<li><span class="dropdown-item" title="%s – %s" %s>' . $version . ' %s</span></li>', $site_name, $modx->getVersionData('full_appname'), $style, $modx->config['settings_version']); |
|
353 | + echo sprintf('<li><span class="dropdown-item" title="%s – %s" %s>'.$version.' %s</span></li>', $site_name, $modx->getVersionData('full_appname'), $style, $modx->config['settings_version']); |
|
354 | 354 | ?> |
355 | 355 | </ul> |
356 | 356 | </li> |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | */ |
532 | 532 | function constructLink($action, $img, $text, $allowed) |
533 | 533 | { |
534 | - if ((bool)$allowed) { |
|
534 | + if ((bool) $allowed) { |
|
535 | 535 | echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action, $action); |
536 | 536 | echo sprintf('<i class="%s"></i> %s</div>', $img, $text); |
537 | 537 | } |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | <script type="text/javascript"> |
543 | 543 | |
544 | 544 | if (document.getElementById('treeMenu')) { |
545 | - <?php if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?> |
|
545 | + <?php if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?> |
|
546 | 546 | |
547 | 547 | document.getElementById('treeMenu_openelements').onclick = function(e) { |
548 | 548 | e.preventDefault(); |
@@ -560,12 +560,12 @@ discard block |
||
560 | 560 | } |
561 | 561 | }; |
562 | 562 | <?php } ?> |
563 | - <?php if($use_browser && $modx->hasPermission('assets_images')) { ?> |
|
563 | + <?php if ($use_browser && $modx->hasPermission('assets_images')) { ?> |
|
564 | 564 | |
565 | 565 | document.getElementById('treeMenu_openimages').onclick = function(e) { |
566 | 566 | e.preventDefault(); |
567 | 567 | if (modx.config.global_tabs && !e.shiftKey) { |
568 | - modx.tabs({url: '<?= MODX_MANAGER_URL . 'media/browser/' . $which_browser . '/browse.php?filemanager=media/browser/' . $which_browser . '/browse.php&type=images' ?>', title: '<?= $_lang["images_management"] ?>'}); |
|
568 | + modx.tabs({url: '<?= MODX_MANAGER_URL.'media/browser/'.$which_browser.'/browse.php?filemanager=media/browser/'.$which_browser.'/browse.php&type=images' ?>', title: '<?= $_lang["images_management"] ?>'}); |
|
569 | 569 | } else { |
570 | 570 | var randomNum = '<?= $_lang["files_files"] ?>'; |
571 | 571 | if (e.shiftKey) { |
@@ -578,12 +578,12 @@ discard block |
||
578 | 578 | } |
579 | 579 | }; |
580 | 580 | <?php } ?> |
581 | - <?php if($use_browser && $modx->hasPermission('assets_files')) { ?> |
|
581 | + <?php if ($use_browser && $modx->hasPermission('assets_files')) { ?> |
|
582 | 582 | |
583 | 583 | document.getElementById('treeMenu_openfiles').onclick = function(e) { |
584 | 584 | e.preventDefault(); |
585 | 585 | if (modx.config.global_tabs && !e.shiftKey) { |
586 | - modx.tabs({url: '<?= MODX_MANAGER_URL . 'media/browser/' . $which_browser . '/browse.php?filemanager=media/browser/' . $which_browser . '/browse.php&type=files' ?>', title: '<?= $_lang["files_files"] ?>'}); |
|
586 | + modx.tabs({url: '<?= MODX_MANAGER_URL.'media/browser/'.$which_browser.'/browse.php?filemanager=media/browser/'.$which_browser.'/browse.php&type=files' ?>', title: '<?= $_lang["files_files"] ?>'}); |
|
587 | 587 | } else { |
588 | 588 | var randomNum = '<?= $_lang["files_files"] ?>'; |
589 | 589 | if (e.shiftKey) { |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | |
638 | 638 | </div> |
639 | 639 | <?php if ($modx->config['show_picker'] != "0") { |
640 | - include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php'); |
|
640 | + include('media/style/'.$modx->config['manager_theme'].'/color.switcher.php'); |
|
641 | 641 | } ?> |
642 | 642 | </body> |
643 | 643 | </html> |
@@ -20,37 +20,37 @@ discard block |
||
20 | 20 | $body_class = ''; |
21 | 21 | $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness'); |
22 | 22 | if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) { |
23 | - $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']]; |
|
23 | + $body_class .= ' '.$theme_modes[$_COOKIE['MODX_themeMode']]; |
|
24 | 24 | } elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) { |
25 | - $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']]; |
|
25 | + $body_class .= ' '.$theme_modes[$modx->config['manager_theme_mode']]; |
|
26 | 26 | } |
27 | 27 | |
28 | -$css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime; |
|
28 | +$css = 'media/style/'.$modx->config['manager_theme'].'/style.css?v='.$lastInstallTime; |
|
29 | 29 | |
30 | 30 | if ($modx->config['manager_theme'] == 'default') { |
31 | - if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') |
|
32 | - && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
33 | - require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
|
31 | + if (!file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css') |
|
32 | + && is_writable(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css')) { |
|
33 | + require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php'; |
|
34 | 34 | $minifier = new Formatter\CSSMinify(); |
35 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
36 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
37 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css'); |
|
38 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css'); |
|
39 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css'); |
|
40 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css'); |
|
41 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css'); |
|
42 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css'); |
|
43 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css'); |
|
44 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css'); |
|
45 | - $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css'); |
|
35 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css'); |
|
36 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css'); |
|
37 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css'); |
|
38 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css'); |
|
39 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css'); |
|
40 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css'); |
|
41 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css'); |
|
42 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css'); |
|
43 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css'); |
|
44 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css'); |
|
45 | + $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css'); |
|
46 | 46 | $css = $minifier->minify(); |
47 | 47 | file_put_contents( |
48 | - MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', |
|
48 | + MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css', |
|
49 | 49 | $css |
50 | 50 | ); |
51 | 51 | } |
52 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
53 | - $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
|
52 | + if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) { |
|
53 | + $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime; |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | <meta http-equiv="X-UA-Compatible" content="IE=edge"/> |
66 | 66 | <link rel="stylesheet" type="text/css" href="<?= $css ?>"/> |
67 | 67 | <script type="text/javascript" src="media/script/tabpane.js"></script> |
68 | - <?= sprintf('<script type="text/javascript" src="%s"></script>' . "\n", $modx->config['mgr_jquery_path']) ?> |
|
68 | + <?= sprintf('<script type="text/javascript" src="%s"></script>'."\n", $modx->config['mgr_jquery_path']) ?> |
|
69 | 69 | <?php if ($modx->config['show_picker'] != "0") { ?> |
70 | 70 | <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/color.switcher.js" |
71 | 71 | type="text/javascript"></script> |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | <?php } ?> |
79 | 79 | |
80 | 80 | <!-- OnManagerMainFrameHeaderHTMLBlock --> |
81 | - <?= $onManagerMainFrameHeaderHTMLBlock . "\n" ?> |
|
81 | + <?= $onManagerMainFrameHeaderHTMLBlock."\n" ?> |
|
82 | 82 | |
83 | 83 | <script type="text/javascript"> |
84 | 84 | if (!evo) { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | <script> |
108 | 108 | <?php |
109 | 109 | if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) { |
110 | - echo 'doRefresh(' . $_REQUEST['r'] . ");\n"; |
|
110 | + echo 'doRefresh('.$_REQUEST['r'].");\n"; |
|
111 | 111 | } |
112 | 112 | ?> |
113 | 113 | </script> |