@@ -248,9 +248,9 @@ |
||
248 | 248 | echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_not_exist'] . '</p>'; |
249 | 249 | $errors++; |
250 | 250 | echo '<p>' . $_lang['table_prefix_not_exist_note'] . '</p>'; |
251 | - } else { |
|
251 | + } else { |
|
252 | 252 | echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
253 | - } |
|
253 | + } |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | // check mysql version |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! function_exists('f_owc')){ |
|
2 | +if (!function_exists('f_owc')) { |
|
3 | 3 | /** |
4 | 4 | * @param $path |
5 | 5 | * @param $data |
@@ -12,30 +12,30 @@ discard block |
||
12 | 12 | fwrite($hnd, $data); |
13 | 13 | fclose($hnd); |
14 | 14 | |
15 | - if(null !== $mode) chmod($path, $mode); |
|
16 | - }catch(Exception $e){ |
|
15 | + if (null !== $mode) chmod($path, $mode); |
|
16 | + } catch (Exception $e) { |
|
17 | 17 | // Nothing, this is NOT normal |
18 | 18 | unset($e); |
19 | 19 | } |
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | -$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
|
24 | -if( ! isset($_lang)) $_lang = array(); |
|
23 | +$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0; |
|
24 | +if (!isset($_lang)) $_lang = array(); |
|
25 | 25 | |
26 | 26 | echo '<div class="stepcontainer"> |
27 | 27 | <ul class="progressbar"> |
28 | - <li class="visited">' . $_lang['choose_language'] . '</li> |
|
29 | - <li class="visited">' . $_lang['installation_mode'] . '</li> |
|
30 | - <li class="visited">' . $_lang['optional_items'] . '</li> |
|
31 | - <li class="active">' . $_lang['preinstall_validation'] . '</li> |
|
32 | - <li>' . $_lang['install_results'] . '</li> |
|
28 | + <li class="visited">' . $_lang['choose_language'].'</li> |
|
29 | + <li class="visited">' . $_lang['installation_mode'].'</li> |
|
30 | + <li class="visited">' . $_lang['optional_items'].'</li> |
|
31 | + <li class="active">' . $_lang['preinstall_validation'].'</li> |
|
32 | + <li>' . $_lang['install_results'].'</li> |
|
33 | 33 | </ul> |
34 | 34 | <div class="clearleft"></div> |
35 | 35 | </div>'; |
36 | 36 | |
37 | -echo '<h2>' . $_lang['preinstall_validation'] . '</h2>'; |
|
38 | -echo '<h3>' . $_lang['summary_setup_check'] . '</h3>'; |
|
37 | +echo '<h2>'.$_lang['preinstall_validation'].'</h2>'; |
|
38 | +echo '<h3>'.$_lang['summary_setup_check'].'</h3>'; |
|
39 | 39 | |
40 | 40 | $errors = 0; |
41 | 41 | |
@@ -43,73 +43,73 @@ discard block |
||
43 | 43 | // check PHP version |
44 | 44 | define('PHP_MIN_VERSION', '5.4.0'); |
45 | 45 | $phpMinVersion = PHP_MIN_VERSION; // Maybe not necessary. For backward compatibility |
46 | -echo '<p>' . $_lang['checking_php_version']; |
|
46 | +echo '<p>'.$_lang['checking_php_version']; |
|
47 | 47 | // -1 if left is less, 0 if equal, +1 if left is higher |
48 | 48 | if (version_compare(phpversion(), PHP_MIN_VERSION) < 0) { |
49 | 49 | $errors++; |
50 | - $tmp = $_lang['you_running_php'] . phpversion() . str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
51 | - echo '<span class="notok">' . $_lang['failed'] . '</span>' . $tmp . '</p>'; |
|
50 | + $tmp = $_lang['you_running_php'].phpversion().str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]); |
|
51 | + echo '<span class="notok">'.$_lang['failed'].'</span>'.$tmp.'</p>'; |
|
52 | 52 | } else { |
53 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
53 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | // check if iconv is available |
58 | -echo '<p>' . $_lang['checking_iconv']; |
|
58 | +echo '<p>'.$_lang['checking_iconv']; |
|
59 | 59 | $iconv = (int) function_exists('iconv'); |
60 | -if ($iconv == '0'){ |
|
61 | - echo '<span class="notok">' . $_lang['failed'].'</span></p><p><strong>'.$_lang['checking_iconv_note'].'</strong></p>'; |
|
60 | +if ($iconv == '0') { |
|
61 | + echo '<span class="notok">'.$_lang['failed'].'</span></p><p><strong>'.$_lang['checking_iconv_note'].'</strong></p>'; |
|
62 | 62 | $errors++; |
63 | 63 | } else { |
64 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
64 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
65 | 65 | } |
66 | 66 | // check sessions |
67 | -echo '<p>' . $_lang['checking_sessions']; |
|
67 | +echo '<p>'.$_lang['checking_sessions']; |
|
68 | 68 | if ($_SESSION['test'] != 1) { |
69 | - echo '<span class="notok">' . $_lang['failed']. '</span></p>'; |
|
69 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
70 | 70 | $errors++; |
71 | 71 | } else { |
72 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
72 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | 76 | // check directories |
77 | 77 | // cache exists? |
78 | -echo '<p>' . $_lang['checking_if_cache_exist']; |
|
78 | +echo '<p>'.$_lang['checking_if_cache_exist']; |
|
79 | 79 | if (!file_exists("../assets/cache") || !file_exists("../assets/cache/rss")) { |
80 | - echo '<span class="notok">' . $_lang['failed'] . '</span></p>'; |
|
80 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
81 | 81 | $errors++; |
82 | 82 | } else { |
83 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
83 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
87 | 87 | // cache writable? |
88 | -echo '<p>' . $_lang['checking_if_cache_writable']; |
|
88 | +echo '<p>'.$_lang['checking_if_cache_writable']; |
|
89 | 89 | if (!is_writable("../assets/cache")) { |
90 | 90 | $errors++; |
91 | - echo '<span class="notok">' . $_lang['failed'] . '</span></p>'; |
|
91 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
92 | 92 | } else { |
93 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
93 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
97 | 97 | // cache files writable? |
98 | -echo '<p>' . $_lang['checking_if_cache_file_writable']; |
|
98 | +echo '<p>'.$_lang['checking_if_cache_file_writable']; |
|
99 | 99 | $tmp = "../assets/cache/siteCache.idx.php"; |
100 | -if ( ! file_exists($tmp)) { |
|
100 | +if (!file_exists($tmp)) { |
|
101 | 101 | f_owc($tmp, "<?php //EVO site cache file ?>"); |
102 | 102 | } |
103 | -if ( ! is_writable($tmp)) { |
|
103 | +if (!is_writable($tmp)) { |
|
104 | 104 | $errors++; |
105 | - echo '<span class="notok">' . $_lang['failed'] . '</span></p>'; |
|
105 | + echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
|
106 | 106 | } else { |
107 | 107 | echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
108 | 108 | } |
109 | 109 | |
110 | 110 | |
111 | 111 | echo '<p>'.$_lang['checking_if_cache_file2_writable']; |
112 | -if ( ! is_writable("../assets/cache/sitePublishing.idx.php")) { |
|
112 | +if (!is_writable("../assets/cache/sitePublishing.idx.php")) { |
|
113 | 113 | $errors++; |
114 | 114 | echo '<span class="notok">'.$_lang['failed'].'</span></p>'; |
115 | 115 | } else { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | // File Browser directories exists? |
121 | 121 | echo '<p>'.$_lang['checking_if_images_exist']; |
122 | -switch(true){ |
|
122 | +switch (true) { |
|
123 | 123 | case !file_exists("../assets/images"): |
124 | 124 | case !file_exists("../assets/files"): |
125 | 125 | case !file_exists("../assets/backup"): |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | // File Browser directories writable? |
136 | 136 | echo '<p>'.$_lang['checking_if_images_writable']; |
137 | -switch(true){ |
|
137 | +switch (true) { |
|
138 | 138 | case !is_writable("../assets/images"): |
139 | 139 | case !is_writable("../assets/files"): |
140 | 140 | case !is_writable("../assets/backup"): |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1); |
195 | 195 | $database_connection_charset = $_POST['database_connection_charset']; |
196 | 196 | $database_connection_method = $_POST['database_connection_method']; |
197 | - $dbase = '`' . $_POST['database_name'] . '`'; |
|
197 | + $dbase = '`'.$_POST['database_name'].'`'; |
|
198 | 198 | $table_prefix = $_POST['tableprefix']; |
199 | 199 | } |
200 | 200 | echo '<p>'.$_lang['creating_database_connection']; |
@@ -234,54 +234,54 @@ discard block |
||
234 | 234 | |
235 | 235 | // check table prefix |
236 | 236 | if ($conn && $installMode == 0) { |
237 | - echo '<p>' . $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
238 | - if ($rs= mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
239 | - echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_already_inuse'] . '</p>'; |
|
237 | + echo '<p>'.$_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
238 | + if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
239 | + echo '<span class="notok">'.$_lang['failed'].'</span></b>'.$_lang['table_prefix_already_inuse'].'</p>'; |
|
240 | 240 | $errors++; |
241 | - echo "<p>" . $_lang['table_prefix_already_inuse_note'] . '</p>'; |
|
241 | + echo "<p>".$_lang['table_prefix_already_inuse_note'].'</p>'; |
|
242 | 242 | } else { |
243 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
243 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
244 | 244 | } |
245 | 245 | } elseif ($conn && $installMode == 2) { |
246 | - echo '<p>' . $_lang['checking_table_prefix'] . $table_prefix . '`: '; |
|
247 | - if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
248 | - echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_not_exist'] . '</p>'; |
|
246 | + echo '<p>'.$_lang['checking_table_prefix'].$table_prefix.'`: '; |
|
247 | + if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
248 | + echo '<span class="notok">'.$_lang['failed'].'</span></b>'.$_lang['table_prefix_not_exist'].'</p>'; |
|
249 | 249 | $errors++; |
250 | - echo '<p>' . $_lang['table_prefix_not_exist_note'] . '</p>'; |
|
250 | + echo '<p>'.$_lang['table_prefix_not_exist_note'].'</p>'; |
|
251 | 251 | } else { |
252 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
252 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | 256 | // check mysql version |
257 | 257 | if ($conn) { |
258 | - echo '<p>' . $_lang['checking_mysql_version']; |
|
259 | - if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) { |
|
260 | - echo '<span class="notok">' . $_lang['warning'] . '</span></b> <strong>' . $_lang['mysql_5051'] . '</strong></p>'; |
|
261 | - echo '<p><span class="notok">' . $_lang['mysql_5051_warning'] . '</span></p>'; |
|
258 | + echo '<p>'.$_lang['checking_mysql_version']; |
|
259 | + if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) { |
|
260 | + echo '<span class="notok">'.$_lang['warning'].'</span></b> <strong>'.$_lang['mysql_5051'].'</strong></p>'; |
|
261 | + echo '<p><span class="notok">'.$_lang['mysql_5051_warning'].'</span></p>'; |
|
262 | 262 | } else { |
263 | - echo '<span class="ok">' . $_lang['ok'] . '</span> <strong>' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . '</strong></p>'; |
|
263 | + echo '<span class="ok">'.$_lang['ok'].'</span> <strong>'.$_lang['mysql_version_is'].mysqli_get_server_info($conn).'</strong></p>'; |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | 267 | // check for strict mode |
268 | 268 | if ($conn) { |
269 | - echo '<p>'. $_lang['checking_mysql_strict_mode']; |
|
269 | + echo '<p>'.$_lang['checking_mysql_strict_mode']; |
|
270 | 270 | $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode"); |
271 | - if (mysqli_num_rows($mysqlmode) > 0){ |
|
271 | + if (mysqli_num_rows($mysqlmode) > 0) { |
|
272 | 272 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
273 | 273 | //$modes = array("STRICT_TRANS_TABLES"); // for testing |
274 | 274 | // print_r($modes); |
275 | 275 | foreach ($modes as $mode) { |
276 | 276 | if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) { |
277 | - echo '<span class="notok">' . $_lang['warning'] . '</span></b> <strong> ' . $_lang['strict_mode'] . '</strong></p>'; |
|
278 | - echo '<p><span class="notok">' . $_lang['strict_mode_error'] . '</span></p>'; |
|
277 | + echo '<span class="notok">'.$_lang['warning'].'</span></b> <strong> '.$_lang['strict_mode'].'</strong></p>'; |
|
278 | + echo '<p><span class="notok">'.$_lang['strict_mode_error'].'</span></p>'; |
|
279 | 279 | } else { |
280 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
280 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | } else { |
284 | - echo '<span class="ok">' . $_lang['ok'] . '</span></p>'; |
|
284 | + echo '<span class="ok">'.$_lang['ok'].'</span></p>'; |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | // Version and strict mode check end |
@@ -297,18 +297,18 @@ discard block |
||
297 | 297 | f_owc("../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>'); |
298 | 298 | } |
299 | 299 | |
300 | -if($installMode > 0 && $_POST['installdata'] == "1") { |
|
301 | - echo '<p class="notes"><strong>' . $_lang['sample_web_site'] . ':</strong> ' . $_lang['sample_web_site_note'] . '</p>'; |
|
300 | +if ($installMode > 0 && $_POST['installdata'] == "1") { |
|
301 | + echo '<p class="notes"><strong>'.$_lang['sample_web_site'].':</strong> '.$_lang['sample_web_site_note'].'</p>'; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | if ($errors > 0) { |
305 | 305 | echo '<p>'; |
306 | - echo $_lang['setup_cannot_continue'] . ' '; |
|
306 | + echo $_lang['setup_cannot_continue'].' '; |
|
307 | 307 | |
308 | - if($errors > 1){ |
|
309 | - echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural']; |
|
310 | - }else{ |
|
311 | - echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']; |
|
308 | + if ($errors > 1) { |
|
309 | + echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural']; |
|
310 | + } else { |
|
311 | + echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again']; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | echo $_lang['visit_forum']; |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | |
318 | 318 | echo '<p> </p>'; |
319 | 319 | |
320 | -$nextAction= $errors > 0 ? 'summary' : 'install'; |
|
321 | -$nextButton= $errors > 0 ? $_lang['retry'] : $_lang['install']; |
|
322 | -$nextVisibility= $errors > 0 || isset($_POST['chkagree']) ? 'visible' : 'hidden'; |
|
323 | -$agreeToggle= $errors > 0 ? '' : ' onclick="if(document.getElementById(\'chkagree\').checked){document.getElementById(\'nextbutton\').style.visibility=\'visible\';}else{document.getElementById(\'nextbutton\').style.visibility=\'hidden\';}"'; |
|
320 | +$nextAction = $errors > 0 ? 'summary' : 'install'; |
|
321 | +$nextButton = $errors > 0 ? $_lang['retry'] : $_lang['install']; |
|
322 | +$nextVisibility = $errors > 0 || isset($_POST['chkagree']) ? 'visible' : 'hidden'; |
|
323 | +$agreeToggle = $errors > 0 ? '' : ' onclick="if(document.getElementById(\'chkagree\').checked){document.getElementById(\'nextbutton\').style.visibility=\'visible\';}else{document.getElementById(\'nextbutton\').style.visibility=\'hidden\';}"'; |
|
324 | 324 | ?> |
325 | 325 | <form name="install" id="install_form" action="index.php?action=<?php echo $nextAction ?>" method="post"> |
326 | 326 | <div> |
@@ -342,32 +342,32 @@ discard block |
||
342 | 342 | |
343 | 343 | <input type="hidden" value="<?php echo $_POST['installdata'] ?>" name="installdata" /> |
344 | 344 | <?php |
345 | - $templates = isset ($_POST['template']) ? $_POST['template'] : array (); |
|
345 | + $templates = isset ($_POST['template']) ? $_POST['template'] : array(); |
|
346 | 346 | foreach ($templates as $i => $template) echo '<input type="hidden" name="template[]" value="'.$template.'" />'; |
347 | 347 | |
348 | - $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array (); |
|
348 | + $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array(); |
|
349 | 349 | foreach ($tvs as $i => $tv) echo '<input type="hidden" name="tv[]" value="'.$tv.'" />'; |
350 | 350 | |
351 | - $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array (); |
|
351 | + $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array(); |
|
352 | 352 | foreach ($chunks as $i => $chunk) echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />'; |
353 | 353 | |
354 | - $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array (); |
|
354 | + $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array(); |
|
355 | 355 | foreach ($snippets as $i => $snippet) echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />'; |
356 | 356 | |
357 | - $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array (); |
|
357 | + $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array(); |
|
358 | 358 | foreach ($plugins as $i => $plugin) echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />'; |
359 | 359 | |
360 | - $modules = isset ($_POST['module']) ? $_POST['module'] : array (); |
|
360 | + $modules = isset ($_POST['module']) ? $_POST['module'] : array(); |
|
361 | 361 | foreach ($modules as $i => $module) echo '<input type="hidden" name="module[]" value="'.$module.'" />'; |
362 | 362 | ?> |
363 | 363 | </div> |
364 | 364 | |
365 | -<h2><?php echo $_lang['agree_to_terms'];?></h2> |
|
365 | +<h2><?php echo $_lang['agree_to_terms']; ?></h2> |
|
366 | 366 | <p> |
367 | -<input type="checkbox" value="1" id="chkagree" name="chkagree" style="line-height:18px" <?php echo isset($_POST['chkagree']) ? 'checked="checked" ':""; ?><?php echo $agreeToggle;?>/><label for="chkagree" style="display:inline;float:none;line-height:18px;"> <?php echo $_lang['iagree_box']?> </label> |
|
367 | +<input type="checkbox" value="1" id="chkagree" name="chkagree" style="line-height:18px" <?php echo isset($_POST['chkagree']) ? 'checked="checked" ' : ""; ?><?php echo $agreeToggle; ?>/><label for="chkagree" style="display:inline;float:none;line-height:18px;"> <?php echo $_lang['iagree_box']?> </label> |
|
368 | 368 | </p> |
369 | 369 | <p class="buttonlinks"> |
370 | 370 | <a href="javascript:document.getElementById('install_form').action='index.php?action=options&language=<?php echo $install_language?>';document.getElementById('install_form').submit();" class="prev" title="<?php echo $_lang['btnback_value']?>"><span><?php echo $_lang['btnback_value']?></span></a> |
371 | - <a id="nextbutton" href="javascript:document.getElementById('install_form').submit();" title="<?php echo $nextButton ?>" style="visibility:<?php echo $nextVisibility;?>"><span><?php echo $nextButton ?></span></a> |
|
371 | + <a id="nextbutton" href="javascript:document.getElementById('install_form').submit();" title="<?php echo $nextButton ?>" style="visibility:<?php echo $nextVisibility; ?>"><span><?php echo $nextButton ?></span></a> |
|
372 | 372 | </p> |
373 | 373 | </form> |
@@ -1,19 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! function_exists('f_owc')){ |
|
2 | +if( ! function_exists('f_owc')) { |
|
3 | 3 | /** |
4 | 4 | * @param $path |
5 | 5 | * @param $data |
6 | 6 | * @param null|int $mode |
7 | 7 | */ |
8 | - function f_owc($path, $data, $mode = null){ |
|
8 | + function f_owc($path, $data, $mode = null) |
|
9 | + { |
|
9 | 10 | try { |
10 | 11 | // make an attempt to create the file |
11 | 12 | $hnd = fopen($path, 'w'); |
12 | 13 | fwrite($hnd, $data); |
13 | 14 | fclose($hnd); |
14 | 15 | |
15 | - if(null !== $mode) chmod($path, $mode); |
|
16 | - }catch(Exception $e){ |
|
16 | + if(null !== $mode) { |
|
17 | + chmod($path, $mode); |
|
18 | + } |
|
19 | + } catch(Exception $e) { |
|
17 | 20 | // Nothing, this is NOT normal |
18 | 21 | unset($e); |
19 | 22 | } |
@@ -21,7 +24,9 @@ discard block |
||
21 | 24 | } |
22 | 25 | |
23 | 26 | $installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
24 | -if( ! isset($_lang)) $_lang = array(); |
|
27 | +if( ! isset($_lang)) { |
|
28 | + $_lang = array(); |
|
29 | +} |
|
25 | 30 | |
26 | 31 | echo '<div class="stepcontainer"> |
27 | 32 | <ul class="progressbar"> |
@@ -57,7 +62,7 @@ discard block |
||
57 | 62 | // check if iconv is available |
58 | 63 | echo '<p>' . $_lang['checking_iconv']; |
59 | 64 | $iconv = (int) function_exists('iconv'); |
60 | -if ($iconv == '0'){ |
|
65 | +if ($iconv == '0') { |
|
61 | 66 | echo '<span class="notok">' . $_lang['failed'].'</span></p><p><strong>'.$_lang['checking_iconv_note'].'</strong></p>'; |
62 | 67 | $errors++; |
63 | 68 | } else { |
@@ -119,7 +124,7 @@ discard block |
||
119 | 124 | |
120 | 125 | // File Browser directories exists? |
121 | 126 | echo '<p>'.$_lang['checking_if_images_exist']; |
122 | -switch(true){ |
|
127 | +switch(true) { |
|
123 | 128 | case !file_exists("../assets/images"): |
124 | 129 | case !file_exists("../assets/files"): |
125 | 130 | case !file_exists("../assets/backup"): |
@@ -134,7 +139,7 @@ discard block |
||
134 | 139 | |
135 | 140 | // File Browser directories writable? |
136 | 141 | echo '<p>'.$_lang['checking_if_images_writable']; |
137 | -switch(true){ |
|
142 | +switch(true) { |
|
138 | 143 | case !is_writable("../assets/images"): |
139 | 144 | case !is_writable("../assets/files"): |
140 | 145 | case !is_writable("../assets/backup"): |
@@ -268,7 +273,7 @@ discard block |
||
268 | 273 | if ($conn) { |
269 | 274 | echo '<p>'. $_lang['checking_mysql_strict_mode']; |
270 | 275 | $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode"); |
271 | - if (mysqli_num_rows($mysqlmode) > 0){ |
|
276 | + if (mysqli_num_rows($mysqlmode) > 0) { |
|
272 | 277 | $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM); |
273 | 278 | //$modes = array("STRICT_TRANS_TABLES"); // for testing |
274 | 279 | // print_r($modes); |
@@ -305,9 +310,9 @@ discard block |
||
305 | 310 | echo '<p>'; |
306 | 311 | echo $_lang['setup_cannot_continue'] . ' '; |
307 | 312 | |
308 | - if($errors > 1){ |
|
313 | + if($errors > 1) { |
|
309 | 314 | echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural']; |
310 | - }else{ |
|
315 | + } else { |
|
311 | 316 | echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']; |
312 | 317 | } |
313 | 318 | |
@@ -343,23 +348,35 @@ discard block |
||
343 | 348 | <input type="hidden" value="<?php echo $_POST['installdata'] ?>" name="installdata" /> |
344 | 349 | <?php |
345 | 350 | $templates = isset ($_POST['template']) ? $_POST['template'] : array (); |
346 | - foreach ($templates as $i => $template) echo '<input type="hidden" name="template[]" value="'.$template.'" />'; |
|
351 | + foreach ($templates as $i => $template) { |
|
352 | + echo '<input type="hidden" name="template[]" value="'.$template.'" />'; |
|
353 | + } |
|
347 | 354 | |
348 | 355 | $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array (); |
349 | - foreach ($tvs as $i => $tv) echo '<input type="hidden" name="tv[]" value="'.$tv.'" />'; |
|
356 | + foreach ($tvs as $i => $tv) { |
|
357 | + echo '<input type="hidden" name="tv[]" value="'.$tv.'" />'; |
|
358 | + } |
|
350 | 359 | |
351 | 360 | $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array (); |
352 | - foreach ($chunks as $i => $chunk) echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />'; |
|
361 | + foreach ($chunks as $i => $chunk) { |
|
362 | + echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />'; |
|
363 | + } |
|
353 | 364 | |
354 | 365 | $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array (); |
355 | - foreach ($snippets as $i => $snippet) echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />'; |
|
366 | + foreach ($snippets as $i => $snippet) { |
|
367 | + echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />'; |
|
368 | + } |
|
356 | 369 | |
357 | 370 | $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array (); |
358 | - foreach ($plugins as $i => $plugin) echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />'; |
|
371 | + foreach ($plugins as $i => $plugin) { |
|
372 | + echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />'; |
|
373 | + } |
|
359 | 374 | |
360 | 375 | $modules = isset ($_POST['module']) ? $_POST['module'] : array (); |
361 | - foreach ($modules as $i => $module) echo '<input type="hidden" name="module[]" value="'.$module.'" />'; |
|
362 | -?> |
|
376 | + foreach ($modules as $i => $module) { |
|
377 | + echo '<input type="hidden" name="module[]" value="'.$module.'" />'; |
|
378 | + } |
|
379 | + ?> |
|
363 | 380 | </div> |
364 | 381 | |
365 | 382 | <h2><?php echo $_lang['agree_to_terms'];?></h2> |
@@ -207,7 +207,7 @@ |
||
207 | 207 | |
208 | 208 | |
209 | 209 | // make sure we can use the database |
210 | -if ($installMode > 0 && !mysqli_query($conn, "USE {$dbase}")) { |
|
210 | +if ($installMode > 0 && !mysqli_query($conn, "use {$dbase}")) { |
|
211 | 211 | $errors++; |
212 | 212 | echo '<span class="notok">'.$_lang['database_use_failed'].'</span><p />'.$_lang["database_use_failed_note"].'</p>'; |
213 | 213 | } |
@@ -770,7 +770,7 @@ |
||
770 | 770 | <form name="install" id="install_form" action="index.php?action=options" method="post"> |
771 | 771 | <?php |
772 | 772 | if ($errors == 0) { |
773 | - // check if install folder is removeable |
|
773 | + // check if install folder is removeable |
|
774 | 774 | if (is_writable("../install")) { ?> |
775 | 775 | <span id="removeinstall" style="float:left;cursor:pointer;color:#505050;line-height:18px;" onclick="var chk=document.install.rminstaller; if(chk) chk.checked=!chk.checked;"><input type="checkbox" name="rminstaller" onclick="event.cancelBubble=true;" <?php echo (empty ($errors) ? 'checked="checked"' : '') ?> style="cursor:default;" /><?php echo $_lang['remove_install_folder_auto'] ?></span> |
776 | 776 | <?php |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | } |
239 | 239 | |
240 | 240 | // write $somecontent to our opened file. |
241 | -if (@ fwrite($handle, $configString) === FALSE) { |
|
241 | +if (@ fwrite($handle, $configString) === false) { |
|
242 | 242 | $configFileFailed = true; |
243 | 243 | } |
244 | 244 | @ fclose($handle); |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'"); |
327 | 327 | |
328 | 328 | if (mysqli_num_rows($rs)) { |
329 | - 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;")) { |
|
329 | + 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;")) { |
|
330 | 330 | $errors += 1; |
331 | 331 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
332 | 332 | return; |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | if (mysqli_num_rows($rs)) { |
383 | 383 | $insert = true; |
384 | 384 | while($row = mysqli_fetch_assoc($rs)) { |
385 | - 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']};")) { |
|
385 | + 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']};")) { |
|
386 | 386 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
387 | 387 | return; |
388 | 388 | } |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | } |
459 | 459 | $update = $count_original_name > 0 && $overwrite == 'true'; |
460 | 460 | if ($update) { |
461 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
461 | + if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
462 | 462 | $errors += 1; |
463 | 463 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
464 | 464 | return; |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | if (mysqli_num_rows($rs)) { |
509 | 509 | $row = mysqli_fetch_assoc($rs); |
510 | 510 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
511 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
511 | + if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
512 | 512 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
513 | 513 | return; |
514 | 514 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | |
553 | 553 | // disable legacy versions based on legacy_names provided |
554 | 554 | if(!empty($leg_names)) { |
555 | - $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
555 | + $update_query = "update $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
556 | 556 | $rs = mysqli_query($sqlParser->conn, $update_query); |
557 | 557 | } |
558 | 558 | |
@@ -568,13 +568,13 @@ discard block |
||
568 | 568 | while($row = mysqli_fetch_assoc($rs)) { |
569 | 569 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
570 | 570 | if($row['description'] == $desc){ |
571 | - if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
571 | + if (! mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
572 | 572 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
573 | 573 | return; |
574 | 574 | } |
575 | 575 | $insert = false; |
576 | 576 | } else { |
577 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
577 | + if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
578 | 578 | echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
579 | 579 | return; |
580 | 580 | } |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | if (mysqli_num_rows($rs)) { |
640 | 640 | $row = mysqli_fetch_assoc($rs); |
641 | 641 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
642 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
642 | + if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
643 | 643 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
644 | 644 | return; |
645 | 645 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | <?php |
13 | 13 | if (file_exists(__DIR__."/../assets/cache/siteManager.php")) { |
14 | 14 | include_once(__DIR__."/../assets/cache/siteManager.php"); |
15 | -}else{ |
|
15 | +} else { |
|
16 | 16 | define('MGR_DIR', 'manager'); |
17 | 17 | } |
18 | 18 | define('MODX_CLI', false); |
@@ -70,13 +70,15 @@ discard block |
||
70 | 70 | |
71 | 71 | // get base path and url |
72 | 72 | $a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"]))); |
73 | -if (count($a) > 1) |
|
73 | +if (count($a) > 1) { |
|
74 | 74 | array_pop($a); |
75 | +} |
|
75 | 76 | $url = implode("install", $a); |
76 | 77 | reset($a); |
77 | 78 | $a = explode("install", str_replace("\\", "/", realpath(__DIR__))); |
78 | -if (count($a) > 1) |
|
79 | +if (count($a) > 1) { |
|
79 | 80 | array_pop($a); |
81 | +} |
|
80 | 82 | $pth = implode("install", $a); |
81 | 83 | unset ($a); |
82 | 84 | $base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
@@ -97,7 +99,9 @@ discard block |
||
97 | 99 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
98 | 100 | $create = true; |
99 | 101 | } else { |
100 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset); |
|
102 | + if (function_exists('mysqli_set_charset')) { |
|
103 | + mysqli_set_charset($conn, $database_charset); |
|
104 | + } |
|
101 | 105 | mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}"); |
102 | 106 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
103 | 107 | } |
@@ -199,7 +203,7 @@ discard block |
||
199 | 203 | // custom or not |
200 | 204 | if (file_exists(__DIR__."/../../assets/cache/siteManager.php")) { |
201 | 205 | $mgrdir = 'include_once(__DIR__."/../../assets/cache/siteManager.php");'; |
202 | -}else{ |
|
206 | +} else { |
|
203 | 207 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
204 | 208 | } |
205 | 209 | |
@@ -335,7 +339,9 @@ discard block |
||
335 | 339 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
336 | 340 | return; |
337 | 341 | } |
338 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
342 | + if(!is_null($save_sql_id_as)) { |
|
343 | + $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
344 | + } |
|
339 | 345 | echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
340 | 346 | } |
341 | 347 | } |
@@ -429,9 +435,9 @@ discard block |
||
429 | 435 | $overwrite = mysqli_real_escape_string($conn, $moduleChunk[4]); |
430 | 436 | $filecontent = $moduleChunk[2]; |
431 | 437 | |
432 | - if (!file_exists($filecontent)) |
|
433 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
434 | - else { |
|
438 | + if (!file_exists($filecontent)) { |
|
439 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
440 | + } else { |
|
435 | 441 | |
436 | 442 | // Create the category if it does not already exist |
437 | 443 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -483,9 +489,9 @@ discard block |
||
483 | 489 | $guid = mysqli_real_escape_string($conn, $moduleModule[4]); |
484 | 490 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
485 | 491 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
486 | - if (!file_exists($filecontent)) |
|
487 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
488 | - else { |
|
492 | + if (!file_exists($filecontent)) { |
|
493 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
494 | + } else { |
|
489 | 495 | |
490 | 496 | // Create the category if it does not already exist |
491 | 497 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -535,9 +541,9 @@ discard block |
||
535 | 541 | // parse comma-separated legacy names and prepare them for sql IN clause |
536 | 542 | $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
537 | 543 | } |
538 | - if (!file_exists($filecontent)) |
|
539 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
540 | - else { |
|
544 | + if (!file_exists($filecontent)) { |
|
545 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
546 | + } else { |
|
541 | 547 | |
542 | 548 | // disable legacy versions based on legacy_names provided |
543 | 549 | if(!empty($leg_names)) { |
@@ -556,7 +562,7 @@ discard block |
||
556 | 562 | $insert = true; |
557 | 563 | while($row = mysqli_fetch_assoc($rs)) { |
558 | 564 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
559 | - if($row['description'] == $desc){ |
|
565 | + if($row['description'] == $desc) { |
|
560 | 566 | if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
561 | 567 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
562 | 568 | return; |
@@ -614,9 +620,9 @@ discard block |
||
614 | 620 | $filecontent = $moduleSnippet[2]; |
615 | 621 | $properties = $moduleSnippet[3]; |
616 | 622 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
617 | - if (!file_exists($filecontent)) |
|
618 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
619 | - else { |
|
623 | + if (!file_exists($filecontent)) { |
|
624 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
625 | + } else { |
|
620 | 626 | |
621 | 627 | // Create the category if it does not already exist |
622 | 628 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -724,13 +730,16 @@ discard block |
||
724 | 730 | } |
725 | 731 | |
726 | 732 | // call back function |
727 | -if ($callBackFnc != "") |
|
733 | +if ($callBackFnc != "") { |
|
728 | 734 | $callBackFnc ($sqlParser); |
735 | +} |
|
729 | 736 | |
730 | 737 | // Setup the MODX API -- needed for the cache processor |
731 | 738 | define('MODX_API_MODE', true); |
732 | 739 | define('MODX_BASE_PATH', $base_path); |
733 | -if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
740 | +if (!defined('MODX_MANAGER_PATH')) { |
|
741 | + define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
742 | +} |
|
734 | 743 | $database_type = 'mysqli'; |
735 | 744 | // initiate a new document parser |
736 | 745 | include_once('../'.MGR_DIR.'/includes/document.parser.class.inc.php'); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | <?php |
13 | 13 | if (file_exists(__DIR__."/../assets/cache/siteManager.php")) { |
14 | 14 | include_once(__DIR__."/../assets/cache/siteManager.php"); |
15 | -}else{ |
|
15 | +} else { |
|
16 | 16 | define('MGR_DIR', 'manager'); |
17 | 17 | } |
18 | 18 | define('MODX_CLI', false); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | echo "<p>{$_lang['setup_database']}</p>\n"; |
42 | 42 | |
43 | -$installMode= (int)$_POST['installmode']; |
|
43 | +$installMode = (int) $_POST['installmode']; |
|
44 | 44 | $installData = $_POST['installdata'] == "1" ? 1 : 0; |
45 | 45 | |
46 | 46 | //if ($installMode == 1) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
55 | 55 | $database_connection_charset = $_POST['database_connection_charset']; |
56 | 56 | $database_connection_method = $_POST['database_connection_method']; |
57 | -$dbase = "`" . $_POST['database_name'] . "`"; |
|
57 | +$dbase = "`".$_POST['database_name']."`"; |
|
58 | 58 | $table_prefix = $_POST['tableprefix']; |
59 | 59 | $adminname = $_POST['cmsadmin']; |
60 | 60 | $adminemail = $_POST['cmsadminemail']; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | // set session name variable |
67 | 67 | if (!isset ($site_sessionname)) { |
68 | - $site_sessionname = 'SN' . uniqid(''); |
|
68 | + $site_sessionname = 'SN'.uniqid(''); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // get base path and url |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | array_pop($a); |
80 | 80 | $pth = implode("install", $a); |
81 | 81 | unset ($a); |
82 | -$base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
|
83 | -$base_path = $pth . (substr($pth, -1) != "/" ? "/" : ""); |
|
82 | +$base_url = $url.(substr($url, -1) != "/" ? "/" : ""); |
|
83 | +$base_path = $pth.(substr($pth, -1) != "/" ? "/" : ""); |
|
84 | 84 | |
85 | 85 | // connect to the database |
86 | -echo "<p>". $_lang['setup_database_create_connection']; |
|
86 | +echo "<p>".$_lang['setup_database_create_connection']; |
|
87 | 87 | if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) { |
88 | 88 | echo '<span class="notok">'.$_lang["setup_database_create_connection_failed"]."</span></p><p>".$_lang['setup_database_create_connection_failed_note']."</p>"; |
89 | 89 | return; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | // select database |
95 | -echo "<p>".$_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: "; |
|
95 | +echo "<p>".$_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: "; |
|
96 | 96 | if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) { |
97 | 97 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
98 | 98 | $create = true; |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | |
105 | 105 | // try to create the database |
106 | 106 | if ($create) { |
107 | - echo "<p>".$_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: "; |
|
107 | + echo "<p>".$_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: "; |
|
108 | 108 | // if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) { |
109 | - if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
109 | + if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
110 | 110 | echo '<span class="notok">'.$_lang['setup_database_creation_failed']."</span>".$_lang['setup_database_creation_failed_note']."</p>"; |
111 | 111 | $errors += 1; |
112 | 112 | ?> |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | |
126 | 126 | // check table prefix |
127 | 127 | if ($installMode == 0) { |
128 | - echo "<p>" . $_lang['checking_table_prefix'] . $table_prefix . "`: "; |
|
129 | - if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
130 | - echo '<span class="notok">' . $_lang['failed'] . "</span>" . $_lang['table_prefix_already_inuse'] . "</p>"; |
|
128 | + echo "<p>".$_lang['checking_table_prefix'].$table_prefix."`: "; |
|
129 | + if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
130 | + echo '<span class="notok">'.$_lang['failed']."</span>".$_lang['table_prefix_already_inuse']."</p>"; |
|
131 | 131 | $errors += 1; |
132 | - echo "<p>" . $_lang['table_prefix_already_inuse_note'] . "</p>"; |
|
132 | + echo "<p>".$_lang['table_prefix_already_inuse_note']."</p>"; |
|
133 | 133 | return; |
134 | 134 | } else { |
135 | 135 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
@@ -139,20 +139,20 @@ discard block |
||
139 | 139 | // check status of Inherit Parent Template plugin |
140 | 140 | $auto_template_logic = 'parent'; |
141 | 141 | if ($installMode != 0) { |
142 | - $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'"); |
|
142 | + $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'"); |
|
143 | 143 | $row = mysqli_fetch_row($rs); |
144 | - if(!$row) { |
|
144 | + if (!$row) { |
|
145 | 145 | // not installed |
146 | 146 | $auto_template_logic = 'system'; |
147 | 147 | } else { |
148 | - if($row[1] == 1) { |
|
148 | + if ($row[1] == 1) { |
|
149 | 149 | // installed but disabled |
150 | 150 | $auto_template_logic = 'system'; |
151 | 151 | } else { |
152 | 152 | // installed, enabled .. see how it's configured |
153 | 153 | $properties = parseProperties($row[0]); |
154 | - if(isset($properties['inheritTemplate'])) { |
|
155 | - if($properties['inheritTemplate'] == 'From First Sibling') { |
|
154 | + if (isset($properties['inheritTemplate'])) { |
|
155 | + if ($properties['inheritTemplate'] == 'From First Sibling') { |
|
156 | 156 | $auto_template_logic = 'sibling'; |
157 | 157 | } |
158 | 158 | } |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | |
163 | 163 | // open db connection |
164 | 164 | $setupPath = realpath(__DIR__); |
165 | -include dirname(__DIR__) . '/processor/result.php'; |
|
166 | -include_once dirname(__DIR__) . '/sqlParser.class.php'; |
|
165 | +include dirname(__DIR__).'/processor/result.php'; |
|
166 | +include_once dirname(__DIR__).'/sqlParser.class.php'; |
|
167 | 167 | $sqlParser = new SqlParser($database_server, $database_user, $database_password, str_replace("`", "", $dbase), $table_prefix, $adminname, $adminemail, $adminpass, $database_connection_charset, $managerlanguage, $database_connection_method, $auto_template_logic); |
168 | 168 | $sqlParser->mode = ($installMode < 1) ? "new" : "upd"; |
169 | 169 | /* image and file manager paths now handled via settings screen in Manager |
@@ -176,20 +176,20 @@ discard block |
||
176 | 176 | $sqlParser->connect(); |
177 | 177 | |
178 | 178 | // install/update database |
179 | -echo "<p>" . $_lang['setup_database_creating_tables']; |
|
179 | +echo "<p>".$_lang['setup_database_creating_tables']; |
|
180 | 180 | if ($moduleSQLBaseFile) { |
181 | 181 | $sqlParser->process($moduleSQLBaseFile); |
182 | 182 | // display database results |
183 | 183 | if ($sqlParser->installFailed == true) { |
184 | 184 | $errors += 1; |
185 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
186 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
187 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
185 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
186 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
187 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
188 | 188 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
189 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
189 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
190 | 190 | } |
191 | 191 | echo "</p>"; |
192 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
192 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
193 | 193 | return; |
194 | 194 | } else { |
195 | 195 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | // custom or not |
200 | 200 | if (file_exists(__DIR__."/../../assets/cache/siteManager.php")) { |
201 | 201 | $mgrdir = 'include_once(__DIR__."/../../assets/cache/siteManager.php");'; |
202 | -}else{ |
|
202 | +} else { |
|
203 | 203 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
204 | 204 | } |
205 | 205 | |
206 | 206 | // write the config.inc.php file if new installation |
207 | -echo "<p>" . $_lang['writing_config_file']; |
|
207 | +echo "<p>".$_lang['writing_config_file']; |
|
208 | 208 | |
209 | 209 | $confph = array(); |
210 | 210 | $confph['database_server'] = $database_server; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $confph['lastInstallTime'] = time(); |
218 | 218 | $confph['site_sessionname'] = $site_sessionname; |
219 | 219 | |
220 | -$configString = file_get_contents(dirname(dirname(__DIR__)) . '/config.inc.tpl'); |
|
220 | +$configString = file_get_contents(dirname(dirname(__DIR__)).'/config.inc.tpl'); |
|
221 | 221 | $configString = parse($configString, $confph); |
222 | 222 | |
223 | 223 | $filename = '../'.MGR_DIR.'/includes/config.inc.php'; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | @chmod($filename, 0404); |
237 | 237 | |
238 | 238 | if ($configFileFailed == true) { |
239 | - echo '<span class="notok">' . $_lang['failed'] . "</span></p>"; |
|
239 | + echo '<span class="notok">'.$_lang['failed']."</span></p>"; |
|
240 | 240 | $errors += 1; |
241 | 241 | ?> |
242 | 242 | <p><?php echo $_lang['cant_write_config_file']?><span class="mono"><?php echo MGR_DIR; ?>/includes/config.inc.php</span></p> |
@@ -253,35 +253,35 @@ discard block |
||
253 | 253 | // generate new site_id and set manager theme to default |
254 | 254 | if ($installMode == 0) { |
255 | 255 | $siteid = uniqid(''); |
256 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
256 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
257 | 257 | } else { |
258 | 258 | // update site_id if missing |
259 | - $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"); |
|
259 | + $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'"); |
|
260 | 260 | if ($ds) { |
261 | 261 | $r = mysqli_fetch_assoc($ds); |
262 | 262 | $siteid = $r['setting_value']; |
263 | 263 | if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') { |
264 | 264 | $siteid = uniqid(''); |
265 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
265 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
270 | 270 | // Reset database for installation of demo-site |
271 | 271 | if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) { |
272 | - echo "<p>" . $_lang['resetting_database']; |
|
272 | + echo "<p>".$_lang['resetting_database']; |
|
273 | 273 | $sqlParser->process($moduleSQLResetFile); |
274 | 274 | // display database results |
275 | 275 | if ($sqlParser->installFailed == true) { |
276 | 276 | $errors += 1; |
277 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
278 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
279 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
277 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
278 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
279 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
280 | 280 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
281 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
281 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
282 | 282 | } |
283 | 283 | echo "</p>"; |
284 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
284 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
285 | 285 | return; |
286 | 286 | } else { |
287 | 287 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
@@ -290,11 +290,11 @@ discard block |
||
290 | 290 | |
291 | 291 | // Install Templates |
292 | 292 | if (isset ($_POST['template']) || $installData) { |
293 | - echo "<h3>" . $_lang['templates'] . ":</h3> "; |
|
293 | + echo "<h3>".$_lang['templates'].":</h3> "; |
|
294 | 294 | $selTemplates = $_POST['template']; |
295 | 295 | foreach ($moduleTemplates as $k=>$moduleTemplate) { |
296 | 296 | $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1; |
297 | - if($installSample || in_array($k, $selTemplates)) { |
|
297 | + if ($installSample || in_array($k, $selTemplates)) { |
|
298 | 298 | $name = mysqli_real_escape_string($conn, $moduleTemplate[0]); |
299 | 299 | $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]); |
300 | 300 | $category = mysqli_real_escape_string($conn, $moduleTemplate[4]); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $filecontent = $moduleTemplate[3]; |
303 | 303 | $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site |
304 | 304 | if (!file_exists($filecontent)) { |
305 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
305 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
306 | 306 | } else { |
307 | 307 | // Create the category if it does not already exist |
308 | 308 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -312,31 +312,31 @@ discard block |
||
312 | 312 | $template = mysqli_real_escape_string($conn, $template); |
313 | 313 | |
314 | 314 | // See if the template already exists |
315 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'"); |
|
315 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'"); |
|
316 | 316 | |
317 | 317 | if (mysqli_num_rows($rs)) { |
318 | - 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;")) { |
|
318 | + 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;")) { |
|
319 | 319 | $errors += 1; |
320 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
320 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
321 | 321 | return; |
322 | 322 | } |
323 | - if(!is_null($save_sql_id_as)) { |
|
323 | + if (!is_null($save_sql_id_as)) { |
|
324 | 324 | $sql_id = @mysqli_insert_id($sqlParser->conn); |
325 | - if(!$sql_id) { |
|
326 | - $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
325 | + if (!$sql_id) { |
|
326 | + $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
327 | 327 | $sql_id = $idQuery['id']; |
328 | 328 | } |
329 | 329 | $custom_placeholders[$save_sql_id_as] = $sql_id; |
330 | 330 | } |
331 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
331 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
332 | 332 | } else { |
333 | - if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
333 | + if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
334 | 334 | $errors += 1; |
335 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
335 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
336 | 336 | return; |
337 | 337 | } |
338 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
339 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
338 | + if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
339 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | } |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | |
346 | 346 | // Install Template Variables |
347 | 347 | if (isset ($_POST['tv']) || $installData) { |
348 | - echo "<h3>" . $_lang['tvs'] . ":</h3> "; |
|
348 | + echo "<h3>".$_lang['tvs'].":</h3> "; |
|
349 | 349 | $selTVs = $_POST['tv']; |
350 | 350 | foreach ($moduleTVs as $k=>$moduleTV) { |
351 | 351 | $installSample = in_array('sample', $moduleTV[12]) && $installData == 1; |
352 | - if($installSample || in_array($k, $selTVs)) { |
|
352 | + if ($installSample || in_array($k, $selTVs)) { |
|
353 | 353 | $name = mysqli_real_escape_string($conn, $moduleTV[0]); |
354 | 354 | $caption = mysqli_real_escape_string($conn, $moduleTV[1]); |
355 | 355 | $desc = mysqli_real_escape_string($conn, $moduleTV[2]); |
@@ -367,25 +367,25 @@ discard block |
||
367 | 367 | // Create the category if it does not already exist |
368 | 368 | $category = getCreateDbCategory($category, $sqlParser); |
369 | 369 | |
370 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'"); |
|
370 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'"); |
|
371 | 371 | if (mysqli_num_rows($rs)) { |
372 | 372 | $insert = true; |
373 | - while($row = mysqli_fetch_assoc($rs)) { |
|
374 | - 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']};")) { |
|
375 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
373 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
374 | + 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']};")) { |
|
375 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
376 | 376 | return; |
377 | 377 | } |
378 | 378 | $insert = false; |
379 | 379 | } |
380 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
380 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
381 | 381 | } else { |
382 | 382 | //$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',(SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE `id` END) `id` FROM $dbase.`" . $table_prefix . "categories` WHERE `category` = '$category'),$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
383 | - $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');"; |
|
383 | + $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');"; |
|
384 | 384 | if (!mysqli_query($sqlParser->conn, $q)) { |
385 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
385 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
386 | 386 | return; |
387 | 387 | } |
388 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
388 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | // add template assignments |
@@ -394,10 +394,10 @@ discard block |
||
394 | 394 | if (count($assignments) > 0) { |
395 | 395 | |
396 | 396 | // remove existing tv -> template assignments |
397 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
397 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
398 | 398 | $row = mysqli_fetch_assoc($ds); |
399 | 399 | $id = $row["id"]; |
400 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\''); |
|
400 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\''); |
|
401 | 401 | |
402 | 402 | // add tv -> template assignments |
403 | 403 | foreach ($assignments as $assignment) { |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | if ($ds && $ts) { |
407 | 407 | $tRow = mysqli_fetch_assoc($ts); |
408 | 408 | $templateId = $tRow['id']; |
409 | - mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
409 | + mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
410 | 410 | } |
411 | 411 | } |
412 | 412 | } |
@@ -416,12 +416,12 @@ discard block |
||
416 | 416 | |
417 | 417 | // Install Chunks |
418 | 418 | if (isset ($_POST['chunk']) || $installData) { |
419 | - echo "<h3>" . $_lang['chunks'] . ":</h3> "; |
|
419 | + echo "<h3>".$_lang['chunks'].":</h3> "; |
|
420 | 420 | $selChunks = $_POST['chunk']; |
421 | 421 | foreach ($moduleChunks as $k=>$moduleChunk) { |
422 | 422 | $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1; |
423 | 423 | $count_new_name = 0; |
424 | - if($installSample || in_array($k, $selChunks)) { |
|
424 | + if ($installSample || in_array($k, $selChunks)) { |
|
425 | 425 | |
426 | 426 | $name = mysqli_real_escape_string($conn, $moduleChunk[0]); |
427 | 427 | $desc = mysqli_real_escape_string($conn, $moduleChunk[1]); |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | $filecontent = $moduleChunk[2]; |
431 | 431 | |
432 | 432 | if (!file_exists($filecontent)) |
433 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
433 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
434 | 434 | else { |
435 | 435 | |
436 | 436 | // Create the category if it does not already exist |
@@ -438,31 +438,31 @@ discard block |
||
438 | 438 | |
439 | 439 | $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1); |
440 | 440 | $chunk = mysqli_real_escape_string($conn, $chunk); |
441 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"); |
|
441 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'"); |
|
442 | 442 | $count_original_name = mysqli_num_rows($rs); |
443 | - if($overwrite == 'false') { |
|
444 | - $newname = $name . '-' . str_replace('.', '_', $modx_version); |
|
445 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"); |
|
443 | + if ($overwrite == 'false') { |
|
444 | + $newname = $name.'-'.str_replace('.', '_', $modx_version); |
|
445 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'"); |
|
446 | 446 | $count_new_name = mysqli_num_rows($rs); |
447 | 447 | } |
448 | 448 | $update = $count_original_name > 0 && $overwrite == 'true'; |
449 | 449 | if ($update) { |
450 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
450 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
451 | 451 | $errors += 1; |
452 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
452 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
453 | 453 | return; |
454 | 454 | } |
455 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
456 | - } elseif($count_new_name == 0) { |
|
457 | - if($count_original_name > 0 && $overwrite == 'false') { |
|
455 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
456 | + } elseif ($count_new_name == 0) { |
|
457 | + if ($count_original_name > 0 && $overwrite == 'false') { |
|
458 | 458 | $name = $newname; |
459 | 459 | } |
460 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
460 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
461 | 461 | $errors += 1; |
462 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
462 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
463 | 463 | return; |
464 | 464 | } |
465 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
465 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
466 | 466 | } |
467 | 467 | } |
468 | 468 | } |
@@ -471,11 +471,11 @@ discard block |
||
471 | 471 | |
472 | 472 | // Install Modules |
473 | 473 | if (isset ($_POST['module']) || $installData) { |
474 | - echo "<h3>" . $_lang['modules'] . ":</h3> "; |
|
474 | + echo "<h3>".$_lang['modules'].":</h3> "; |
|
475 | 475 | $selModules = $_POST['module']; |
476 | 476 | foreach ($moduleModules as $k=>$moduleModule) { |
477 | 477 | $installSample = in_array('sample', $moduleModule[7]) && $installData == 1; |
478 | - if($installSample || in_array($k, $selModules)) { |
|
478 | + if ($installSample || in_array($k, $selModules)) { |
|
479 | 479 | $name = mysqli_real_escape_string($conn, $moduleModule[0]); |
480 | 480 | $desc = mysqli_real_escape_string($conn, $moduleModule[1]); |
481 | 481 | $filecontent = $moduleModule[2]; |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
485 | 485 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
486 | 486 | if (!file_exists($filecontent)) |
487 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
487 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
488 | 488 | else { |
489 | 489 | |
490 | 490 | // Create the category if it does not already exist |
@@ -493,22 +493,22 @@ discard block |
||
493 | 493 | $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
494 | 494 | // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab |
495 | 495 | $module = mysqli_real_escape_string($conn, $module); |
496 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'"); |
|
496 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'"); |
|
497 | 497 | if (mysqli_num_rows($rs)) { |
498 | 498 | $row = mysqli_fetch_assoc($rs); |
499 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
500 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
501 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
499 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
500 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
501 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
502 | 502 | return; |
503 | 503 | } |
504 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
504 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
505 | 505 | } else { |
506 | 506 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
507 | - 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);")) { |
|
508 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
507 | + 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);")) { |
|
508 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
509 | 509 | return; |
510 | 510 | } |
511 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
511 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
512 | 512 | } |
513 | 513 | } |
514 | 514 | } |
@@ -517,11 +517,11 @@ discard block |
||
517 | 517 | |
518 | 518 | // Install Plugins |
519 | 519 | if (isset ($_POST['plugin']) || $installData) { |
520 | - echo "<h3>" . $_lang['plugins'] . ":</h3> "; |
|
520 | + echo "<h3>".$_lang['plugins'].":</h3> "; |
|
521 | 521 | $selPlugs = $_POST['plugin']; |
522 | 522 | foreach ($modulePlugins as $k=>$modulePlugin) { |
523 | 523 | $installSample = is_array($modulePlugin[8]) && in_array('sample', $modulePlugin[8]) && $installData == 1; |
524 | - if($installSample || in_array($k, $selPlugs)) { |
|
524 | + if ($installSample || in_array($k, $selPlugs)) { |
|
525 | 525 | $name = mysqli_real_escape_string($conn, $modulePlugin[0]); |
526 | 526 | $desc = mysqli_real_escape_string($conn, $modulePlugin[1]); |
527 | 527 | $filecontent = $modulePlugin[2]; |
@@ -531,17 +531,17 @@ discard block |
||
531 | 531 | $category = mysqli_real_escape_string($conn, $modulePlugin[6]); |
532 | 532 | $leg_names = ''; |
533 | 533 | $disabled = $modulePlugin[9]; |
534 | - if(array_key_exists(7, $modulePlugin)) { |
|
534 | + if (array_key_exists(7, $modulePlugin)) { |
|
535 | 535 | // parse comma-separated legacy names and prepare them for sql IN clause |
536 | - $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
|
536 | + $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'"; |
|
537 | 537 | } |
538 | 538 | if (!file_exists($filecontent)) |
539 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
539 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
540 | 540 | else { |
541 | 541 | |
542 | 542 | // disable legacy versions based on legacy_names provided |
543 | - if(!empty($leg_names)) { |
|
544 | - $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
543 | + if (!empty($leg_names)) { |
|
544 | + $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
545 | 545 | $rs = mysqli_query($sqlParser->conn, $update_query); |
546 | 546 | } |
547 | 547 | |
@@ -551,50 +551,50 @@ discard block |
||
551 | 551 | $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
552 | 552 | $plugin = removeDocblock($plugin, 'plugin'); |
553 | 553 | $plugin = mysqli_real_escape_string($conn, $plugin); |
554 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'"); |
|
554 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'"); |
|
555 | 555 | if (mysqli_num_rows($rs)) { |
556 | 556 | $insert = true; |
557 | - while($row = mysqli_fetch_assoc($rs)) { |
|
558 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
559 | - if($row['description'] == $desc){ |
|
560 | - if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
561 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
557 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
558 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
559 | + if ($row['description'] == $desc) { |
|
560 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
561 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
562 | 562 | return; |
563 | 563 | } |
564 | 564 | $insert = false; |
565 | 565 | } else { |
566 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
566 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
567 | 567 | echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
568 | 568 | return; |
569 | 569 | } |
570 | 570 | } |
571 | 571 | } |
572 | - if($insert === true) { |
|
573 | - $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
574 | - 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);")) { |
|
572 | + if ($insert === true) { |
|
573 | + $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
574 | + 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);")) { |
|
575 | 575 | echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
576 | 576 | return; |
577 | 577 | } |
578 | 578 | } |
579 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
579 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
580 | 580 | } else { |
581 | 581 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
582 | - 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);")) { |
|
583 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
582 | + 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);")) { |
|
583 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
584 | 584 | return; |
585 | 585 | } |
586 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
586 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
587 | 587 | } |
588 | 588 | // add system events |
589 | 589 | if (count($events) > 0) { |
590 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
590 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
591 | 591 | if ($ds) { |
592 | 592 | $row = mysqli_fetch_assoc($ds); |
593 | 593 | $id = $row["id"]; |
594 | 594 | // remove existing events |
595 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\''); |
|
595 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\''); |
|
596 | 596 | // add new events |
597 | - 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) . "')"); |
|
597 | + 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)."')"); |
|
598 | 598 | } |
599 | 599 | } |
600 | 600 | } |
@@ -604,18 +604,18 @@ discard block |
||
604 | 604 | |
605 | 605 | // Install Snippets |
606 | 606 | if (isset ($_POST['snippet']) || $installData) { |
607 | - echo "<h3>" . $_lang['snippets'] . ":</h3> "; |
|
607 | + echo "<h3>".$_lang['snippets'].":</h3> "; |
|
608 | 608 | $selSnips = $_POST['snippet']; |
609 | 609 | foreach ($moduleSnippets as $k=>$moduleSnippet) { |
610 | 610 | $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1; |
611 | - if($installSample || in_array($k, $selSnips)) { |
|
611 | + if ($installSample || in_array($k, $selSnips)) { |
|
612 | 612 | $name = mysqli_real_escape_string($conn, $moduleSnippet[0]); |
613 | 613 | $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]); |
614 | 614 | $filecontent = $moduleSnippet[2]; |
615 | 615 | $properties = $moduleSnippet[3]; |
616 | 616 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
617 | 617 | if (!file_exists($filecontent)) |
618 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
618 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
619 | 619 | else { |
620 | 620 | |
621 | 621 | // Create the category if it does not already exist |
@@ -624,22 +624,22 @@ discard block |
||
624 | 624 | $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent))); |
625 | 625 | $snippet = removeDocblock($snippet, 'snippet'); |
626 | 626 | $snippet = mysqli_real_escape_string($conn, $snippet); |
627 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'"); |
|
627 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'"); |
|
628 | 628 | if (mysqli_num_rows($rs)) { |
629 | 629 | $row = mysqli_fetch_assoc($rs); |
630 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
631 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
632 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
630 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
631 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
632 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
633 | 633 | return; |
634 | 634 | } |
635 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
635 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
636 | 636 | } else { |
637 | 637 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
638 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
639 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
638 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
639 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
640 | 640 | return; |
641 | 641 | } |
642 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
642 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
643 | 643 | } |
644 | 644 | } |
645 | 645 | } |
@@ -648,24 +648,24 @@ discard block |
||
648 | 648 | |
649 | 649 | // Install demo-site |
650 | 650 | if ($installData && $moduleSQLDataFile) { |
651 | - echo "<p>" . $_lang['installing_demo_site']; |
|
651 | + echo "<p>".$_lang['installing_demo_site']; |
|
652 | 652 | $sqlParser->process($moduleSQLDataFile); |
653 | 653 | // display database results |
654 | 654 | if ($sqlParser->installFailed == true) { |
655 | 655 | $errors += 1; |
656 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
657 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
658 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
656 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
657 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
658 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
659 | 659 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
660 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
660 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
661 | 661 | } |
662 | 662 | echo "</p>"; |
663 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
663 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
664 | 664 | return; |
665 | 665 | } else { |
666 | 666 | $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix); |
667 | 667 | $rs = mysqli_query($sqlParser->conn, $sql); |
668 | - if(mysqli_num_rows($rs)) { |
|
668 | + if (mysqli_num_rows($rs)) { |
|
669 | 669 | $row = mysqli_fetch_assoc($rs); |
670 | 670 | $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']); |
671 | 671 | mysqli_query($sqlParser->conn, $sql); |
@@ -676,9 +676,9 @@ discard block |
||
676 | 676 | |
677 | 677 | // Install Dependencies |
678 | 678 | foreach ($moduleDependencies as $dependency) { |
679 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"'); |
|
679 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"'); |
|
680 | 680 | if (!$ds) { |
681 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
681 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
682 | 682 | return; |
683 | 683 | } else { |
684 | 684 | $row = mysqli_fetch_assoc($ds); |
@@ -686,37 +686,37 @@ discard block |
||
686 | 686 | $moduleGuid = $row["guid"]; |
687 | 687 | } |
688 | 688 | // get extra id |
689 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"'); |
|
689 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"'); |
|
690 | 690 | if (!$ds) { |
691 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
691 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
692 | 692 | return; |
693 | 693 | } else { |
694 | 694 | $row = mysqli_fetch_assoc($ds); |
695 | 695 | $extraId = $row["id"]; |
696 | 696 | } |
697 | 697 | // setup extra as module dependency |
698 | - $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'); |
|
698 | + $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'); |
|
699 | 699 | if (!$ds) { |
700 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
700 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
701 | 701 | return; |
702 | 702 | } else { |
703 | 703 | if (mysqli_num_rows($ds) === 0) { |
704 | - mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')'); |
|
705 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_create'] . '</span></p>'; |
|
704 | + mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')'); |
|
705 | + echo '<p> '.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_create'].'</span></p>'; |
|
706 | 706 | } else { |
707 | - 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']); |
|
708 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_update'] . '</span></p>'; |
|
707 | + 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']); |
|
708 | + echo '<p> '.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_update'].'</span></p>'; |
|
709 | 709 | } |
710 | 710 | if ($dependency['type'] == 30 || $dependency['type'] == 40) { |
711 | 711 | // set extra guid for plugins and snippets |
712 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1'); |
|
712 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1'); |
|
713 | 713 | if (!$ds) { |
714 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
714 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
715 | 715 | return; |
716 | 716 | } else { |
717 | 717 | if (mysqli_num_rows($ds) != 0) { |
718 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId); |
|
719 | - echo '<p> ' . $dependency['name'] . ': <span class="ok">' . $_lang['guid_set'] . '</span></p>'; |
|
718 | + mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId); |
|
719 | + echo '<p> '.$dependency['name'].': <span class="ok">'.$_lang['guid_set'].'</span></p>'; |
|
720 | 720 | } |
721 | 721 | } |
722 | 722 | } |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | |
726 | 726 | // call back function |
727 | 727 | if ($callBackFnc != "") |
728 | - $callBackFnc ($sqlParser); |
|
728 | + $callBackFnc($sqlParser); |
|
729 | 729 | |
730 | 730 | // Setup the MODX API -- needed for the cache processor |
731 | 731 | define('MODX_API_MODE', true); |
@@ -759,12 +759,12 @@ discard block |
||
759 | 759 | } |
760 | 760 | |
761 | 761 | // setup completed! |
762 | -echo "<p><b>" . $_lang['installation_successful'] . "</b></p>"; |
|
763 | -echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>"; |
|
762 | +echo "<p><b>".$_lang['installation_successful']."</b></p>"; |
|
763 | +echo "<p>".$_lang['to_log_into_content_manager']."</p>"; |
|
764 | 764 | if ($installMode == 0) { |
765 | - echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['installation_note'] . "</p>"; |
|
765 | + echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['installation_note']."</p>"; |
|
766 | 766 | } else { |
767 | - echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['upgrade_note'] . "</p>"; |
|
767 | + echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['upgrade_note']."</p>"; |
|
768 | 768 | } |
769 | 769 | ?> |
770 | 770 | <form name="install" id="install_form" action="index.php?action=options" method="post"> |
@@ -793,10 +793,10 @@ discard block |
||
793 | 793 | var chk = document.install.rminstaller; |
794 | 794 | if(chk && chk.checked) { |
795 | 795 | // remove install folder and files |
796 | - window.location.href = "../<?php echo MGR_DIR;?>/processors/remove_installer.processor.php?rminstall=1"; |
|
796 | + window.location.href = "../<?php echo MGR_DIR; ?>/processors/remove_installer.processor.php?rminstall=1"; |
|
797 | 797 | } |
798 | 798 | else { |
799 | - window.location.href = "../<?php echo MGR_DIR;?>/"; |
|
799 | + window.location.href = "../<?php echo MGR_DIR; ?>/"; |
|
800 | 800 | } |
801 | 801 | } |
802 | 802 | /* ]]> */ |
@@ -4,141 +4,141 @@ |
||
4 | 4 | // SNUFFKIN/ Alex 2004 |
5 | 5 | |
6 | 6 | class SqlParser { |
7 | - public $host; |
|
8 | - public $dbname; |
|
9 | - public $prefix; |
|
10 | - public $user; |
|
11 | - public $password; |
|
12 | - public $mysqlErrors; |
|
13 | - public $conn; |
|
14 | - public $installFailed; |
|
15 | - public $sitename; |
|
16 | - public $adminname; |
|
17 | - public $adminemail; |
|
18 | - public $adminpass; |
|
19 | - public $managerlanguage; |
|
20 | - public $mode; |
|
21 | - public $fileManagerPath; |
|
22 | - public $imgPath; |
|
23 | - public $imgUrl; |
|
24 | - public $dbMODx; |
|
25 | - public $dbVersion; |
|
7 | + public $host; |
|
8 | + public $dbname; |
|
9 | + public $prefix; |
|
10 | + public $user; |
|
11 | + public $password; |
|
12 | + public $mysqlErrors; |
|
13 | + public $conn; |
|
14 | + public $installFailed; |
|
15 | + public $sitename; |
|
16 | + public $adminname; |
|
17 | + public $adminemail; |
|
18 | + public $adminpass; |
|
19 | + public $managerlanguage; |
|
20 | + public $mode; |
|
21 | + public $fileManagerPath; |
|
22 | + public $imgPath; |
|
23 | + public $imgUrl; |
|
24 | + public $dbMODx; |
|
25 | + public $dbVersion; |
|
26 | 26 | public $connection_charset; |
27 | 27 | public $connection_method; |
28 | 28 | public $ignoreDuplicateErrors; |
29 | 29 | public $autoTemplateLogic; |
30 | 30 | |
31 | - public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
32 | - $this->host = $host; |
|
33 | - $this->dbname = $db; |
|
34 | - $this->prefix = $prefix; |
|
35 | - $this->user = $user; |
|
36 | - $this->password = $password; |
|
37 | - $this->adminpass = $adminpass; |
|
38 | - $this->adminname = $adminname; |
|
39 | - $this->adminemail = $adminemail; |
|
40 | - $this->connection_charset = $connection_charset; |
|
41 | - $this->connection_method = $connection_method; |
|
42 | - $this->ignoreDuplicateErrors = false; |
|
43 | - $this->managerlanguage = $managerlanguage; |
|
31 | + public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
32 | + $this->host = $host; |
|
33 | + $this->dbname = $db; |
|
34 | + $this->prefix = $prefix; |
|
35 | + $this->user = $user; |
|
36 | + $this->password = $password; |
|
37 | + $this->adminpass = $adminpass; |
|
38 | + $this->adminname = $adminname; |
|
39 | + $this->adminemail = $adminemail; |
|
40 | + $this->connection_charset = $connection_charset; |
|
41 | + $this->connection_method = $connection_method; |
|
42 | + $this->ignoreDuplicateErrors = false; |
|
43 | + $this->managerlanguage = $managerlanguage; |
|
44 | 44 | $this->autoTemplateLogic = $auto_template_logic; |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | - public function connect() { |
|
48 | - $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
|
49 | - mysqli_select_db($this->conn, $this->dbname); |
|
50 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
47 | + public function connect() { |
|
48 | + $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
|
49 | + mysqli_select_db($this->conn, $this->dbname); |
|
50 | + if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
51 | 51 | |
52 | - $this->dbVersion = 3.23; // assume version 3.23 |
|
53 | - if(function_exists("mysqli_get_server_info")) { |
|
54 | - $ver = mysqli_get_server_info($this->conn); |
|
55 | - $this->dbMODx = version_compare($ver,"4.0.2"); |
|
56 | - $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
|
57 | - } |
|
52 | + $this->dbVersion = 3.23; // assume version 3.23 |
|
53 | + if(function_exists("mysqli_get_server_info")) { |
|
54 | + $ver = mysqli_get_server_info($this->conn); |
|
55 | + $this->dbMODx = version_compare($ver,"4.0.2"); |
|
56 | + $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
|
57 | + } |
|
58 | 58 | |
59 | 59 | mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | 62 | public function process($filename) { |
63 | - global $custom_placeholders; |
|
64 | - |
|
65 | - // check to make sure file exists |
|
66 | - if (!file_exists($filename)) { |
|
67 | - $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
|
68 | - $this->installFailed = true ; |
|
69 | - return false; |
|
70 | - } |
|
71 | - |
|
72 | - $fh = fopen($filename, 'r'); |
|
73 | - $idata = ''; |
|
74 | - |
|
75 | - while (!feof($fh)) { |
|
76 | - $idata .= fread($fh, 1024); |
|
77 | - } |
|
78 | - |
|
79 | - fclose($fh); |
|
80 | - $idata = str_replace("\r", '', $idata); |
|
81 | - |
|
82 | - // check if in upgrade mode |
|
83 | - if ($this->mode === 'upd') { |
|
84 | - // remove non-upgradeable parts |
|
85 | - $s = strpos($idata,'non-upgrade-able[['); |
|
86 | - $e = strpos($idata,']]non-upgrade-able') + 17; |
|
87 | - if($s && $e) { |
|
88 | - $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata); |
|
63 | + global $custom_placeholders; |
|
64 | + |
|
65 | + // check to make sure file exists |
|
66 | + if (!file_exists($filename)) { |
|
67 | + $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
|
68 | + $this->installFailed = true ; |
|
69 | + return false; |
|
70 | + } |
|
71 | + |
|
72 | + $fh = fopen($filename, 'r'); |
|
73 | + $idata = ''; |
|
74 | + |
|
75 | + while (!feof($fh)) { |
|
76 | + $idata .= fread($fh, 1024); |
|
77 | + } |
|
78 | + |
|
79 | + fclose($fh); |
|
80 | + $idata = str_replace("\r", '', $idata); |
|
81 | + |
|
82 | + // check if in upgrade mode |
|
83 | + if ($this->mode === 'upd') { |
|
84 | + // remove non-upgradeable parts |
|
85 | + $s = strpos($idata,'non-upgrade-able[['); |
|
86 | + $e = strpos($idata,']]non-upgrade-able') + 17; |
|
87 | + if($s && $e) { |
|
88 | + $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata); |
|
89 | 89 | } |
90 | - } |
|
91 | - |
|
92 | - // replace {} tags |
|
93 | - $idata = str_replace('{PREFIX}', $this->prefix, $idata); |
|
94 | - $idata = str_replace('{ADMIN}', $this->adminname, $idata); |
|
95 | - $idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata); |
|
96 | - $idata = str_replace('{ADMINPASS}', $this->adminpass, $idata); |
|
97 | - $idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata); |
|
98 | - $idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata); |
|
99 | - $idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata); |
|
100 | - $idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata); |
|
101 | - $idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata); |
|
102 | - /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
|
103 | - |
|
104 | - // Replace custom placeholders |
|
105 | - foreach($custom_placeholders as $key=>$val) { |
|
106 | - if (strpos($idata, '{'.$key.'}') !== false) { |
|
107 | - $idata = str_replace('{'.$key.'}', $val, $idata); |
|
108 | - } |
|
109 | - } |
|
110 | - |
|
111 | - $sql_array = explode("\n\n", $idata); |
|
112 | - |
|
113 | - $num = 0; |
|
114 | - foreach($sql_array as $sql_entry) { |
|
115 | - $sql_do = trim($sql_entry, "\r\n; "); |
|
116 | - |
|
117 | - if (preg_match('/^\#/', $sql_do)) continue; |
|
118 | - |
|
119 | - // strip out comments and \n for mysql 3.x |
|
120 | - if ($this->dbVersion <4.0) { |
|
121 | - $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
122 | - $sql_do = str_replace('\r', "", $sql_do); |
|
123 | - $sql_do = str_replace('\n', "", $sql_do); |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - $num = $num + 1; |
|
128 | - if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
129 | - if(mysqli_error($this->conn)) { |
|
130 | - // Ignore duplicate and drop errors - Raymond |
|
131 | - if ($this->ignoreDuplicateErrors){ |
|
132 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
133 | - } |
|
134 | - // End Ignore duplicate |
|
135 | - $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
|
136 | - $this->installFailed = true; |
|
137 | - } |
|
138 | - } |
|
139 | - } |
|
90 | + } |
|
91 | + |
|
92 | + // replace {} tags |
|
93 | + $idata = str_replace('{PREFIX}', $this->prefix, $idata); |
|
94 | + $idata = str_replace('{ADMIN}', $this->adminname, $idata); |
|
95 | + $idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata); |
|
96 | + $idata = str_replace('{ADMINPASS}', $this->adminpass, $idata); |
|
97 | + $idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata); |
|
98 | + $idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata); |
|
99 | + $idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata); |
|
100 | + $idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata); |
|
101 | + $idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata); |
|
102 | + /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
|
103 | + |
|
104 | + // Replace custom placeholders |
|
105 | + foreach($custom_placeholders as $key=>$val) { |
|
106 | + if (strpos($idata, '{'.$key.'}') !== false) { |
|
107 | + $idata = str_replace('{'.$key.'}', $val, $idata); |
|
108 | + } |
|
109 | + } |
|
110 | + |
|
111 | + $sql_array = explode("\n\n", $idata); |
|
112 | + |
|
113 | + $num = 0; |
|
114 | + foreach($sql_array as $sql_entry) { |
|
115 | + $sql_do = trim($sql_entry, "\r\n; "); |
|
116 | + |
|
117 | + if (preg_match('/^\#/', $sql_do)) continue; |
|
118 | + |
|
119 | + // strip out comments and \n for mysql 3.x |
|
120 | + if ($this->dbVersion <4.0) { |
|
121 | + $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
122 | + $sql_do = str_replace('\r', "", $sql_do); |
|
123 | + $sql_do = str_replace('\n', "", $sql_do); |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + $num = $num + 1; |
|
128 | + if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
129 | + if(mysqli_error($this->conn)) { |
|
130 | + // Ignore duplicate and drop errors - Raymond |
|
131 | + if ($this->ignoreDuplicateErrors){ |
|
132 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
133 | + } |
|
134 | + // End Ignore duplicate |
|
135 | + $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
|
136 | + $this->installFailed = true; |
|
137 | + } |
|
138 | + } |
|
139 | + } |
|
140 | 140 | |
141 | 141 | public function close() { |
142 | - mysqli_close($this->conn); |
|
143 | - } |
|
142 | + mysqli_close($this->conn); |
|
143 | + } |
|
144 | 144 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | // MySQL Dump Parser |
4 | 4 | // SNUFFKIN/ Alex 2004 |
5 | 5 | |
6 | -class SqlParser { |
|
6 | +class SqlParser{ |
|
7 | 7 | public $host; |
8 | 8 | public $dbname; |
9 | 9 | public $prefix; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public $ignoreDuplicateErrors; |
29 | 29 | public $autoTemplateLogic; |
30 | 30 | |
31 | - public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
31 | + public function __construct($host, $user, $password, $db, $prefix = 'modx_', $adminname, $adminemail, $adminpass, $connection_charset = 'utf8', $managerlanguage = 'english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent'){ |
|
32 | 32 | $this->host = $host; |
33 | 33 | $this->dbname = $db; |
34 | 34 | $this->prefix = $prefix; |
@@ -44,28 +44,28 @@ discard block |
||
44 | 44 | $this->autoTemplateLogic = $auto_template_logic; |
45 | 45 | } |
46 | 46 | |
47 | - public function connect() { |
|
47 | + public function connect(){ |
|
48 | 48 | $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
49 | 49 | mysqli_select_db($this->conn, $this->dbname); |
50 | 50 | if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
51 | 51 | |
52 | 52 | $this->dbVersion = 3.23; // assume version 3.23 |
53 | - if(function_exists("mysqli_get_server_info")) { |
|
53 | + if (function_exists("mysqli_get_server_info")) { |
|
54 | 54 | $ver = mysqli_get_server_info($this->conn); |
55 | - $this->dbMODx = version_compare($ver,"4.0.2"); |
|
55 | + $this->dbMODx = version_compare($ver, "4.0.2"); |
|
56 | 56 | $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2] |
57 | 57 | } |
58 | 58 | |
59 | - mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
|
59 | + mysqli_query($this->conn, "{$this->connection_method} {$this->connection_charset}"); |
|
60 | 60 | } |
61 | 61 | |
62 | - public function process($filename) { |
|
62 | + public function process($filename){ |
|
63 | 63 | global $custom_placeholders; |
64 | 64 | |
65 | 65 | // check to make sure file exists |
66 | 66 | if (!file_exists($filename)) { |
67 | 67 | $this->mysqlErrors[] = array("error" => "File '$filename' not found"); |
68 | - $this->installFailed = true ; |
|
68 | + $this->installFailed = true; |
|
69 | 69 | return false; |
70 | 70 | } |
71 | 71 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | // check if in upgrade mode |
83 | 83 | if ($this->mode === 'upd') { |
84 | 84 | // remove non-upgradeable parts |
85 | - $s = strpos($idata,'non-upgrade-able[['); |
|
86 | - $e = strpos($idata,']]non-upgrade-able') + 17; |
|
87 | - if($s && $e) { |
|
88 | - $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata); |
|
85 | + $s = strpos($idata, 'non-upgrade-able[['); |
|
86 | + $e = strpos($idata, ']]non-upgrade-able') + 17; |
|
87 | + if ($s && $e) { |
|
88 | + $idata = str_replace(substr($idata, $s, $e - $s), ' Removed non upgradeable items', $idata); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/ |
103 | 103 | |
104 | 104 | // Replace custom placeholders |
105 | - foreach($custom_placeholders as $key=>$val) { |
|
105 | + foreach ($custom_placeholders as $key=>$val) { |
|
106 | 106 | if (strpos($idata, '{'.$key.'}') !== false) { |
107 | 107 | $idata = str_replace('{'.$key.'}', $val, $idata); |
108 | 108 | } |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | $sql_array = explode("\n\n", $idata); |
112 | 112 | |
113 | 113 | $num = 0; |
114 | - foreach($sql_array as $sql_entry) { |
|
114 | + foreach ($sql_array as $sql_entry) { |
|
115 | 115 | $sql_do = trim($sql_entry, "\r\n; "); |
116 | 116 | |
117 | 117 | if (preg_match('/^\#/', $sql_do)) continue; |
118 | 118 | |
119 | 119 | // strip out comments and \n for mysql 3.x |
120 | - if ($this->dbVersion <4.0) { |
|
121 | - $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do); |
|
120 | + if ($this->dbVersion < 4.0) { |
|
121 | + $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~", "", $sql_do); |
|
122 | 122 | $sql_do = str_replace('\r', "", $sql_do); |
123 | 123 | $sql_do = str_replace('\n', "", $sql_do); |
124 | 124 | } |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | |
127 | 127 | $num = $num + 1; |
128 | 128 | if ($sql_do) mysqli_query($this->conn, $sql_do); |
129 | - if(mysqli_error($this->conn)) { |
|
129 | + if (mysqli_error($this->conn)) { |
|
130 | 130 | // Ignore duplicate and drop errors - Raymond |
131 | - if ($this->ignoreDuplicateErrors){ |
|
132 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
131 | + if ($this->ignoreDuplicateErrors) { |
|
132 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 || mysqli_errno($this->conn) == 1091) continue; |
|
133 | 133 | } |
134 | 134 | // End Ignore duplicate |
135 | 135 | $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - public function close() { |
|
141 | + public function close(){ |
|
142 | 142 | mysqli_close($this->conn); |
143 | 143 | } |
144 | 144 | } |
@@ -3,7 +3,8 @@ discard block |
||
3 | 3 | // MySQL Dump Parser |
4 | 4 | // SNUFFKIN/ Alex 2004 |
5 | 5 | |
6 | -class SqlParser { |
|
6 | +class SqlParser |
|
7 | +{ |
|
7 | 8 | public $host; |
8 | 9 | public $dbname; |
9 | 10 | public $prefix; |
@@ -28,7 +29,8 @@ discard block |
||
28 | 29 | public $ignoreDuplicateErrors; |
29 | 30 | public $autoTemplateLogic; |
30 | 31 | |
31 | - public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
32 | + public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') |
|
33 | + { |
|
32 | 34 | $this->host = $host; |
33 | 35 | $this->dbname = $db; |
34 | 36 | $this->prefix = $prefix; |
@@ -44,10 +46,13 @@ discard block |
||
44 | 46 | $this->autoTemplateLogic = $auto_template_logic; |
45 | 47 | } |
46 | 48 | |
47 | - public function connect() { |
|
49 | + public function connect() |
|
50 | + { |
|
48 | 51 | $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
49 | 52 | mysqli_select_db($this->conn, $this->dbname); |
50 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
53 | + if (function_exists('mysqli_set_charset')) { |
|
54 | + mysqli_set_charset($this->conn, $this->connection_charset); |
|
55 | + } |
|
51 | 56 | |
52 | 57 | $this->dbVersion = 3.23; // assume version 3.23 |
53 | 58 | if(function_exists("mysqli_get_server_info")) { |
@@ -59,7 +64,8 @@ discard block |
||
59 | 64 | mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
60 | 65 | } |
61 | 66 | |
62 | - public function process($filename) { |
|
67 | + public function process($filename) |
|
68 | + { |
|
63 | 69 | global $custom_placeholders; |
64 | 70 | |
65 | 71 | // check to make sure file exists |
@@ -114,7 +120,9 @@ discard block |
||
114 | 120 | foreach($sql_array as $sql_entry) { |
115 | 121 | $sql_do = trim($sql_entry, "\r\n; "); |
116 | 122 | |
117 | - if (preg_match('/^\#/', $sql_do)) continue; |
|
123 | + if (preg_match('/^\#/', $sql_do)) { |
|
124 | + continue; |
|
125 | + } |
|
118 | 126 | |
119 | 127 | // strip out comments and \n for mysql 3.x |
120 | 128 | if ($this->dbVersion <4.0) { |
@@ -125,11 +133,15 @@ discard block |
||
125 | 133 | |
126 | 134 | |
127 | 135 | $num = $num + 1; |
128 | - if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
136 | + if ($sql_do) { |
|
137 | + mysqli_query($this->conn, $sql_do); |
|
138 | + } |
|
129 | 139 | if(mysqli_error($this->conn)) { |
130 | 140 | // Ignore duplicate and drop errors - Raymond |
131 | - if ($this->ignoreDuplicateErrors){ |
|
132 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
141 | + if ($this->ignoreDuplicateErrors) { |
|
142 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) { |
|
143 | + continue; |
|
144 | + } |
|
133 | 145 | } |
134 | 146 | // End Ignore duplicate |
135 | 147 | $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
@@ -138,7 +150,8 @@ discard block |
||
138 | 150 | } |
139 | 151 | } |
140 | 152 | |
141 | - public function close() { |
|
153 | + public function close() |
|
154 | + { |
|
142 | 155 | mysqli_close($this->conn); |
143 | 156 | } |
144 | 157 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'sv' => 'svenska' |
38 | 38 | ); |
39 | 39 | $_langISO6391 = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); |
40 | -if (! empty($_langFiles[$_langISO6391])) { |
|
40 | +if (!empty($_langFiles[$_langISO6391])) { |
|
41 | 41 | $install_language = $_langFiles[$_langISO6391]; |
42 | 42 | } |
43 | 43 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | # load language file |
53 | 53 | require_once 'lang/english.inc.php'; // As fallback |
54 | -require_once 'lang/' . $install_language . '.inc.php'; |
|
54 | +require_once 'lang/'.$install_language.'.inc.php'; |
|
55 | 55 | |
56 | 56 | $manager_language = $install_language; |
57 | 57 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * |
16 | 16 | * Please commit your language changes on Transifex (https://www.transifex.com/projects/p/modx-evolution/) or on GitHub (https://github.com/modxcms/evolution). |
17 | 17 | */ |
18 | -setlocale (LC_ALL, 'ru_RU.UTF-8'); |
|
18 | +setlocale(LC_ALL, 'ru_RU.UTF-8'); |
|
19 | 19 | $_lang["agree_to_terms"] = 'Согласиться с условиями лицензии и приступить к установке'; |
20 | 20 | $_lang["alert_database_test_connection"] = 'Вы должны создать базу данных или выбрать базу данных для проверки!'; |
21 | 21 | $_lang["alert_database_test_connection_failed"] = 'Неудачная проверка выбранной базы данных!'; |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //:: EVO Installer Setup file |
3 | 3 | //::::::::::::::::::::::::::::::::::::::::: |
4 | -if (is_file($base_path . 'assets/cache/siteManager.php')) { |
|
5 | - include_once($base_path . 'assets/cache/siteManager.php'); |
|
4 | +if (is_file($base_path.'assets/cache/siteManager.php')) { |
|
5 | + include_once($base_path.'assets/cache/siteManager.php'); |
|
6 | 6 | } |
7 | 7 | if (!defined('MGR_DIR')) { |
8 | 8 | define('MGR_DIR', 'manager'); |
9 | 9 | } |
10 | 10 | |
11 | -require_once(dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/version.inc.php'); |
|
11 | +require_once(dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/version.inc.php'); |
|
12 | 12 | |
13 | -$chunkPath = $base_path . 'install/assets/chunks'; |
|
14 | -$snippetPath = $base_path . 'install/assets/snippets'; |
|
15 | -$pluginPath = $base_path . 'install/assets/plugins'; |
|
16 | -$modulePath = $base_path . 'install/assets/modules'; |
|
17 | -$templatePath = $base_path . 'install/assets/templates'; |
|
18 | -$tvPath = $base_path . 'install/assets/tvs'; |
|
13 | +$chunkPath = $base_path.'install/assets/chunks'; |
|
14 | +$snippetPath = $base_path.'install/assets/snippets'; |
|
15 | +$pluginPath = $base_path.'install/assets/plugins'; |
|
16 | +$modulePath = $base_path.'install/assets/modules'; |
|
17 | +$templatePath = $base_path.'install/assets/templates'; |
|
18 | +$tvPath = $base_path.'install/assets/tvs'; |
|
19 | 19 | |
20 | 20 | // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category |
21 | 21 | $mt = &$moduleTemplates; |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | $params = parse_docblock($templatePath, $tplfile); |
29 | 29 | if (is_array($params) && (count($params) > 0)) { |
30 | 30 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
31 | - $mt[] = array |
|
32 | - ( |
|
31 | + $mt[] = array( |
|
33 | 32 | $params['name'], |
34 | 33 | $description, |
35 | 34 | // Don't think this is gonna be used ... but adding it just in case 'type' |
@@ -149,7 +148,7 @@ discard block |
||
149 | 148 | $params['modx_category'], |
150 | 149 | $params['legacy_names'], |
151 | 150 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false, |
152 | - (int)$params['disabled'] |
|
151 | + (int) $params['disabled'] |
|
153 | 152 | ); |
154 | 153 | } |
155 | 154 | } |
@@ -174,12 +173,12 @@ discard block |
||
174 | 173 | "$modulePath/{$params['filename']}", |
175 | 174 | $params['properties'], |
176 | 175 | $params['guid'], |
177 | - (int)$params['shareparams'], |
|
176 | + (int) $params['shareparams'], |
|
178 | 177 | $params['modx_category'], |
179 | 178 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
180 | 179 | ); |
181 | 180 | } |
182 | - if ((int)$params['shareparams'] || !empty($params['dependencies'])) { |
|
181 | + if ((int) $params['shareparams'] || !empty($params['dependencies'])) { |
|
183 | 182 | $dependencies = explode(',', $params['dependencies']); |
184 | 183 | foreach ($dependencies as $dependency) { |
185 | 184 | $dependency = explode(':', $dependency); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @param string $param |
174 | 174 | * @param array $tvsArray |
175 | - * @return mixed |
|
175 | + * @return string |
|
176 | 176 | */ |
177 | 177 | function parseTvValues($param, $tvsArray) |
178 | 178 | { |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | /** |
567 | 567 | * returns an array if a delimiter is present. returns array is a recordset is present |
568 | 568 | * |
569 | - * @param $src |
|
569 | + * @param string $src |
|
570 | 570 | * @param string $delim |
571 | 571 | * @param string $type |
572 | 572 | * @param bool $columns |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | |
1023 | 1023 | if (! function_exists('ParseIntputOptions')) { |
1024 | 1024 | /** |
1025 | - * @param string|array|mysqli_result $v |
|
1025 | + * @param string $v |
|
1026 | 1026 | * @return array |
1027 | 1027 | */ |
1028 | 1028 | function ParseIntputOptions($v) |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('ProcessTVCommand')) { |
|
3 | +if (!function_exists('ProcessTVCommand')) { |
|
4 | 4 | /** |
5 | 5 | * @param string $value |
6 | 6 | * @param string $name |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | function ProcessTVCommand($value, $name = '', $docid = '', $src = 'docform', $tvsArray = array()) |
13 | 13 | { |
14 | 14 | $modx = evolutionCMS(); |
15 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
15 | + $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier; |
|
16 | 16 | $nvalue = trim($value); |
17 | 17 | if (substr($nvalue, 0, 1) != '@') { |
18 | 18 | return $value; |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | // if an inherited value is found and if there is content following the @INHERIT binding |
78 | 78 | // remove @INHERIT and output that following content. This content could contain other |
79 | 79 | // @ bindings, that are processed in the next step |
80 | - if ((string)$tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) { |
|
81 | - $output = trim(str_replace('@INHERIT', '', (string)$tv['value'])); |
|
80 | + if ((string) $tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) { |
|
81 | + $output = trim(str_replace('@INHERIT', '', (string) $tv['value'])); |
|
82 | 82 | break 2; |
83 | 83 | } |
84 | 84 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | case 'DIRECTORY' : |
88 | 88 | $files = array(); |
89 | - $path = $modx->config['base_path'] . $param; |
|
89 | + $path = $modx->config['base_path'].$param; |
|
90 | 90 | if (substr($path, -1, 1) != '/') { |
91 | 91 | $path .= '/'; |
92 | 92 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | -if (! function_exists('ProcessFile')) { |
|
120 | +if (!function_exists('ProcessFile')) { |
|
121 | 121 | /** |
122 | 122 | * @param $file |
123 | 123 | * @return string |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | -if (! function_exists('ParseCommand')) { |
|
137 | +if (!function_exists('ParseCommand')) { |
|
138 | 138 | /** |
139 | 139 | * ParseCommand - separate @ cmd from params |
140 | 140 | * |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | $binding_array = array(); |
157 | 157 | foreach ($BINDINGS as $cmd) { |
158 | - if (strpos($binding_string, '@' . $cmd) === 0) { |
|
158 | + if (strpos($binding_string, '@'.$cmd) === 0) { |
|
159 | 159 | $code = substr($binding_string, strlen($cmd) + 1); |
160 | 160 | $binding_array = array($cmd, trim($code)); |
161 | 161 | break; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | -if (! function_exists('parseTvValues')) { |
|
169 | +if (!function_exists('parseTvValues')) { |
|
170 | 170 | /** |
171 | 171 | * Parse MODX Template-Variables |
172 | 172 | * |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | -if (! function_exists('getTVDisplayFormat')) { |
|
200 | +if (!function_exists('getTVDisplayFormat')) { |
|
201 | 201 | /** |
202 | 202 | * @param string $name |
203 | 203 | * @param string $value |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $o = ''; |
216 | 216 | |
217 | 217 | // process any TV commands in value |
218 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
218 | + $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier; |
|
219 | 219 | $value = ProcessTVCommand($value, $name, $docid); |
220 | 220 | |
221 | 221 | $params = array(); |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | $attr['align'] = $params['align']; |
255 | 255 | } |
256 | 256 | foreach ($attr as $k => $v) { |
257 | - $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
257 | + $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
258 | 258 | } |
259 | - $attributes .= ' ' . $params['attrib']; |
|
259 | + $attributes .= ' '.$params['attrib']; |
|
260 | 260 | |
261 | 261 | // Output the image with attributes |
262 | - $o .= '<img' . rtrim($attributes) . ' />'; |
|
262 | + $o .= '<img'.rtrim($attributes).' />'; |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | break; |
@@ -331,12 +331,12 @@ discard block |
||
331 | 331 | 'target' => $params['target'], |
332 | 332 | ); |
333 | 333 | foreach ($attr as $k => $v) { |
334 | - $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
334 | + $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
335 | 335 | } |
336 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
336 | + $attributes .= ' '.$params['attrib']; // add extra |
|
337 | 337 | |
338 | 338 | // Output the link |
339 | - $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
339 | + $o .= '<a'.rtrim($attributes).'>'.($params['text'] ? $modx->htmlspecialchars($params['text']) : $name).'</a>'; |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | break; |
@@ -362,12 +362,12 @@ discard block |
||
362 | 362 | 'style' => $params['style'], |
363 | 363 | ); |
364 | 364 | foreach ($attr as $k => $v) { |
365 | - $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
365 | + $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
366 | 366 | } |
367 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
367 | + $attributes .= ' '.$params['attrib']; // add extra |
|
368 | 368 | |
369 | 369 | // Output the HTML Tag |
370 | - $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
370 | + $o .= '<'.$tagname.rtrim($attributes).'>'.$tagvalue.'</'.$tagname.'>'; |
|
371 | 371 | } |
372 | 372 | break; |
373 | 373 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $w = $params['w'] ? $params['w'] : '100%'; |
377 | 377 | $h = $params['h'] ? $params['h'] : '400px'; |
378 | 378 | $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
379 | - $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
379 | + $o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">'; |
|
380 | 380 | $o .= $modx->htmlspecialchars($value); |
381 | 381 | $o .= '</textarea></div>'; |
382 | 382 | $replace_richtext = array($id); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | case "viewport": |
405 | 405 | $value = parseInput($value); |
406 | - $id = '_' . time(); |
|
406 | + $id = '_'.time(); |
|
407 | 407 | if (!$params['vpid']) { |
408 | 408 | $params['vpid'] = $id; |
409 | 409 | } |
@@ -417,41 +417,41 @@ discard block |
||
417 | 417 | $h = "100%"; |
418 | 418 | } |
419 | 419 | if ($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
420 | - $autoMode = "3"; //both |
|
420 | + $autoMode = "3"; //both |
|
421 | 421 | } else { |
422 | 422 | if ($params['awidth'] == 'Yes') { |
423 | 423 | $autoMode = "1"; //width only |
424 | 424 | } else { |
425 | 425 | if ($params['aheight'] == 'Yes') { |
426 | - $autoMode = "2"; //height only |
|
426 | + $autoMode = "2"; //height only |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
431 | - $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
431 | + $modx->regClientStartupScript(MODX_MANAGER_URL."media/script/bin/viewport.js", array( |
|
432 | 432 | 'name' => 'viewport', |
433 | 433 | 'version' => '0', |
434 | 434 | 'plaintext' => false |
435 | 435 | )); |
436 | - $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
436 | + $o = $sTag." id='".$params['vpid']."' name='".$params['vpid']."' "; |
|
437 | 437 | if ($params['class']) { |
438 | - $o .= " class='" . $params['class'] . "' "; |
|
438 | + $o .= " class='".$params['class']."' "; |
|
439 | 439 | } |
440 | 440 | if ($params['style']) { |
441 | - $o .= " style='" . $params['style'] . "' "; |
|
441 | + $o .= " style='".$params['style']."' "; |
|
442 | 442 | } |
443 | 443 | if ($params['attrib']) { |
444 | - $o .= $params['attrib'] . " "; |
|
444 | + $o .= $params['attrib']." "; |
|
445 | 445 | } |
446 | - $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
447 | - $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
448 | - $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
446 | + $o .= "scrolling='".($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto"))."' "; |
|
447 | + $o .= "src='".$value."' frameborder='".$params['borsize']."' "; |
|
448 | + $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'".$params['vpid']."\\',".$autoMode.")',100);\" width='".$w."' height='".$h."' "; |
|
449 | 449 | $o .= ">"; |
450 | 450 | $o .= $eTag; |
451 | 451 | break; |
452 | 452 | |
453 | 453 | case "datagrid": |
454 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
454 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
455 | 455 | $grd = new DataGrid('', $value); |
456 | 456 | |
457 | 457 | $grd->noRecordMsg = $params['egmsg']; |
@@ -498,16 +498,16 @@ discard block |
||
498 | 498 | $o = ''; |
499 | 499 | /* If we are loading a file */ |
500 | 500 | if (substr($params['output'], 0, 5) == "@FILE") { |
501 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
501 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 6)); |
|
502 | 502 | if (!file_exists($file_name)) { |
503 | - $widget_output = $file_name . ' does not exist'; |
|
503 | + $widget_output = $file_name.' does not exist'; |
|
504 | 504 | } else { |
505 | 505 | $widget_output = file_get_contents($file_name); |
506 | 506 | } |
507 | 507 | } elseif (substr($params['output'], 0, 8) == '@INCLUDE') { |
508 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
508 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 9)); |
|
509 | 509 | if (!file_exists($file_name)) { |
510 | - $widget_output = $file_name . ' does not exist'; |
|
510 | + $widget_output = $file_name.' does not exist'; |
|
511 | 511 | } else { |
512 | 512 | /* The included file needs to set $widget_output. Can be string, array, object */ |
513 | 513 | include $file_name; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | } |
550 | 550 | } |
551 | 551 | |
552 | -if (! function_exists('decodeParamValue')) { |
|
552 | +if (!function_exists('decodeParamValue')) { |
|
553 | 553 | /** |
554 | 554 | * @param string $s |
555 | 555 | * @return string |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
565 | -if (! function_exists('parseInput')) { |
|
565 | +if (!function_exists('parseInput')) { |
|
566 | 566 | /** |
567 | 567 | * returns an array if a delimiter is present. returns array is a recordset is present |
568 | 568 | * |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | } |
595 | 595 | } |
596 | 596 | |
597 | -if (! function_exists('getUnixtimeFromDateString')) { |
|
597 | +if (!function_exists('getUnixtimeFromDateString')) { |
|
598 | 598 | /** |
599 | 599 | * @param string $value |
600 | 600 | * @return bool|false|int |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | } |
623 | 623 | } |
624 | 624 | |
625 | -if (! function_exists('renderFormElement')) { |
|
625 | +if (!function_exists('renderFormElement')) { |
|
626 | 626 | /** |
627 | 627 | * DISPLAY FORM ELEMENTS |
628 | 628 | * |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | $field_style = '', |
646 | 646 | $row = array(), |
647 | 647 | $tvsArray = array() |
648 | - ) { |
|
648 | + ){ |
|
649 | 649 | $modx = evolutionCMS(); |
650 | 650 | global $_style; |
651 | 651 | global $_lang; |
@@ -665,22 +665,22 @@ discard block |
||
665 | 665 | |
666 | 666 | case "text": // handler for regular text boxes |
667 | 667 | case "rawtext"; // non-htmlentity converted text boxes |
668 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
668 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" />'; |
|
669 | 669 | break; |
670 | 670 | case "email": // handles email input fields |
671 | - $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
671 | + $field_html .= '<input type="email" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%"/>'; |
|
672 | 672 | break; |
673 | 673 | case "number": // handles the input of numbers |
674 | - $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
674 | + $field_html .= '<input type="number" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
675 | 675 | break; |
676 | 676 | case "textareamini": // handler for textarea mini boxes |
677 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
677 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>'; |
|
678 | 678 | break; |
679 | 679 | case "textarea": // handler for textarea boxes |
680 | 680 | case "rawtextarea": // non-htmlentity convertex textarea boxes |
681 | 681 | case "htmlarea": // handler for textarea boxes (deprecated) |
682 | 682 | case "richtext": // handler for textarea boxes |
683 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
683 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>'; |
|
684 | 684 | break; |
685 | 685 | case "date": |
686 | 686 | $field_id = str_replace(array( |
@@ -690,12 +690,12 @@ discard block |
||
690 | 690 | if ($field_value == '') { |
691 | 691 | $field_value = 0; |
692 | 692 | } |
693 | - $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
694 | - $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
693 | + $field_html .= '<input id="tv'.$field_id.'" name="tv'.$field_id.'" class="DatePicker" type="text" value="'.($field_value == 0 || !isset($field_value) ? "" : $field_value).'" onblur="documentDirty=true;" />'; |
|
694 | + $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].value=\'\';document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="'.$_style["actions_calendar_delete"].'"></i></a>'; |
|
695 | 695 | |
696 | 696 | break; |
697 | 697 | case "dropdown": // handler for select boxes |
698 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
698 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">'; |
|
699 | 699 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', |
700 | 700 | $tvsArray)); |
701 | 701 | while (list($item, $itemvalue) = each($index_list)) { |
@@ -703,12 +703,12 @@ discard block |
||
703 | 703 | if (strlen($itemvalue) == 0) { |
704 | 704 | $itemvalue = $item; |
705 | 705 | } |
706 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
706 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
707 | 707 | } |
708 | 708 | $field_html .= "</select>"; |
709 | 709 | break; |
710 | 710 | case "listbox": // handler for select boxes |
711 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
711 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">'; |
|
712 | 712 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', |
713 | 713 | $tvsArray)); |
714 | 714 | while (list($item, $itemvalue) = each($index_list)) { |
@@ -716,13 +716,13 @@ discard block |
||
716 | 716 | if (strlen($itemvalue) == 0) { |
717 | 717 | $itemvalue = $item; |
718 | 718 | } |
719 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
719 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
720 | 720 | } |
721 | 721 | $field_html .= "</select>"; |
722 | 722 | break; |
723 | 723 | case "listbox-multiple": // handler for select boxes where you can choose multiple items |
724 | 724 | $field_value = explode("||", $field_value); |
725 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
725 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
726 | 726 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', |
727 | 727 | $tvsArray)); |
728 | 728 | while (list($item, $itemvalue) = each($index_list)) { |
@@ -730,8 +730,8 @@ discard block |
||
730 | 730 | if (strlen($itemvalue) == 0) { |
731 | 731 | $itemvalue = $item; |
732 | 732 | } |
733 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, |
|
734 | - $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
733 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue, |
|
734 | + $field_value) ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
735 | 735 | } |
736 | 736 | $field_html .= "</select>"; |
737 | 737 | break; |
@@ -743,17 +743,17 @@ discard block |
||
743 | 743 | 'ftp://' => 'ftp://', |
744 | 744 | 'mailto:' => 'mailto:' |
745 | 745 | ); |
746 | - $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
746 | + $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_id.'_prefix" name="tv'.$field_id.'_prefix" onchange="documentDirty=true;">'; |
|
747 | 747 | foreach ($urls as $k => $v) { |
748 | 748 | if (strpos($field_value, $v) === false) { |
749 | - $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
749 | + $field_html .= '<option value="'.$v.'">'.$k.'</option>'; |
|
750 | 750 | } else { |
751 | 751 | $field_value = str_replace($v, '', $field_value); |
752 | - $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
752 | + $field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>'; |
|
753 | 753 | } |
754 | 754 | } |
755 | 755 | $field_html .= '</select></td><td>'; |
756 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
756 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;" /></td></tr></table>'; |
|
757 | 757 | break; |
758 | 758 | case 'checkbox': // handles check boxes |
759 | 759 | $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | if (strlen($itemvalue) == 0) { |
796 | 796 | $itemvalue = $item; |
797 | 797 | } |
798 | - $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
798 | + $field_html .= '<input type="radio" value="'.$modx->htmlspecialchars($itemvalue).'" id="tv_'.$i.'" name="tv'.$field_id.'" '.($itemvalue == $field_value ? 'checked="checked"' : '').' onchange="documentDirty=true;" /><label for="tv_'.$i.'" class="radio">'.$item.'</label><br />'; |
|
799 | 799 | $i++; |
800 | 800 | } |
801 | 801 | break; |
@@ -825,13 +825,13 @@ discard block |
||
825 | 825 | lastImageCtrl = ctrl; |
826 | 826 | var w = screen.width * 0.5; |
827 | 827 | var h = screen.height * 0.5; |
828 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
828 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
829 | 829 | } |
830 | 830 | function BrowseFileServer(ctrl) { |
831 | 831 | lastFileCtrl = ctrl; |
832 | 832 | var w = screen.width * 0.5; |
833 | 833 | var h = screen.height * 0.5; |
834 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
834 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
835 | 835 | } |
836 | 836 | function SetUrlChange(el) { |
837 | 837 | if ('createEvent' in document) { |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | </script>"; |
866 | 866 | $ResourceManagerLoaded = true; |
867 | 867 | } |
868 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
868 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseServer(\'tv'.$field_id.'\')" />'; |
|
869 | 869 | break; |
870 | 870 | case "file": // handles the input of file uploads |
871 | 871 | /* Modified by Timon for use with resource browser */ |
@@ -895,13 +895,13 @@ discard block |
||
895 | 895 | lastImageCtrl = ctrl; |
896 | 896 | var w = screen.width * 0.5; |
897 | 897 | var h = screen.height * 0.5; |
898 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
898 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
899 | 899 | } |
900 | 900 | function BrowseFileServer(ctrl) { |
901 | 901 | lastFileCtrl = ctrl; |
902 | 902 | var w = screen.width * 0.5; |
903 | 903 | var h = screen.height * 0.5; |
904 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
904 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
905 | 905 | } |
906 | 906 | function SetUrlChange(el) { |
907 | 907 | if ('createEvent' in document) { |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | </script>"; |
936 | 936 | $ResourceManagerLoaded = true; |
937 | 937 | } |
938 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
938 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseFileServer(\'tv'.$field_id.'\')" />'; |
|
939 | 939 | |
940 | 940 | break; |
941 | 941 | |
@@ -943,16 +943,16 @@ discard block |
||
943 | 943 | $custom_output = ''; |
944 | 944 | /* If we are loading a file */ |
945 | 945 | if (substr($field_elements, 0, 5) == "@FILE") { |
946 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
946 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 6)); |
|
947 | 947 | if (!file_exists($file_name)) { |
948 | - $custom_output = $file_name . ' does not exist'; |
|
948 | + $custom_output = $file_name.' does not exist'; |
|
949 | 949 | } else { |
950 | 950 | $custom_output = file_get_contents($file_name); |
951 | 951 | } |
952 | 952 | } elseif (substr($field_elements, 0, 8) == '@INCLUDE') { |
953 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
953 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 9)); |
|
954 | 954 | if (!file_exists($file_name)) { |
955 | - $custom_output = $file_name . ' does not exist'; |
|
955 | + $custom_output = $file_name.' does not exist'; |
|
956 | 956 | } else { |
957 | 957 | ob_start(); |
958 | 958 | include $file_name; |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | $chunk_name = trim(substr($field_elements, 7)); |
964 | 964 | $chunk_body = $modx->getChunk($chunk_name); |
965 | 965 | if ($chunk_body == false) { |
966 | - $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
966 | + $custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')'; |
|
967 | 967 | } else { |
968 | 968 | $custom_output = $chunk_body; |
969 | 969 | } |
@@ -988,15 +988,15 @@ discard block |
||
988 | 988 | break; |
989 | 989 | |
990 | 990 | default: // the default handler -- for errors, mostly |
991 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
991 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />'; |
|
992 | 992 | |
993 | 993 | } // end switch statement |
994 | 994 | } else { |
995 | 995 | $custom = explode(":", $field_type); |
996 | 996 | $custom_output = ''; |
997 | - $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
997 | + $file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php'; |
|
998 | 998 | if (!file_exists($file_name)) { |
999 | - $custom_output = $file_name . ' does not exist'; |
|
999 | + $custom_output = $file_name.' does not exist'; |
|
1000 | 1000 | } else { |
1001 | 1001 | ob_start(); |
1002 | 1002 | include $file_name; |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | } // end renderFormElement function |
1021 | 1021 | } |
1022 | 1022 | |
1023 | -if (! function_exists('ParseIntputOptions')) { |
|
1023 | +if (!function_exists('ParseIntputOptions')) { |
|
1024 | 1024 | /** |
1025 | 1025 | * @param string|array|mysqli_result $v |
1026 | 1026 | * @return array |
@@ -573,7 +573,8 @@ |
||
573 | 573 | * @return array|string |
574 | 574 | */ |
575 | 575 | function parseInput($src, $delim = "||", $type = "string", $columns = true) |
576 | - { // type can be: string, array |
|
576 | + { |
|
577 | +// type can be: string, array |
|
577 | 578 | $modx = evolutionCMS(); |
578 | 579 | if ($modx->db->isResult($src)) { |
579 | 580 | // must be a recordset |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $modx->setPlaceholder($rvKey, $rvValue); |
52 | 52 | } |
53 | 53 | $param = $modx->mergePlaceholderContent($param); |
54 | - $rs = $modx->db->query("SELECT $param;"); |
|
54 | + $rs = $modx->db->query("select $param;"); |
|
55 | 55 | $output = $rs; |
56 | 56 | break; |
57 | 57 |
@@ -237,7 +237,7 @@ |
||
237 | 237 | /** |
238 | 238 | * build siteCache file |
239 | 239 | * @param DocumentParser $modx |
240 | - * @return boolean success |
|
240 | + * @return null|boolean success |
|
241 | 241 | */ |
242 | 242 | public function buildCache($modx) |
243 | 243 | { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | if (isset($this->aliases[$id])) { |
95 | 95 | if ($this->aliasVisible[$id] == 1) { |
96 | 96 | if ($path != '') { |
97 | - $path = $this->aliases[$id] . '/' . $path; |
|
97 | + $path = $this->aliases[$id].'/'.$path; |
|
98 | 98 | } else { |
99 | 99 | $path = $this->aliases[$id]; |
100 | 100 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $modx->messageQuit("Cache path not set."); |
119 | 119 | } |
120 | 120 | |
121 | - $files = glob(realpath($this->cachePath) . '/*.pageCache.php'); |
|
121 | + $files = glob(realpath($this->cachePath).'/*.pageCache.php'); |
|
122 | 122 | $filesincache = count($files); |
123 | 123 | $deletedfiles = array(); |
124 | 124 | while ($file = array_shift($files)) { |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | if (isset($opcache)) { |
152 | 152 | echo '<p>Opcache empty.</p>'; |
153 | 153 | } |
154 | - echo '<p>' . $_lang['cache_files_deleted'] . '</p><ul>'; |
|
154 | + echo '<p>'.$_lang['cache_files_deleted'].'</p><ul>'; |
|
155 | 155 | foreach ($deletedfiles as $deletedfile) { |
156 | - echo '<li>' . $deletedfile . '</li>'; |
|
156 | + echo '<li>'.$deletedfile.'</li>'; |
|
157 | 157 | } |
158 | 158 | echo '</ul>'; |
159 | 159 | } |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | |
173 | 173 | |
174 | 174 | // write the file |
175 | - $content = '<?php' . "\n"; |
|
176 | - $content .= '$recent_update=\'' . $this->request_time . '\';' . "\n"; |
|
177 | - $content .= '$cacheRefreshTime=\'' . $cacheRefreshTime . '\';' . "\n"; |
|
175 | + $content = '<?php'."\n"; |
|
176 | + $content .= '$recent_update=\''.$this->request_time.'\';'."\n"; |
|
177 | + $content .= '$cacheRefreshTime=\''.$cacheRefreshTime.'\';'."\n"; |
|
178 | 178 | |
179 | - $filename = $this->cachePath . '/sitePublishing.idx.php'; |
|
179 | + $filename = $this->cachePath.'/sitePublishing.idx.php'; |
|
180 | 180 | if (!$handle = fopen($filename, 'w')) { |
181 | 181 | exit("Cannot open file ({$filename}"); |
182 | 182 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $timesArr = array(); |
201 | 201 | |
202 | 202 | $result = $modx->db->select('MIN(pub_date) AS minpub', '[+prefix+]site_content', |
203 | - 'pub_date>' . $this->request_time); |
|
203 | + 'pub_date>'.$this->request_time); |
|
204 | 204 | if (!$result) { |
205 | 205 | echo "Couldn't determine next publish event!"; |
206 | 206 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | $result = $modx->db->select('MIN(unpub_date) AS minunpub', '[+prefix+]site_content', |
214 | - 'unpub_date>' . $this->request_time); |
|
214 | + 'unpub_date>'.$this->request_time); |
|
215 | 215 | if (!$result) { |
216 | 216 | echo "Couldn't determine next unpublish event!"; |
217 | 217 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $config = array(); |
251 | 251 | $content .= '$c=&$this->config;'; |
252 | 252 | while (list($key, $value) = $modx->db->getRow($rs, 'num')) { |
253 | - $content .= '$c[\'' . $key . '\']="' . $this->escapeDoubleQuotes($value) . '";'; |
|
253 | + $content .= '$c[\''.$key.'\']="'.$this->escapeDoubleQuotes($value).'";'; |
|
254 | 254 | $config[$key] = $value; |
255 | 255 | } |
256 | 256 | |
@@ -288,23 +288,23 @@ discard block |
||
288 | 288 | $docid = $doc['id']; |
289 | 289 | if ($use_alias_path) { |
290 | 290 | $tmpPath = $this->getParents($doc['parent']); |
291 | - $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '') . $doc['alias']; |
|
291 | + $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '').$doc['alias']; |
|
292 | 292 | $key = $alias; |
293 | 293 | } else { |
294 | 294 | $key = $doc['alias']; |
295 | 295 | } |
296 | 296 | |
297 | 297 | $doc['path'] = $tmpPath; |
298 | - $content .= '$a[' . $docid . ']=array(\'id\'=>' . $docid . ',\'alias\'=>\'' . $doc['alias'] . '\',\'path\'=>\'' . $doc['path'] . '\',\'parent\'=>' . $doc['parent'] . ',\'isfolder\'=>' . $doc['isfolder'] . ',\'alias_visible\'=>' . $doc['alias_visible'] . ');'; |
|
299 | - $content .= '$d[\'' . $key . '\']=' . $docid . ';'; |
|
300 | - $content .= '$m[]=array(' . $doc['parent'] . '=>' . $docid . ');'; |
|
298 | + $content .= '$a['.$docid.']=array(\'id\'=>'.$docid.',\'alias\'=>\''.$doc['alias'].'\',\'path\'=>\''.$doc['path'].'\',\'parent\'=>'.$doc['parent'].',\'isfolder\'=>'.$doc['isfolder'].',\'alias_visible\'=>'.$doc['alias_visible'].');'; |
|
299 | + $content .= '$d[\''.$key.'\']='.$docid.';'; |
|
300 | + $content .= '$m[]=array('.$doc['parent'].'=>'.$docid.');'; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | // get content types |
304 | 304 | $rs = $modx->db->select('id, contentType', '[+prefix+]site_content', "contentType!='text/html'"); |
305 | 305 | $content .= '$c=&$this->contentTypes;'; |
306 | 306 | while ($doc = $modx->db->getRow($rs)) { |
307 | - $content .= '$c[\'' . $doc['id'] . '\']=\'' . $doc['contentType'] . '\';'; |
|
307 | + $content .= '$c[\''.$doc['id'].'\']=\''.$doc['contentType'].'\';'; |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | // WRITE Chunks to cache file |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | if ($modx->config['minifyphp_incache']) { |
315 | 315 | $doc['snippet'] = $this->php_strip_whitespace($doc['snippet']); |
316 | 316 | } |
317 | - $content .= '$c[\'' . $doc['name'] . '\']=\'' . ($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])) . '\';'; |
|
317 | + $content .= '$c[\''.$doc['name'].'\']=\''.($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])).'\';'; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | // WRITE snippets to cache file |
@@ -325,18 +325,18 @@ discard block |
||
325 | 325 | while ($row = $modx->db->getRow($rs)) { |
326 | 326 | $key = $row['name']; |
327 | 327 | if ($row['disabled']) { |
328 | - $content .= '$s[\'' . $key . '\']=\'return false;\';'; |
|
328 | + $content .= '$s[\''.$key.'\']=\'return false;\';'; |
|
329 | 329 | } else { |
330 | 330 | $value = trim($row['snippet']); |
331 | 331 | if ($modx->config['minifyphp_incache']) { |
332 | 332 | $value = $this->php_strip_whitespace($value); |
333 | 333 | } |
334 | - $content .= '$s[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
334 | + $content .= '$s[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
335 | 335 | $properties = $modx->parseProperties($row['properties']); |
336 | 336 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
337 | 337 | $properties = array_merge($sharedproperties, $properties); |
338 | 338 | if (0 < count($properties)) { |
339 | - $content .= '$s[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
339 | + $content .= '$s[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | } |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | if ($modx->config['minifyphp_incache']) { |
355 | 355 | $value = $this->php_strip_whitespace($value); |
356 | 356 | } |
357 | - $content .= '$p[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
357 | + $content .= '$p[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
358 | 358 | if ($row['properties'] != '' || $row['sharedproperties'] != '') { |
359 | 359 | $properties = $modx->parseProperties($row['properties']); |
360 | 360 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
361 | 361 | $properties = array_merge($sharedproperties, $properties); |
362 | 362 | if (0 < count($properties)) { |
363 | - $content .= '$p[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
363 | + $content .= '$p[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | } |
@@ -383,14 +383,14 @@ discard block |
||
383 | 383 | } |
384 | 384 | foreach ($events as $evtname => $pluginnames) { |
385 | 385 | $events[$evtname] = $pluginnames; |
386 | - $content .= '$e[\'' . $evtname . '\']=array(\'' . implode('\',\'', |
|
387 | - $this->escapeSingleQuotes($pluginnames)) . '\');'; |
|
386 | + $content .= '$e[\''.$evtname.'\']=array(\''.implode('\',\'', |
|
387 | + $this->escapeSingleQuotes($pluginnames)).'\');'; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | $content .= "\n"; |
391 | 391 | |
392 | 392 | // close and write the file |
393 | - $filename = $this->cachePath . 'siteCache.idx.php'; |
|
393 | + $filename = $this->cachePath.'siteCache.idx.php'; |
|
394 | 394 | |
395 | 395 | // invoke OnBeforeCacheUpdate event |
396 | 396 | if ($modx) { |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | exit("Cannot write main MODX cache file! Make sure the assets/cache directory is writable!"); |
402 | 402 | } |
403 | 403 | |
404 | - if (!is_file($this->cachePath . '/.htaccess')) { |
|
405 | - file_put_contents($this->cachePath . '/.htaccess', "order deny,allow\ndeny from all\n"); |
|
404 | + if (!is_file($this->cachePath.'/.htaccess')) { |
|
405 | + file_put_contents($this->cachePath.'/.htaccess', "order deny,allow\ndeny from all\n"); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | // invoke OnCacheUpdate event |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | |
425 | 425 | $source = trim($source); |
426 | 426 | if (substr($source, 0, 5) !== '<?php') { |
427 | - $source = '<?php ' . $source; |
|
427 | + $source = '<?php '.$source; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | $tokens = token_get_all($source); |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | } |
483 | 483 | } |
484 | 484 | $source = preg_replace(array('@^<\?php@i', '|\s+|', '|<!--|', '|-->|', '|-->\s+<!--|'), |
485 | - array('', ' ', "\n" . '<!--', '-->' . "\n", '-->' . "\n" . '<!--'), $_); |
|
485 | + array('', ' ', "\n".'<!--', '-->'."\n", '-->'."\n".'<!--'), $_); |
|
486 | 486 | $source = trim($source); |
487 | 487 | |
488 | 488 | return $source; |
@@ -79,7 +79,8 @@ discard block |
||
79 | 79 | * @return string |
80 | 80 | */ |
81 | 81 | public function getParents($id, $path = '') |
82 | - { // modx:returns child's parent |
|
82 | + { |
|
83 | +// modx:returns child's parent |
|
83 | 84 | $modx = evolutionCMS(); |
84 | 85 | if (empty($this->aliases)) { |
85 | 86 | $f = "id, IF(alias='', id, alias) AS alias, parent, alias_visible"; |
@@ -456,7 +457,8 @@ discard block |
||
456 | 457 | $_ = trim($_); |
457 | 458 | } |
458 | 459 | $lastChar = substr($_, -1); |
459 | - if (!in_array($lastChar, $chars)) {// ,320,327,288,284,289 |
|
460 | + if (!in_array($lastChar, $chars)) { |
|
461 | +// ,320,327,288,284,289 |
|
460 | 462 | if (!in_array($prev_token, |
461 | 463 | array(T_FOREACH, T_WHILE, T_FOR, T_BOOLEAN_AND, T_BOOLEAN_OR, T_DOUBLE_ARROW))) { |
462 | 464 | $_ .= ' '; |
@@ -63,7 +63,7 @@ |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | - * @return mixed |
|
66 | + * @return string |
|
67 | 67 | */ |
68 | 68 | public function getOutput() |
69 | 69 | { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | if (is_array($SystemAlertMsgQueque)) { |
36 | 36 | $title = ''; |
37 | 37 | if ($this->name && $this->activePlugin) { |
38 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
38 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
39 | 39 | } |
40 | 40 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
41 | 41 | } |