Completed
Pull Request — develop (#714)
by Agel_Nash
15:06 queued 06:49
created
install/src/controllers/connection.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,27 +1,27 @@  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 4
 // Determine upgradeability
5 5
 $upgradeable = 0;
6 6
 if ($installMode === 0) {
7 7
     $database_name = '';
8 8
     $database_server = 'localhost';
9
-    $table_prefix = base_convert(mt_rand(10, 20), 10, 36) .
10
-        substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), mt_rand(0, 33), 3) .
9
+    $table_prefix = base_convert(mt_rand(10, 20), 10, 36).
10
+        substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), mt_rand(0, 33), 3).
11 11
         '_';
12 12
 } else {
13 13
     $database_name = '';
14
-    if (! is_file($base_path . MGR_DIR . '/includes/config.inc.php')) {
14
+    if (!is_file($base_path.MGR_DIR.'/includes/config.inc.php')) {
15 15
         $upgradeable = 0;
16 16
     } else {
17 17
         // Include the file so we can test its validity
18
-        include $base_path . MGR_DIR . '/includes/config.inc.php';
18
+        include $base_path.MGR_DIR.'/includes/config.inc.php';
19 19
         // We need to have all connection settings - but prefix may be empty so we have to ignore it
20 20
         if ($dbase) {
21 21
             $database_name = trim($dbase, '`');
22 22
             if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) {
23 23
                 $upgradeable = (isset($_POST['installmode']) && $_POST['installmode'] === 'new') ? 0 : 2;
24
-            } elseif (! mysqli_select_db($conn, trim($dbase, '`'))) {
24
+            } elseif (!mysqli_select_db($conn, trim($dbase, '`'))) {
25 25
                 $upgradeable = (isset($_POST['installmode']) && $_POST['installmode'] === 'new') ? 0 : 2;
26 26
             } else {
27 27
                 $upgradeable = 1;
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 }
34 34
 
35 35
 // check the database collation if not specified in the configuration
36
-if ($upgradeable && (! isset($database_connection_charset) || empty($database_connection_charset))) {
36
+if ($upgradeable && (!isset($database_connection_charset) || empty($database_connection_charset))) {
37 37
     if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) {
38 38
         $rs = mysqli_query($conn, "show session variables like 'collation_server'");
39 39
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 $ph['databaseloginpassword'] = isset($_SESSION['databaseloginpassword']) ? $_SESSION['databaseloginpassword'] : "";
78 78
 $ph['MGR_DIR'] = MGR_DIR;
79 79
 
80
-$content = file_get_contents(dirname(__DIR__) . '/template/actions/connection.tpl');
80
+$content = file_get_contents(dirname(__DIR__).'/template/actions/connection.tpl');
81 81
 $content = parse($content, $_lang, '[%', '%]');
82 82
 $content = parse($content, $ph);
83 83
 
Please login to merge, or discard this patch.
install/src/controllers/summary.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -248,9 +248,9 @@
 block discarded – undo
248 248
         echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_not_exist'] . '</p>';
249 249
         $errors++;
250 250
         echo '<p>' . $_lang['table_prefix_not_exist_note'] . '</p>';
251
-  } else {
251
+    } else {
252 252
         echo '<span class="ok">' . $_lang['ok'] . '</span></p>';
253
-  }
253
+    }
254 254
 }
255 255
 
256 256
 // check mysql version
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 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,73 +43,73 @@  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
 
76 76
 // check directories
77 77
 // cache exists?
78
-echo '<p>' . $_lang['checking_if_cache_exist'];
78
+echo '<p>'.$_lang['checking_if_cache_exist'];
79 79
 if (!file_exists("../assets/cache") || !file_exists("../assets/cache/rss")) {
80
-    echo '<span class="notok">' . $_lang['failed'] . '</span></p>';
80
+    echo '<span class="notok">'.$_lang['failed'].'</span></p>';
81 81
     $errors++;
82 82
 } else {
83
-    echo '<span class="ok">' . $_lang['ok'] . '</span></p>';
83
+    echo '<span class="ok">'.$_lang['ok'].'</span></p>';
84 84
 }
85 85
 
86 86
 
87 87
 // cache writable?
88
-echo '<p>' . $_lang['checking_if_cache_writable'];
88
+echo '<p>'.$_lang['checking_if_cache_writable'];
89 89
 if (!is_writable("../assets/cache")) {
90 90
     $errors++;
91
-    echo '<span class="notok">' . $_lang['failed'] . '</span></p>';
91
+    echo '<span class="notok">'.$_lang['failed'].'</span></p>';
92 92
 } else {
93
-    echo '<span class="ok">' . $_lang['ok'] . '</span></p>';
93
+    echo '<span class="ok">'.$_lang['ok'].'</span></p>';
94 94
 }
95 95
 
96 96
 
97 97
 // cache files writable?
98
-echo '<p>' . $_lang['checking_if_cache_file_writable'];
98
+echo '<p>'.$_lang['checking_if_cache_file_writable'];
99 99
 $tmp = "../assets/cache/siteCache.idx.php";
100
-if ( ! file_exists($tmp)) {
100
+if (!file_exists($tmp)) {
101 101
     f_owc($tmp, "<?php //EVO site cache file ?>");
102 102
 }
103
-if ( ! is_writable($tmp)) {
103
+if (!is_writable($tmp)) {
104 104
     $errors++;
105
-    echo '<span class="notok">' . $_lang['failed'] . '</span></p>';
105
+    echo '<span class="notok">'.$_lang['failed'].'</span></p>';
106 106
 } else {
107 107
     echo '<span class="ok">'.$_lang['ok'].'</span></p>';
108 108
 }
109 109
 
110 110
 
111 111
 echo '<p>'.$_lang['checking_if_cache_file2_writable'];
112
-if ( ! is_writable("../assets/cache/sitePublishing.idx.php")) {
112
+if (!is_writable("../assets/cache/sitePublishing.idx.php")) {
113 113
     $errors++;
114 114
     echo '<span class="notok">'.$_lang['failed'].'</span></p>';
115 115
 } else {
@@ -119,7 +119,7 @@  discard block
 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"):
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1);
195 195
     $database_connection_charset = $_POST['database_connection_charset'];
196 196
     $database_connection_method = $_POST['database_connection_method'];
197
-    $dbase = '`' . $_POST['database_name'] . '`';
197
+    $dbase = '`'.$_POST['database_name'].'`';
198 198
     $table_prefix = $_POST['tableprefix'];
199 199
 }
200 200
 echo '<p>'.$_lang['creating_database_connection'];
@@ -234,54 +234,54 @@  discard block
 block discarded – undo
234 234
 
235 235
 // check table prefix
236 236
 if ($conn && $installMode == 0) {
237
-    echo '<p>' . $_lang['checking_table_prefix'] . $table_prefix . '`: ';
238
-    if ($rs= mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
239
-        echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_already_inuse'] . '</p>';
237
+    echo '<p>'.$_lang['checking_table_prefix'].$table_prefix.'`: ';
238
+    if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
239
+        echo '<span class="notok">'.$_lang['failed'].'</span></b>'.$_lang['table_prefix_already_inuse'].'</p>';
240 240
         $errors++;
241
-        echo "<p>" . $_lang['table_prefix_already_inuse_note'] . '</p>';
241
+        echo "<p>".$_lang['table_prefix_already_inuse_note'].'</p>';
242 242
     } else {
243
-        echo '<span class="ok">' . $_lang['ok'] . '</span></p>';
243
+        echo '<span class="ok">'.$_lang['ok'].'</span></p>';
244 244
     }
245 245
 } elseif ($conn && $installMode == 2) {
246
-    echo '<p>' . $_lang['checking_table_prefix'] . $table_prefix . '`: ';
247
-    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
248
-        echo '<span class="notok">' . $_lang['failed'] . '</span></b>' . $_lang['table_prefix_not_exist'] . '</p>';
246
+    echo '<p>'.$_lang['checking_table_prefix'].$table_prefix.'`: ';
247
+    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
248
+        echo '<span class="notok">'.$_lang['failed'].'</span></b>'.$_lang['table_prefix_not_exist'].'</p>';
249 249
         $errors++;
250
-        echo '<p>' . $_lang['table_prefix_not_exist_note'] . '</p>';
250
+        echo '<p>'.$_lang['table_prefix_not_exist_note'].'</p>';
251 251
   } else {
252
-        echo '<span class="ok">' . $_lang['ok'] . '</span></p>';
252
+        echo '<span class="ok">'.$_lang['ok'].'</span></p>';
253 253
   }
254 254
 }
255 255
 
256 256
 // check mysql version
257 257
 if ($conn) {
258
-    echo '<p>' . $_lang['checking_mysql_version'];
259
-    if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) {
260
-        echo '<span class="notok">'  . $_lang['warning'] . '</span></b>&nbsp;&nbsp;<strong>' . $_lang['mysql_5051'] . '</strong></p>';
261
-        echo '<p><span class="notok">' . $_lang['mysql_5051_warning'] . '</span></p>';
258
+    echo '<p>'.$_lang['checking_mysql_version'];
259
+    if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) {
260
+        echo '<span class="notok">'.$_lang['warning'].'</span></b>&nbsp;&nbsp;<strong>'.$_lang['mysql_5051'].'</strong></p>';
261
+        echo '<p><span class="notok">'.$_lang['mysql_5051_warning'].'</span></p>';
262 262
     } else {
263
-        echo '<span class="ok">' . $_lang['ok'] . '</span>&nbsp;&nbsp;<strong>' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . '</strong></p>';
263
+        echo '<span class="ok">'.$_lang['ok'].'</span>&nbsp;&nbsp;<strong>'.$_lang['mysql_version_is'].mysqli_get_server_info($conn).'</strong></p>';
264 264
     }
265 265
 }
266 266
 
267 267
 // check for strict mode
268 268
 if ($conn) {
269
-    echo '<p>'. $_lang['checking_mysql_strict_mode'];
269
+    echo '<p>'.$_lang['checking_mysql_strict_mode'];
270 270
     $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode");
271
-    if (mysqli_num_rows($mysqlmode) > 0){
271
+    if (mysqli_num_rows($mysqlmode) > 0) {
272 272
         $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM);
273 273
         //$modes = array("STRICT_TRANS_TABLES"); // for testing
274 274
         // print_r($modes);
275 275
         foreach ($modes as $mode) {
276 276
             if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) {
277
-                echo '<span class="notok">' . $_lang['warning'] . '</span></b> <strong>&nbsp;&nbsp;' . $_lang['strict_mode'] . '</strong></p>';
278
-                echo '<p><span class="notok">' . $_lang['strict_mode_error'] . '</span></p>';
277
+                echo '<span class="notok">'.$_lang['warning'].'</span></b> <strong>&nbsp;&nbsp;'.$_lang['strict_mode'].'</strong></p>';
278
+                echo '<p><span class="notok">'.$_lang['strict_mode_error'].'</span></p>';
279 279
             } else {
280
-                echo '<span class="ok">' . $_lang['ok'] . '</span></p>';
280
+                echo '<span class="ok">'.$_lang['ok'].'</span></p>';
281 281
             }
282 282
         }
283 283
     } else {
284
-        echo '<span class="ok">' . $_lang['ok'] . '</span></p>';
284
+        echo '<span class="ok">'.$_lang['ok'].'</span></p>';
285 285
     }
286 286
 }
287 287
 // Version and strict mode check end
@@ -297,18 +297,18 @@  discard block
 block discarded – undo
297 297
     f_owc("../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>');
298 298
 }
299 299
 
300
-if($installMode > 0 && $_POST['installdata'] == "1") {
301
-    echo '<p class="notes"><strong>' . $_lang['sample_web_site'] . ':</strong> ' . $_lang['sample_web_site_note'] . '</p>';
300
+if ($installMode > 0 && $_POST['installdata'] == "1") {
301
+    echo '<p class="notes"><strong>'.$_lang['sample_web_site'].':</strong> '.$_lang['sample_web_site_note'].'</p>';
302 302
 }
303 303
 
304 304
 if ($errors > 0) {
305 305
     echo '<p>';
306
-    echo $_lang['setup_cannot_continue'] . ' ';
306
+    echo $_lang['setup_cannot_continue'].' ';
307 307
 
308
-    if($errors > 1){
309
-        echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural'];
310
-    }else{
311
-        echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again'];
308
+    if ($errors > 1) {
309
+        echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural'];
310
+    } else {
311
+        echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again'];
312 312
     }
313 313
 
314 314
     echo $_lang['visit_forum'];
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 
318 318
 echo '<p>&nbsp;</p>';
319 319
 
320
-$nextAction= $errors > 0 ? 'summary' : 'install';
321
-$nextButton= $errors > 0 ? $_lang['retry'] : $_lang['install'];
322
-$nextVisibility= $errors > 0 || isset($_POST['chkagree']) ? 'visible' : 'hidden';
323
-$agreeToggle= $errors > 0 ? '' : ' onclick="if(document.getElementById(\'chkagree\').checked){document.getElementById(\'nextbutton\').style.visibility=\'visible\';}else{document.getElementById(\'nextbutton\').style.visibility=\'hidden\';}"';
320
+$nextAction = $errors > 0 ? 'summary' : 'install';
321
+$nextButton = $errors > 0 ? $_lang['retry'] : $_lang['install'];
322
+$nextVisibility = $errors > 0 || isset($_POST['chkagree']) ? 'visible' : 'hidden';
323
+$agreeToggle = $errors > 0 ? '' : ' onclick="if(document.getElementById(\'chkagree\').checked){document.getElementById(\'nextbutton\').style.visibility=\'visible\';}else{document.getElementById(\'nextbutton\').style.visibility=\'hidden\';}"';
324 324
 ?>
325 325
 <form name="install" id="install_form" action="index.php?action=<?php echo $nextAction ?>" method="post">
326 326
   <div>
@@ -342,32 +342,32 @@  discard block
 block discarded – undo
342 342
 
343 343
     <input type="hidden" value="<?php echo $_POST['installdata'] ?>" name="installdata" />
344 344
 <?php
345
-    $templates = isset ($_POST['template']) ? $_POST['template'] : array ();
345
+    $templates = isset ($_POST['template']) ? $_POST['template'] : array();
346 346
     foreach ($templates as $i => $template) echo '<input type="hidden" name="template[]" value="'.$template.'" />';
347 347
 
348
-    $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array ();
348
+    $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array();
349 349
     foreach ($tvs as $i => $tv) echo '<input type="hidden" name="tv[]" value="'.$tv.'" />';
350 350
 
351
-    $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array ();
351
+    $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array();
352 352
     foreach ($chunks as $i => $chunk) echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />';
353 353
 
354
-    $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array ();
354
+    $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array();
355 355
     foreach ($snippets as $i => $snippet) echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />';
356 356
 
357
-    $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array ();
357
+    $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array();
358 358
     foreach ($plugins as $i => $plugin) echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />';
359 359
 
360
-    $modules = isset ($_POST['module']) ? $_POST['module'] : array ();
360
+    $modules = isset ($_POST['module']) ? $_POST['module'] : array();
361 361
     foreach ($modules as $i => $module) echo '<input type="hidden" name="module[]" value="'.$module.'" />';
362 362
 ?>
363 363
 </div>
364 364
 
365
-<h2><?php echo $_lang['agree_to_terms'];?></h2>
365
+<h2><?php echo $_lang['agree_to_terms']; ?></h2>
366 366
 <p>
367
-<input type="checkbox" value="1" id="chkagree" name="chkagree" style="line-height:18px" <?php echo isset($_POST['chkagree']) ? 'checked="checked" ':""; ?><?php echo $agreeToggle;?>/><label for="chkagree" style="display:inline;float:none;line-height:18px;"> <?php echo $_lang['iagree_box']?> </label>
367
+<input type="checkbox" value="1" id="chkagree" name="chkagree" style="line-height:18px" <?php echo isset($_POST['chkagree']) ? 'checked="checked" ' : ""; ?><?php echo $agreeToggle; ?>/><label for="chkagree" style="display:inline;float:none;line-height:18px;"> <?php echo $_lang['iagree_box']?> </label>
368 368
 </p>
369 369
     <p class="buttonlinks">
370 370
         <a href="javascript:document.getElementById('install_form').action='index.php?action=options&language=<?php echo $install_language?>';document.getElementById('install_form').submit();" class="prev" title="<?php echo $_lang['btnback_value']?>"><span><?php echo $_lang['btnback_value']?></span></a>
371
-        <a id="nextbutton" href="javascript:document.getElementById('install_form').submit();" title="<?php echo $nextButton ?>" style="visibility:<?php echo $nextVisibility;?>"><span><?php echo $nextButton ?></span></a>
371
+        <a id="nextbutton" href="javascript:document.getElementById('install_form').submit();" title="<?php echo $nextButton ?>" style="visibility:<?php echo $nextVisibility; ?>"><span><?php echo $nextButton ?></span></a>
372 372
     </p>
373 373
 </form>
Please login to merge, or discard this patch.
Braces   +35 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,19 +1,22 @@  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
6 6
      * @param null|int $mode
7 7
      */
8
-    function f_owc($path, $data, $mode = null){
8
+    function f_owc($path, $data, $mode = null)
9
+    {
9 10
         try {
10 11
             // make an attempt to create the file
11 12
             $hnd = fopen($path, 'w');
12 13
             fwrite($hnd, $data);
13 14
             fclose($hnd);
14 15
 
15
-            if(null !== $mode) chmod($path, $mode);
16
-        }catch(Exception $e){
16
+            if(null !== $mode) {
17
+                chmod($path, $mode);
18
+            }
19
+        } catch(Exception $e) {
17 20
             // Nothing, this is NOT normal
18 21
             unset($e);
19 22
         }
@@ -21,7 +24,9 @@  discard block
 block discarded – undo
21 24
 }
22 25
 
23 26
 $installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0;
24
-if( ! isset($_lang)) $_lang = array();
27
+if( ! isset($_lang)) {
28
+    $_lang = array();
29
+}
25 30
 
26 31
 echo '<div class="stepcontainer">
27 32
       <ul class="progressbar">
@@ -57,7 +62,7 @@  discard block
 block discarded – undo
57 62
 // check if iconv is available
58 63
 echo '<p>' . $_lang['checking_iconv'];
59 64
 $iconv = (int) function_exists('iconv');
60
-if ($iconv == '0'){
65
+if ($iconv == '0') {
61 66
     echo '<span class="notok">' . $_lang['failed'].'</span></p><p><strong>'.$_lang['checking_iconv_note'].'</strong></p>';
62 67
     $errors++;
63 68
 } else {
@@ -119,7 +124,7 @@  discard block
 block discarded – undo
119 124
 
120 125
 // File Browser directories exists?
121 126
 echo '<p>'.$_lang['checking_if_images_exist'];
122
-switch(true){
127
+switch(true) {
123 128
     case !file_exists("../assets/images"):
124 129
     case !file_exists("../assets/files"):
125 130
     case !file_exists("../assets/backup"):
@@ -134,7 +139,7 @@  discard block
 block discarded – undo
134 139
 
135 140
 // File Browser directories writable?
136 141
 echo '<p>'.$_lang['checking_if_images_writable'];
137
-switch(true){
142
+switch(true) {
138 143
     case !is_writable("../assets/images"):
139 144
     case !is_writable("../assets/files"):
140 145
     case !is_writable("../assets/backup"):
@@ -268,7 +273,7 @@  discard block
 block discarded – undo
268 273
 if ($conn) {
269 274
     echo '<p>'. $_lang['checking_mysql_strict_mode'];
270 275
     $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode");
271
-    if (mysqli_num_rows($mysqlmode) > 0){
276
+    if (mysqli_num_rows($mysqlmode) > 0) {
272 277
         $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM);
273 278
         //$modes = array("STRICT_TRANS_TABLES"); // for testing
274 279
         // print_r($modes);
@@ -305,9 +310,9 @@  discard block
 block discarded – undo
305 310
     echo '<p>';
306 311
     echo $_lang['setup_cannot_continue'] . ' ';
307 312
 
308
-    if($errors > 1){
313
+    if($errors > 1) {
309 314
         echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural'];
310
-    }else{
315
+    } else {
311 316
         echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again'];
312 317
     }
313 318
 
@@ -343,23 +348,35 @@  discard block
 block discarded – undo
343 348
     <input type="hidden" value="<?php echo $_POST['installdata'] ?>" name="installdata" />
344 349
 <?php
345 350
     $templates = isset ($_POST['template']) ? $_POST['template'] : array ();
346
-    foreach ($templates as $i => $template) echo '<input type="hidden" name="template[]" value="'.$template.'" />';
351
+    foreach ($templates as $i => $template) {
352
+        echo '<input type="hidden" name="template[]" value="'.$template.'" />';
353
+    }
347 354
 
348 355
     $tvs = isset ($_POST['tv']) ? $_POST['tv'] : array ();
349
-    foreach ($tvs as $i => $tv) echo '<input type="hidden" name="tv[]" value="'.$tv.'" />';
356
+    foreach ($tvs as $i => $tv) {
357
+        echo '<input type="hidden" name="tv[]" value="'.$tv.'" />';
358
+    }
350 359
 
351 360
     $chunks = isset ($_POST['chunk']) ? $_POST['chunk'] : array ();
352
-    foreach ($chunks as $i => $chunk) echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />';
361
+    foreach ($chunks as $i => $chunk) {
362
+        echo '<input type="hidden" name="chunk[]" value="'.$chunk.'" />';
363
+    }
353 364
 
354 365
     $snippets = isset ($_POST['snippet']) ? $_POST['snippet'] : array ();
355
-    foreach ($snippets as $i => $snippet) echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />';
366
+    foreach ($snippets as $i => $snippet) {
367
+        echo '<input type="hidden" name="snippet[]" value="'.$snippet.'" />';
368
+    }
356 369
 
357 370
     $plugins = isset ($_POST['plugin']) ? $_POST['plugin'] : array ();
358
-    foreach ($plugins as $i => $plugin) echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />';
371
+    foreach ($plugins as $i => $plugin) {
372
+        echo '<input type="hidden" name="plugin[]" value="'.$plugin.'" />';
373
+    }
359 374
 
360 375
     $modules = isset ($_POST['module']) ? $_POST['module'] : array ();
361
-    foreach ($modules as $i => $module) echo '<input type="hidden" name="module[]" value="'.$module.'" />';
362
-?>
376
+    foreach ($modules as $i => $module) {
377
+        echo '<input type="hidden" name="module[]" value="'.$module.'" />';
378
+    }
379
+    ?>
363 380
 </div>
364 381
 
365 382
 <h2><?php echo $_lang['agree_to_terms'];?></h2>
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@
 block discarded – undo
207 207
 
208 208
 
209 209
 // make sure we can use the database
210
-if ($installMode > 0 && !mysqli_query($conn, "USE {$dbase}")) {
210
+if ($installMode > 0 && !mysqli_query($conn, "use {$dbase}")) {
211 211
     $errors++;
212 212
     echo '<span class="notok">'.$_lang['database_use_failed'].'</span><p />'.$_lang["database_use_failed_note"].'</p>';
213 213
 }
Please login to merge, or discard this patch.
install/src/controllers/install.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -770,7 +770,7 @@
 block discarded – undo
770 770
 <form name="install" id="install_form" action="index.php?action=options" method="post">
771 771
 <?php
772 772
 if ($errors == 0) {
773
-	// check if install folder is removeable
773
+    // check if install folder is removeable
774 774
     if (is_writable("../install")) { ?>
775 775
 <span id="removeinstall" style="float:left;cursor:pointer;color:#505050;line-height:18px;" onclick="var chk=document.install.rminstaller; if(chk) chk.checked=!chk.checked;"><input type="checkbox" name="rminstaller" onclick="event.cancelBubble=true;" <?php echo (empty ($errors) ? 'checked="checked"' : '') ?> style="cursor:default;" /><?php echo $_lang['remove_install_folder_auto'] ?></span>
776 776
 <?php
Please login to merge, or discard this patch.
Spacing   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 <?php
13 13
 if (file_exists(__DIR__."/../assets/cache/siteManager.php")) {
14 14
     include_once(__DIR__."/../assets/cache/siteManager.php");
15
-}else{
15
+} else {
16 16
     define('MGR_DIR', 'manager');
17 17
 }
18 18
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
 echo "<p>{$_lang['setup_database']}</p>\n";
41 41
 
42
-$installMode= (int)$_POST['installmode'];
42
+$installMode = (int) $_POST['installmode'];
43 43
 $installData = $_POST['installdata'] == "1" ? 1 : 0;
44 44
 
45 45
 //if ($installMode == 1) {
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
54 54
 $database_connection_charset = $_POST['database_connection_charset'];
55 55
 $database_connection_method = $_POST['database_connection_method'];
56
-$dbase = "`" . $_POST['database_name'] . "`";
56
+$dbase = "`".$_POST['database_name']."`";
57 57
 $table_prefix = $_POST['tableprefix'];
58 58
 $adminname = $_POST['cmsadmin'];
59 59
 $adminemail = $_POST['cmsadminemail'];
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 // set session name variable
66 66
 if (!isset ($site_sessionname)) {
67
-    $site_sessionname = 'SN' . uniqid('');
67
+    $site_sessionname = 'SN'.uniqid('');
68 68
 }
69 69
 
70 70
 // get base path and url
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
     array_pop($a);
79 79
 $pth = implode("install", $a);
80 80
 unset ($a);
81
-$base_url = $url . (substr($url, -1) != "/" ? "/" : "");
82
-$base_path = $pth . (substr($pth, -1) != "/" ? "/" : "");
81
+$base_url = $url.(substr($url, -1) != "/" ? "/" : "");
82
+$base_path = $pth.(substr($pth, -1) != "/" ? "/" : "");
83 83
 
84 84
 // connect to the database
85
-echo "<p>". $_lang['setup_database_create_connection'];
85
+echo "<p>".$_lang['setup_database_create_connection'];
86 86
 if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) {
87 87
     echo '<span class="notok">'.$_lang["setup_database_create_connection_failed"]."</span></p><p>".$_lang['setup_database_create_connection_failed_note']."</p>";
88 88
     return;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 }
92 92
 
93 93
 // select database
94
-echo "<p>".$_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: ";
94
+echo "<p>".$_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: ";
95 95
 if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) {
96 96
     echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>";
97 97
     $create = true;
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 
104 104
 // try to create the database
105 105
 if ($create) {
106
-    echo "<p>".$_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: ";
106
+    echo "<p>".$_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: ";
107 107
     //	if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) {
108
-    if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
108
+    if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
109 109
         echo '<span class="notok">'.$_lang['setup_database_creation_failed']."</span>".$_lang['setup_database_creation_failed_note']."</p>";
110 110
         $errors += 1;
111 111
         ?>
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 
125 125
 // check table prefix
126 126
 if ($installMode == 0) {
127
-    echo "<p>" . $_lang['checking_table_prefix'] . $table_prefix . "`: ";
128
-    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
129
-        echo '<span class="notok">' . $_lang['failed'] . "</span>" . $_lang['table_prefix_already_inuse'] . "</p>";
127
+    echo "<p>".$_lang['checking_table_prefix'].$table_prefix."`: ";
128
+    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
129
+        echo '<span class="notok">'.$_lang['failed']."</span>".$_lang['table_prefix_already_inuse']."</p>";
130 130
         $errors += 1;
131
-        echo "<p>" . $_lang['table_prefix_already_inuse_note'] . "</p>";
131
+        echo "<p>".$_lang['table_prefix_already_inuse_note']."</p>";
132 132
         return;
133 133
     } else {
134 134
         echo '<span class="ok">'.$_lang['ok']."</span></p>";
@@ -138,20 +138,20 @@  discard block
 block discarded – undo
138 138
 // check status of Inherit Parent Template plugin
139 139
 $auto_template_logic = 'parent';
140 140
 if ($installMode != 0) {
141
-    $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'");
141
+    $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'");
142 142
     $row = mysqli_fetch_row($rs);
143
-    if(!$row) {
143
+    if (!$row) {
144 144
         // not installed
145 145
         $auto_template_logic = 'system';
146 146
     } else {
147
-        if($row[1] == 1) {
147
+        if ($row[1] == 1) {
148 148
             // installed but disabled
149 149
             $auto_template_logic = 'system';
150 150
         } else {
151 151
             // installed, enabled .. see how it's configured
152 152
             $properties = parseProperties($row[0]);
153
-            if(isset($properties['inheritTemplate'])) {
154
-                if($properties['inheritTemplate'] == 'From First Sibling') {
153
+            if (isset($properties['inheritTemplate'])) {
154
+                if ($properties['inheritTemplate'] == 'From First Sibling') {
155 155
                     $auto_template_logic = 'sibling';
156 156
                 }
157 157
             }
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 
162 162
 // open db connection
163 163
 $setupPath = realpath(__DIR__);
164
-include dirname(__DIR__) . '/processor/result.php';
165
-include_once dirname(__DIR__) . '/sqlParser.class.php';
164
+include dirname(__DIR__).'/processor/result.php';
165
+include_once dirname(__DIR__).'/sqlParser.class.php';
166 166
 $sqlParser = new SqlParser($database_server, $database_user, $database_password, str_replace("`", "", $dbase), $table_prefix, $adminname, $adminemail, $adminpass, $database_connection_charset, $managerlanguage, $database_connection_method, $auto_template_logic);
167 167
 $sqlParser->mode = ($installMode < 1) ? "new" : "upd";
168 168
 /* image and file manager paths now handled via settings screen in Manager
@@ -175,20 +175,20 @@  discard block
 block discarded – undo
175 175
 $sqlParser->connect();
176 176
 
177 177
 // install/update database
178
-echo "<p>" . $_lang['setup_database_creating_tables'];
178
+echo "<p>".$_lang['setup_database_creating_tables'];
179 179
 if ($moduleSQLBaseFile) {
180 180
     $sqlParser->process($moduleSQLBaseFile);
181 181
     // display database results
182 182
     if ($sqlParser->installFailed == true) {
183 183
         $errors += 1;
184
-        echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>";
185
-        echo "<p>" . $_lang['setup_couldnt_install'] . "</p>";
186
-        echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />";
184
+        echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>";
185
+        echo "<p>".$_lang['setup_couldnt_install']."</p>";
186
+        echo "<p>".$_lang['installation_error_occured']."<br /><br />";
187 187
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
188
-            echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
188
+            echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />";
189 189
         }
190 190
         echo "</p>";
191
-        echo "<p>" . $_lang['some_tables_not_updated'] . "</p>";
191
+        echo "<p>".$_lang['some_tables_not_updated']."</p>";
192 192
         return;
193 193
     } else {
194 194
         echo '<span class="ok">'.$_lang['ok']."</span></p>";
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
 // custom or not
199 199
 if (file_exists(__DIR__."/../../assets/cache/siteManager.php")) {
200 200
     $mgrdir = 'include_once(__DIR__."/../../assets/cache/siteManager.php");';
201
-}else{
201
+} else {
202 202
     $mgrdir = 'define(\'MGR_DIR\', \'manager\');';
203 203
 }
204 204
 
205 205
 // write the config.inc.php file if new installation
206
-echo "<p>" . $_lang['writing_config_file'];
206
+echo "<p>".$_lang['writing_config_file'];
207 207
 
208 208
 $confph = array();
209 209
 $confph['database_server']    = $database_server;
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 $confph['lastInstallTime']    = time();
217 217
 $confph['site_sessionname']   = $site_sessionname;
218 218
 
219
-$configString = file_get_contents(dirname(__DIR__) . '/stubs/config.tpl');
219
+$configString = file_get_contents(dirname(__DIR__).'/stubs/config.tpl');
220 220
 $configString = parse($configString, $confph);
221 221
 
222 222
 $filename = '../'.MGR_DIR.'/includes/config.inc.php';
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 @chmod($filename, 0404);
236 236
 
237 237
 if ($configFileFailed == true) {
238
-    echo '<span class="notok">' . $_lang['failed'] . "</span></p>";
238
+    echo '<span class="notok">'.$_lang['failed']."</span></p>";
239 239
     $errors += 1;
240 240
     ?>
241 241
     <p><?php echo $_lang['cant_write_config_file']?><span class="mono"><?php echo MGR_DIR; ?>/includes/config.inc.php</span></p>
@@ -252,35 +252,35 @@  discard block
 block discarded – undo
252 252
 // generate new site_id and set manager theme to default
253 253
 if ($installMode == 0) {
254 254
     $siteid = uniqid('');
255
-    mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
255
+    mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
256 256
 } else {
257 257
     // update site_id if missing
258
-    $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'");
258
+    $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'");
259 259
     if ($ds) {
260 260
         $r = mysqli_fetch_assoc($ds);
261 261
         $siteid = $r['setting_value'];
262 262
         if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') {
263 263
             $siteid = uniqid('');
264
-            mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
264
+            mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
265 265
         }
266 266
     }
267 267
 }
268 268
 
269 269
 // Reset database for installation of demo-site
270 270
 if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) {
271
-    echo "<p>" . $_lang['resetting_database'];
271
+    echo "<p>".$_lang['resetting_database'];
272 272
     $sqlParser->process($moduleSQLResetFile);
273 273
     // display database results
274 274
     if ($sqlParser->installFailed == true) {
275 275
         $errors += 1;
276
-        echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>";
277
-        echo "<p>" . $_lang['setup_couldnt_install'] . "</p>";
278
-        echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />";
276
+        echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>";
277
+        echo "<p>".$_lang['setup_couldnt_install']."</p>";
278
+        echo "<p>".$_lang['installation_error_occured']."<br /><br />";
279 279
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
280
-            echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
280
+            echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />";
281 281
         }
282 282
         echo "</p>";
283
-        echo "<p>" . $_lang['some_tables_not_updated'] . "</p>";
283
+        echo "<p>".$_lang['some_tables_not_updated']."</p>";
284 284
         return;
285 285
     } else {
286 286
         echo '<span class="ok">'.$_lang['ok']."</span></p>";
@@ -289,11 +289,11 @@  discard block
 block discarded – undo
289 289
 
290 290
 // Install Templates
291 291
 if (isset ($_POST['template']) || $installData) {
292
-    echo "<h3>" . $_lang['templates'] . ":</h3> ";
292
+    echo "<h3>".$_lang['templates'].":</h3> ";
293 293
     $selTemplates = $_POST['template'];
294 294
     foreach ($moduleTemplates as $k=>$moduleTemplate) {
295 295
         $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1;
296
-        if($installSample || in_array($k, $selTemplates)) {
296
+        if ($installSample || in_array($k, $selTemplates)) {
297 297
             $name = mysqli_real_escape_string($conn, $moduleTemplate[0]);
298 298
             $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]);
299 299
             $category = mysqli_real_escape_string($conn, $moduleTemplate[4]);
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
             $filecontent = $moduleTemplate[3];
302 302
             $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site
303 303
             if (!file_exists($filecontent)) {
304
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
304
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].".</span></p>";
305 305
             } else {
306 306
                 // Create the category if it does not already exist
307 307
                 $category_id = getCreateDbCategory($category, $sqlParser);
@@ -311,31 +311,31 @@  discard block
 block discarded – undo
311 311
                 $template = mysqli_real_escape_string($conn, $template);
312 312
 
313 313
                 // See if the template already exists
314
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'");
314
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'");
315 315
 
316 316
                 if (mysqli_num_rows($rs)) {
317
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
317
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
318 318
                         $errors += 1;
319
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
319
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
320 320
                         return;
321 321
                     }
322
-                    if(!is_null($save_sql_id_as)) {
322
+                    if (!is_null($save_sql_id_as)) {
323 323
                         $sql_id = @mysqli_insert_id($sqlParser->conn);
324
-                        if(!$sql_id) {
325
-                            $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;"));
324
+                        if (!$sql_id) {
325
+                            $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;"));
326 326
                             $sql_id = $idQuery['id'];
327 327
                         }
328 328
                         $custom_placeholders[$save_sql_id_as] = $sql_id;
329 329
                     }
330
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
330
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
331 331
                 } else {
332
-                    if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
332
+                    if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
333 333
                         $errors += 1;
334
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
334
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
335 335
                         return;
336 336
                     }
337
-                    if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
338
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
337
+                    if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
338
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
339 339
                 }
340 340
             }
341 341
         }
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
 
345 345
 // Install Template Variables
346 346
 if (isset ($_POST['tv']) || $installData) {
347
-    echo "<h3>" . $_lang['tvs'] . ":</h3> ";
347
+    echo "<h3>".$_lang['tvs'].":</h3> ";
348 348
     $selTVs = $_POST['tv'];
349 349
     foreach ($moduleTVs as $k=>$moduleTV) {
350 350
         $installSample = in_array('sample', $moduleTV[12]) && $installData == 1;
351
-        if($installSample || in_array($k, $selTVs)) {
351
+        if ($installSample || in_array($k, $selTVs)) {
352 352
             $name = mysqli_real_escape_string($conn, $moduleTV[0]);
353 353
             $caption = mysqli_real_escape_string($conn, $moduleTV[1]);
354 354
             $desc = mysqli_real_escape_string($conn, $moduleTV[2]);
@@ -366,25 +366,25 @@  discard block
 block discarded – undo
366 366
             // Create the category if it does not already exist
367 367
             $category = getCreateDbCategory($category, $sqlParser);
368 368
 
369
-            $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'");
369
+            $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'");
370 370
             if (mysqli_num_rows($rs)) {
371 371
                 $insert = true;
372
-                while($row = mysqli_fetch_assoc($rs)) {
373
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
374
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
372
+                while ($row = mysqli_fetch_assoc($rs)) {
373
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
374
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
375 375
                         return;
376 376
                     }
377 377
                     $insert = false;
378 378
                 }
379
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
379
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
380 380
             } else {
381 381
                 //$q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',(SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE `id` END) `id` FROM $dbase.`" . $table_prefix . "categories` WHERE `category` = '$category'),$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
382
-                $q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
382
+                $q = "INSERT INTO $dbase.`".$table_prefix."site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
383 383
                 if (!mysqli_query($sqlParser->conn, $q)) {
384
-                    echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
384
+                    echo "<p>".mysqli_error($sqlParser->conn)."</p>";
385 385
                     return;
386 386
                 }
387
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
387
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
388 388
             }
389 389
 
390 390
             // add template assignments
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
             if (count($assignments) > 0) {
394 394
 
395 395
                 // remove existing tv -> template assignments
396
-                $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
396
+                $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
397 397
                 $row = mysqli_fetch_assoc($ds);
398 398
                 $id = $row["id"];
399
-                mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\'');
399
+                mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\'');
400 400
 
401 401
                 // add tv -> template assignments
402 402
                 foreach ($assignments as $assignment) {
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                     if ($ds && $ts) {
406 406
                         $tRow = mysqli_fetch_assoc($ts);
407 407
                         $templateId = $tRow['id'];
408
-                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
408
+                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
409 409
                     }
410 410
                 }
411 411
             }
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
 
416 416
 // Install Chunks
417 417
 if (isset ($_POST['chunk']) || $installData) {
418
-    echo "<h3>" . $_lang['chunks'] . ":</h3> ";
418
+    echo "<h3>".$_lang['chunks'].":</h3> ";
419 419
     $selChunks = $_POST['chunk'];
420 420
     foreach ($moduleChunks as $k=>$moduleChunk) {
421 421
         $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1;
422 422
         $count_new_name = 0;
423
-        if($installSample || in_array($k, $selChunks)) {
423
+        if ($installSample || in_array($k, $selChunks)) {
424 424
 
425 425
             $name = mysqli_real_escape_string($conn, $moduleChunk[0]);
426 426
             $desc = mysqli_real_escape_string($conn, $moduleChunk[1]);
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
             $filecontent = $moduleChunk[2];
430 430
 
431 431
             if (!file_exists($filecontent))
432
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
432
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].".</span></p>";
433 433
             else {
434 434
 
435 435
                 // Create the category if it does not already exist
@@ -437,31 +437,31 @@  discard block
 block discarded – undo
437 437
 
438 438
                 $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1);
439 439
                 $chunk = mysqli_real_escape_string($conn, $chunk);
440
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'");
440
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'");
441 441
                 $count_original_name = mysqli_num_rows($rs);
442
-                if($overwrite == 'false') {
443
-                    $newname = $name . '-' . str_replace('.', '_', $modx_version);
444
-                    $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'");
442
+                if ($overwrite == 'false') {
443
+                    $newname = $name.'-'.str_replace('.', '_', $modx_version);
444
+                    $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'");
445 445
                     $count_new_name = mysqli_num_rows($rs);
446 446
                 }
447 447
                 $update = $count_original_name > 0 && $overwrite == 'true';
448 448
                 if ($update) {
449
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
449
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
450 450
                         $errors += 1;
451
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
451
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
452 452
                         return;
453 453
                     }
454
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
455
-                } elseif($count_new_name == 0) {
456
-                    if($count_original_name > 0 && $overwrite == 'false') {
454
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
455
+                } elseif ($count_new_name == 0) {
456
+                    if ($count_original_name > 0 && $overwrite == 'false') {
457 457
                         $name = $newname;
458 458
                     }
459
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
459
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
460 460
                         $errors += 1;
461
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
461
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
462 462
                         return;
463 463
                     }
464
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
464
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
465 465
                 }
466 466
             }
467 467
         }
@@ -470,11 +470,11 @@  discard block
 block discarded – undo
470 470
 
471 471
 // Install Modules
472 472
 if (isset ($_POST['module']) || $installData) {
473
-    echo "<h3>" . $_lang['modules'] . ":</h3> ";
473
+    echo "<h3>".$_lang['modules'].":</h3> ";
474 474
     $selModules = $_POST['module'];
475 475
     foreach ($moduleModules as $k=>$moduleModule) {
476 476
         $installSample = in_array('sample', $moduleModule[7]) && $installData == 1;
477
-        if($installSample || in_array($k, $selModules)) {
477
+        if ($installSample || in_array($k, $selModules)) {
478 478
             $name = mysqli_real_escape_string($conn, $moduleModule[0]);
479 479
             $desc = mysqli_real_escape_string($conn, $moduleModule[1]);
480 480
             $filecontent = $moduleModule[2];
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
             $shared = mysqli_real_escape_string($conn, $moduleModule[5]);
484 484
             $category = mysqli_real_escape_string($conn, $moduleModule[6]);
485 485
             if (!file_exists($filecontent))
486
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
486
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].".</span></p>";
487 487
             else {
488 488
 
489 489
                 // Create the category if it does not already exist
@@ -492,22 +492,22 @@  discard block
 block discarded – undo
492 492
                 $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
493 493
                 // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab
494 494
                 $module = mysqli_real_escape_string($conn, $module);
495
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'");
495
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'");
496 496
                 if (mysqli_num_rows($rs)) {
497 497
                     $row = mysqli_fetch_assoc($rs);
498
-                    $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
499
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
500
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
498
+                    $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
499
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
500
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
501 501
                         return;
502 502
                     }
503
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
503
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
504 504
                 } else {
505 505
                     $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
506
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
507
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
506
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
507
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
508 508
                         return;
509 509
                     }
510
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
510
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
511 511
                 }
512 512
             }
513 513
         }
@@ -516,11 +516,11 @@  discard block
 block discarded – undo
516 516
 
517 517
 // Install Plugins
518 518
 if (isset ($_POST['plugin']) || $installData) {
519
-    echo "<h3>" . $_lang['plugins'] . ":</h3> ";
519
+    echo "<h3>".$_lang['plugins'].":</h3> ";
520 520
     $selPlugs = $_POST['plugin'];
521 521
     foreach ($modulePlugins as $k=>$modulePlugin) {
522 522
         $installSample = in_array('sample', $modulePlugin[8]) && $installData == 1;
523
-        if($installSample || in_array($k, $selPlugs)) {
523
+        if ($installSample || in_array($k, $selPlugs)) {
524 524
             $name = mysqli_real_escape_string($conn, $modulePlugin[0]);
525 525
             $desc = mysqli_real_escape_string($conn, $modulePlugin[1]);
526 526
             $filecontent = $modulePlugin[2];
@@ -530,17 +530,17 @@  discard block
 block discarded – undo
530 530
             $category = mysqli_real_escape_string($conn, $modulePlugin[6]);
531 531
             $leg_names = '';
532 532
             $disabled = $modulePlugin[9];
533
-            if(array_key_exists(7, $modulePlugin)) {
533
+            if (array_key_exists(7, $modulePlugin)) {
534 534
                 // parse comma-separated legacy names and prepare them for sql IN clause
535
-                $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'";
535
+                $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'";
536 536
             }
537 537
             if (!file_exists($filecontent))
538
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
538
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].".</span></p>";
539 539
             else {
540 540
 
541 541
                 // disable legacy versions based on legacy_names provided
542
-                if(!empty($leg_names)) {
543
-                    $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
542
+                if (!empty($leg_names)) {
543
+                    $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
544 544
                     $rs = mysqli_query($sqlParser->conn, $update_query);
545 545
                 }
546 546
 
@@ -550,50 +550,50 @@  discard block
 block discarded – undo
550 550
                 $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
551 551
                 $plugin = removeDocblock($plugin, 'plugin');
552 552
                 $plugin = mysqli_real_escape_string($conn, $plugin);
553
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'");
553
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'");
554 554
                 if (mysqli_num_rows($rs)) {
555 555
                     $insert = true;
556
-                    while($row = mysqli_fetch_assoc($rs)) {
557
-                        $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
558
-                        if($row['description'] == $desc){
559
-                            if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
560
-                                echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
556
+                    while ($row = mysqli_fetch_assoc($rs)) {
557
+                        $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
558
+                        if ($row['description'] == $desc) {
559
+                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
560
+                                echo "<p>".mysqli_error($sqlParser->conn)."</p>";
561 561
                                 return;
562 562
                             }
563 563
                             $insert = false;
564 564
                         } else {
565
-                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
565
+                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
566 566
                                 echo "<p>".mysqli_error($sqlParser->conn)."</p>";
567 567
                                 return;
568 568
                             }
569 569
                         }
570 570
                     }
571
-                    if($insert === true) {
572
-                        $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
573
-                        if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
571
+                    if ($insert === true) {
572
+                        $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
573
+                        if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
574 574
                             echo "<p>".mysqli_error($sqlParser->conn)."</p>";
575 575
                             return;
576 576
                         }
577 577
                     }
578
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
578
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
579 579
                 } else {
580 580
                     $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
581
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
582
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
581
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
582
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
583 583
                         return;
584 584
                     }
585
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
585
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
586 586
                 }
587 587
                 // add system events
588 588
                 if (count($events) > 0) {
589
-                    $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
589
+                    $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
590 590
                     if ($ds) {
591 591
                         $row = mysqli_fetch_assoc($ds);
592 592
                         $id = $row["id"];
593 593
                         // remove existing events
594
-                        mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\'');
594
+                        mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\'');
595 595
                         // add new events
596
-                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`" . $table_prefix . "system_eventnames` se WHERE name IN ('" . implode("','", $events) . "')");
596
+                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`".$table_prefix."system_eventnames` se WHERE name IN ('".implode("','", $events)."')");
597 597
                     }
598 598
                 }
599 599
             }
@@ -603,18 +603,18 @@  discard block
 block discarded – undo
603 603
 
604 604
 // Install Snippets
605 605
 if (isset ($_POST['snippet']) || $installData) {
606
-    echo "<h3>" . $_lang['snippets'] . ":</h3> ";
606
+    echo "<h3>".$_lang['snippets'].":</h3> ";
607 607
     $selSnips = $_POST['snippet'];
608 608
     foreach ($moduleSnippets as $k=>$moduleSnippet) {
609 609
         $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1;
610
-        if($installSample || in_array($k, $selSnips)) {
610
+        if ($installSample || in_array($k, $selSnips)) {
611 611
             $name = mysqli_real_escape_string($conn, $moduleSnippet[0]);
612 612
             $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]);
613 613
             $filecontent = $moduleSnippet[2];
614 614
             $properties = $moduleSnippet[3];
615 615
             $category = mysqli_real_escape_string($conn, $moduleSnippet[4]);
616 616
             if (!file_exists($filecontent))
617
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
617
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].".</span></p>";
618 618
             else {
619 619
 
620 620
                 // Create the category if it does not already exist
@@ -623,22 +623,22 @@  discard block
 block discarded – undo
623 623
                 $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent)));
624 624
                 $snippet = removeDocblock($snippet, 'snippet');
625 625
                 $snippet = mysqli_real_escape_string($conn, $snippet);
626
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'");
626
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'");
627 627
                 if (mysqli_num_rows($rs)) {
628 628
                     $row = mysqli_fetch_assoc($rs);
629
-                    $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
630
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
631
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
629
+                    $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
630
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
631
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
632 632
                         return;
633 633
                     }
634
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
634
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
635 635
                 } else {
636 636
                     $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
637
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
638
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
637
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
638
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
639 639
                         return;
640 640
                     }
641
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
641
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
642 642
                 }
643 643
             }
644 644
         }
@@ -647,24 +647,24 @@  discard block
 block discarded – undo
647 647
 
648 648
 // Install demo-site
649 649
 if ($installData && $moduleSQLDataFile) {
650
-    echo "<p>" . $_lang['installing_demo_site'];
650
+    echo "<p>".$_lang['installing_demo_site'];
651 651
     $sqlParser->process($moduleSQLDataFile);
652 652
     // display database results
653 653
     if ($sqlParser->installFailed == true) {
654 654
         $errors += 1;
655
-        echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>";
656
-        echo "<p>" . $_lang['setup_couldnt_install'] . "</p>";
657
-        echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />";
655
+        echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>";
656
+        echo "<p>".$_lang['setup_couldnt_install']."</p>";
657
+        echo "<p>".$_lang['installation_error_occured']."<br /><br />";
658 658
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
659
-            echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
659
+            echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />";
660 660
         }
661 661
         echo "</p>";
662
-        echo "<p>" . $_lang['some_tables_not_updated'] . "</p>";
662
+        echo "<p>".$_lang['some_tables_not_updated']."</p>";
663 663
         return;
664 664
     } else {
665 665
         $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix);
666 666
         $rs = mysqli_query($sqlParser->conn, $sql);
667
-        if(mysqli_num_rows($rs)) {
667
+        if (mysqli_num_rows($rs)) {
668 668
             $row = mysqli_fetch_assoc($rs);
669 669
             $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']);
670 670
             mysqli_query($sqlParser->conn, $sql);
@@ -675,9 +675,9 @@  discard block
 block discarded – undo
675 675
 
676 676
 // Install Dependencies
677 677
 foreach ($moduleDependencies as $dependency) {
678
-    $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"');
678
+    $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"');
679 679
     if (!$ds) {
680
-        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
680
+        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
681 681
         return;
682 682
     } else {
683 683
         $row = mysqli_fetch_assoc($ds);
@@ -685,37 +685,37 @@  discard block
 block discarded – undo
685 685
         $moduleGuid = $row["guid"];
686 686
     }
687 687
     // get extra id
688
-    $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"');
688
+    $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"');
689 689
     if (!$ds) {
690
-        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
690
+        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
691 691
         return;
692 692
     } else {
693 693
         $row = mysqli_fetch_assoc($ds);
694 694
         $extraId = $row["id"];
695 695
     }
696 696
     // setup extra as module dependency
697
-    $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1');
697
+    $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1');
698 698
     if (!$ds) {
699
-        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
699
+        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
700 700
         return;
701 701
     } else {
702 702
         if (mysqli_num_rows($ds) === 0) {
703
-            mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')');
704
-            echo '<p>&nbsp;&nbsp;' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_create'] . '</span></p>';
703
+            mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')');
704
+            echo '<p>&nbsp;&nbsp;'.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_create'].'</span></p>';
705 705
         } else {
706
-            mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']);
707
-            echo '<p>&nbsp;&nbsp;' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_update'] . '</span></p>';
706
+            mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` SET module = '.$moduleId.', resource = '.$extraId.', type = '.$dependency['type'].' WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type']);
707
+            echo '<p>&nbsp;&nbsp;'.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_update'].'</span></p>';
708 708
         }
709 709
         if ($dependency['type'] == 30 || $dependency['type'] == 40) {
710 710
             // set extra guid for plugins and snippets
711
-            $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1');
711
+            $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1');
712 712
             if (!$ds) {
713
-                echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
713
+                echo "<p>".mysqli_error($sqlParser->conn)."</p>";
714 714
                 return;
715 715
             } else {
716 716
                 if (mysqli_num_rows($ds) != 0) {
717
-                    mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId);
718
-                    echo '<p>&nbsp;&nbsp;' . $dependency['name'] . ': <span class="ok">' . $_lang['guid_set'] . '</span></p>';
717
+                    mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId);
718
+                    echo '<p>&nbsp;&nbsp;'.$dependency['name'].': <span class="ok">'.$_lang['guid_set'].'</span></p>';
719 719
                 }
720 720
             }
721 721
         }
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 
725 725
 // call back function
726 726
 if ($callBackFnc != "")
727
-    $callBackFnc ($sqlParser);
727
+    $callBackFnc($sqlParser);
728 728
 
729 729
 // Setup the MODX API -- needed for the cache processor
730 730
 define('MODX_API_MODE', true);
@@ -759,12 +759,12 @@  discard block
 block discarded – undo
759 759
 }
760 760
 
761 761
 // setup completed!
762
-echo "<p><b>" . $_lang['installation_successful'] . "</b></p>";
763
-echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>";
762
+echo "<p><b>".$_lang['installation_successful']."</b></p>";
763
+echo "<p>".$_lang['to_log_into_content_manager']."</p>";
764 764
 if ($installMode == 0) {
765
-    echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['installation_note'] . "</p>";
765
+    echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['installation_note']."</p>";
766 766
 } else {
767
-    echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['upgrade_note'] . "</p>";
767
+    echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['upgrade_note']."</p>";
768 768
 }
769 769
 ?>
770 770
 <form name="install" id="install_form" action="index.php?action=options" method="post">
@@ -793,10 +793,10 @@  discard block
 block discarded – undo
793 793
 	var chk = document.install.rminstaller;
794 794
 	if(chk && chk.checked) {
795 795
 		// remove install folder and files
796
-		window.location.href = "../<?php echo MGR_DIR;?>/processors/remove_installer.processor.php?rminstall=1";
796
+		window.location.href = "../<?php echo MGR_DIR; ?>/processors/remove_installer.processor.php?rminstall=1";
797 797
 	}
798 798
 	else {
799
-		window.location.href = "../<?php echo MGR_DIR;?>/";
799
+		window.location.href = "../<?php echo MGR_DIR; ?>/";
800 800
 	}
801 801
 }
802 802
 /* ]]> */
Please login to merge, or discard this patch.
Braces   +30 added lines, -21 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 <?php
13 13
 if (file_exists(__DIR__."/../assets/cache/siteManager.php")) {
14 14
     include_once(__DIR__."/../assets/cache/siteManager.php");
15
-}else{
15
+} else {
16 16
     define('MGR_DIR', 'manager');
17 17
 }
18 18
 
@@ -69,13 +69,15 @@  discard block
 block discarded – undo
69 69
 
70 70
 // get base path and url
71 71
 $a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"])));
72
-if (count($a) > 1)
72
+if (count($a) > 1) {
73 73
     array_pop($a);
74
+}
74 75
 $url = implode("install", $a);
75 76
 reset($a);
76 77
 $a = explode("install", str_replace("\\", "/", realpath(__DIR__)));
77
-if (count($a) > 1)
78
+if (count($a) > 1) {
78 79
     array_pop($a);
80
+}
79 81
 $pth = implode("install", $a);
80 82
 unset ($a);
81 83
 $base_url = $url . (substr($url, -1) != "/" ? "/" : "");
@@ -96,7 +98,9 @@  discard block
 block discarded – undo
96 98
     echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>";
97 99
     $create = true;
98 100
 } else {
99
-    if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset);
101
+    if (function_exists('mysqli_set_charset')) {
102
+        mysqli_set_charset($conn, $database_charset);
103
+    }
100 104
     mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}");
101 105
     echo '<span class="ok">'.$_lang['ok']."</span></p>";
102 106
 }
@@ -198,7 +202,7 @@  discard block
 block discarded – undo
198 202
 // custom or not
199 203
 if (file_exists(__DIR__."/../../assets/cache/siteManager.php")) {
200 204
     $mgrdir = 'include_once(__DIR__."/../../assets/cache/siteManager.php");';
201
-}else{
205
+} else {
202 206
     $mgrdir = 'define(\'MGR_DIR\', \'manager\');';
203 207
 }
204 208
 
@@ -334,7 +338,9 @@  discard block
 block discarded – undo
334 338
                         echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
335 339
                         return;
336 340
                     }
337
-                    if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
341
+                    if(!is_null($save_sql_id_as)) {
342
+                        $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
343
+                    }
338 344
                     echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
339 345
                 }
340 346
             }
@@ -428,9 +434,9 @@  discard block
 block discarded – undo
428 434
             $overwrite = mysqli_real_escape_string($conn, $moduleChunk[4]);
429 435
             $filecontent = $moduleChunk[2];
430 436
 
431
-            if (!file_exists($filecontent))
432
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
433
-            else {
437
+            if (!file_exists($filecontent)) {
438
+                            echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
439
+            } else {
434 440
 
435 441
                 // Create the category if it does not already exist
436 442
                 $category_id = getCreateDbCategory($category, $sqlParser);
@@ -482,9 +488,9 @@  discard block
 block discarded – undo
482 488
             $guid = mysqli_real_escape_string($conn, $moduleModule[4]);
483 489
             $shared = mysqli_real_escape_string($conn, $moduleModule[5]);
484 490
             $category = mysqli_real_escape_string($conn, $moduleModule[6]);
485
-            if (!file_exists($filecontent))
486
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
487
-            else {
491
+            if (!file_exists($filecontent)) {
492
+                            echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
493
+            } else {
488 494
 
489 495
                 // Create the category if it does not already exist
490 496
                 $category = getCreateDbCategory($category, $sqlParser);
@@ -534,9 +540,9 @@  discard block
 block discarded – undo
534 540
                 // parse comma-separated legacy names and prepare them for sql IN clause
535 541
                 $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'";
536 542
             }
537
-            if (!file_exists($filecontent))
538
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
539
-            else {
543
+            if (!file_exists($filecontent)) {
544
+                            echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
545
+            } else {
540 546
 
541 547
                 // disable legacy versions based on legacy_names provided
542 548
                 if(!empty($leg_names)) {
@@ -555,7 +561,7 @@  discard block
 block discarded – undo
555 561
                     $insert = true;
556 562
                     while($row = mysqli_fetch_assoc($rs)) {
557 563
                         $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
558
-                        if($row['description'] == $desc){
564
+                        if($row['description'] == $desc) {
559 565
                             if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
560 566
                                 echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
561 567
                                 return;
@@ -613,9 +619,9 @@  discard block
 block discarded – undo
613 619
             $filecontent = $moduleSnippet[2];
614 620
             $properties = $moduleSnippet[3];
615 621
             $category = mysqli_real_escape_string($conn, $moduleSnippet[4]);
616
-            if (!file_exists($filecontent))
617
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
618
-            else {
622
+            if (!file_exists($filecontent)) {
623
+                            echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
624
+            } else {
619 625
 
620 626
                 // Create the category if it does not already exist
621 627
                 $category = getCreateDbCategory($category, $sqlParser);
@@ -723,13 +729,16 @@  discard block
 block discarded – undo
723 729
 }
724 730
 
725 731
 // call back function
726
-if ($callBackFnc != "")
732
+if ($callBackFnc != "") {
727 733
     $callBackFnc ($sqlParser);
734
+}
728 735
 
729 736
 // Setup the MODX API -- needed for the cache processor
730 737
 define('MODX_API_MODE', true);
731 738
 define('MODX_BASE_PATH', $base_path);
732
-if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
739
+if (!defined('MODX_MANAGER_PATH')) {
740
+    define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
741
+}
733 742
 $database_type = 'mysqli';
734 743
 // initiate a new document parser
735 744
 include_once('../'.MGR_DIR.'/includes/document.parser.class.inc.php');
Please login to merge, or discard this patch.
Upper-Lower-Casing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 }
239 239
 
240 240
 // write $somecontent to our opened file.
241
-if (@ fwrite($handle, $configString) === FALSE) {
241
+if (@ fwrite($handle, $configString) === false) {
242 242
     $configFileFailed = true;
243 243
 }
244 244
 @ fclose($handle);
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
                 $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'");
327 327
 
328 328
                 if (mysqli_num_rows($rs)) {
329
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
329
+                    if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
330 330
                         $errors += 1;
331 331
                         echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
332 332
                         return;
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             if (mysqli_num_rows($rs)) {
383 383
                 $insert = true;
384 384
                 while($row = mysqli_fetch_assoc($rs)) {
385
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
385
+                    if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
386 386
                         echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
387 387
                         return;
388 388
                     }
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
                 }
459 459
                 $update = $count_original_name > 0 && $overwrite == 'true';
460 460
                 if ($update) {
461
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
461
+                    if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
462 462
                         $errors += 1;
463 463
                         echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
464 464
                         return;
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
                 if (mysqli_num_rows($rs)) {
509 509
                     $row = mysqli_fetch_assoc($rs);
510 510
                     $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
511
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
511
+                    if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
512 512
                         echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
513 513
                         return;
514 514
                     }
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 
553 553
                 // disable legacy versions based on legacy_names provided
554 554
                 if(!empty($leg_names)) {
555
-                    $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
555
+                    $update_query = "update $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
556 556
                     $rs = mysqli_query($sqlParser->conn, $update_query);
557 557
                 }
558 558
 
@@ -568,13 +568,13 @@  discard block
 block discarded – undo
568 568
                     while($row = mysqli_fetch_assoc($rs)) {
569 569
                         $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
570 570
                         if($row['description'] == $desc){
571
-                            if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
571
+                            if (! mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
572 572
                                 echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
573 573
                                 return;
574 574
                             }
575 575
                             $insert = false;
576 576
                         } else {
577
-                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
577
+                            if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
578 578
                                 echo "<p>".mysqli_error($sqlParser->conn)."</p>";
579 579
                                 return;
580 580
                             }
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
                 if (mysqli_num_rows($rs)) {
640 640
                     $row = mysqli_fetch_assoc($rs);
641 641
                     $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
642
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
642
+                    if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
643 643
                         echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
644 644
                         return;
645 645
                     }
Please login to merge, or discard this patch.
install/src/sqlParser.class.php 3 patches
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -4,141 +4,141 @@
 block discarded – undo
4 4
 // SNUFFKIN/ Alex 2004
5 5
 
6 6
 class SqlParser {
7
-	public $host;
8
-	public $dbname;
9
-	public $prefix;
10
-	public $user;
11
-	public $password;
12
-	public $mysqlErrors;
13
-	public $conn;
14
-	public $installFailed;
15
-	public $sitename;
16
-	public $adminname;
17
-	public $adminemail;
18
-	public $adminpass;
19
-	public $managerlanguage;
20
-	public $mode;
21
-	public $fileManagerPath;
22
-	public $imgPath;
23
-	public $imgUrl;
24
-	public $dbMODx;
25
-	public $dbVersion;
7
+    public $host;
8
+    public $dbname;
9
+    public $prefix;
10
+    public $user;
11
+    public $password;
12
+    public $mysqlErrors;
13
+    public $conn;
14
+    public $installFailed;
15
+    public $sitename;
16
+    public $adminname;
17
+    public $adminemail;
18
+    public $adminpass;
19
+    public $managerlanguage;
20
+    public $mode;
21
+    public $fileManagerPath;
22
+    public $imgPath;
23
+    public $imgUrl;
24
+    public $dbMODx;
25
+    public $dbVersion;
26 26
     public $connection_charset;
27 27
     public $connection_method;
28 28
     public $ignoreDuplicateErrors;
29 29
     public $autoTemplateLogic;
30 30
 
31
-	public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') {
32
-		$this->host = $host;
33
-		$this->dbname = $db;
34
-		$this->prefix = $prefix;
35
-		$this->user = $user;
36
-		$this->password = $password;
37
-		$this->adminpass = $adminpass;
38
-		$this->adminname = $adminname;
39
-		$this->adminemail = $adminemail;
40
-		$this->connection_charset = $connection_charset;
41
-		$this->connection_method = $connection_method;
42
-		$this->ignoreDuplicateErrors = false;
43
-		$this->managerlanguage = $managerlanguage;
31
+    public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') {
32
+        $this->host = $host;
33
+        $this->dbname = $db;
34
+        $this->prefix = $prefix;
35
+        $this->user = $user;
36
+        $this->password = $password;
37
+        $this->adminpass = $adminpass;
38
+        $this->adminname = $adminname;
39
+        $this->adminemail = $adminemail;
40
+        $this->connection_charset = $connection_charset;
41
+        $this->connection_method = $connection_method;
42
+        $this->ignoreDuplicateErrors = false;
43
+        $this->managerlanguage = $managerlanguage;
44 44
         $this->autoTemplateLogic = $auto_template_logic;
45
-	}
45
+    }
46 46
 
47
-	public function connect() {
48
-		$this->conn = mysqli_connect($this->host, $this->user, $this->password);
49
-		mysqli_select_db($this->conn, $this->dbname);
50
-		if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset);
47
+    public function connect() {
48
+        $this->conn = mysqli_connect($this->host, $this->user, $this->password);
49
+        mysqli_select_db($this->conn, $this->dbname);
50
+        if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset);
51 51
 
52
-		$this->dbVersion = 3.23; // assume version 3.23
53
-		if(function_exists("mysqli_get_server_info")) {
54
-			$ver = mysqli_get_server_info($this->conn);
55
-			$this->dbMODx 	 = version_compare($ver,"4.0.2");
56
-			$this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2]
57
-		}
52
+        $this->dbVersion = 3.23; // assume version 3.23
53
+        if(function_exists("mysqli_get_server_info")) {
54
+            $ver = mysqli_get_server_info($this->conn);
55
+            $this->dbMODx 	 = version_compare($ver,"4.0.2");
56
+            $this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2]
57
+        }
58 58
 
59 59
         mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}");
60
-	}
60
+    }
61 61
 
62 62
     public function process($filename) {
63
-	    global $custom_placeholders;
64
-
65
-		// check to make sure file exists
66
-		if (!file_exists($filename)) {
67
-			$this->mysqlErrors[] = array("error" => "File '$filename' not found");
68
-			$this->installFailed = true ;
69
-			return false;
70
-		}
71
-
72
-		$fh = fopen($filename, 'r');
73
-		$idata = '';
74
-
75
-		while (!feof($fh)) {
76
-			$idata .= fread($fh, 1024);
77
-		}
78
-
79
-		fclose($fh);
80
-		$idata = str_replace("\r", '', $idata);
81
-
82
-		// check if in upgrade mode
83
-		if ($this->mode === 'upd') {
84
-			// remove non-upgradeable parts
85
-			$s = strpos($idata,'non-upgrade-able[[');
86
-			$e = strpos($idata,']]non-upgrade-able') + 17;
87
-			if($s && $e) {
88
-			    $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata);
63
+        global $custom_placeholders;
64
+
65
+        // check to make sure file exists
66
+        if (!file_exists($filename)) {
67
+            $this->mysqlErrors[] = array("error" => "File '$filename' not found");
68
+            $this->installFailed = true ;
69
+            return false;
70
+        }
71
+
72
+        $fh = fopen($filename, 'r');
73
+        $idata = '';
74
+
75
+        while (!feof($fh)) {
76
+            $idata .= fread($fh, 1024);
77
+        }
78
+
79
+        fclose($fh);
80
+        $idata = str_replace("\r", '', $idata);
81
+
82
+        // check if in upgrade mode
83
+        if ($this->mode === 'upd') {
84
+            // remove non-upgradeable parts
85
+            $s = strpos($idata,'non-upgrade-able[[');
86
+            $e = strpos($idata,']]non-upgrade-able') + 17;
87
+            if($s && $e) {
88
+                $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata);
89 89
             }
90
-		}
91
-
92
-		// replace {} tags
93
-		$idata = str_replace('{PREFIX}', $this->prefix, $idata);
94
-		$idata = str_replace('{ADMIN}', $this->adminname, $idata);
95
-		$idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata);
96
-		$idata = str_replace('{ADMINPASS}', $this->adminpass, $idata);
97
-		$idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata);
98
-		$idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata);
99
-		$idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata);
100
-		$idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata);
101
-		$idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata);
102
-		/*$idata = str_replace('{VERSION}', $modx_version, $idata);*/
103
-
104
-		// Replace custom placeholders
105
-		foreach($custom_placeholders as $key=>$val) {
106
-			if (strpos($idata, '{'.$key.'}') !== false) {
107
-				$idata = str_replace('{'.$key.'}', $val, $idata);
108
-			}
109
-		}
110
-
111
-		$sql_array = explode("\n\n", $idata);
112
-
113
-		$num = 0;
114
-		foreach($sql_array as $sql_entry) {
115
-			$sql_do = trim($sql_entry, "\r\n; ");
116
-
117
-			if (preg_match('/^\#/', $sql_do)) continue;
118
-
119
-			// strip out comments and \n for mysql 3.x
120
-			if ($this->dbVersion <4.0) {
121
-				$sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do);
122
-				$sql_do = str_replace('\r', "", $sql_do);
123
-				$sql_do = str_replace('\n', "", $sql_do);
124
-			}
125
-
126
-
127
-			$num = $num + 1;
128
-			if ($sql_do) mysqli_query($this->conn, $sql_do);
129
-			if(mysqli_error($this->conn)) {
130
-				// Ignore duplicate and drop errors - Raymond
131
-				if ($this->ignoreDuplicateErrors){
132
-					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue;
133
-				}
134
-				// End Ignore duplicate
135
-				$this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do);
136
-				$this->installFailed = true;
137
-			}
138
-		}
139
-	}
90
+        }
91
+
92
+        // replace {} tags
93
+        $idata = str_replace('{PREFIX}', $this->prefix, $idata);
94
+        $idata = str_replace('{ADMIN}', $this->adminname, $idata);
95
+        $idata = str_replace('{ADMINEMAIL}', $this->adminemail, $idata);
96
+        $idata = str_replace('{ADMINPASS}', $this->adminpass, $idata);
97
+        $idata = str_replace('{IMAGEPATH}', $this->imgPath, $idata);
98
+        $idata = str_replace('{IMAGEURL}', $this->imgUrl, $idata);
99
+        $idata = str_replace('{FILEMANAGERPATH}', $this->fileManagerPath, $idata);
100
+        $idata = str_replace('{MANAGERLANGUAGE}', $this->managerlanguage, $idata);
101
+        $idata = str_replace('{AUTOTEMPLATELOGIC}', $this->autoTemplateLogic, $idata);
102
+        /*$idata = str_replace('{VERSION}', $modx_version, $idata);*/
103
+
104
+        // Replace custom placeholders
105
+        foreach($custom_placeholders as $key=>$val) {
106
+            if (strpos($idata, '{'.$key.'}') !== false) {
107
+                $idata = str_replace('{'.$key.'}', $val, $idata);
108
+            }
109
+        }
110
+
111
+        $sql_array = explode("\n\n", $idata);
112
+
113
+        $num = 0;
114
+        foreach($sql_array as $sql_entry) {
115
+            $sql_do = trim($sql_entry, "\r\n; ");
116
+
117
+            if (preg_match('/^\#/', $sql_do)) continue;
118
+
119
+            // strip out comments and \n for mysql 3.x
120
+            if ($this->dbVersion <4.0) {
121
+                $sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do);
122
+                $sql_do = str_replace('\r', "", $sql_do);
123
+                $sql_do = str_replace('\n', "", $sql_do);
124
+            }
125
+
126
+
127
+            $num = $num + 1;
128
+            if ($sql_do) mysqli_query($this->conn, $sql_do);
129
+            if(mysqli_error($this->conn)) {
130
+                // Ignore duplicate and drop errors - Raymond
131
+                if ($this->ignoreDuplicateErrors){
132
+                    if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue;
133
+                }
134
+                // End Ignore duplicate
135
+                $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do);
136
+                $this->installFailed = true;
137
+            }
138
+        }
139
+    }
140 140
 
141 141
     public function close() {
142
-		mysqli_close($this->conn);
143
-	}
142
+        mysqli_close($this->conn);
143
+    }
144 144
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 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,28 +44,28 @@  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
 		$this->conn = mysqli_connect($this->host, $this->user, $this->password);
49 49
 		mysqli_select_db($this->conn, $this->dbname);
50 50
 		if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset);
51 51
 
52 52
 		$this->dbVersion = 3.23; // assume version 3.23
53
-		if(function_exists("mysqli_get_server_info")) {
53
+		if (function_exists("mysqli_get_server_info")) {
54 54
 			$ver = mysqli_get_server_info($this->conn);
55
-			$this->dbMODx 	 = version_compare($ver,"4.0.2");
55
+			$this->dbMODx 	 = version_compare($ver, "4.0.2");
56 56
 			$this->dbVersion = (float) $ver; // Typecasting (float) instead of floatval() [PHP < 4.2]
57 57
 		}
58 58
 
59
-        mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}");
59
+        mysqli_query($this->conn, "{$this->connection_method} {$this->connection_charset}");
60 60
 	}
61 61
 
62
-    public function process($filename) {
62
+    public function process($filename){
63 63
 	    global $custom_placeholders;
64 64
 
65 65
 		// check to make sure file exists
66 66
 		if (!file_exists($filename)) {
67 67
 			$this->mysqlErrors[] = array("error" => "File '$filename' not found");
68
-			$this->installFailed = true ;
68
+			$this->installFailed = true;
69 69
 			return false;
70 70
 		}
71 71
 
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 		// check if in upgrade mode
83 83
 		if ($this->mode === 'upd') {
84 84
 			// remove non-upgradeable parts
85
-			$s = strpos($idata,'non-upgrade-able[[');
86
-			$e = strpos($idata,']]non-upgrade-able') + 17;
87
-			if($s && $e) {
88
-			    $idata = str_replace(substr($idata, $s,$e-$s),' Removed non upgradeable items', $idata);
85
+			$s = strpos($idata, 'non-upgrade-able[[');
86
+			$e = strpos($idata, ']]non-upgrade-able') + 17;
87
+			if ($s && $e) {
88
+			    $idata = str_replace(substr($idata, $s, $e - $s), ' Removed non upgradeable items', $idata);
89 89
             }
90 90
 		}
91 91
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		/*$idata = str_replace('{VERSION}', $modx_version, $idata);*/
103 103
 
104 104
 		// Replace custom placeholders
105
-		foreach($custom_placeholders as $key=>$val) {
105
+		foreach ($custom_placeholders as $key=>$val) {
106 106
 			if (strpos($idata, '{'.$key.'}') !== false) {
107 107
 				$idata = str_replace('{'.$key.'}', $val, $idata);
108 108
 			}
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 		$sql_array = explode("\n\n", $idata);
112 112
 
113 113
 		$num = 0;
114
-		foreach($sql_array as $sql_entry) {
114
+		foreach ($sql_array as $sql_entry) {
115 115
 			$sql_do = trim($sql_entry, "\r\n; ");
116 116
 
117 117
 			if (preg_match('/^\#/', $sql_do)) continue;
118 118
 
119 119
 			// strip out comments and \n for mysql 3.x
120
-			if ($this->dbVersion <4.0) {
121
-				$sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~","",$sql_do);
120
+			if ($this->dbVersion < 4.0) {
121
+				$sql_do = preg_replace("~COMMENT.*[^']?'.*[^']?'~", "", $sql_do);
122 122
 				$sql_do = str_replace('\r', "", $sql_do);
123 123
 				$sql_do = str_replace('\n', "", $sql_do);
124 124
 			}
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
 
127 127
 			$num = $num + 1;
128 128
 			if ($sql_do) mysqli_query($this->conn, $sql_do);
129
-			if(mysqli_error($this->conn)) {
129
+			if (mysqli_error($this->conn)) {
130 130
 				// Ignore duplicate and drop errors - Raymond
131
-				if ($this->ignoreDuplicateErrors){
132
-					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue;
131
+				if ($this->ignoreDuplicateErrors) {
132
+					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 || mysqli_errno($this->conn) == 1091) continue;
133 133
 				}
134 134
 				// End Ignore duplicate
135 135
 				$this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		}
139 139
 	}
140 140
 
141
-    public function close() {
141
+    public function close(){
142 142
 		mysqli_close($this->conn);
143 143
 	}
144 144
 }
Please login to merge, or discard this patch.
Braces   +23 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,7 +3,8 @@  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 8
 	public $host;
8 9
 	public $dbname;
9 10
 	public $prefix;
@@ -28,7 +29,8 @@  discard block
 block discarded – undo
28 29
     public $ignoreDuplicateErrors;
29 30
     public $autoTemplateLogic;
30 31
 
31
-	public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') {
32
+	public function __construct($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent')
33
+	{
32 34
 		$this->host = $host;
33 35
 		$this->dbname = $db;
34 36
 		$this->prefix = $prefix;
@@ -44,10 +46,13 @@  discard block
 block discarded – undo
44 46
         $this->autoTemplateLogic = $auto_template_logic;
45 47
 	}
46 48
 
47
-	public function connect() {
49
+	public function connect()
50
+	{
48 51
 		$this->conn = mysqli_connect($this->host, $this->user, $this->password);
49 52
 		mysqli_select_db($this->conn, $this->dbname);
50
-		if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset);
53
+		if (function_exists('mysqli_set_charset')) {
54
+		    mysqli_set_charset($this->conn, $this->connection_charset);
55
+		}
51 56
 
52 57
 		$this->dbVersion = 3.23; // assume version 3.23
53 58
 		if(function_exists("mysqli_get_server_info")) {
@@ -59,7 +64,8 @@  discard block
 block discarded – undo
59 64
         mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}");
60 65
 	}
61 66
 
62
-    public function process($filename) {
67
+    public function process($filename)
68
+    {
63 69
 	    global $custom_placeholders;
64 70
 
65 71
 		// check to make sure file exists
@@ -114,7 +120,9 @@  discard block
 block discarded – undo
114 120
 		foreach($sql_array as $sql_entry) {
115 121
 			$sql_do = trim($sql_entry, "\r\n; ");
116 122
 
117
-			if (preg_match('/^\#/', $sql_do)) continue;
123
+			if (preg_match('/^\#/', $sql_do)) {
124
+			    continue;
125
+			}
118 126
 
119 127
 			// strip out comments and \n for mysql 3.x
120 128
 			if ($this->dbVersion <4.0) {
@@ -125,11 +133,15 @@  discard block
 block discarded – undo
125 133
 
126 134
 
127 135
 			$num = $num + 1;
128
-			if ($sql_do) mysqli_query($this->conn, $sql_do);
136
+			if ($sql_do) {
137
+			    mysqli_query($this->conn, $sql_do);
138
+			}
129 139
 			if(mysqli_error($this->conn)) {
130 140
 				// Ignore duplicate and drop errors - Raymond
131
-				if ($this->ignoreDuplicateErrors){
132
-					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue;
141
+				if ($this->ignoreDuplicateErrors) {
142
+					if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) {
143
+					    continue;
144
+					}
133 145
 				}
134 146
 				// End Ignore duplicate
135 147
 				$this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do);
@@ -138,7 +150,8 @@  discard block
 block discarded – undo
138 150
 		}
139 151
 	}
140 152
 
141
-    public function close() {
153
+    public function close()
154
+    {
142 155
 		mysqli_close($this->conn);
143 156
 	}
144 157
 }
Please login to merge, or discard this patch.
install/src/lang.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     'sv' => 'svenska'
38 38
 );
39 39
 $_langISO6391 = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
40
-if (! empty($_langFiles[$_langISO6391])) {
40
+if (!empty($_langFiles[$_langISO6391])) {
41 41
     $install_language = $_langFiles[$_langISO6391];
42 42
 }
43 43
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 }
52 52
 # load language file
53 53
 require_once 'lang/english.inc.php'; // As fallback
54
-require_once 'lang/' . $install_language . '.inc.php';
54
+require_once 'lang/'.$install_language.'.inc.php';
55 55
 
56 56
 $manager_language = $install_language;
57 57
 
Please login to merge, or discard this patch.
install/src/lang/russian-UTF8.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
  *
16 16
  * Please commit your language changes on Transifex (https://www.transifex.com/projects/p/modx-evolution/) or on GitHub (https://github.com/modxcms/evolution).
17 17
  */
18
-setlocale (LC_ALL, 'ru_RU.UTF-8');
18
+setlocale(LC_ALL, 'ru_RU.UTF-8');
19 19
 $_lang["agree_to_terms"] = 'Согласиться с условиями лицензии и приступить к установке';
20 20
 $_lang["alert_database_test_connection"] = 'Вы должны создать базу данных или выбрать базу данных для проверки!';
21 21
 $_lang["alert_database_test_connection_failed"] = 'Неудачная проверка выбранной базы данных!';
Please login to merge, or discard this patch.
install/src/processor/result.php 1 patch
Spacing   +13 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 //:: EVO Installer Setup file
3 3
 //:::::::::::::::::::::::::::::::::::::::::
4
-if (is_file($base_path . 'assets/cache/siteManager.php')) {
5
-    include_once($base_path . 'assets/cache/siteManager.php');
4
+if (is_file($base_path.'assets/cache/siteManager.php')) {
5
+    include_once($base_path.'assets/cache/siteManager.php');
6 6
 }
7 7
 if (!defined('MGR_DIR')) {
8 8
     define('MGR_DIR', 'manager');
9 9
 }
10 10
 
11
-require_once(dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/version.inc.php');
11
+require_once(dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/version.inc.php');
12 12
 
13
-$chunkPath = $base_path . 'install/assets/chunks';
14
-$snippetPath = $base_path . 'install/assets/snippets';
15
-$pluginPath = $base_path . 'install/assets/plugins';
16
-$modulePath = $base_path . 'install/assets/modules';
17
-$templatePath = $base_path . 'install/assets/templates';
18
-$tvPath = $base_path . 'install/assets/tvs';
13
+$chunkPath = $base_path.'install/assets/chunks';
14
+$snippetPath = $base_path.'install/assets/snippets';
15
+$pluginPath = $base_path.'install/assets/plugins';
16
+$modulePath = $base_path.'install/assets/modules';
17
+$templatePath = $base_path.'install/assets/templates';
18
+$tvPath = $base_path.'install/assets/tvs';
19 19
 
20 20
 // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category
21 21
 $mt = &$moduleTemplates;
@@ -28,8 +28,7 @@  discard block
 block discarded – undo
28 28
         $params = parse_docblock($templatePath, $tplfile);
29 29
         if (is_array($params) && (count($params) > 0)) {
30 30
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
31
-            $mt[] = array
32
-            (
31
+            $mt[] = array(
33 32
                 $params['name'],
34 33
                 $description,
35 34
                 // Don't think this is gonna be used ... but adding it just in case 'type'
@@ -149,7 +148,7 @@  discard block
 block discarded – undo
149 148
                 $params['modx_category'],
150 149
                 $params['legacy_names'],
151 150
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false,
152
-                (int)$params['disabled']
151
+                (int) $params['disabled']
153 152
             );
154 153
         }
155 154
     }
@@ -174,12 +173,12 @@  discard block
 block discarded – undo
174 173
                 "$modulePath/{$params['filename']}",
175 174
                 $params['properties'],
176 175
                 $params['guid'],
177
-                (int)$params['shareparams'],
176
+                (int) $params['shareparams'],
178 177
                 $params['modx_category'],
179 178
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
180 179
             );
181 180
         }
182
-        if ((int)$params['shareparams'] || !empty($params['dependencies'])) {
181
+        if ((int) $params['shareparams'] || !empty($params['dependencies'])) {
183 182
             $dependencies = explode(',', $params['dependencies']);
184 183
             foreach ($dependencies as $dependency) {
185 184
                 $dependency = explode(':', $dependency);
Please login to merge, or discard this patch.