Completed
Push — develop ( 8dee05 )
by Dmytro
20:08
created
install/src/controllers/connection/servertest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
 $output = $_lang["status_connecting"];
8 8
 if (function_exists('mysqli_connect')) {
9 9
     $h = explode(':', $host, 2);
10
-    if (!$conn = @mysqli_connect($h[0], $uid, $pwd,'', isset($h[1]) ? $h[1] : null)) {
11
-        $output .= '<span id="server_fail" style="color:#FF0000;"> ' . $_lang['status_failed'] . '</span>';
10
+    if (!$conn = @mysqli_connect($h[0], $uid, $pwd, '', isset($h[1]) ? $h[1] : null)) {
11
+        $output .= '<span id="server_fail" style="color:#FF0000;"> '.$_lang['status_failed'].'</span>';
12 12
     } else {
13
-        $output .= '<span id="server_pass" style="color:#80c000;"> ' . $_lang['status_passed_server'] . '</span>';
13
+        $output .= '<span id="server_pass" style="color:#80c000;"> '.$_lang['status_passed_server'].'</span>';
14 14
 
15 15
         // Mysql version check
16 16
         if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) {
17
-            $output .= '<br /><span style="color:#FF0000;"> ' . $_lang['mysql_5051'] . '</span>';
17
+            $output .= '<br /><span style="color:#FF0000;"> '.$_lang['mysql_5051'].'</span>';
18 18
         }
19 19
         // Mode check
20 20
         $mysqlmode = mysqli_query($conn, "SELECT @@session.sql_mode");
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
                 }
28 28
             }
29 29
             if ($strictMode) {
30
-                $output .= '<br /><span style="color:#FF0000;"> ' . $_lang['strict_mode'] . '</span>';
30
+                $output .= '<br /><span style="color:#FF0000;"> '.$_lang['strict_mode'].'</span>';
31 31
             }
32 32
         }
33 33
     }
34 34
 } else {
35
-    $output .= '<span id="server_fail" style="color:#FF0000;"> ' . $_lang['status_failed_mysqli'] . '</span>';
35
+    $output .= '<span id="server_fail" style="color:#FF0000;"> '.$_lang['status_failed_mysqli'].'</span>';
36 36
 }
37 37
 echo $output;
Please login to merge, or discard this patch.
install/src/controllers/connection/databasetest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
 
8 8
 $output = $_lang["status_checking_database"];
9 9
 $h = explode(':', $host, 2);
10
-if (!$conn = mysqli_connect($h[0], $uid, $pwd,'', isset($h[1]) ? $h[1] : null)) {
11
-    $output .= '<span id="database_fail" style="color:#FF0000;">' . $_lang['status_failed'] . '</span>';
10
+if (!$conn = mysqli_connect($h[0], $uid, $pwd, '', isset($h[1]) ? $h[1] : null)) {
11
+    $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed'].'</span>';
12 12
 } else {
13 13
     $database_name = mysqli_real_escape_string($conn, $_POST['database_name']);
14 14
     $database_name = str_replace("`", "", $database_name);
@@ -19,22 +19,22 @@  discard block
 block discarded – undo
19 19
     if (!@ mysqli_select_db($conn, $database_name)) {
20 20
         // create database
21 21
         $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
22
-        $query = "CREATE DATABASE `" . $database_name . "` CHARACTER SET " . $database_charset . " COLLATE " . $database_collation . ";";
22
+        $query = "CREATE DATABASE `".$database_name."` CHARACTER SET ".$database_charset." COLLATE ".$database_collation.";";
23 23
 
24 24
         if (!mysqli_query($conn, $query)) {
25
-            $output .= '<span id="database_fail" style="color:#FF0000;">' . $_lang['status_failed_could_not_create_database'] . '</span>';
25
+            $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_could_not_create_database'].'</span>';
26 26
         } else {
27
-            $output .= '<span id="database_pass" style="color:#80c000;">' . $_lang['status_passed_database_created'] . '</span>';
27
+            $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed_database_created'].'</span>';
28 28
         }
29 29
     } elseif (($installMode == 0) && (mysqli_query($conn,
30 30
             "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) {
31
-        $output .= '<span id="database_fail" style="color:#FF0000;">' . $_lang['status_failed_table_prefix_already_in_use'] . '</span>';
31
+        $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_table_prefix_already_in_use'].'</span>';
32 32
     } elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn,
33 33
             "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) {
34
-        $output .= '<span id="database_fail" style="color:#FF0000;">' . sprintf($_lang['status_failed_database_collation_does_not_match'],
35
-                $row[1]) . '</span>';
34
+        $output .= '<span id="database_fail" style="color:#FF0000;">'.sprintf($_lang['status_failed_database_collation_does_not_match'],
35
+                $row[1]).'</span>';
36 36
     } else {
37
-        $output .= '<span id="database_pass" style="color:#80c000;">' . $_lang['status_passed'] . '</span>';
37
+        $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed'].'</span>';
38 38
     }
39 39
 }
40 40
 
Please login to merge, or discard this patch.
install/src/controllers/summary.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,33 +43,33 @@  discard block
 block discarded – undo
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
 
@@ -85,24 +85,24 @@  discard block
 block discarded – undo
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
 }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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"):
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
     $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1);
197 197
     $database_connection_charset = $_POST['database_connection_charset'];
198 198
     $database_connection_method = $_POST['database_connection_method'];
199
-    $dbase = '`' . $_POST['database_name'] . '`';
199
+    $dbase = '`'.$_POST['database_name'].'`';
200 200
     $table_prefix = $_POST['tableprefix'];
201 201
 }
202 202
 echo '<p>'.$_lang['creating_database_connection'];
203 203
 $host = explode(':', $database_server, 2);
204
-if (!$conn = mysqli_connect($host[0], $database_user, $database_password,'', isset($host[1]) ? $host[1] : null)) {
204
+if (!$conn = mysqli_connect($host[0], $database_user, $database_password, '', isset($host[1]) ? $host[1] : null)) {
205 205
     $errors++;
206 206
     echo '<span class="notok">'.$_lang['database_connection_failed'].'</span><p />'.$_lang['database_connection_failed_note'].'</p>';
207 207
 } else {
@@ -237,54 +237,54 @@  discard block
 block discarded – undo
237 237
 
238 238
 // check table prefix
239 239
 if ($conn && $installMode == 0) {
240
-    echo '<p>' . $_lang['checking_table_prefix'] . $table_prefix . '`: ';
241
-    if ($rs= mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
242
-        echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_already_inuse'] . '</p>';
240
+    echo '<p>'.$_lang['checking_table_prefix'].$table_prefix.'`: ';
241
+    if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
242
+        echo '<span class="notok">'.$_lang['failed'].'</span></b>'.$_lang['table_prefix_already_inuse'].'</p>';
243 243
         $errors++;
244
-        echo "<p>" . $_lang['table_prefix_already_inuse_note'] . '</p>';
244
+        echo "<p>".$_lang['table_prefix_already_inuse_note'].'</p>';
245 245
     } else {
246
-        echo '<span class="ok">' . $_lang['ok'] . '</span></p>';
246
+        echo '<span class="ok">'.$_lang['ok'].'</span></p>';
247 247
     }
248 248
 } elseif ($conn && $installMode == 2) {
249
-    echo '<p>' . $_lang['checking_table_prefix'] . $table_prefix . '`: ';
250
-    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
251
-        echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_not_exist'] . '</p>';
249
+    echo '<p>'.$_lang['checking_table_prefix'].$table_prefix.'`: ';
250
+    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
251
+        echo '<span class="notok">'.$_lang['failed'].'</span></b>'.$_lang['table_prefix_not_exist'].'</p>';
252 252
         $errors++;
253
-        echo '<p>' . $_lang['table_prefix_not_exist_note'] . '</p>';
253
+        echo '<p>'.$_lang['table_prefix_not_exist_note'].'</p>';
254 254
   } else {
255
-        echo '<span class="ok">' . $_lang['ok'] . '</span></p>';
255
+        echo '<span class="ok">'.$_lang['ok'].'</span></p>';
256 256
   }
257 257
 }
258 258
 
259 259
 // check mysql version
260 260
 if ($conn) {
261
-    echo '<p>' . $_lang['checking_mysql_version'];
262
-    if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) {
263
-        echo '<span class="notok">'  . $_lang['warning'] . '</span></b>&nbsp;&nbsp;<strong>' . $_lang['mysql_5051'] . '</strong></p>';
264
-        echo '<p><span class="notok">' . $_lang['mysql_5051_warning'] . '</span></p>';
261
+    echo '<p>'.$_lang['checking_mysql_version'];
262
+    if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) {
263
+        echo '<span class="notok">'.$_lang['warning'].'</span></b>&nbsp;&nbsp;<strong>'.$_lang['mysql_5051'].'</strong></p>';
264
+        echo '<p><span class="notok">'.$_lang['mysql_5051_warning'].'</span></p>';
265 265
     } else {
266
-        echo '<span class="ok">' . $_lang['ok'] . '</span>&nbsp;&nbsp;<strong>' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . '</strong></p>';
266
+        echo '<span class="ok">'.$_lang['ok'].'</span>&nbsp;&nbsp;<strong>'.$_lang['mysql_version_is'].mysqli_get_server_info($conn).'</strong></p>';
267 267
     }
268 268
 }
269 269
 
270 270
 // check for strict mode
271 271
 if ($conn) {
272
-    echo '<p>'. $_lang['checking_mysql_strict_mode'];
272
+    echo '<p>'.$_lang['checking_mysql_strict_mode'];
273 273
     $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode");
274
-    if (mysqli_num_rows($mysqlmode) > 0){
274
+    if (mysqli_num_rows($mysqlmode) > 0) {
275 275
         $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM);
276 276
         //$modes = array("STRICT_TRANS_TABLES"); // for testing
277 277
         // print_r($modes);
278 278
         foreach ($modes as $mode) {
279 279
             if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) {
280
-                echo '<span class="notok">' . $_lang['warning'] . '</span></b> <strong>&nbsp;&nbsp;' . $_lang['strict_mode'] . '</strong></p>';
281
-                echo '<p><span class="notok">' . $_lang['strict_mode_error'] . '</span></p>';
280
+                echo '<span class="notok">'.$_lang['warning'].'</span></b> <strong>&nbsp;&nbsp;'.$_lang['strict_mode'].'</strong></p>';
281
+                echo '<p><span class="notok">'.$_lang['strict_mode_error'].'</span></p>';
282 282
             } else {
283
-                echo '<span class="ok">' . $_lang['ok'] . '</span></p>';
283
+                echo '<span class="ok">'.$_lang['ok'].'</span></p>';
284 284
             }
285 285
         }
286 286
     } else {
287
-        echo '<span class="ok">' . $_lang['ok'] . '</span></p>';
287
+        echo '<span class="ok">'.$_lang['ok'].'</span></p>';
288 288
     }
289 289
 }
290 290
 // Version and strict mode check end
@@ -300,18 +300,18 @@  discard block
 block discarded – undo
300 300
     f_owc("../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>');
301 301
 }
302 302
 
303
-if($installMode > 0 && $_POST['installdata'] == "1") {
304
-    echo '<p class="notes"><strong>' . $_lang['sample_web_site'] . ':</strong> ' . $_lang['sample_web_site_note'] . '</p>';
303
+if ($installMode > 0 && $_POST['installdata'] == "1") {
304
+    echo '<p class="notes"><strong>'.$_lang['sample_web_site'].':</strong> '.$_lang['sample_web_site_note'].'</p>';
305 305
 }
306 306
 
307 307
 if ($errors > 0) {
308 308
     echo '<p>';
309
-    echo $_lang['setup_cannot_continue'] . ' ';
309
+    echo $_lang['setup_cannot_continue'].' ';
310 310
 
311
-    if($errors > 1){
312
-        echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural'];
313
-    }else{
314
-        echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again'];
311
+    if ($errors > 1) {
312
+        echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural'];
313
+    } else {
314
+        echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again'];
315 315
     }
316 316
 
317 317
     echo $_lang['visit_forum'];
@@ -320,10 +320,10 @@  discard block
 block discarded – undo
320 320
 
321 321
 echo '<p>&nbsp;</p>';
322 322
 
323
-$nextAction= $errors > 0 ? 'summary' : 'install';
324
-$nextButton= $errors > 0 ? $_lang['retry'] : $_lang['install'];
325
-$nextVisibility= $errors > 0 || isset($_POST['chkagree']) ? 'visible' : 'hidden';
326
-$agreeToggle= $errors > 0 ? '' : ' onclick="if(document.getElementById(\'chkagree\').checked){document.getElementById(\'nextbutton\').style.visibility=\'visible\';}else{document.getElementById(\'nextbutton\').style.visibility=\'hidden\';}"';
323
+$nextAction = $errors > 0 ? 'summary' : 'install';
324
+$nextButton = $errors > 0 ? $_lang['retry'] : $_lang['install'];
325
+$nextVisibility = $errors > 0 || isset($_POST['chkagree']) ? 'visible' : 'hidden';
326
+$agreeToggle = $errors > 0 ? '' : ' onclick="if(document.getElementById(\'chkagree\').checked){document.getElementById(\'nextbutton\').style.visibility=\'visible\';}else{document.getElementById(\'nextbutton\').style.visibility=\'hidden\';}"';
327 327
 ?>
328 328
 <form name="install" id="install_form" action="index.php?action=<?php echo $nextAction ?>" method="post">
329 329
   <div>
@@ -345,32 +345,32 @@  discard block
 block discarded – undo
345 345
 
346 346
     <input type="hidden" value="<?php echo $_POST['installdata'] ?>" name="installdata" />
347 347
 <?php
348
-    $templates = isset ($_POST['template']) ? $_POST['template'] : array ();
348
+    $templates = isset ($_POST['template']) ? $_POST['template'] : array();
349 349
     foreach ($templates as $i => $template) echo '<input type="hidden" name="template[]" value="'.$template.'" />';
350 350
 
351
-    $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array ();
351
+    $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array();
352 352
     foreach ($tvs as $i => $tv) echo '<input type="hidden" name="tv[]" value="'.$tv.'" />';
353 353
 
354
-    $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array ();
354
+    $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array();
355 355
     foreach ($chunks as $i => $chunk) echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />';
356 356
 
357
-    $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array ();
357
+    $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array();
358 358
     foreach ($snippets as $i => $snippet) echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />';
359 359
 
360
-    $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array ();
360
+    $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array();
361 361
     foreach ($plugins as $i => $plugin) echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />';
362 362
 
363
-    $modules = isset ($_POST['module']) ? $_POST['module'] : array ();
363
+    $modules = isset ($_POST['module']) ? $_POST['module'] : array();
364 364
     foreach ($modules as $i => $module) echo '<input type="hidden" name="module[]" value="'.$module.'" />';
365 365
 ?>
366 366
 </div>
367 367
 
368
-<h2><?php echo $_lang['agree_to_terms'];?></h2>
368
+<h2><?php echo $_lang['agree_to_terms']; ?></h2>
369 369
 <p>
370
-<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>
370
+<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>
371 371
 </p>
372 372
     <p class="buttonlinks">
373 373
         <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>
374
-        <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>
374
+        <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>
375 375
     </p>
376 376
 </form>
Please login to merge, or discard this patch.
install/src/controllers/install.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (file_exists(dirname(__DIR__, 3) . "/assets/cache/siteManager.php")) {
3
-    include_once dirname(__DIR__, 3) . "/assets/cache/siteManager.php";
2
+if (file_exists(dirname(__DIR__, 3)."/assets/cache/siteManager.php")) {
3
+    include_once dirname(__DIR__, 3)."/assets/cache/siteManager.php";
4 4
 } else {
5 5
     define('MGR_DIR', 'manager');
6 6
 }
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 // set timout limit
25 25
 @ set_time_limit(120); // used @ to prevent warning when using safe mode?
26 26
 
27
-$installMode = (int)$_POST['installmode'];
28
-$installData = (int)!empty($_POST['installdata']);
27
+$installMode = (int) $_POST['installmode'];
28
+$installData = (int) !empty($_POST['installdata']);
29 29
 
30 30
 // get db info from post
31 31
 $database_server = $_POST['databasehost'];
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
36 36
 $database_connection_charset = $_POST['database_connection_charset'];
37 37
 $database_connection_method = $_POST['database_connection_method'];
38
-$dbase = "`" . $_POST['database_name'] . "`";
38
+$dbase = "`".$_POST['database_name']."`";
39 39
 $table_prefix = $_POST['tableprefix'];
40 40
 $adminname = $_POST['cmsadmin'];
41 41
 $adminemail = $_POST['cmsadminemail'];
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 // set session name variable
47 47
 if (!isset ($site_sessionname)) {
48
-    $site_sessionname = 'SN' . uniqid('');
48
+    $site_sessionname = 'SN'.uniqid('');
49 49
 }
50 50
 
51 51
 // get base path and url
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 }
62 62
 $pth = implode('install', $a);
63 63
 unset ($a);
64
-$base_url = $url . (substr($url, -1) != '/' ? '/' : '');
65
-$base_path = $pth . (substr($pth, -1) != '/' ? '/' : '');
64
+$base_url = $url.(substr($url, -1) != '/' ? '/' : '');
65
+$base_path = $pth.(substr($pth, -1) != '/' ? '/' : '');
66 66
 
67 67
 // connect to the database
68 68
 $host = explode(':', $database_server, 2);
69
-$conn = @mysqli_connect($host[0], $database_user, $database_password,'', isset($host[1]) ? $host[1] : null);
69
+$conn = @mysqli_connect($host[0], $database_user, $database_password, '', isset($host[1]) ? $host[1] : null);
70 70
 $installLevel = 0;
71 71
 if ($conn) {
72 72
     $installLevel = 0;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     if ($installLevel === 1) {
93 93
         // check table prefix
94 94
         if ($installMode === 0) {
95
-            $query = "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`";
95
+            $query = "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`";
96 96
             if (@mysqli_query($conn, $query)) {
97 97
                 $errors += 1;
98 98
             } else {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         // check status of Inherit Parent Template plugin
108 108
         $auto_template_logic = 'parent';
109 109
         if ($installMode !== 0) {
110
-            $query = "SELECT properties, disabled FROM " . $dbase . ".`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'";
110
+            $query = "SELECT properties, disabled FROM ".$dbase.".`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'";
111 111
             $rs = mysqli_query($conn, $query);
112 112
             $row = mysqli_fetch_row($rs);
113 113
             if (!$row) {
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
         }
131 131
 
132 132
         // open db connection
133
-        include dirname(__DIR__) . '/processor/result.php';
134
-        include_once dirname(__DIR__) . '/sqlParser.class.php';
133
+        include dirname(__DIR__).'/processor/result.php';
134
+        include_once dirname(__DIR__).'/sqlParser.class.php';
135 135
         $sqlParser = new SqlParser(
136 136
             $database_server,
137 137
             $database_user,
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
         $confph['lastInstallTime'] = time();
180 180
         $confph['site_sessionname'] = $site_sessionname;
181 181
 
182
-        $configString = file_get_contents(dirname(__DIR__, 2) . '/stubs/files/config/database/connections/default.tpl');
182
+        $configString = file_get_contents(dirname(__DIR__, 2).'/stubs/files/config/database/connections/default.tpl');
183 183
         $configString = parse($configString, $confph);
184 184
 
185
-        $filename = EVO_CORE_PATH . 'config/database/connections/default.php';
185
+        $filename = EVO_CORE_PATH.'config/database/connections/default.php';
186 186
         $configFileFailed = false;
187 187
         if (@ !$handle = fopen($filename, 'w')) {
188 188
             $configFileFailed = true;
@@ -210,13 +210,13 @@  discard block
 block discarded – undo
210 210
             $siteid = uniqid('');
211 211
             mysqli_query(
212 212
                     $sqlParser->conn,
213
-                "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"
213
+                "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"
214 214
             );
215 215
         } else {
216 216
             // update site_id if missing
217 217
             $ds = mysqli_query(
218 218
                     $sqlParser->conn,
219
-                "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"
219
+                "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'"
220 220
             );
221 221
             if ($ds) {
222 222
                 $r = mysqli_fetch_assoc($ds);
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
                     $siteid = uniqid('');
226 226
                     mysqli_query(
227 227
                             $sqlParser->conn,
228
-                        "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"
228
+                        "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"
229 229
                     );
230 230
                 }
231 231
             }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     if ($installLevel === 5 && (isset ($_POST['template']) || $installData)) {
252 252
         $selTemplates = $_POST['template'];
253 253
         foreach ($moduleTemplates as $k => $moduleTemplate) {
254
-            if (! is_array($moduleTemplate)) {
254
+            if (!is_array($moduleTemplate)) {
255 255
                 continue;
256 256
             }
257 257
             $installDataLevel['templates'][$moduleTemplate[0]] = array(
@@ -289,12 +289,12 @@  discard block
 block discarded – undo
289 289
                     $template = mysqli_real_escape_string($conn, $template);
290 290
 
291 291
                     // See if the template already exists
292
-                    $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'";
292
+                    $query = "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'";
293 293
                     $rs = mysqli_query($sqlParser->conn, $query);
294 294
 
295 295
                     if (mysqli_num_rows($rs)) {
296 296
                         $installDataLevel['templates'][$moduleTemplate[0]]['type'] = 'update';
297
-                        $query = "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;";
297
+                        $query = "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;";
298 298
                         if (!mysqli_query($sqlParser->conn, $query)) {
299 299
                             $errors += 1;
300 300
                             $installDataLevel['templates'][$moduleTemplate[0]]['error'] = array(
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                         if (!is_null($save_sql_id_as)) {
308 308
                             $sql_id = @mysqli_insert_id($sqlParser->conn);
309 309
                             if (!$sql_id) {
310
-                                $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;";
310
+                                $query = "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;";
311 311
                                 $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, $query));
312 312
                                 $sql_id = $idQuery['id'];
313 313
                             }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                         }
316 316
                     } else {
317 317
                         $installDataLevel['templates'][$moduleTemplate[0]]['type'] = 'create';
318
-                        $query = "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');";
318
+                        $query = "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');";
319 319
                         if (!@mysqli_query($sqlParser->conn, $query)) {
320 320
                             $errors += 1;
321 321
                             $installDataLevel['templates'][$moduleTemplate[0]]['error'] = array(
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
                 // Create the category if it does not already exist
381 381
                 $category = getCreateDbCategory($category, $sqlParser);
382 382
 
383
-                $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'";
384
-                $rs = mysqli_query($sqlParser->conn,$query);
383
+                $query = "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'";
384
+                $rs = mysqli_query($sqlParser->conn, $query);
385 385
                 if (mysqli_num_rows($rs)) {
386 386
                     $installDataLevel['tvs'][$moduleTV[0]]['type'] = 'update';
387 387
                     while ($row = mysqli_fetch_assoc($rs)) {
388
-                        $query = "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']};";
388
+                        $query = "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']};";
389 389
                         if (!mysqli_query($sqlParser->conn, $query)) {
390 390
                             $installDataLevel['tvs'][$moduleTV[0]]['error'] = array(
391 391
                                 'type' => 'sql',
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                     }
399 399
                 } else {
400 400
                     $installDataLevel['tvs'][$moduleTV[0]]['type'] = 'create';
401
-                    $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');";
401
+                    $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');";
402 402
                     if (!mysqli_query($sqlParser->conn, $q)) {
403 403
                         $installDataLevel['tvs'][$moduleTV[0]]['error'] = array(
404 404
                             'type' => 'sql',
@@ -415,23 +415,23 @@  discard block
 block discarded – undo
415 415
                 if (count($assignments) > 0) {
416 416
 
417 417
                     // remove existing tv -> template assignments
418
-                    $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name' AND description='$desc';";
418
+                    $query = "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';";
419 419
                     $ds = mysqli_query($sqlParser->conn, $query);
420 420
                     $row = mysqli_fetch_assoc($ds);
421 421
                     $id = $row["id"];
422
-                    $query = 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\'';
422
+                    $query = 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\'';
423 423
                     mysqli_query($sqlParser->conn, $query);
424 424
 
425 425
                     // add tv -> template assignments
426 426
                     foreach ($assignments as $assignment) {
427 427
                         $template = mysqli_real_escape_string($conn, $assignment);
428
-                        $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$template';";
428
+                        $query = "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$template';";
429 429
                         $ts = mysqli_query($sqlParser->conn, $query);
430 430
                         if ($ds && $ts) {
431 431
                             $tRow = mysqli_fetch_assoc($ts);
432 432
                             $templateId = $tRow['id'];
433
-                            $query = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)";
434
-                            mysqli_query($sqlParser->conn,$query);
433
+                            $query = "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)";
434
+                            mysqli_query($sqlParser->conn, $query);
435 435
                         }
436 436
                     }
437 437
                 }
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['chunk']) || $installData)) {
444 444
         $selChunks = $_POST['chunk'];
445 445
         foreach ($moduleChunks as $k => $moduleChunk) {
446
-            if (! is_array($moduleChunk)) {
446
+            if (!is_array($moduleChunk)) {
447 447
                 continue;
448 448
             }
449 449
             $installDataLevel['chunks'][$moduleChunk[0]] = array(
@@ -481,14 +481,14 @@  discard block
 block discarded – undo
481 481
                     $chunk = mysqli_real_escape_string($conn, $chunk);
482 482
                     $rs = mysqli_query(
483 483
                         $sqlParser->conn,
484
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"
484
+                        "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'"
485 485
                     );
486 486
                     $count_original_name = mysqli_num_rows($rs);
487 487
                     if ($overwrite == 'false') {
488
-                        $newname = $name . '-' . str_replace('.', '_', $modx_version);
488
+                        $newname = $name.'-'.str_replace('.', '_', $modx_version);
489 489
                         $rs = mysqli_query(
490 490
                             $sqlParser->conn,
491
-                            "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"
491
+                            "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'"
492 492
                         );
493 493
                         $count_new_name = mysqli_num_rows($rs);
494 494
                     }
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
                     if ($update) {
497 497
                         $installDataLevel['chunks'][$moduleChunk[0]]['type'] = 'update';
498 498
                         if (!mysqli_query($sqlParser->conn,
499
-                            "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
499
+                            "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
500 500
                             $errors += 1;
501 501
                             $installDataLevel['chunks'][$moduleChunk[0]]['error'] = array(
502 502
                                 'type' => 'sql',
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
                         } else {
514 514
                             $installDataLevel['chunks'][$moduleChunk[0]]['type'] = 'create';
515 515
                         }
516
-                        $query = "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);";
516
+                        $query = "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);";
517 517
                         if (!mysqli_query($sqlParser->conn, $query)) {
518 518
                             $errors += 1;
519 519
                             $installDataLevel['chunks'][$moduleChunk[0]]['error'] = array(
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['module']) || $installData)) {
537 537
         $selModules = $_POST['module'];
538 538
         foreach ($moduleModules as $k => $moduleModule) {
539
-            if (! is_array($moduleModule)) {
539
+            if (!is_array($moduleModule)) {
540 540
                 continue;
541 541
             }
542 542
             $installDataLevel['modules'][$moduleModule[0]] = array(
@@ -575,13 +575,13 @@  discard block
 block discarded – undo
575 575
                     // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab
576 576
                     $module = mysqli_real_escape_string($conn, $module);
577 577
                     $rs = mysqli_query($sqlParser->conn,
578
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'");
578
+                        "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'");
579 579
                     if (mysqli_num_rows($rs)) {
580 580
                         $installDataLevel['modules'][$moduleModule[0]]['type'] = 'update';
581 581
                         $row = mysqli_fetch_assoc($rs);
582 582
                         $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
583 583
                         if (!mysqli_query($sqlParser->conn,
584
-                            "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
584
+                            "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
585 585
                             $installDataLevel['modules'][$moduleModule[0]]['error'] = array(
586 586
                                 'type' => 'sql',
587 587
                                 'content' => mysqli_error($sqlParser->conn)
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
                         $installDataLevel['modules'][$moduleModule[0]]['type'] = 'create';
594 594
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
595 595
                         if (!mysqli_query($sqlParser->conn,
596
-                            "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
596
+                            "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
597 597
                             $installDataLevel['modules'][$moduleModule[0]]['error'] = array(
598 598
                                 'type' => 'sql',
599 599
                                 'content' => mysqli_error($sqlParser->conn)
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['plugin']) || $installData)) {
614 614
         $selPlugs = $_POST['plugin'];
615 615
         foreach ($modulePlugins as $k => $modulePlugin) {
616
-            if (! is_array($modulePlugin)) {
616
+            if (!is_array($modulePlugin)) {
617 617
                 continue;
618 618
             }
619 619
             $installDataLevel['plugins'][$modulePlugin[0]] = array(
@@ -647,12 +647,12 @@  discard block
 block discarded – undo
647 647
                 $disabled = $modulePlugin[9];
648 648
                 if (array_key_exists(7, $modulePlugin)) {
649 649
                     // parse comma-separated legacy names and prepare them for sql IN clause
650
-                    $leg_names = "'" . implode(
650
+                    $leg_names = "'".implode(
651 651
                             "','",
652 652
                             preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))
653
-                        ) . "'";
653
+                        )."'";
654 654
                 }
655
-                if (! file_exists($filecontent)) {
655
+                if (!file_exists($filecontent)) {
656 656
                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
657 657
                         'type' => 'file_not_found'
658 658
                     );
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 
661 661
                     // disable legacy versions based on legacy_names provided
662 662
                     if (!empty($leg_names)) {
663
-                        $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
663
+                        $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
664 664
                         $rs = mysqli_query($sqlParser->conn, $update_query);
665 665
                     }
666 666
 
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
                     $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
671 671
                     $plugin = removeDocblock($plugin, 'plugin');
672 672
                     $plugin = mysqli_real_escape_string($conn, $plugin);
673
-                    $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'";
673
+                    $query = "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'";
674 674
                     $rs = mysqli_query($sqlParser->conn, $query);
675 675
                     if (mysqli_num_rows($rs)) {
676 676
                         $installDataLevel['plugins'][$modulePlugin[0]]['type'] = 'update';
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
                         while ($row = mysqli_fetch_assoc($rs)) {
679 679
                             $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
680 680
                             if ($row['description'] == $desc) {
681
-                                $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};";
681
+                                $query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};";
682 682
                                 if (!mysqli_query($sqlParser->conn, $query)) {
683 683
                                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
684 684
                                         'type' => 'sql',
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
                                 }
690 690
                                 $insert = false;
691 691
                             } else {
692
-                                $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};";
692
+                                $query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};";
693 693
                                 if (!mysqli_query($sqlParser->conn, $query)) {
694 694
                                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
695 695
                                         'type' => 'sql',
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
                             }
702 702
                         }
703 703
                         if ($insert === true) {
704
-                            if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$props','$guid','0',$category);")) {
704
+                            if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$props','$guid','0',$category);")) {
705 705
                                 $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
706 706
                                     'type' => 'sql',
707 707
                                     'content' => mysqli_error($sqlParser->conn)
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
                     } else {
714 714
                         $installDataLevel['plugins'][$modulePlugin[0]]['type'] = 'create';
715 715
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
716
-                        $query = "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);";
716
+                        $query = "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);";
717 717
                         if (!mysqli_query($sqlParser->conn, $query)) {
718 718
                             $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
719 719
                                 'type' => 'sql',
@@ -725,14 +725,14 @@  discard block
 block discarded – undo
725 725
                     }
726 726
                     // add system events
727 727
                     if (count($events) > 0) {
728
-                        $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name' AND description='$desc';";
728
+                        $query = "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';";
729 729
                         $ds = mysqli_query($sqlParser->conn, $query);
730 730
                         if ($ds) {
731 731
                             $row = mysqli_fetch_assoc($ds);
732 732
                             $id = $row["id"];
733 733
                             $_events = implode("','", $events);
734 734
                             // add new events
735
-                            $sql = "INSERT IGNORE 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 ('{$_events}')";
735
+                            $sql = "INSERT IGNORE 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 ('{$_events}')";
736 736
                             mysqli_query($sqlParser->conn, $sql);
737 737
                             // remove absent events
738 738
                             $sql = "DELETE `pe` FROM {$dbase}.`{$table_prefix}site_plugin_events` `pe` LEFT JOIN {$dbase}.`{$table_prefix}system_eventnames` `se` ON `pe`.`evtid`=`se`.`id` AND `name` IN ('{$_events}') WHERE ISNULL(`name`) AND `pluginid` = {$id}";
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['snippet']) || $installData)) {
751 751
         $selSnips = $_POST['snippet'];
752 752
         foreach ($moduleSnippets as $k => $moduleSnippet) {
753
-            if (! is_array($moduleSnippet)) {
753
+            if (!is_array($moduleSnippet)) {
754 754
                 continue;
755 755
             }
756 756
             $installDataLevel['snippets'][$moduleSnippet[0]] = array(
@@ -785,13 +785,13 @@  discard block
 block discarded – undo
785 785
                     $snippet = removeDocblock($snippet, 'snippet');
786 786
                     $snippet = mysqli_real_escape_string($conn, $snippet);
787 787
                     $rs = mysqli_query($sqlParser->conn,
788
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'");
788
+                        "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'");
789 789
                     if (mysqli_num_rows($rs)) {
790 790
                         $installDataLevel['snippets'][$moduleSnippet[0]]['type'] = 'update';
791 791
                         $row = mysqli_fetch_assoc($rs);
792 792
                         $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
793 793
                         if (!mysqli_query($sqlParser->conn,
794
-                            "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
794
+                            "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
795 795
                             $installDataLevel['snippets'][$moduleSnippet[0]]['error'] = array(
796 796
                                 'type' => 'sql',
797 797
                                 'content' => mysqli_error($sqlParser->conn)
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
                         $installDataLevel['snippets'][$moduleSnippet[0]]['type'] = 'create';
804 804
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
805 805
                         if (!mysqli_query($sqlParser->conn,
806
-                            "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
806
+                            "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
807 807
                             $installDataLevel['snippets'][$moduleSnippet[0]]['error'] = array(
808 808
                                 'type' => 'sql',
809 809
                                 'content' => mysqli_error($sqlParser->conn)
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
                     'content' => '' //dependency name or error message
871 871
                 )*/
872 872
             );
873
-            $query = 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"';
873
+            $query = 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"';
874 874
             $ds = mysqli_query($sqlParser->conn, $query);
875 875
             if (!$ds) {
876 876
                 $installDependencyLevel[$dependency['module']]['error'] = array(
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
                 $moduleGuid = $row["guid"];
886 886
             }
887 887
             // get extra id
888
-            $query = 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"';
888
+            $query = 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"';
889 889
             $ds = mysqli_query($sqlParser->conn, $query);
890 890
             if (!$ds) {
891 891
                 $installDependencyLevel[$dependency['module']]['error'] = array(
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
                 $extraId = $row["id"];
900 900
             }
901 901
             // setup extra as module dependency
902
-            $query = 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1';
902
+            $query = 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1';
903 903
             $ds = mysqli_query($sqlParser->conn, $query);
904 904
             if (!$ds) {
905 905
                 $installDependencyLevel[$dependency['module']]['error'] = array(
@@ -910,17 +910,17 @@  discard block
 block discarded – undo
910 910
                 break;
911 911
             } else {
912 912
                 if (mysqli_num_rows($ds) === 0) {
913
-                    $query = 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')';
913
+                    $query = 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')';
914 914
                     mysqli_query($sqlParser->conn, $query);
915 915
                     $installDependencyLevel[$dependency['module']]['type'] = 'create';
916 916
                 } else {
917
-                    $query = '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'];
917
+                    $query = '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'];
918 918
                     mysqli_query($sqlParser->conn, $query);
919 919
                     $installDependencyLevel[$dependency['module']]['type'] = 'update';
920 920
                 }
921 921
                 if ($dependency['type'] == 30 || $dependency['type'] == 40) {
922 922
                     // set extra guid for plugins and snippets
923
-                    $query = 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1';
923
+                    $query = 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1';
924 924
                     $ds = mysqli_query($sqlParser->conn, $query);
925 925
                     if (!$ds) {
926 926
                         $installDependencyLevel[$dependency['module']]['extra'] = array(
@@ -931,8 +931,8 @@  discard block
 block discarded – undo
931 931
                         break;
932 932
                     } else {
933 933
                         if (mysqli_num_rows($ds) != 0) {
934
-                            $query = 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId;
935
-                            $ds= mysqli_query($sqlParser->conn, $query);
934
+                            $query = 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId;
935
+                            $ds = mysqli_query($sqlParser->conn, $query);
936 936
                             $installDependencyLevel[$dependency['module']]['extra'] = array(
937 937
                                 'type' => 'done',
938 938
                                 'content' => $dependency['name']
@@ -954,24 +954,24 @@  discard block
 block discarded – undo
954 954
         }
955 955
 
956 956
         // Setup the MODX API -- needed for the cache processor
957
-        if (file_exists(dirname(__DIR__, 3) . '/' . MGR_DIR . '/includes/config_mutator.php')) {
958
-            require_once dirname(__DIR__, 3) . '/' . MGR_DIR . '/includes/config_mutator.php';
957
+        if (file_exists(dirname(__DIR__, 3).'/'.MGR_DIR.'/includes/config_mutator.php')) {
958
+            require_once dirname(__DIR__, 3).'/'.MGR_DIR.'/includes/config_mutator.php';
959 959
         }
960 960
         define('MODX_API_MODE', true);
961 961
         if (!defined('MODX_BASE_PATH')) {
962 962
             define('MODX_BASE_PATH', $base_path);
963 963
         }
964 964
         if (!defined('MODX_MANAGER_PATH')) {
965
-            define('MODX_MANAGER_PATH', $base_path . MGR_DIR . '/');
965
+            define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
966 966
         }
967 967
         $database_type = 'mysqli';
968 968
         // initiate a new document parser
969 969
         if (!defined('EVO_BOOTSTRAP_FILE')) {
970
-            define('EVO_BOOTSTRAP_FILE', EVO_CORE_PATH . 'bootstrap.php');
971
-            require_once EVO_CORE_PATH . 'bootstrap.php';
970
+            define('EVO_BOOTSTRAP_FILE', EVO_CORE_PATH.'bootstrap.php');
971
+            require_once EVO_CORE_PATH.'bootstrap.php';
972 972
         }
973 973
 
974
-        if (! defined('MODX_CLASS')) {
974
+        if (!defined('MODX_CLASS')) {
975 975
             define('MODX_CLASS', '\DocumentParser');
976 976
         }
977 977
 
@@ -985,20 +985,20 @@  discard block
 block discarded – undo
985 985
 //        $sync->emptyCache(); // first empty the cache
986 986
 
987 987
         // try to chmod the cache go-rwx (for suexeced php)
988
-        @chmod(dirname(__DIR__, 3) . '/assets/cache/siteCache.idx.php', 0600);
989
-        @chmod(dirname(__DIR__, 3) . '/assets/cache/sitePublishing.idx.php', 0600);
988
+        @chmod(dirname(__DIR__, 3).'/assets/cache/siteCache.idx.php', 0600);
989
+        @chmod(dirname(__DIR__, 3).'/assets/cache/sitePublishing.idx.php', 0600);
990 990
 
991 991
         // remove any locks on the manager functions so initial manager login is not blocked
992
-        mysqli_query($conn, "TRUNCATE TABLE `" . $table_prefix . "active_users`");
992
+        mysqli_query($conn, "TRUNCATE TABLE `".$table_prefix."active_users`");
993 993
 
994 994
         // close db connection
995 995
 //        $sqlParser->close();
996 996
 
997 997
         // andrazk 20070416 - release manager access
998
-        if (file_exists(dirname(__DIR__, 3) . '/assets/cache/installProc.inc.php')) {
999
-            @chmod(dirname(__DIR__, 3) . '/assets/cache/installProc.inc.php', 0755);
1000
-            unlink(dirname(__DIR__, 3) . '/assets/cache/installProc.inc.php');
998
+        if (file_exists(dirname(__DIR__, 3).'/assets/cache/installProc.inc.php')) {
999
+            @chmod(dirname(__DIR__, 3).'/assets/cache/installProc.inc.php', 0755);
1000
+            unlink(dirname(__DIR__, 3).'/assets/cache/installProc.inc.php');
1001 1001
         }
1002 1002
     }
1003 1003
 }
1004
-include_once dirname(__DIR__) . '/template/actions/install.php';
1004
+include_once dirname(__DIR__).'/template/actions/install.php';
Please login to merge, or discard this patch.
install/src/controllers/options.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php
2
-$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0;
2
+$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0;
3 3
 
4
-switch($installMode){
4
+switch ($installMode) {
5 5
     case 0:
6 6
     case 2:
7 7
         $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8mb4_general_ci';
8 8
         $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
9 9
         $_POST['database_connection_charset'] = $database_charset;
10
-        if(empty($_SESSION['databaseloginpassword']))
10
+        if (empty($_SESSION['databaseloginpassword']))
11 11
             $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword'];
12
-        if(empty($_SESSION['databaseloginname']))
12
+        if (empty($_SESSION['databaseloginname']))
13 13
             $_SESSION['databaseloginname'] = $_POST['databaseloginname'];
14 14
         break;
15 15
     case 1:
16
-        include $base_path . MGR_DIR . '/includes/config.inc.php';
16
+        include $base_path.MGR_DIR.'/includes/config.inc.php';
17 17
         $host = explode(':', $database_server, 2);
18
-        if (@ $conn = mysqli_connect($host[0], $database_user, $database_password,'', isset($host[1]) ? $host[1] : null)) {
18
+        if (@ $conn = mysqli_connect($host[0], $database_user, $database_password, '', isset($host[1]) ? $host[1] : null)) {
19 19
             if (@ mysqli_query($conn, "USE {$dbase}")) {
20 20
                 if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) {
21 21
                     $rs = mysqli_query($conn, "show session variables like 'collation_server'");
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 $ph['checked'] = isset ($_POST['installdata']) && $_POST['installdata'] == "1" ? 'checked' : '';
70 70
 
71 71
 # load setup information file
72
-include_once dirname(__DIR__) . '/processor/result.php';
72
+include_once dirname(__DIR__).'/processor/result.php';
73 73
 $ph['templates'] = getTemplates($moduleTemplates);
74 74
 $ph['tvs']       = getTVs($moduleTVs);
75 75
 $ph['chunks']    = getChunks($moduleChunks);
@@ -79,6 +79,6 @@  discard block
 block discarded – undo
79 79
 
80 80
 $ph['action'] = ($installMode == 1) ? 'mode' : 'connection';
81 81
 
82
-$tpl = file_get_contents(dirname(__DIR__) . '/template/actions/options.tpl');
82
+$tpl = file_get_contents(dirname(__DIR__).'/template/actions/options.tpl');
83 83
 $content = parse($tpl, $ph);
84 84
 echo parse($content, $_lang, '[%', '%]');
Please login to merge, or discard this patch.
install/src/sqlParser.class.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,29 +44,29 @@  discard block
 block discarded – undo
44 44
         $this->autoTemplateLogic = $auto_template_logic;
45 45
 	}
46 46
 
47
-	public function connect() {
47
+	public function connect(){
48 48
         $host = explode(':', $this->host, 2);
49
-        $this->conn = mysqli_connect($host[0], $this->user, $this->password,'', isset($host[1]) ? $host[1] : null);
49
+        $this->conn = mysqli_connect($host[0], $this->user, $this->password, '', isset($host[1]) ? $host[1] : null);
50 50
 		mysqli_select_db($this->conn, $this->dbname);
51 51
 		if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset);
52 52
 
53 53
 		$this->dbVersion = 3.23; // assume version 3.23
54
-		if(function_exists("mysqli_get_server_info")) {
54
+		if (function_exists("mysqli_get_server_info")) {
55 55
 			$ver = mysqli_get_server_info($this->conn);
56
-			$this->dbMODx 	 = version_compare($ver,"4.0.2");
56
+			$this->dbMODx 	 = version_compare($ver, "4.0.2");
57 57
 			$this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2]
58 58
 		}
59 59
 
60
-        mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}");
60
+        mysqli_query($this->conn, "{$this->connection_method} {$this->connection_charset}");
61 61
 	}
62 62
 
63
-    public function process($filename) {
63
+    public function process($filename){
64 64
 	    global $custom_placeholders;
65 65
 
66 66
 		// check to make sure file exists
67 67
 		if (!file_exists($filename)) {
68 68
 			$this->mysqlErrors[] = array("error" => "File '$filename' not found");
69
-			$this->installFailed = true ;
69
+			$this->installFailed = true;
70 70
 			return false;
71 71
 		}
72 72
 
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 		// check if in upgrade mode
84 84
 		if ($this->mode === 'upd') {
85 85
 			// remove non-upgradeable parts
86
-			$s = strpos($idata,'non-upgrade-able[[');
87
-			$e = strpos($idata,']]non-upgrade-able') + 17;
88
-			if($s && $e) {
89
-			    $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata);
86
+			$s = strpos($idata, 'non-upgrade-able[[');
87
+			$e = strpos($idata, ']]non-upgrade-able') + 17;
88
+			if ($s && $e) {
89
+			    $idata = str_replace(substr($idata, $s, $e - $s), ' Removed non upgradeable items', $idata);
90 90
             }
91 91
 		}
92 92
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		/*$idata = str_replace('{VERSION}', $modx_version, $idata);*/
105 105
 
106 106
 		// Replace custom placeholders
107
-		foreach($custom_placeholders as $key=>$val) {
107
+		foreach ($custom_placeholders as $key=>$val) {
108 108
 			if (strpos($idata, '{'.$key.'}') !== false) {
109 109
 				$idata = str_replace('{'.$key.'}', $val, $idata);
110 110
 			}
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
 		$sql_array = explode("\n\n", $idata);
114 114
 
115 115
 		$num = 0;
116
-		foreach($sql_array as $sql_entry) {
116
+		foreach ($sql_array as $sql_entry) {
117 117
 			$sql_do = trim($sql_entry, "\r\n; ");
118 118
 
119 119
 			if (preg_match('/^\#/', $sql_do)) continue;
120 120
 
121 121
 			// strip out comments and \n for mysql 3.x
122
-			if ($this->dbVersion <4.0) {
123
-				$sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do);
122
+			if ($this->dbVersion < 4.0) {
123
+				$sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~", "", $sql_do);
124 124
 				$sql_do = str_replace('\r', "", $sql_do);
125 125
 				$sql_do = str_replace('\n', "", $sql_do);
126 126
 			}
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 
129 129
 			$num = $num + 1;
130 130
 			if ($sql_do) mysqli_query($this->conn, $sql_do);
131
-			if(mysqli_error($this->conn)) {
131
+			if (mysqli_error($this->conn)) {
132 132
 				// Ignore duplicate and drop errors - Raymond
133
-				if ($this->ignoreDuplicateErrors){
134
-					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue;
133
+				if ($this->ignoreDuplicateErrors) {
134
+					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 || mysqli_errno($this->conn) == 1091) continue;
135 135
 				}
136 136
 				// End Ignore duplicate
137 137
 				$this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do);
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
 
143 143
     public function getTableEncoding()
144 144
     {
145
-        $out = 'DEFAULT CHARSET=' . $this->connection_charset;
145
+        $out = 'DEFAULT CHARSET='.$this->connection_charset;
146 146
         if (!empty($this->database_collation)) {
147
-            $out .= ' COLLATE=' . $this->database_collation;
147
+            $out .= ' COLLATE='.$this->database_collation;
148 148
         }
149 149
         return $out;
150 150
     }
151 151
 
152
-    public function close() {
152
+    public function close(){
153 153
 		mysqli_close($this->conn);
154 154
 	}
155 155
 }
Please login to merge, or discard this patch.
install/src/functions.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! function_exists('getLangOptions')) {
2
+if (!function_exists('getLangOptions')) {
3 3
     /**
4 4
      * @param string $install_language
5 5
      * @return string
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     function getLangOptions($install_language = 'english')
8 8
     {
9 9
         $langs = array();
10
-        if ($handle = opendir(__DIR__ . '/lang/')) {
10
+        if ($handle = opendir(__DIR__.'/lang/')) {
11 11
             while (false !== ($file = readdir($handle))) {
12 12
                 if (strpos($file, '.')) {
13 13
                     $langs[] = str_replace('.inc.php', '', $file);
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
             $abrv_language = explode('-', $language);
22 22
             $selected = ($language === $install_language) ? 'selected' : '';
23 23
             $_[] = sprintf('<option value="%s" %s>%s</option>', $language, $selected,
24
-                    ucwords($abrv_language[0])) . "\n";
24
+                    ucwords($abrv_language[0]))."\n";
25 25
         }
26 26
 
27 27
         return implode("\n", $_);
28 28
     }
29 29
 }
30 30
 
31
-if (! function_exists('install_sessionCheck')) {
31
+if (!function_exists('install_sessionCheck')) {
32 32
     function install_sessionCheck()
33 33
     {
34 34
         global $_lang;
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 </head>
51 51
 <body>
52 52
 	<div class="install">
53
-		<p>' . $_lang["session_problem"] . '</p>
54
-		<p><a href="./">' . $_lang["session_problem_try_again"] . '</a></p>
53
+		<p>' . $_lang["session_problem"].'</p>
54
+		<p><a href="./">' . $_lang["session_problem_try_again"].'</a></p>
55 55
 	</div>
56 56
 </body>
57 57
 </html>';
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     function parse($src, $ph, $left = '[+', $right = '+]')
73 73
     {
74 74
         foreach ($ph as $k => $v) {
75
-            $k = $left . $k . $right;
75
+            $k = $left.$k.$right;
76 76
             $src = str_replace($k, $v, $src);
77 77
         }
78 78
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $ph['textdir'] = $modx_textdir ? ' id="rtl"' : '';
100 100
         $ph['help_link'] = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd'];
101 101
         $ph['version'] = $moduleVersion;
102
-        $ph['release_date'] = ($modx_textdir ? '&rlm;' : '') . $modx_release_date;
102
+        $ph['release_date'] = ($modx_textdir ? '&rlm;' : '').$modx_release_date;
103 103
         $ph['footer1'] = $_lang['modx_footer1'];
104 104
         $ph['footer2'] = $_lang['modx_footer2'];
105 105
         $ph['current_year'] = date('Y');
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                 $installmode = 0;
129 129
             } else {
130 130
                 $host = explode(':', $database_server, 2);
131
-                $conn = mysqli_connect($host[0], $database_user, $database_password,'', isset($host[1]) ? $host[1] : null);
131
+                $conn = mysqli_connect($host[0], $database_user, $database_password, '', isset($host[1]) ? $host[1] : null);
132 132
                 if ($conn) {
133 133
                     $_SESSION['database_server'] = $database_server;
134 134
                     $_SESSION['database_user'] = $database_user;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             $manager_language = "english";
187 187
         }
188 188
         $langs = array();
189
-        if ($handle = opendir(MODX_MANAGER_PATH . 'includes/lang')) {
189
+        if ($handle = opendir(MODX_MANAGER_PATH.'includes/lang')) {
190 190
             while (false !== ($file = readdir($handle))) {
191 191
                 if (strpos($file, '.inc.') !== false) {
192 192
                     $langs[] = $file;
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
             $i++;
253 253
         }
254 254
 
255
-        return (0 < count($_)) ? '<h3>[%templates%]</h3>' . implode("\n", $_) : '';
255
+        return (0 < count($_)) ? '<h3>[%templates%]</h3>'.implode("\n", $_) : '';
256 256
     }
257 257
 }
258 258
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
             $i++;
283 283
         }
284 284
 
285
-        return (0 < count($_)) ? '<h3>[%tvs%]</h3>' . implode("\n", $_) : '';
285
+        return (0 < count($_)) ? '<h3>[%tvs%]</h3>'.implode("\n", $_) : '';
286 286
     }
287 287
 }
288 288
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             $i++;
314 314
         }
315 315
 
316
-        return (0 < count($_)) ? '<h3>[%chunks%]</h3>' . implode("\n", $_) : '';
316
+        return (0 < count($_)) ? '<h3>[%chunks%]</h3>'.implode("\n", $_) : '';
317 317
     }
318 318
 }
319 319
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
             $i++;
345 345
         }
346 346
 
347
-        return (0 < count($_)) ? '<h3>[%modules%]</h3>' . implode("\n", $_) : '';
347
+        return (0 < count($_)) ? '<h3>[%modules%]</h3>'.implode("\n", $_) : '';
348 348
     }
349 349
 }
350 350
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
             $i++;
380 380
         }
381 381
 
382
-        return (0 < count($_)) ? '<h3>[%plugins%]</h3>' . implode("\n", $_) : '';
382
+        return (0 < count($_)) ? '<h3>[%plugins%]</h3>'.implode("\n", $_) : '';
383 383
     }
384 384
 }
385 385
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
             $i++;
411 411
         }
412 412
 
413
-        return (0 < count($_)) ? '<h3>[%snippets%]</h3>' . implode("\n", $_) : '';
413
+        return (0 < count($_)) ? '<h3>[%snippets%]</h3>'.implode("\n", $_) : '';
414 414
     }
415 415
 }
416 416
 
@@ -421,46 +421,46 @@  discard block
 block discarded – undo
421 421
 
422 422
         // secure web documents - privateweb
423 423
         mysqli_query($sqlParser->conn,
424
-            "UPDATE `" . $sqlParser->prefix . "site_content` SET privateweb = 0 WHERE privateweb = 1");
424
+            "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1");
425 425
         $sql = "SELECT DISTINCT sc.id
426
-             FROM `" . $sqlParser->prefix . "site_content` sc
427
-             LEFT JOIN `" . $sqlParser->prefix . "document_groups` dg ON dg.document = sc.id
428
-             LEFT JOIN `" . $sqlParser->prefix . "webgroup_access` wga ON wga.documentgroup = dg.document_group
426
+             FROM `" . $sqlParser->prefix."site_content` sc
427
+             LEFT JOIN `" . $sqlParser->prefix."document_groups` dg ON dg.document = sc.id
428
+             LEFT JOIN `" . $sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group
429 429
              WHERE wga.id>0";
430 430
         $ds = mysqli_query($sqlParser->conn, $sql);
431 431
         if (!$ds) {
432
-            echo "An error occurred while executing a query: " . mysqli_error($sqlParser->conn);
432
+            echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
433 433
         } else {
434 434
             while ($r = mysqli_fetch_assoc($ds)) {
435 435
                 $ids[] = $r["id"];
436 436
             }
437 437
             if (count($ids) > 0) {
438 438
                 mysqli_query($sqlParser->conn,
439
-                    "UPDATE `" . $sqlParser->prefix . "site_content` SET privateweb = 1 WHERE id IN (" . implode(", ",
440
-                        $ids) . ")");
439
+                    "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",
440
+                        $ids).")");
441 441
                 unset($ids);
442 442
             }
443 443
         }
444 444
 
445 445
         // secure manager documents privatemgr
446 446
         mysqli_query($sqlParser->conn,
447
-            "UPDATE `" . $sqlParser->prefix . "site_content` SET privatemgr = 0 WHERE privatemgr = 1");
447
+            "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1");
448 448
         $sql = "SELECT DISTINCT sc.id
449
-             FROM `" . $sqlParser->prefix . "site_content` sc
450
-             LEFT JOIN `" . $sqlParser->prefix . "document_groups` dg ON dg.document = sc.id
451
-             LEFT JOIN `" . $sqlParser->prefix . "membergroup_access` mga ON mga.documentgroup = dg.document_group
449
+             FROM `" . $sqlParser->prefix."site_content` sc
450
+             LEFT JOIN `" . $sqlParser->prefix."document_groups` dg ON dg.document = sc.id
451
+             LEFT JOIN `" . $sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group
452 452
              WHERE mga.id>0";
453 453
         $ds = mysqli_query($sqlParser->conn, $sql);
454 454
         if (!$ds) {
455
-            echo "An error occurred while executing a query: " . mysqli_error($sqlParser->conn);
455
+            echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
456 456
         } else {
457 457
             while ($r = mysqli_fetch_assoc($ds)) {
458 458
                 $ids[] = $r["id"];
459 459
             }
460 460
             if (count($ids) > 0) {
461 461
                 mysqli_query($sqlParser->conn,
462
-                    "UPDATE `" . $sqlParser->prefix . "site_content` SET privatemgr = 1 WHERE id IN (" . implode(", ",
463
-                        $ids) . ")");
462
+                    "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",
463
+                        $ids).")");
464 464
                 unset($ids);
465 465
             }
466 466
         }
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
     function parse_docblock($element_dir, $filename)
472 472
     {
473 473
         $params = array();
474
-        $fullpath = $element_dir . '/' . $filename;
474
+        $fullpath = $element_dir.'/'.$filename;
475 475
         if (is_readable($fullpath)) {
476 476
             $tpl = @fopen($fullpath, "r");
477 477
             if ($tpl) {
@@ -688,17 +688,17 @@  discard block
 block discarded – undo
688 688
     function getCreateDbCategory($category, $sqlParser)
689 689
     {
690 690
         $dbase = $sqlParser->dbname;
691
-        $dbase = '`' . trim($dbase, '`') . '`';
691
+        $dbase = '`'.trim($dbase, '`').'`';
692 692
         $table_prefix = $sqlParser->prefix;
693 693
         $category_id = 0;
694 694
         if (!empty($category)) {
695 695
             $category = mysqli_real_escape_string($sqlParser->conn, $category);
696 696
             $rs = mysqli_query($sqlParser->conn,
697
-                "SELECT id FROM $dbase.`" . $table_prefix . "categories` WHERE category = '" . $category . "'");
697
+                "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'");
698 698
             if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
699 699
                 $category_id = $row['id'];
700 700
             } else {
701
-                $q = "INSERT INTO $dbase.`" . $table_prefix . "categories` (`category`) VALUES ('{$category}');";
701
+                $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');";
702 702
                 $rs = mysqli_query($sqlParser->conn, $q);
703 703
                 if ($rs) {
704 704
                     $category_id = mysqli_insert_id($sqlParser->conn);
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
             default:
741 741
                 return $cleaned;
742 742
         };
743
-        if (substr(trim($cleaned), 0, $count) == $include . ' MODX_BASE_PATH.\'assets/' . $elm_name . '/') {
743
+        if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') {
744 744
             return $cleaned;
745 745
         }
746 746
 
Please login to merge, or discard this patch.
install/cli-install.php 1 patch
Spacing   +258 added lines, -260 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 $self = 'install/cli-install.php';
10
-$path = __DIR__ . '/';
11
-$base_path = dirname(__DIR__) . '/';
10
+$path = __DIR__.'/';
11
+$base_path = dirname(__DIR__).'/';
12 12
 define('MODX_API_MODE', true);
13 13
 define('MODX_BASE_PATH', $base_path);
14 14
 define('MODX_SITE_URL', '/');
@@ -18,22 +18,22 @@  discard block
 block discarded – undo
18 18
 // set error reporting
19 19
 error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
20 20
 
21
-if (is_file($base_path . "assets/cache/siteManager.php")) {
22
-    include_once($base_path . "assets/cache/siteManager.php");
21
+if (is_file($base_path."assets/cache/siteManager.php")) {
22
+    include_once($base_path."assets/cache/siteManager.php");
23 23
 }
24
-if (!defined('MGR_DIR') && is_dir($base_path . "manager")) {
24
+if (!defined('MGR_DIR') && is_dir($base_path."manager")) {
25 25
     define('MGR_DIR', 'manager');
26 26
 }
27 27
 
28 28
 require_once 'src/lang.php';
29
-require_once($base_path . MGR_DIR . '/includes/version.inc.php');
29
+require_once($base_path.MGR_DIR.'/includes/version.inc.php');
30 30
 
31 31
 $moduleName = "EVO";
32
-$moduleVersion = $modx_branch . ' ' . $modx_version;
32
+$moduleVersion = $modx_branch.' '.$modx_version;
33 33
 $moduleRelease = $modx_release_date;
34
-$moduleSQLBaseFile = $path . 'stubs/sql/setup.sql';
35
-$moduleSQLDataFile = $path . 'stubs/sql/setup.data.sql';
36
-$moduleSQLResetFile = $path . 'stubs/sql/setup.data.reset.sql';
34
+$moduleSQLBaseFile = $path.'stubs/sql/setup.sql';
35
+$moduleSQLDataFile = $path.'stubs/sql/setup.data.sql';
36
+$moduleSQLResetFile = $path.'stubs/sql/setup.data.reset.sql';
37 37
 
38 38
 $moduleChunks = array(); // chunks - array : name, description, type - 0:file or 1:content, file or content
39 39
 $moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content
@@ -48,29 +48,29 @@  discard block
 block discarded – undo
48 48
 
49 49
 $installMode = 0;
50 50
 $installData = 0;
51
-$tableprefixauto = base_convert(rand(10, 20), 10, 36) . substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'),
52
-        rand(0, 33), 3) . '_';
51
+$tableprefixauto = base_convert(rand(10, 20), 10, 36).substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'),
52
+        rand(0, 33), 3).'_';
53 53
 
54 54
 $args = array_slice($argv, 1);
55 55
 
56 56
 if (empty($args)) {
57
-    echo 'Install Evolution CMS' . PHP_EOL;
57
+    echo 'Install Evolution CMS'.PHP_EOL;
58 58
     //$installYes = readline("Type 'y' to continue: ");
59 59
     //if ($installYes != 'y') return;
60 60
 
61 61
     //set param manual
62
-    $databasehost = readline($_lang['connection_screen_database_host'] . ' [localhost] ');
63
-    $databaseloginname = readline($_lang['connection_screen_database_login'] . ' ');
64
-    $databaseloginpassword = readline($_lang['connection_screen_database_pass'] . ' ');
65
-    $database_name = readline($_lang['connection_screen_database_name'] . ' ');
66
-    $tableprefix = readline($_lang['connection_screen_table_prefix'] . ' [' . $tableprefixauto . '] ');
67
-    $database_connection_method = readline($_lang['connection_screen_connection_method'] . ' [SET CHARACTER SET] ');
68
-    $database_collation = readline($_lang['connection_screen_collation'] . ' [utf8mb4_general_ci] ');
69
-    $cmsadmin = readline($_lang['connection_screen_default_admin_login'] . ' [admin] ');
70
-    $cmsadminemail = readline($_lang['connection_screen_default_admin_email'] . ' ');
71
-    $cmspassword = readline($_lang['connection_screen_default_admin_password'] . ' ');
72
-    $managerlanguage = readline('Мanager language:' . ' [en] ');
73
-    $installData = readline('Instal demo-site (y/n):' . ' [n] ');
62
+    $databasehost = readline($_lang['connection_screen_database_host'].' [localhost] ');
63
+    $databaseloginname = readline($_lang['connection_screen_database_login'].' ');
64
+    $databaseloginpassword = readline($_lang['connection_screen_database_pass'].' ');
65
+    $database_name = readline($_lang['connection_screen_database_name'].' ');
66
+    $tableprefix = readline($_lang['connection_screen_table_prefix'].' ['.$tableprefixauto.'] ');
67
+    $database_connection_method = readline($_lang['connection_screen_connection_method'].' [SET CHARACTER SET] ');
68
+    $database_collation = readline($_lang['connection_screen_collation'].' [utf8mb4_general_ci] ');
69
+    $cmsadmin = readline($_lang['connection_screen_default_admin_login'].' [admin] ');
70
+    $cmsadminemail = readline($_lang['connection_screen_default_admin_email'].' ');
71
+    $cmspassword = readline($_lang['connection_screen_default_admin_password'].' ');
72
+    $managerlanguage = readline('Мanager language:'.' [en] ');
73
+    $installData = readline('Instal demo-site (y/n):'.' [n] ');
74 74
 
75 75
 } else {
76 76
 
@@ -169,114 +169,114 @@  discard block
 block discarded – undo
169 169
 // check PHP version
170 170
 define('PHP_MIN_VERSION', '5.4.0');
171 171
 $phpMinVersion = PHP_MIN_VERSION; // Maybe not necessary. For backward compatibility
172
-echo PHP_EOL . $_lang['checking_php_version'];
172
+echo PHP_EOL.$_lang['checking_php_version'];
173 173
 // -1 if left is less, 0 if equal, +1 if left is higher
174 174
 if (version_compare(phpversion(), PHP_MIN_VERSION) < 0) {
175 175
     $errors++;
176
-    $tmp = $_lang['you_running_php'] . phpversion() . str_replace('[+min_version+]', PHP_MIN_VERSION,
176
+    $tmp = $_lang['you_running_php'].phpversion().str_replace('[+min_version+]', PHP_MIN_VERSION,
177 177
             $_lang["modx_requires_php"]);
178
-    echo $_lang['failed'] . ' ' . $tmp . PHP_EOL;
178
+    echo $_lang['failed'].' '.$tmp.PHP_EOL;
179 179
 } else {
180
-    echo $_lang['ok'] . PHP_EOL;
180
+    echo $_lang['ok'].PHP_EOL;
181 181
 }
182 182
 
183 183
 // check directories
184 184
 // cache exists?
185 185
 echo strip_tags($_lang['checking_if_cache_exist']);
186
-if (!file_exists($path . "../assets/cache") || !file_exists($path . "../assets/cache/rss")) {
187
-    echo $_lang['failed'] . PHP_EOL;
186
+if (!file_exists($path."../assets/cache") || !file_exists($path."../assets/cache/rss")) {
187
+    echo $_lang['failed'].PHP_EOL;
188 188
     $errors++;
189 189
 } else {
190
-    echo $_lang['ok'] . PHP_EOL;
190
+    echo $_lang['ok'].PHP_EOL;
191 191
 }
192 192
 
193 193
 
194 194
 // cache writable?
195 195
 echo strip_tags($_lang['checking_if_cache_writable']);
196
-if (!is_writable($path . "../assets/cache")) {
196
+if (!is_writable($path."../assets/cache")) {
197 197
     $errors++;
198
-    echo $_lang['failed'] . PHP_EOL;
198
+    echo $_lang['failed'].PHP_EOL;
199 199
 } else {
200
-    echo $_lang['ok'] . PHP_EOL;
200
+    echo $_lang['ok'].PHP_EOL;
201 201
 }
202 202
 
203 203
 
204 204
 // cache files writable?
205 205
 echo strip_tags($_lang['checking_if_cache_file_writable']);
206
-$tmp = $path . "../assets/cache/siteCache.idx.php";
206
+$tmp = $path."../assets/cache/siteCache.idx.php";
207 207
 if (!file_exists($tmp)) {
208 208
     f_owc($tmp, "<?php //EVO site cache file ?>");
209 209
 }
210 210
 if (!is_writable($tmp)) {
211 211
     $errors++;
212
-    echo $_lang['failed'] . PHP_EOL;
212
+    echo $_lang['failed'].PHP_EOL;
213 213
 } else {
214
-    echo $_lang['ok'] . PHP_EOL;
214
+    echo $_lang['ok'].PHP_EOL;
215 215
 }
216 216
 
217 217
 
218 218
 echo strip_tags($_lang['checking_if_cache_file2_writable']);
219
-if (!is_writable($path . "../assets/cache/sitePublishing.idx.php")) {
219
+if (!is_writable($path."../assets/cache/sitePublishing.idx.php")) {
220 220
     $errors++;
221
-    echo $_lang['failed'] . PHP_EOL;
221
+    echo $_lang['failed'].PHP_EOL;
222 222
 } else {
223
-    echo $_lang['ok'] . PHP_EOL;
223
+    echo $_lang['ok'].PHP_EOL;
224 224
 }
225 225
 
226 226
 
227 227
 // File Browser directories exists?
228 228
 echo strip_tags($_lang['checking_if_images_exist']);
229 229
 switch (true) {
230
-    case !file_exists($path . "../assets/images"):
231
-    case !file_exists($path . "../assets/files"):
232
-    case !file_exists($path . "../assets/backup"):
230
+    case !file_exists($path."../assets/images"):
231
+    case !file_exists($path."../assets/files"):
232
+    case !file_exists($path."../assets/backup"):
233 233
         //case !file_exists("../assets/.thumbs"):
234 234
         $errors++;
235
-        echo $_lang['failed'] . PHP_EOL;
235
+        echo $_lang['failed'].PHP_EOL;
236 236
         break;
237 237
     default:
238
-        echo $_lang['ok'] . PHP_EOL;
238
+        echo $_lang['ok'].PHP_EOL;
239 239
 }
240 240
 
241 241
 
242 242
 // File Browser directories writable?
243 243
 echo strip_tags($_lang['checking_if_images_writable']);
244 244
 switch (true) {
245
-    case !is_writable($path . "../assets/images"):
246
-    case !is_writable($path . "../assets/files"):
247
-    case !is_writable($path . "../assets/backup"):
245
+    case !is_writable($path."../assets/images"):
246
+    case !is_writable($path."../assets/files"):
247
+    case !is_writable($path."../assets/backup"):
248 248
         //case !is_writable("../assets/.thumbs"):
249 249
         $errors++;
250
-        echo $_lang['failed'] . PHP_EOL;
250
+        echo $_lang['failed'].PHP_EOL;
251 251
         break;
252 252
     default:
253
-        echo $_lang['ok'] . PHP_EOL;
253
+        echo $_lang['ok'].PHP_EOL;
254 254
 }
255 255
 
256 256
 
257 257
 // export exists?
258 258
 echo strip_tags($_lang['checking_if_export_exists']);
259
-if (!file_exists($path . "../assets/export")) {
260
-    echo $_lang['failed'] . PHP_EOL;
259
+if (!file_exists($path."../assets/export")) {
260
+    echo $_lang['failed'].PHP_EOL;
261 261
     $errors++;
262 262
 } else {
263
-    echo $_lang['ok'] . PHP_EOL;
263
+    echo $_lang['ok'].PHP_EOL;
264 264
 }
265 265
 
266 266
 
267 267
 // export writable?
268 268
 echo strip_tags($_lang['checking_if_export_writable']);
269
-if (!is_writable($path . "../assets/export")) {
270
-    echo $_lang['failed'] . PHP_EOL;
269
+if (!is_writable($path."../assets/export")) {
270
+    echo $_lang['failed'].PHP_EOL;
271 271
     $errors++;
272 272
 } else {
273
-    echo $_lang['ok'] . PHP_EOL;
273
+    echo $_lang['ok'].PHP_EOL;
274 274
 }
275 275
 
276 276
 
277 277
 // config.inc.php writable?
278 278
 echo strip_tags($_lang['checking_if_config_exist_and_writable']);
279
-$tmp = $path . "../" . MGR_DIR . "/includes/config.inc.php";
279
+$tmp = $path."../".MGR_DIR."/includes/config.inc.php";
280 280
 if (!is_file($tmp)) {
281 281
     f_owc($tmp, "<?php //EVO configuration file ?>", 0666);
282 282
 } else {
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
 $isWriteable = is_writable($tmp);
286 286
 if (!$isWriteable) {
287 287
     $errors++;
288
-    echo $_lang['failed'] . PHP_EOL;
288
+    echo $_lang['failed'].PHP_EOL;
289 289
 } else {
290
-    echo $_lang['ok'] . PHP_EOL;
290
+    echo $_lang['ok'].PHP_EOL;
291 291
 }
292 292
 
293 293
 
294 294
 // connect to the database
295 295
 if ($installMode == 1) {
296
-    include $path . "../" . MGR_DIR . "/includes/config.inc.php";
296
+    include $path."../".MGR_DIR."/includes/config.inc.php";
297 297
 } else {
298 298
     // get db info from post
299 299
     $database_server = $databasehost;
@@ -303,23 +303,23 @@  discard block
 block discarded – undo
303 303
     $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1);
304 304
     $database_connection_charset = $database_collation;
305 305
     $database_connection_method = $database_connection_method;
306
-    $dbase = '`' . $database_name . '`';
306
+    $dbase = '`'.$database_name.'`';
307 307
     $table_prefix = $tableprefix;
308 308
 }
309 309
 echo $_lang['creating_database_connection'];
310 310
 $host = explode(':', $database_server, 2);
311
-if (!$conn = mysqli_connect($host[0], $database_user, $database_password,'', isset($host[1]) ? $host[1] : null)) {
311
+if (!$conn = mysqli_connect($host[0], $database_user, $database_password, '', isset($host[1]) ? $host[1] : null)) {
312 312
     $errors++;
313
-    echo $_lang['database_connection_failed'] . PHP_EOL;
313
+    echo $_lang['database_connection_failed'].PHP_EOL;
314 314
 } else {
315
-    echo $_lang['ok'] . PHP_EOL;
315
+    echo $_lang['ok'].PHP_EOL;
316 316
 }
317 317
 
318 318
 
319 319
 // make sure we can use the database
320 320
 if ($installMode > 0 && !mysqli_query($conn, "USE {$dbase}")) {
321 321
     $errors++;
322
-    echo $_lang['database_use_failed'] . PHP_EOL;
322
+    echo $_lang['database_use_failed'].PHP_EOL;
323 323
 }
324 324
 
325 325
 // check the database collation if not specified in the configuration
@@ -344,22 +344,22 @@  discard block
 block discarded – undo
344 344
 
345 345
 // check table prefix
346 346
 if ($conn && $installMode == 0) {
347
-    echo $_lang['checking_table_prefix'] . $table_prefix . '`: ';
348
-    if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
349
-        echo $_lang['failed'] . ' ' . $_lang['table_prefix_already_inuse_note'] . PHP_EOL;
347
+    echo $_lang['checking_table_prefix'].$table_prefix.'`: ';
348
+    if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
349
+        echo $_lang['failed'].' '.$_lang['table_prefix_already_inuse_note'].PHP_EOL;
350 350
         $errors++;
351 351
 
352 352
     } else {
353
-        echo $_lang['ok'] . PHP_EOL;
353
+        echo $_lang['ok'].PHP_EOL;
354 354
     }
355 355
 } elseif ($conn && $installMode == 2) {
356
-    echo $_lang['checking_table_prefix'] . $table_prefix . '`: ';
357
-    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
358
-        echo $_lang['failed'] . ' ' . $_lang['table_prefix_not_exist'] . PHP_EOL;
356
+    echo $_lang['checking_table_prefix'].$table_prefix.'`: ';
357
+    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
358
+        echo $_lang['failed'].' '.$_lang['table_prefix_not_exist'].PHP_EOL;
359 359
         $errors++;
360 360
 
361 361
     } else {
362
-        echo $_lang['ok'] . PHP_EOL;
362
+        echo $_lang['ok'].PHP_EOL;
363 363
     }
364 364
 }
365 365
 
@@ -367,10 +367,10 @@  discard block
 block discarded – undo
367 367
 if ($conn) {
368 368
     echo $_lang['checking_mysql_version'];
369 369
     if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) {
370
-        echo $_lang['warning'] . ' ' . $_lang['mysql_5051'] . PHP_EOL;
371
-        echo $_lang['mysql_5051_warning'] . PHP_EOL;
370
+        echo $_lang['warning'].' '.$_lang['mysql_5051'].PHP_EOL;
371
+        echo $_lang['mysql_5051_warning'].PHP_EOL;
372 372
     } else {
373
-        echo $_lang['ok'] . ' ' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . PHP_EOL;
373
+        echo $_lang['ok'].' '.$_lang['mysql_version_is'].mysqli_get_server_info($conn).PHP_EOL;
374 374
     }
375 375
 }
376 376
 
@@ -384,40 +384,40 @@  discard block
 block discarded – undo
384 384
         // print_r($modes);
385 385
         foreach ($modes as $mode) {
386 386
             if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) {
387
-                echo $_lang['warning'] . ' ' . $_lang['strict_mode'] . PHP_EOL;
388
-                echo $_lang['strict_mode_error'] . PHP_EOL;
387
+                echo $_lang['warning'].' '.$_lang['strict_mode'].PHP_EOL;
388
+                echo $_lang['strict_mode_error'].PHP_EOL;
389 389
             } else {
390
-                echo $_lang['ok'] . PHP_EOL;
390
+                echo $_lang['ok'].PHP_EOL;
391 391
             }
392 392
         }
393 393
     } else {
394
-        echo $_lang['ok'] . PHP_EOL;
394
+        echo $_lang['ok'].PHP_EOL;
395 395
     }
396 396
 }
397 397
 // Version and strict mode check end
398 398
 
399 399
 // andrazk 20070416 - add install flag and disable manager login
400 400
 // assets/cache writable?
401
-if (is_writable($path . "../assets/cache")) {
402
-    if (file_exists($path . '../assets/cache/installProc.inc.php')) {
403
-        @chmod($path . '../assets/cache/installProc.inc.php', 0755);
404
-        unlink($path . '../assets/cache/installProc.inc.php');
401
+if (is_writable($path."../assets/cache")) {
402
+    if (file_exists($path.'../assets/cache/installProc.inc.php')) {
403
+        @chmod($path.'../assets/cache/installProc.inc.php', 0755);
404
+        unlink($path.'../assets/cache/installProc.inc.php');
405 405
     }
406 406
 
407
-    f_owc($path . "../assets/cache/installProc.inc.php", '<?php $installStartTime = ' . time() . '; ?>');
407
+    f_owc($path."../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>');
408 408
 }
409 409
 
410 410
 if ($installMode > 0 && $_POST['installdata'] == "1") {
411
-    echo $_lang['sample_web_site'] . ': ' . $_lang['sample_web_site_note'] . PHP_EOL;
411
+    echo $_lang['sample_web_site'].': '.$_lang['sample_web_site_note'].PHP_EOL;
412 412
 }
413 413
 
414 414
 if ($errors > 0) {
415
-    echo $_lang['setup_cannot_continue'] . ' ';
415
+    echo $_lang['setup_cannot_continue'].' ';
416 416
 
417 417
     if ($errors > 1) {
418
-        echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural'];
418
+        echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural'];
419 419
     } else {
420
-        echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again'] . PHP_EOL;
420
+        echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again'].PHP_EOL;
421 421
     }
422 422
 
423 423
     die();
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 
435 435
 
436 436
 if ($installMode == 1) {
437
-    include $path . "../" . MGR_DIR . "/includes/config.inc.php";
437
+    include $path."../".MGR_DIR."/includes/config.inc.php";
438 438
 } else {
439 439
     // get db info from post
440 440
     $database_server = $databasehost;
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
     $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
445 445
     $database_connection_charset = $database_charset;
446 446
     $database_connection_method = $database_connection_method;
447
-    $dbase = "`" . $database_name . "`";
447
+    $dbase = "`".$database_name."`";
448 448
     $table_prefix = $tableprefix;
449 449
     $adminname = $cmsadmin;
450 450
     $adminemail = $cmsadminemail;
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 
456 456
 // set session name variable
457 457
 if (!isset ($site_sessionname)) {
458
-    $site_sessionname = 'SN' . uniqid('');
458
+    $site_sessionname = 'SN'.uniqid('');
459 459
 }
460 460
 
461 461
 // get base path and url
@@ -471,65 +471,65 @@  discard block
 block discarded – undo
471 471
 }
472 472
 $pth = implode("install", $a);
473 473
 unset ($a);
474
-$base_url = $url . (substr($url, -1) != "/" ? "/" : "");
475
-$base_path = $pth . (substr($pth, -1) != "/" ? "/" : "");
474
+$base_url = $url.(substr($url, -1) != "/" ? "/" : "");
475
+$base_path = $pth.(substr($pth, -1) != "/" ? "/" : "");
476 476
 
477 477
 // connect to the database
478
-echo $_lang['setup_database_create_connection'] . ': ';
478
+echo $_lang['setup_database_create_connection'].': ';
479 479
 $host = explode(':', $database_server, 2);
480
-if (!$conn = mysqli_connect($host[0], $database_user, $database_password,'', isset($host[1]) ? $host[1] : null)) {
481
-    echo $_lang["setup_database_create_connection_failed"] . " " . $_lang['setup_database_create_connection_failed_note'] . PHP_EOL;
480
+if (!$conn = mysqli_connect($host[0], $database_user, $database_password, '', isset($host[1]) ? $host[1] : null)) {
481
+    echo $_lang["setup_database_create_connection_failed"]." ".$_lang['setup_database_create_connection_failed_note'].PHP_EOL;
482 482
 
483 483
     return;
484 484
 } else {
485
-    echo $_lang['ok'] . PHP_EOL;
485
+    echo $_lang['ok'].PHP_EOL;
486 486
 }
487 487
 
488 488
 // select database
489
-echo $_lang['setup_database_selection'] . str_replace("`", "", $dbase) . "`: ";
489
+echo $_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: ";
490 490
 if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) {
491
-    echo $_lang['setup_database_selection_failed'] . " " . $_lang['setup_database_selection_failed_note'] . PHP_EOL;
491
+    echo $_lang['setup_database_selection_failed']." ".$_lang['setup_database_selection_failed_note'].PHP_EOL;
492 492
     $create = true;
493 493
 } else {
494 494
     if (function_exists('mysqli_set_charset')) {
495 495
         mysqli_set_charset($conn, $database_charset);
496 496
     }
497 497
     mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}");
498
-    echo $_lang['ok'] . PHP_EOL;
498
+    echo $_lang['ok'].PHP_EOL;
499 499
 }
500 500
 
501 501
 // try to create the database
502 502
 if ($create) {
503
-    echo $_lang['setup_database_creation'] . str_replace("`", "", $dbase) . "`: ";
503
+    echo $_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: ";
504 504
     //  if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) {
505 505
     if (!mysqli_query($conn,
506 506
         "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
507
-        echo $_lang['setup_database_creation_failed'] . " " . $_lang['setup_database_creation_failed_note'] . PHP_EOL;
507
+        echo $_lang['setup_database_creation_failed']." ".$_lang['setup_database_creation_failed_note'].PHP_EOL;
508 508
         $errors += 1;
509 509
 
510
-        echo 'database charset: ' . $database_charset . PHP_EOL;
511
-        echo 'database collation: ' . $database_collation . PHP_EOL;
510
+        echo 'database charset: '.$database_charset.PHP_EOL;
511
+        echo 'database collation: '.$database_collation.PHP_EOL;
512 512
 
513
-        echo $_lang['setup_database_creation_failed_note2'] . PHP_EOL;
513
+        echo $_lang['setup_database_creation_failed_note2'].PHP_EOL;
514 514
 
515 515
         die();
516 516
 
517 517
     } else {
518
-        echo $_lang['ok'] . PHP_EOL;
518
+        echo $_lang['ok'].PHP_EOL;
519 519
     }
520 520
 }
521 521
 
522 522
 // check table prefix
523 523
 if ($installMode == 0) {
524
-    echo $_lang['checking_table_prefix'] . $table_prefix . "`: ";
525
-    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
526
-        echo $_lang['failed'] . " " . $_lang['table_prefix_already_inuse'] . PHP_EOL;
524
+    echo $_lang['checking_table_prefix'].$table_prefix."`: ";
525
+    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
526
+        echo $_lang['failed']." ".$_lang['table_prefix_already_inuse'].PHP_EOL;
527 527
         $errors += 1;
528
-        echo $_lang['table_prefix_already_inuse_note'] . PHP_EOL;
528
+        echo $_lang['table_prefix_already_inuse_note'].PHP_EOL;
529 529
 
530 530
         return;
531 531
     } else {
532
-        echo $_lang['ok'] . PHP_EOL;
532
+        echo $_lang['ok'].PHP_EOL;
533 533
     }
534 534
 }
535 535
 
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 $auto_template_logic = 'parent';
572 572
 if ($installMode != 0) {
573 573
     $rs = mysqli_query($conn,
574
-        "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'");
574
+        "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'");
575 575
     $row = mysqli_fetch_row($rs);
576 576
     if (!$row) {
577 577
         // not installed
@@ -595,12 +595,12 @@  discard block
 block discarded – undo
595 595
 
596 596
 // open db connection
597 597
 $setupPath = realpath(__DIR__);
598
-$chunkPath = $path . 'assets/chunks';
599
-$snippetPath = $path . 'assets/snippets';
600
-$pluginPath = $path . 'assets/plugins';
601
-$modulePath = $path . 'assets/modules';
602
-$templatePath = $path . 'assets/templates';
603
-$tvPath = $path . 'assets/tvs';
598
+$chunkPath = $path.'assets/chunks';
599
+$snippetPath = $path.'assets/snippets';
600
+$pluginPath = $path.'assets/plugins';
601
+$modulePath = $path.'assets/modules';
602
+$templatePath = $path.'assets/templates';
603
+$tvPath = $path.'assets/tvs';
604 604
 
605 605
 // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category
606 606
 $mt = &$moduleTemplates;
@@ -613,8 +613,7 @@  discard block
 block discarded – undo
613 613
         $params = parse_docblock($templatePath, $tplfile);
614 614
         if (is_array($params) && (count($params) > 0)) {
615 615
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
616
-            $mt[] = array
617
-            (
616
+            $mt[] = array(
618 617
                 $params['name'],
619 618
                 $description,
620 619
                 // Don't think this is gonna be used ... but adding it just in case 'type'
@@ -654,8 +653,7 @@  discard block
 block discarded – undo
654 653
                 "$templatePath/{$params['filename']}",
655 654
                 /* not currently used */
656 655
                 $params['template_assignments'] != "*" ?
657
-                    $params['template_assignments'] :
658
-                    implode(',', array_map(function($value){return isset($value[0]) && is_scalar($value[0]);},$mt)),
656
+                    $params['template_assignments'] : implode(',', array_map(function($value){return isset($value[0]) && is_scalar($value[0]); },$mt)),
659 657
                 /* comma-separated list of template names */
660 658
                 $params['modx_category'],
661 659
                 $params['lock_tv'],
@@ -735,7 +733,7 @@  discard block
 block discarded – undo
735 733
                 $params['modx_category'],
736 734
                 $params['legacy_names'],
737 735
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false,
738
-                (int)$params['disabled']
736
+                (int) $params['disabled']
739 737
             );
740 738
         }
741 739
     }
@@ -760,12 +758,12 @@  discard block
 block discarded – undo
760 758
                 "$modulePath/{$params['filename']}",
761 759
                 $params['properties'],
762 760
                 $params['guid'],
763
-                (int)$params['shareparams'],
761
+                (int) $params['shareparams'],
764 762
                 $params['modx_category'],
765 763
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
766 764
             );
767 765
         }
768
-        if ((int)$params['shareparams'] || !empty($params['dependencies'])) {
766
+        if ((int) $params['shareparams'] || !empty($params['dependencies'])) {
769 767
             $dependencies = explode(',', $params['dependencies']);
770 768
             foreach ($dependencies as $dependency) {
771 769
                 $dependency = explode(':', $dependency);
@@ -836,7 +834,7 @@  discard block
 block discarded – undo
836 834
 // setup callback function
837 835
 $callBackFnc = "clean_up";
838 836
 
839
-include $path . "src/sqlParser.class.php";
837
+include $path."src/sqlParser.class.php";
840 838
 $sqlParser = new SqlParser($database_server, $database_user, $database_password, str_replace("`", "", $dbase),
841 839
     $table_prefix, $adminname, $adminemail, $adminpass, $database_connection_charset, $managerlanguage,
842 840
     $database_connection_method, $auto_template_logic);
@@ -857,21 +855,21 @@  discard block
 block discarded – undo
857 855
     // display database results
858 856
     if ($sqlParser->installFailed == true) {
859 857
         $errors += 1;
860
-        echo $_lang['database_alerts'] . PHP_EOL;
861
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
862
-        echo $_lang['installation_error_occured'] . PHP_EOL;
858
+        echo $_lang['database_alerts'].PHP_EOL;
859
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
860
+        echo $_lang['installation_error_occured'].PHP_EOL;
863 861
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
864
-            echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL;
862
+            echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL;
865 863
         }
866
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
864
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
867 865
         die();
868 866
     } else {
869
-        echo $_lang['ok'] . PHP_EOL;
867
+        echo $_lang['ok'].PHP_EOL;
870 868
     }
871 869
 }
872 870
 
873 871
 // custom or not
874
-if (file_exists($path . "../assets/cache/siteManager.php")) {
872
+if (file_exists($path."../assets/cache/siteManager.php")) {
875 873
     $mgrdir = 'include_once(__DIR__."/../../assets/cache/siteManager.php");';
876 874
 } else {
877 875
     $mgrdir = 'define(\'MGR_DIR\', \'manager\');';
@@ -891,10 +889,10 @@  discard block
 block discarded – undo
891 889
 $confph['lastInstallTime'] = time();
892 890
 $confph['site_sessionname'] = $site_sessionname;
893 891
 
894
-$configString = file_get_contents($path . 'stubs/config.tpl');
892
+$configString = file_get_contents($path.'stubs/config.tpl');
895 893
 $configString = parse($configString, $confph);
896 894
 
897
-$filename = $base_path . MGR_DIR . '/includes/config.inc.php';
895
+$filename = $base_path.MGR_DIR.'/includes/config.inc.php';
898 896
 $configFileFailed = false;
899 897
 if (@ !$handle = fopen($filename, 'w')) {
900 898
     $configFileFailed = true;
@@ -910,38 +908,38 @@  discard block
 block discarded – undo
910 908
 $chmodSuccess = @chmod($filename, 0404);
911 909
 
912 910
 if ($configFileFailed == true) {
913
-    echo $_lang['failed'] . PHP_EOL;
911
+    echo $_lang['failed'].PHP_EOL;
914 912
     $errors += 1;
915 913
 
916
-    echo $_lang['cant_write_config_file'] . ' ' . MGR_DIR . '/includes/config.inc.php' . PHP_EOL;
917
-    echo ' ' . PHP_EOL;
918
-    echo ' ' . PHP_EOL;
914
+    echo $_lang['cant_write_config_file'].' '.MGR_DIR.'/includes/config.inc.php'.PHP_EOL;
915
+    echo ' '.PHP_EOL;
916
+    echo ' '.PHP_EOL;
919 917
     echo $configString;
920
-    echo ' ' . PHP_EOL;
921
-    echo ' ' . PHP_EOL;
922
-    echo $_lang['cant_write_config_file_note'] . PHP_EOL;
918
+    echo ' '.PHP_EOL;
919
+    echo ' '.PHP_EOL;
920
+    echo $_lang['cant_write_config_file_note'].PHP_EOL;
923 921
     die();
924 922
 
925 923
 } else {
926
-    echo $_lang['ok'] . PHP_EOL;
924
+    echo $_lang['ok'].PHP_EOL;
927 925
 }
928 926
 
929 927
 // generate new site_id and set manager theme to default
930 928
 if ($installMode == 0) {
931 929
     $siteid = uniqid('');
932 930
     mysqli_query($sqlParser->conn,
933
-        "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
931
+        "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
934 932
 } else {
935 933
     // update site_id if missing
936 934
     $ds = mysqli_query($sqlParser->conn,
937
-        "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'");
935
+        "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'");
938 936
     if ($ds) {
939 937
         $r = mysqli_fetch_assoc($ds);
940 938
         $siteid = $r['setting_value'];
941 939
         if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') {
942 940
             $siteid = uniqid('');
943 941
             mysqli_query($sqlParser->conn,
944
-                "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
942
+                "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
945 943
         }
946 944
     }
947 945
 }
@@ -953,25 +951,25 @@  discard block
 block discarded – undo
953 951
     // display database results
954 952
     if ($sqlParser->installFailed == true) {
955 953
         $errors += 1;
956
-        echo $_lang['database_alerts'] . PHP_EOL;
957
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
958
-        echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
954
+        echo $_lang['database_alerts'].PHP_EOL;
955
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
956
+        echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL;
959 957
         /*
960 958
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
961 959
             echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
962 960
         }
963 961
         echo "</p>";*/
964
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
962
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
965 963
         die();
966 964
     } else {
967
-        echo $_lang['ok'] . PHP_EOL;
965
+        echo $_lang['ok'].PHP_EOL;
968 966
     }
969 967
 }
970 968
 
971 969
 // Install Templates
972 970
 $moduleTemplate = $mt;
973 971
 if (!empty($moduleTemplate) || $installData) {
974
-    echo PHP_EOL . $_lang['templates'] . ":" . PHP_EOL;
972
+    echo PHP_EOL.$_lang['templates'].":".PHP_EOL;
975 973
     //$selTemplates = $_POST['template'];
976 974
     foreach ($moduleTemplates as $k => $moduleTemplate) {
977 975
         $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1;
@@ -983,7 +981,7 @@  discard block
 block discarded – undo
983 981
             $filecontent = $moduleTemplate[3];
984 982
             $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site
985 983
             if (!file_exists($filecontent)) {
986
-                echo "  $name: " . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
984
+                echo "  $name: ".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
987 985
             } else {
988 986
                 // Create the category if it does not already exist
989 987
                 $category_id = getCreateDbCategory($category, $sqlParser);
@@ -994,13 +992,13 @@  discard block
 block discarded – undo
994 992
 
995 993
                 // See if the template already exists
996 994
                 $rs = mysqli_query($sqlParser->conn,
997
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'");
995
+                    "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'");
998 996
 
999 997
                 if (mysqli_num_rows($rs)) {
1000 998
                     if (!mysqli_query($sqlParser->conn,
1001
-                        "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
999
+                        "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
1002 1000
                         $errors += 1;
1003
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1001
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1004 1002
 
1005 1003
                         return;
1006 1004
                     }
@@ -1008,23 +1006,23 @@  discard block
 block discarded – undo
1008 1006
                         $sql_id = @mysqli_insert_id($sqlParser->conn);
1009 1007
                         if (!$sql_id) {
1010 1008
                             $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn,
1011
-                                "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;"));
1009
+                                "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;"));
1012 1010
                             $sql_id = $idQuery['id'];
1013 1011
                         }
1014 1012
                         $custom_placeholders[$save_sql_id_as] = $sql_id;
1015 1013
                     }
1016
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1014
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1017 1015
                 } else {
1018 1016
                     if (!@ mysqli_query($sqlParser->conn,
1019
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
1017
+                        "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
1020 1018
                         $errors += 1;
1021
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1019
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1022 1020
                         die();
1023 1021
                     }
1024 1022
                     if (!is_null($save_sql_id_as)) {
1025 1023
                         $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
1026 1024
                     }
1027
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1025
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1028 1026
                 }
1029 1027
             }
1030 1028
         }
@@ -1034,7 +1032,7 @@  discard block
 block discarded – undo
1034 1032
 // Install Template Variables
1035 1033
 $moduleTVs = $mtv;
1036 1034
 if (is_array($moduleTVs) || $installData) {
1037
-    echo PHP_EOL . $_lang['tvs'] . ': ' . PHP_EOL;
1035
+    echo PHP_EOL.$_lang['tvs'].': '.PHP_EOL;
1038 1036
     //$selTVs = $_POST['tv'];
1039 1037
     foreach ($moduleTVs as $k => $moduleTV) {
1040 1038
         $installSample = in_array('sample', $moduleTV[12]) && $installData == 1;
@@ -1057,27 +1055,27 @@  discard block
 block discarded – undo
1057 1055
             $category = getCreateDbCategory($category, $sqlParser);
1058 1056
 
1059 1057
             $rs = mysqli_query($sqlParser->conn,
1060
-                "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'");
1058
+                "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'");
1061 1059
             if (mysqli_num_rows($rs)) {
1062 1060
                 $insert = true;
1063 1061
                 while ($row = mysqli_fetch_assoc($rs)) {
1064 1062
                     if (!mysqli_query($sqlParser->conn,
1065
-                        "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']};")) {
1066
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1063
+                        "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']};")) {
1064
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1067 1065
 
1068 1066
                         return;
1069 1067
                     }
1070 1068
                     $insert = false;
1071 1069
                 }
1072
-                echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1070
+                echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1073 1071
             } else {
1074
-                $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');";
1072
+                $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');";
1075 1073
                 if (!mysqli_query($sqlParser->conn, $q)) {
1076
-                    echo mysqli_error($sqlParser->conn) . PHP_EOL;
1074
+                    echo mysqli_error($sqlParser->conn).PHP_EOL;
1077 1075
 
1078 1076
                     return;
1079 1077
                 }
1080
-                echo "  $name: " . $_lang['installed'] . PHP_EOL;
1078
+                echo "  $name: ".$_lang['installed'].PHP_EOL;
1081 1079
             }
1082 1080
 
1083 1081
             // add template assignments
@@ -1087,22 +1085,22 @@  discard block
 block discarded – undo
1087 1085
 
1088 1086
                 // remove existing tv -> template assignments
1089 1087
                 $ds = mysqli_query($sqlParser->conn,
1090
-                    "SELECT id FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name' AND description='$desc';");
1088
+                    "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
1091 1089
                 $row = mysqli_fetch_assoc($ds);
1092 1090
                 $id = $row["id"];
1093 1091
                 mysqli_query($sqlParser->conn,
1094
-                    'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\'');
1092
+                    'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\'');
1095 1093
 
1096 1094
                 // add tv -> template assignments
1097 1095
                 foreach ($assignments as $assignment) {
1098 1096
                     $template = mysqli_real_escape_string($conn, $assignment);
1099 1097
                     $ts = mysqli_query($sqlParser->conn,
1100
-                        "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$template';");
1098
+                        "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$template';");
1101 1099
                     if ($ds && $ts) {
1102 1100
                         $tRow = mysqli_fetch_assoc($ts);
1103 1101
                         $templateId = $tRow['id'];
1104 1102
                         mysqli_query($sqlParser->conn,
1105
-                            "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
1103
+                            "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
1106 1104
                     }
1107 1105
                 }
1108 1106
             }
@@ -1114,7 +1112,7 @@  discard block
 block discarded – undo
1114 1112
 $moduleChunks = $mc;
1115 1113
 // Install Chunks
1116 1114
 if (is_array($moduleChunks) || $installData) {
1117
-    echo PHP_EOL . $_lang['chunks'] . ": " . PHP_EOL;
1115
+    echo PHP_EOL.$_lang['chunks'].": ".PHP_EOL;
1118 1116
     foreach ($moduleChunks as $k => $moduleChunk) {
1119 1117
         $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1;
1120 1118
         $count_new_name = 0;
@@ -1127,7 +1125,7 @@  discard block
 block discarded – undo
1127 1125
             $filecontent = $moduleChunk[2];
1128 1126
 
1129 1127
             if (!file_exists($filecontent)) {
1130
-                echo "  $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1128
+                echo "  $name: ".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1131 1129
             } else {
1132 1130
 
1133 1131
                 // Create the category if it does not already exist
@@ -1136,36 +1134,36 @@  discard block
 block discarded – undo
1136 1134
                 $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1);
1137 1135
                 $chunk = mysqli_real_escape_string($conn, $chunk);
1138 1136
                 $rs = mysqli_query($sqlParser->conn,
1139
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'");
1137
+                    "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'");
1140 1138
                 $count_original_name = mysqli_num_rows($rs);
1141 1139
                 if ($overwrite == 'false') {
1142
-                    $newname = $name . '-' . str_replace('.', '_', $modx_version);
1140
+                    $newname = $name.'-'.str_replace('.', '_', $modx_version);
1143 1141
                     $rs = mysqli_query($sqlParser->conn,
1144
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'");
1142
+                        "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'");
1145 1143
                     $count_new_name = mysqli_num_rows($rs);
1146 1144
                 }
1147 1145
                 $update = $count_original_name > 0 && $overwrite == 'true';
1148 1146
                 if ($update) {
1149 1147
                     if (!mysqli_query($sqlParser->conn,
1150
-                        "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1148
+                        "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1151 1149
                         $errors += 1;
1152
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1150
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1153 1151
 
1154 1152
                         return;
1155 1153
                     }
1156
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1154
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1157 1155
                 } elseif ($count_new_name == 0) {
1158 1156
                     if ($count_original_name > 0 && $overwrite == 'false') {
1159 1157
                         $name = $newname;
1160 1158
                     }
1161 1159
                     if (!mysqli_query($sqlParser->conn,
1162
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
1160
+                        "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
1163 1161
                         $errors += 1;
1164
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1162
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1165 1163
 
1166 1164
                         return;
1167 1165
                     }
1168
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1166
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1169 1167
                 }
1170 1168
             }
1171 1169
         }
@@ -1175,7 +1173,7 @@  discard block
 block discarded – undo
1175 1173
 // Install Modules
1176 1174
 $moduleModules = $mm;
1177 1175
 if (is_array($moduleModules) || $installData) {
1178
-    echo PHP_EOL . $_lang['modules'] . ":" . PHP_EOL;
1176
+    echo PHP_EOL.$_lang['modules'].":".PHP_EOL;
1179 1177
     //$selModules = $_POST['module'];
1180 1178
     foreach ($moduleModules as $k => $moduleModule) {
1181 1179
         $installSample = in_array('sample', $moduleModule[7]) && $installData == 1;
@@ -1188,7 +1186,7 @@  discard block
 block discarded – undo
1188 1186
             $shared = mysqli_real_escape_string($conn, $moduleModule[5]);
1189 1187
             $category = mysqli_real_escape_string($conn, $moduleModule[6]);
1190 1188
             if (!file_exists($filecontent)) {
1191
-                echo "  $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1189
+                echo "  $name: ".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1192 1190
             } else {
1193 1191
 
1194 1192
                 // Create the category if it does not already exist
@@ -1198,28 +1196,28 @@  discard block
 block discarded – undo
1198 1196
                 // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab
1199 1197
                 $module = mysqli_real_escape_string($conn, $module);
1200 1198
                 $rs = mysqli_query($sqlParser->conn,
1201
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'");
1199
+                    "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'");
1202 1200
                 if (mysqli_num_rows($rs)) {
1203 1201
                     $row = mysqli_fetch_assoc($rs);
1204 1202
                     $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1205 1203
                     if (!mysqli_query($sqlParser->conn,
1206
-                        "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1207
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1204
+                        "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1205
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1208 1206
 
1209 1207
                         return;
1210 1208
                     }
1211
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1209
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1212 1210
                 } else {
1213 1211
                     if ($properties != null) {
1214 1212
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1215 1213
                     }
1216 1214
                     if (!mysqli_query($sqlParser->conn,
1217
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
1218
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
1215
+                        "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
1216
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
1219 1217
 
1220 1218
                         return;
1221 1219
                     }
1222
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1220
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1223 1221
                 }
1224 1222
             }
1225 1223
         }
@@ -1229,7 +1227,7 @@  discard block
 block discarded – undo
1229 1227
 // Install Plugins
1230 1228
 $modulePlugins = $mp;
1231 1229
 if (is_array($modulePlugins) || $installData) {
1232
-    echo PHP_EOL . $_lang['plugins'] . ":" . PHP_EOL;
1230
+    echo PHP_EOL.$_lang['plugins'].":".PHP_EOL;
1233 1231
     $selPlugs = $_POST['plugin'];
1234 1232
     foreach ($modulePlugins as $k => $modulePlugin) {
1235 1233
         //$installSample = in_array('sample', $modulePlugin[8]) && $installData == 1;
@@ -1245,16 +1243,16 @@  discard block
 block discarded – undo
1245 1243
             $disabled = $modulePlugin[9];
1246 1244
             if (array_key_exists(7, $modulePlugin)) {
1247 1245
                 // parse comma-separated legacy names and prepare them for sql IN clause
1248
-                $leg_names = "'" . implode("','",
1249
-                        preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'";
1246
+                $leg_names = "'".implode("','",
1247
+                        preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'";
1250 1248
             }
1251 1249
             if (!file_exists($filecontent)) {
1252
-                echo "  $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1250
+                echo "  $name: ".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1253 1251
             } else {
1254 1252
 
1255 1253
                 // disable legacy versions based on legacy_names provided
1256 1254
                 if (!empty($leg_names)) {
1257
-                    $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1255
+                    $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1258 1256
                     $rs = mysqli_query($sqlParser->conn, $update_query);
1259 1257
                 }
1260 1258
 
@@ -1265,58 +1263,58 @@  discard block
 block discarded – undo
1265 1263
                 $plugin = removeDocblock($plugin, 'plugin');
1266 1264
                 $plugin = mysqli_real_escape_string($conn, $plugin);
1267 1265
                 $rs = mysqli_query($sqlParser->conn,
1268
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'");
1266
+                    "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'");
1269 1267
                 if (mysqli_num_rows($rs)) {
1270 1268
                     $insert = true;
1271 1269
                     while ($row = mysqli_fetch_assoc($rs)) {
1272 1270
                         $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1273 1271
                         if ($row['description'] == $desc) {
1274 1272
                             if (!mysqli_query($sqlParser->conn,
1275
-                                "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1276
-                                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1273
+                                "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1274
+                                echo mysqli_error($sqlParser->conn).PHP_EOL;
1277 1275
 
1278 1276
                                 return;
1279 1277
                             }
1280 1278
                             $insert = false;
1281 1279
                         } else {
1282 1280
                             if (!mysqli_query($sqlParser->conn,
1283
-                                "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1284
-                                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1281
+                                "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1282
+                                echo mysqli_error($sqlParser->conn).PHP_EOL;
1285 1283
 
1286 1284
                                 return;
1287 1285
                             }
1288 1286
                         }
1289 1287
                     }
1290 1288
                     if ($insert === true) {
1291
-                        if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$props','$guid','0',$category);")) {
1292
-                            echo mysqli_error($sqlParser->conn) . PHP_EOL;
1289
+                        if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$props','$guid','0',$category);")) {
1290
+                            echo mysqli_error($sqlParser->conn).PHP_EOL;
1293 1291
 
1294 1292
                             return;
1295 1293
                         }
1296 1294
                     }
1297
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1295
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1298 1296
                 } else {
1299 1297
                     if ($properties != null) {
1300 1298
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1301 1299
                     }
1302 1300
                     if (!mysqli_query($sqlParser->conn,
1303
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
1304
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1301
+                        "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
1302
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1305 1303
 
1306 1304
                         return;
1307 1305
                     }
1308
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1306
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1309 1307
                 }
1310 1308
                 // add system events
1311 1309
                 if (count($events) > 0) {
1312 1310
                     $ds = mysqli_query($sqlParser->conn,
1313
-                        "SELECT id FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name' AND description='$desc';");
1311
+                        "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
1314 1312
                     if ($ds) {
1315 1313
                         $row = mysqli_fetch_assoc($ds);
1316 1314
                         $id = $row["id"];
1317 1315
                         $_events = implode("','", $events);
1318 1316
                         // add new events
1319
-                        $sql = "INSERT IGNORE 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 ('{$_events}')";
1317
+                        $sql = "INSERT IGNORE 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 ('{$_events}')";
1320 1318
                         mysqli_query($sqlParser->conn, $sql);
1321 1319
                         // remove absent events
1322 1320
                         $sql = "DELETE `pe` FROM {$dbase}.`{$table_prefix}site_plugin_events` `pe` LEFT JOIN {$dbase}.`{$table_prefix}system_eventnames` `se` ON `pe`.`evtid`=`se`.`id` AND `name` IN ('{$_events}') WHERE ISNULL(`name`) AND `pluginid` = {$id}";
@@ -1331,7 +1329,7 @@  discard block
 block discarded – undo
1331 1329
 // Install Snippets
1332 1330
 $moduleSnippet = $ms;
1333 1331
 if (is_array($moduleSnippet) || $installData) {
1334
-    echo PHP_EOL . $_lang['snippets'] . ":" . PHP_EOL;
1332
+    echo PHP_EOL.$_lang['snippets'].":".PHP_EOL;
1335 1333
     //$selSnips = $_POST['snippet'];
1336 1334
     foreach ($moduleSnippets as $k => $moduleSnippet) {
1337 1335
         $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1;
@@ -1342,7 +1340,7 @@  discard block
 block discarded – undo
1342 1340
             $properties = $moduleSnippet[3];
1343 1341
             $category = mysqli_real_escape_string($conn, $moduleSnippet[4]);
1344 1342
             if (!file_exists($filecontent)) {
1345
-                echo "  $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1343
+                echo "  $name: ".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1346 1344
             } else {
1347 1345
 
1348 1346
                 // Create the category if it does not already exist
@@ -1352,28 +1350,28 @@  discard block
 block discarded – undo
1352 1350
                 $snippet = removeDocblock($snippet, 'snippet');
1353 1351
                 $snippet = mysqli_real_escape_string($conn, $snippet);
1354 1352
                 $rs = mysqli_query($sqlParser->conn,
1355
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'");
1353
+                    "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'");
1356 1354
                 if (mysqli_num_rows($rs)) {
1357 1355
                     $row = mysqli_fetch_assoc($rs);
1358 1356
                     $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1359 1357
                     if (!mysqli_query($sqlParser->conn,
1360
-                        "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1361
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1358
+                        "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1359
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1362 1360
 
1363 1361
                         return;
1364 1362
                     }
1365
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1363
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1366 1364
                 } else {
1367 1365
                     if ($properties != null) {
1368 1366
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1369 1367
                     }
1370 1368
                     if (!mysqli_query($sqlParser->conn,
1371
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
1372
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1369
+                        "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
1370
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1373 1371
 
1374 1372
                         return;
1375 1373
                     }
1376
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1374
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1377 1375
                 }
1378 1376
             }
1379 1377
         }
@@ -1382,19 +1380,19 @@  discard block
 block discarded – undo
1382 1380
 
1383 1381
 // Install demo-site
1384 1382
 if ($installData && $moduleSQLDataFile) {
1385
-    echo PHP_EOL . $_lang['installing_demo_site'];
1383
+    echo PHP_EOL.$_lang['installing_demo_site'];
1386 1384
     $sqlParser->process($moduleSQLDataFile);
1387 1385
     // display database results
1388 1386
     if ($sqlParser->installFailed == true) {
1389 1387
         $errors += 1;
1390
-        echo $_lang['database_alerts'] . PHP_EOL;
1391
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
1392
-        echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
1388
+        echo $_lang['database_alerts'].PHP_EOL;
1389
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
1390
+        echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL;
1393 1391
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
1394
-            echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL;
1392
+            echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL;
1395 1393
         }
1396 1394
 
1397
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
1395
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
1398 1396
 
1399 1397
         return;
1400 1398
     } else {
@@ -1406,7 +1404,7 @@  discard block
 block discarded – undo
1406 1404
             $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']);
1407 1405
             mysqli_query($sqlParser->conn, $sql);
1408 1406
         }
1409
-        echo $_lang['ok'] . PHP_EOL;
1407
+        echo $_lang['ok'].PHP_EOL;
1410 1408
     }
1411 1409
 }
1412 1410
 
@@ -1414,9 +1412,9 @@  discard block
 block discarded – undo
1414 1412
 $moduleDependencies = $mdp;
1415 1413
 foreach ($moduleDependencies as $dependency) {
1416 1414
     $ds = mysqli_query($sqlParser->conn,
1417
-        'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"');
1415
+        'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"');
1418 1416
     if (!$ds) {
1419
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1417
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1420 1418
 
1421 1419
         return;
1422 1420
     } else {
@@ -1426,9 +1424,9 @@  discard block
 block discarded – undo
1426 1424
     }
1427 1425
     // get extra id
1428 1426
     $ds = mysqli_query($sqlParser->conn,
1429
-        'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"');
1427
+        'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"');
1430 1428
     if (!$ds) {
1431
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1429
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1432 1430
 
1433 1431
         return;
1434 1432
     } else {
@@ -1437,34 +1435,34 @@  discard block
 block discarded – undo
1437 1435
     }
1438 1436
     // setup extra as module dependency
1439 1437
     $ds = mysqli_query($sqlParser->conn,
1440
-        'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1');
1438
+        'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1');
1441 1439
     if (!$ds) {
1442
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1440
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1443 1441
 
1444 1442
         return;
1445 1443
     } else {
1446 1444
         if (mysqli_num_rows($ds) === 0) {
1447 1445
             mysqli_query($sqlParser->conn,
1448
-                'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')');
1449
-            echo $dependency['module'] . ' Module: ' . $_lang['depedency_create'] . PHP_EOL;
1446
+                'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')');
1447
+            echo $dependency['module'].' Module: '.$_lang['depedency_create'].PHP_EOL;
1450 1448
         } else {
1451 1449
             mysqli_query($sqlParser->conn,
1452
-                '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']);
1453
-            echo $dependency['module'] . ' Module: ' . $_lang['depedency_update'] . PHP_EOL;
1450
+                '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']);
1451
+            echo $dependency['module'].' Module: '.$_lang['depedency_update'].PHP_EOL;
1454 1452
         }
1455 1453
         if ($dependency['type'] == 30 || $dependency['type'] == 40) {
1456 1454
             // set extra guid for plugins and snippets
1457 1455
             $ds = mysqli_query($sqlParser->conn,
1458
-                'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1');
1456
+                'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1');
1459 1457
             if (!$ds) {
1460
-                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1458
+                echo mysqli_error($sqlParser->conn).PHP_EOL;
1461 1459
 
1462 1460
                 return;
1463 1461
             } else {
1464 1462
                 if (mysqli_num_rows($ds) != 0) {
1465 1463
                     mysqli_query($sqlParser->conn,
1466
-                        'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId);
1467
-                    echo $dependency['name'] . ': ' . $_lang['guid_set'] . PHP_EOL;
1464
+                        'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId);
1465
+                    echo $dependency['name'].': '.$_lang['guid_set'].PHP_EOL;
1468 1466
                 }
1469 1467
             }
1470 1468
         }
@@ -1473,58 +1471,58 @@  discard block
 block discarded – undo
1473 1471
 
1474 1472
 // call back function
1475 1473
 if ($callBackFnc != "") {
1476
-    $callBackFnc ($sqlParser);
1474
+    $callBackFnc($sqlParser);
1477 1475
 }
1478 1476
 
1479 1477
 // Setup the MODX API -- needed for the cache processor
1480 1478
 if (!defined('MODX_MANAGER_PATH')) {
1481
-    define('MODX_MANAGER_PATH', $base_path . MGR_DIR . '/');
1479
+    define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
1482 1480
 }
1483 1481
 $database_type = 'mysqli';
1484 1482
 // initiate a new document parser
1485
-include_once($path . '../' . MGR_DIR . '/includes/document.parser.class.inc.php');
1483
+include_once($path.'../'.MGR_DIR.'/includes/document.parser.class.inc.php');
1486 1484
 $modx = new DocumentParser;
1487 1485
 $modx->db->connect();
1488 1486
 // always empty cache after install
1489 1487
 $sync = new EvolutionCMS\Cache();
1490
-$sync->setCachepath($path . "../assets/cache/");
1488
+$sync->setCachepath($path."../assets/cache/");
1491 1489
 $sync->setReport(false);
1492 1490
 $sync->emptyCache(); // first empty the cache
1493 1491
 
1494 1492
 // try to chmod the cache go-rwx (for suexeced php)
1495
-$chmodSuccess = @chmod($path . '../assets/cache/siteCache.idx.php', 0600);
1496
-$chmodSuccess = @chmod($path . '../assets/cache/sitePublishing.idx.php', 0600);
1493
+$chmodSuccess = @chmod($path.'../assets/cache/siteCache.idx.php', 0600);
1494
+$chmodSuccess = @chmod($path.'../assets/cache/sitePublishing.idx.php', 0600);
1497 1495
 
1498 1496
 // remove any locks on the manager functions so initial manager login is not blocked
1499
-mysqli_query($conn, "TRUNCATE TABLE `" . $table_prefix . "active_users`");
1497
+mysqli_query($conn, "TRUNCATE TABLE `".$table_prefix."active_users`");
1500 1498
 
1501 1499
 // close db connection
1502 1500
 $sqlParser->close();
1503 1501
 
1504 1502
 // andrazk 20070416 - release manager access
1505
-if (file_exists($path . '../assets/cache/installProc.inc.php')) {
1506
-    @chmod($path . '../assets/cache/installProc.inc.php', 0755);
1507
-    unlink($path . '../assets/cache/installProc.inc.php');
1503
+if (file_exists($path.'../assets/cache/installProc.inc.php')) {
1504
+    @chmod($path.'../assets/cache/installProc.inc.php', 0755);
1505
+    unlink($path.'../assets/cache/installProc.inc.php');
1508 1506
 }
1509 1507
 
1510 1508
 // setup completed!
1511
-echo PHP_EOL . $_lang['installation_successful'] . PHP_EOL . PHP_EOL;
1509
+echo PHP_EOL.$_lang['installation_successful'].PHP_EOL.PHP_EOL;
1512 1510
 //echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>";
1513 1511
 if ($installMode == 0) {
1514
-    echo strip_tags($_lang['installation_note']) . PHP_EOL;
1512
+    echo strip_tags($_lang['installation_note']).PHP_EOL;
1515 1513
 } else {
1516
-    echo strip_tags($_lang['upgrade_note']) . PHP_EOL;
1514
+    echo strip_tags($_lang['upgrade_note']).PHP_EOL;
1517 1515
 }
1518 1516
 
1519 1517
 
1520 1518
 if (empty($args)) {
1521
-    echo PHP_EOL . 'Remove install folder?' . PHP_EOL;
1519
+    echo PHP_EOL.'Remove install folder?'.PHP_EOL;
1522 1520
     $removeInstall = readline("Type 'y' or 'n' to continue: ");
1523 1521
 }
1524 1522
 //remove installFolder
1525 1523
 if ($removeInstall === 'y') {
1526 1524
     removeFolder($path);
1527
-    removeFolder($base_path . '.tx');
1528
-    unlink($base_path . 'README.md');
1529
-    echo 'Install folder deleted!' . PHP_EOL . PHP_EOL;
1525
+    removeFolder($base_path.'.tx');
1526
+    unlink($base_path.'README.md');
1527
+    echo 'Install folder deleted!'.PHP_EOL.PHP_EOL;
1530 1528
 }
Please login to merge, or discard this patch.
core/functions/nodes.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!function_exists('makeHTML')) {
3
+if (!function_exists('makeHTML')) {
4 4
     /**
5 5
      * @param int $indent
6 6
      * @param int $parent
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
             case 'publishedon':
38 38
             case 'pub_date':
39 39
             case 'unpub_date':
40
-                $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'],
41
-                    'sc.' . $_SESSION['tree_sortby']);
40
+                $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'],
41
+                    'sc.'.$_SESSION['tree_sortby']);
42 42
                 break;
43 43
             default:
44
-                $sortby = 'sc.' . $_SESSION['tree_sortby'];
44
+                $sortby = 'sc.'.$_SESSION['tree_sortby'];
45 45
         };
46 46
 
47
-        $orderby = $modx->getDatabase()->escape($sortby . ' ' . $_SESSION['tree_sortdir']);
47
+        $orderby = $modx->getDatabase()->escape($sortby.' '.$_SESSION['tree_sortdir']);
48 48
 
49 49
         // Folder sorting gets special setup ;) Add menuindex and pagetitle
50 50
         if ($_SESSION['tree_sortby'] == 'isfolder') {
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
             $_SESSION['mgrDocgroups']) : '';
60 60
         $showProtected = false;
61 61
         if ($modx->getConfig('tree_show_protected') !== null) {
62
-            $showProtected = (boolean)$modx->getConfig('tree_show_protected');
62
+            $showProtected = (boolean) $modx->getConfig('tree_show_protected');
63 63
         }
64
-        $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0';
64
+        $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0';
65 65
         if ($showProtected == false) {
66
-            $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
66
+            $access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
67 67
         } else {
68 68
             $access = '';
69 69
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             }
101 101
 
102 102
             $weblinkDisplay = $row['type'] == 'reference' ? sprintf('&nbsp;%s', $_style['tree_linkgo']) : '';
103
-            $pageIdDisplay = '<small>(' . ($modx_textdir ? '&rlm;' : '') . $row['id'] . ')</small>';
103
+            $pageIdDisplay = '<small>('.($modx_textdir ? '&rlm;' : '').$row['id'].')</small>';
104 104
 
105 105
             // Prepare displaying user-locks
106 106
             $lockedByUser = '';
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                         'element_type' => $_lang["lock_element_type_7"],
112 112
                         'lasthit_df'   => $rowLock['lasthit_df']
113 113
                     ));
114
-                    $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>';
114
+                    $lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>';
115 115
                 } else {
116 116
                     $title = $modx->parseText($_lang["lock_element_locked_by"], array(
117 117
                         'element_type' => $_lang["lock_element_type_7"],
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
                         'lasthit_df'   => $rowLock['lasthit_df']
120 120
                     ));
121 121
                     if ($modx->hasPermission('remove_locks')) {
122
-                        $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
122
+                        $lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
123 123
                     } else {
124
-                        $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
124
+                        $lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
125 125
                     }
126 126
                 }
127 127
             }
@@ -130,22 +130,22 @@  discard block
 block discarded – undo
130 130
 
131 131
             $title = '';
132 132
             if (isDateNode($nodeNameSource)) {
133
-                $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]';
133
+                $title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]';
134 134
             }
135
-            $title .= $_lang['id'] . ': ' . $row['id'];
136
-            $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle'];
137
-            $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex'];
138
-            $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-');
139
-            $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename'];
140
-            $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']);
141
-            $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']);
142
-            $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']);
143
-            $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
144
-            $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
145
-            $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
146
-            $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
135
+            $title .= $_lang['id'].': '.$row['id'];
136
+            $title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle'];
137
+            $title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex'];
138
+            $title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-');
139
+            $title .= '[+lf+]'.$_lang['template'].': '.$row['templatename'];
140
+            $title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']);
141
+            $title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']);
142
+            $title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']);
143
+            $title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
144
+            $title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
145
+            $title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
146
+            $title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
147 147
             $title = $modx->getPhpCompat()->htmlspecialchars($title);
148
-            $title = str_replace('[+lf+]', ' &#13;', $title);   // replace line-breaks with empty space as fall-back
148
+            $title = str_replace('[+lf+]', ' &#13;', $title); // replace line-breaks with empty space as fall-back
149 149
 
150 150
             $data = array(
151 151
                 'id'               => $row['id'],
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                 }
230 230
 
231 231
                 if ($ph['contextmenu']) {
232
-                    $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
232
+                    $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
233 233
                 }
234 234
 
235 235
                 if ($_SESSION['tree_show_only_folders']) {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                         }
288 288
 
289 289
                         if ($ph['contextmenu']) {
290
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
290
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
291 291
                         }
292 292
 
293 293
                         $node .= $modx->parseText($tpl, $ph);
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
                         }
326 326
 
327 327
                         if ($ph['contextmenu']) {
328
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
328
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
329 329
                         }
330 330
 
331 331
                         $node .= $modx->parseText($tpl, $ph);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                         }
377 377
 
378 378
                         if ($ph['contextmenu']) {
379
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
379
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
380 380
                         }
381 381
 
382 382
                         $node .= $modx->parseText($tpl, $ph);
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
                         }
419 419
 
420 420
                         if ($ph['contextmenu']) {
421
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
421
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
422 422
                         }
423 423
 
424 424
                         $node .= $modx->parseText($tpl, $ph);
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
     }
445 445
 }
446 446
 
447
-if(!function_exists('getIconInfo')) {
447
+if (!function_exists('getIconInfo')) {
448 448
     /**
449 449
      * @param array $_style
450 450
      * @return array
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     }
479 479
 }
480 480
 
481
-if(!function_exists('getNodeTitle')) {
481
+if (!function_exists('getNodeTitle')) {
482 482
     /**
483 483
      * @param string $nodeNameSource
484 484
      * @param array $row
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
                         $nodetitle .= $modx->getConfig('friendly_url_suffix');
500 500
                     }
501 501
                 }
502
-                $nodetitle = $modx->getConfig('friendly_url_prefix') . $nodetitle;
502
+                $nodetitle = $modx->getConfig('friendly_url_prefix').$nodetitle;
503 503
                 break;
504 504
             case 'pagetitle':
505 505
                 $nodetitle = $row['pagetitle'];
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
     }
534 534
 }
535 535
 
536
-if(!function_exists('isDateNode')) {
536
+if (!function_exists('isDateNode')) {
537 537
     /**
538 538
      * @param string $nodeNameSource
539 539
      * @return bool
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
     }
554 554
 }
555 555
 
556
-if(!function_exists('checkIsFolder')) {
556
+if (!function_exists('checkIsFolder')) {
557 557
     /**
558 558
      * @param int $parent
559 559
      * @param int $isfolder
@@ -563,11 +563,11 @@  discard block
 block discarded – undo
563 563
     {
564 564
         $modx = evolutionCMS();
565 565
 
566
-        return (int)$modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM ' . $modx->getDatabase()->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' '));
566
+        return (int) $modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM '.$modx->getDatabase()->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' '));
567 567
     }
568 568
 }
569 569
 
570
-if(!function_exists('_htmlentities')) {
570
+if (!function_exists('_htmlentities')) {
571 571
     /**
572 572
      * @param mixed $array
573 573
      * @return string
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
     }
584 584
 }
585 585
 
586
-if(!function_exists('getTplSingleNode')) {
586
+if (!function_exists('getTplSingleNode')) {
587 587
     /**
588 588
      * @return string
589 589
      */
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
     }
614 614
 }
615 615
 
616
-if(!function_exists('getTplFolderNode')) {
616
+if (!function_exists('getTplFolderNode')) {
617 617
     /**
618 618
      * @return string
619 619
      */
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
         title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a><div>';
655 655
     }
656 656
 }
657
-if(!function_exists('getTplFolderNodeNotChildren')) {
657
+if (!function_exists('getTplFolderNodeNotChildren')) {
658 658
     /**
659 659
      * @return string
660 660
      */
Please login to merge, or discard this patch.