Completed
Push — develop ( 6a553b...48041c )
by Agel_Nash
06:37
created
install/src/functions.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! function_exists('getLangOptions')) {
2
+if (!function_exists('getLangOptions')) {
3 3
     /**
4 4
      * @param string $install_language
5 5
      * @return string
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     function getLangOptions($install_language = 'english')
8 8
     {
9 9
         $langs = array();
10
-        if ($handle = opendir(__DIR__ . '/lang/')) {
10
+        if ($handle = opendir(__DIR__.'/lang/')) {
11 11
             while (false !== ($file = readdir($handle))) {
12 12
                 if (strpos($file, '.')) {
13 13
                     $langs[] = str_replace('.inc.php', '', $file);
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
             $abrv_language = explode('-', $language);
22 22
             $selected = ($language === $install_language) ? 'selected' : '';
23 23
             $_[] = sprintf('<option value="%s" %s>%s</option>', $language, $selected,
24
-                    ucwords($abrv_language[0])) . "\n";
24
+                    ucwords($abrv_language[0]))."\n";
25 25
         }
26 26
 
27 27
         return implode("\n", $_);
28 28
     }
29 29
 }
30 30
 
31
-if (! function_exists('install_sessionCheck')) {
31
+if (!function_exists('install_sessionCheck')) {
32 32
     function install_sessionCheck()
33 33
     {
34 34
         global $_lang;
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 </head>
51 51
 <body>
52 52
 	<div class="install">
53
-		<p>' . $_lang["session_problem"] . '</p>
54
-		<p><a href="./">' . $_lang["session_problem_try_again"] . '</a></p>
53
+		<p>' . $_lang["session_problem"].'</p>
54
+		<p><a href="./">' . $_lang["session_problem_try_again"].'</a></p>
55 55
 	</div>
56 56
 </body>
57 57
 </html>';
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     function parse($src, $ph, $left = '[+', $right = '+]')
73 73
     {
74 74
         foreach ($ph as $k => $v) {
75
-            $k = $left . $k . $right;
75
+            $k = $left.$k.$right;
76 76
             $src = str_replace($k, $v, $src);
77 77
         }
78 78
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $ph['textdir'] = $modx_textdir ? ' id="rtl"' : '';
100 100
         $ph['help_link'] = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd'];
101 101
         $ph['version'] = $moduleVersion;
102
-        $ph['release_date'] = ($modx_textdir ? '&rlm;' : '') . $modx_release_date;
102
+        $ph['release_date'] = ($modx_textdir ? '&rlm;' : '').$modx_release_date;
103 103
         $ph['footer1'] = $_lang['modx_footer1'];
104 104
         $ph['footer2'] = $_lang['modx_footer2'];
105 105
         $ph['current_year'] = date('Y');
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             $manager_language = "english";
185 185
         }
186 186
         $langs = array();
187
-        if ($handle = opendir(dirname(dirname(__DIR__)) . '/' . MGR_DIR . '/includes/lang')) {
187
+        if ($handle = opendir(dirname(dirname(__DIR__)).'/'.MGR_DIR.'/includes/lang')) {
188 188
             while (false !== ($file = readdir($handle))) {
189 189
                 if (strpos($file, '.inc.') !== false) {
190 190
                     $langs[] = $file;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
             $i++;
251 251
         }
252 252
 
253
-        return (0 < count($_)) ? '<h3>[%templates%]</h3>' . implode("\n", $_) : '';
253
+        return (0 < count($_)) ? '<h3>[%templates%]</h3>'.implode("\n", $_) : '';
254 254
     }
255 255
 }
256 256
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
             $i++;
281 281
         }
282 282
 
283
-        return (0 < count($_)) ? '<h3>[%tvs%]</h3>' . implode("\n", $_) : '';
283
+        return (0 < count($_)) ? '<h3>[%tvs%]</h3>'.implode("\n", $_) : '';
284 284
     }
285 285
 }
286 286
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
             $i++;
312 312
         }
313 313
 
314
-        return (0 < count($_)) ? '<h3>[%chunks%]</h3>' . implode("\n", $_) : '';
314
+        return (0 < count($_)) ? '<h3>[%chunks%]</h3>'.implode("\n", $_) : '';
315 315
     }
316 316
 }
317 317
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             $i++;
343 343
         }
344 344
 
345
-        return (0 < count($_)) ? '<h3>[%modules%]</h3>' . implode("\n", $_) : '';
345
+        return (0 < count($_)) ? '<h3>[%modules%]</h3>'.implode("\n", $_) : '';
346 346
     }
347 347
 }
348 348
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
             $i++;
378 378
         }
379 379
 
380
-        return (0 < count($_)) ? '<h3>[%plugins%]</h3>' . implode("\n", $_) : '';
380
+        return (0 < count($_)) ? '<h3>[%plugins%]</h3>'.implode("\n", $_) : '';
381 381
     }
382 382
 }
383 383
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
             $i++;
409 409
         }
410 410
 
411
-        return (0 < count($_)) ? '<h3>[%snippets%]</h3>' . implode("\n", $_) : '';
411
+        return (0 < count($_)) ? '<h3>[%snippets%]</h3>'.implode("\n", $_) : '';
412 412
     }
413 413
 }
414 414
 
@@ -419,46 +419,46 @@  discard block
 block discarded – undo
419 419
 
420 420
         // secure web documents - privateweb
421 421
         mysqli_query($sqlParser->conn,
422
-            "UPDATE `" . $sqlParser->prefix . "site_content` SET privateweb = 0 WHERE privateweb = 1");
422
+            "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1");
423 423
         $sql = "SELECT DISTINCT sc.id
424
-             FROM `" . $sqlParser->prefix . "site_content` sc
425
-             LEFT JOIN `" . $sqlParser->prefix . "document_groups` dg ON dg.document = sc.id
426
-             LEFT JOIN `" . $sqlParser->prefix . "webgroup_access` wga ON wga.documentgroup = dg.document_group
424
+             FROM `" . $sqlParser->prefix."site_content` sc
425
+             LEFT JOIN `" . $sqlParser->prefix."document_groups` dg ON dg.document = sc.id
426
+             LEFT JOIN `" . $sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group
427 427
              WHERE wga.id>0";
428 428
         $ds = mysqli_query($sqlParser->conn, $sql);
429 429
         if (!$ds) {
430
-            echo "An error occurred while executing a query: " . mysqli_error($sqlParser->conn);
430
+            echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
431 431
         } else {
432 432
             while ($r = mysqli_fetch_assoc($ds)) {
433 433
                 $ids[] = $r["id"];
434 434
             }
435 435
             if (count($ids) > 0) {
436 436
                 mysqli_query($sqlParser->conn,
437
-                    "UPDATE `" . $sqlParser->prefix . "site_content` SET privateweb = 1 WHERE id IN (" . implode(", ",
438
-                        $ids) . ")");
437
+                    "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",
438
+                        $ids).")");
439 439
                 unset($ids);
440 440
             }
441 441
         }
442 442
 
443 443
         // secure manager documents privatemgr
444 444
         mysqli_query($sqlParser->conn,
445
-            "UPDATE `" . $sqlParser->prefix . "site_content` SET privatemgr = 0 WHERE privatemgr = 1");
445
+            "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1");
446 446
         $sql = "SELECT DISTINCT sc.id
447
-             FROM `" . $sqlParser->prefix . "site_content` sc
448
-             LEFT JOIN `" . $sqlParser->prefix . "document_groups` dg ON dg.document = sc.id
449
-             LEFT JOIN `" . $sqlParser->prefix . "membergroup_access` mga ON mga.documentgroup = dg.document_group
447
+             FROM `" . $sqlParser->prefix."site_content` sc
448
+             LEFT JOIN `" . $sqlParser->prefix."document_groups` dg ON dg.document = sc.id
449
+             LEFT JOIN `" . $sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group
450 450
              WHERE mga.id>0";
451 451
         $ds = mysqli_query($sqlParser->conn, $sql);
452 452
         if (!$ds) {
453
-            echo "An error occurred while executing a query: " . mysqli_error($sqlParser->conn);
453
+            echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
454 454
         } else {
455 455
             while ($r = mysqli_fetch_assoc($ds)) {
456 456
                 $ids[] = $r["id"];
457 457
             }
458 458
             if (count($ids) > 0) {
459 459
                 mysqli_query($sqlParser->conn,
460
-                    "UPDATE `" . $sqlParser->prefix . "site_content` SET privatemgr = 1 WHERE id IN (" . implode(", ",
461
-                        $ids) . ")");
460
+                    "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",
461
+                        $ids).")");
462 462
                 unset($ids);
463 463
             }
464 464
         }
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
     function parse_docblock($element_dir, $filename)
470 470
     {
471 471
         $params = array();
472
-        $fullpath = $element_dir . '/' . $filename;
472
+        $fullpath = $element_dir.'/'.$filename;
473 473
         if (is_readable($fullpath)) {
474 474
             $tpl = @fopen($fullpath, "r");
475 475
             if ($tpl) {
@@ -688,17 +688,17 @@  discard block
 block discarded – undo
688 688
     function getCreateDbCategory($category, $sqlParser)
689 689
     {
690 690
         $dbase = $sqlParser->dbname;
691
-        $dbase = '`' . trim($dbase, '`') . '`';
691
+        $dbase = '`'.trim($dbase, '`').'`';
692 692
         $table_prefix = $sqlParser->prefix;
693 693
         $category_id = 0;
694 694
         if (!empty($category)) {
695 695
             $category = mysqli_real_escape_string($sqlParser->conn, $category);
696 696
             $rs = mysqli_query($sqlParser->conn,
697
-                "SELECT id FROM $dbase.`" . $table_prefix . "categories` WHERE category = '" . $category . "'");
697
+                "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'");
698 698
             if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
699 699
                 $category_id = $row['id'];
700 700
             } else {
701
-                $q = "INSERT INTO $dbase.`" . $table_prefix . "categories` (`category`) VALUES ('{$category}');";
701
+                $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');";
702 702
                 $rs = mysqli_query($sqlParser->conn, $q);
703 703
                 if ($rs) {
704 704
                     $category_id = mysqli_insert_id($sqlParser->conn);
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
             default:
741 741
                 return $cleaned;
742 742
         };
743
-        if (substr(trim($cleaned), 0, $count) == $include . ' MODX_BASE_PATH.\'assets/' . $elm_name . '/') {
743
+        if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') {
744 744
             return $cleaned;
745 745
         }
746 746
 
Please login to merge, or discard this patch.
install/src/controllers/mode.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Determine upgradeability
3 3
 $upgradeable = 0;
4
-if (is_file($base_path . MGR_DIR . '/includes/config.inc.php')) { // Include the file so we can test its validity
5
-    include_once $base_path . MGR_DIR . '/includes/config.inc.php';
4
+if (is_file($base_path.MGR_DIR.'/includes/config.inc.php')) { // Include the file so we can test its validity
5
+    include_once $base_path.MGR_DIR.'/includes/config.inc.php';
6 6
     // We need to have all connection settings - tho prefix may be empty so we have to ignore it
7 7
     if (isset($dbase)) {
8 8
         if (!$conn = @mysqli_connect($database_server, $database_user, $database_password))
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 }
18 18
 
19 19
 $ph['moduleName']       = $moduleName;
20
-$ph['displayNew']       = ($upgradeable!=0) ? 'display:none;' : '';
21
-$ph['displayUpg']       = ($upgradeable==0) ? 'display:none;' : '';
20
+$ph['displayNew']       = ($upgradeable != 0) ? 'display:none;' : '';
21
+$ph['displayUpg']       = ($upgradeable == 0) ? 'display:none;' : '';
22 22
 $ph['displayAdvUpg']    = $ph['displayUpg'];
23
-$ph['checkedNew']       = !$upgradeable     ? 'checked' : '';
24
-$ph['checkedUpg']       = ($_POST['installmode']==1 || $upgradeable==1) ? 'checked' : '';
25
-$ph['checkedAdvUpg']    = ($_POST['installmode']==2 || $upgradeable==2) ? 'checked' : '';
23
+$ph['checkedNew']       = !$upgradeable ? 'checked' : '';
24
+$ph['checkedUpg']       = ($_POST['installmode'] == 1 || $upgradeable == 1) ? 'checked' : '';
25
+$ph['checkedAdvUpg']    = ($_POST['installmode'] == 2 || $upgradeable == 2) ? 'checked' : '';
26 26
 $ph['install_language'] = $install_language;
27
-$ph['disabledUpg']      = ($upgradeable!=1) ? 'disabled' : '';
28
-$ph['disabledAdvUpg']   = ($upgradeable==0) ? 'disabled' : '';
27
+$ph['disabledUpg']      = ($upgradeable != 1) ? 'disabled' : '';
28
+$ph['disabledAdvUpg']   = ($upgradeable == 0) ? 'disabled' : '';
29 29
 
30
-$tpl = file_get_contents(dirname(__DIR__) . '/template/actions/mode.tpl');
30
+$tpl = file_get_contents(dirname(__DIR__).'/template/actions/mode.tpl');
31 31
 $content = parse($tpl, $ph);
32
-echo parse($content, $_lang,'[%','%]');
32
+echo parse($content, $_lang, '[%', '%]');
Please login to merge, or discard this patch.
Braces   +12 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,20 +1,22 @@
 block discarded – undo
1 1
 <?php
2 2
 // Determine upgradeability
3 3
 $upgradeable = 0;
4
-if (is_file($base_path . MGR_DIR . '/includes/config.inc.php')) { // Include the file so we can test its validity
4
+if (is_file($base_path . MGR_DIR . '/includes/config.inc.php')) {
5
+// Include the file so we can test its validity
5 6
     include_once $base_path . MGR_DIR . '/includes/config.inc.php';
6 7
     // We need to have all connection settings - tho prefix may be empty so we have to ignore it
7 8
     if (isset($dbase)) {
8
-        if (!$conn = @mysqli_connect($database_server, $database_user, $database_password))
9
-            $upgradeable = isset($_POST['installmode']) && $_POST['installmode'] == 'new' ? 0 : 2;
10
-        elseif (!@mysqli_select_db($conn, trim($dbase, '`')))
11
-            $upgradeable = isset($_POST['installmode']) && $_POST['installmode'] == 'new' ? 0 : 2;
12
-        else
13
-            $upgradeable = 1;
9
+        if (!$conn = @mysqli_connect($database_server, $database_user, $database_password)) {
10
+                    $upgradeable = isset($_POST['installmode']) && $_POST['installmode'] == 'new' ? 0 : 2;
11
+        } elseif (!@mysqli_select_db($conn, trim($dbase, '`'))) {
12
+                    $upgradeable = isset($_POST['installmode']) && $_POST['installmode'] == 'new' ? 0 : 2;
13
+        } else {
14
+                    $upgradeable = 1;
15
+        }
16
+    } else {
17
+            $upgradeable = 2;
18
+    }
14 19
     }
15
-    else
16
-        $upgradeable = 2;
17
-}
18 20
 
19 21
 $ph['moduleName']       = $moduleName;
20 22
 $ph['displayNew']       = ($upgradeable!=0) ? 'display:none;' : '';
Please login to merge, or discard this patch.
install/src/controllers/options.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2
-$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0;
2
+$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0;
3 3
 
4
-switch($installMode){
4
+switch ($installMode) {
5 5
     case 0:
6 6
     case 2:
7 7
         $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci';
8 8
         $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
9 9
         $_POST['database_connection_charset'] = $database_charset;
10
-        if(empty($_SESSION['databaseloginpassword']))
10
+        if (empty($_SESSION['databaseloginpassword']))
11 11
             $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword'];
12
-        if(empty($_SESSION['databaseloginname']))
12
+        if (empty($_SESSION['databaseloginname']))
13 13
             $_SESSION['databaseloginname'] = $_POST['databaseloginname'];
14 14
         break;
15 15
     case 1:
16
-        include $base_path . MGR_DIR . '/includes/config.inc.php';
16
+        include $base_path.MGR_DIR.'/includes/config.inc.php';
17 17
         if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) {
18 18
             if (@ mysqli_query($conn, "USE {$dbase}")) {
19 19
                 if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 $ph['checked'] = isset ($_POST['installdata']) && $_POST['installdata'] == "1" ? 'checked' : '';
69 69
 
70 70
 # load setup information file
71
-include_once dirname(__DIR__) . '/processor/result.php';
71
+include_once dirname(__DIR__).'/processor/result.php';
72 72
 $ph['templates'] = getTemplates($moduleTemplates);
73 73
 $ph['tvs']       = getTVs($moduleTVs);
74 74
 $ph['chunks']    = getChunks($moduleChunks);
@@ -78,6 +78,6 @@  discard block
 block discarded – undo
78 78
 
79 79
 $ph['action'] = ($installMode == 1) ? 'mode' : 'connection';
80 80
 
81
-$tpl = file_get_contents(dirname(__DIR__) . '/template/actions/options.tpl');
81
+$tpl = file_get_contents(dirname(__DIR__).'/template/actions/options.tpl');
82 82
 $content = parse($tpl, $ph);
83 83
 echo parse($content, $_lang, '[%', '%]');
Please login to merge, or discard this patch.
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,16 +1,18 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 $installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0;
3 3
 
4
-switch($installMode){
4
+switch($installMode) {
5 5
     case 0:
6 6
     case 2:
7 7
         $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci';
8 8
         $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
9 9
         $_POST['database_connection_charset'] = $database_charset;
10
-        if(empty($_SESSION['databaseloginpassword']))
11
-            $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword'];
12
-        if(empty($_SESSION['databaseloginname']))
13
-            $_SESSION['databaseloginname'] = $_POST['databaseloginname'];
10
+        if(empty($_SESSION['databaseloginpassword'])) {
11
+                    $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword'];
12
+        }
13
+        if(empty($_SESSION['databaseloginname'])) {
14
+                    $_SESSION['databaseloginname'] = $_POST['databaseloginname'];
15
+        }
14 16
         break;
15 17
     case 1:
16 18
         include $base_path . MGR_DIR . '/includes/config.inc.php';
@@ -24,7 +26,9 @@  discard block
 block discarded – undo
24 26
                 }
25 27
             }
26 28
         }
27
-        if (empty ($database_collation)) $database_collation = 'utf8_general_ci';
29
+        if (empty ($database_collation)) {
30
+            $database_collation = 'utf8_general_ci';
31
+        }
28 32
 
29 33
         $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
30 34
         if (!isset ($database_connection_charset) || empty ($database_connection_charset)) {
@@ -33,7 +37,9 @@  discard block
 block discarded – undo
33 37
 
34 38
         if (!isset ($database_connection_method) || empty ($database_connection_method)) {
35 39
             $database_connection_method = 'SET CHARACTER SET';
36
-            if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_connection_charset);
40
+            if (function_exists('mysqli_set_charset')) {
41
+                mysqli_set_charset($conn, $database_connection_charset);
42
+            }
37 43
         }
38 44
         if ($database_connection_method != 'SET NAMES' && $database_connection_charset != $database_charset) {
39 45
             $database_connection_method = 'SET NAMES';
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     case 1:
16 16
         include $base_path . MGR_DIR . '/includes/config.inc.php';
17 17
         if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) {
18
-            if (@ mysqli_query($conn, "USE {$dbase}")) {
18
+            if (@ mysqli_query($conn, "use {$dbase}")) {
19 19
                 if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) {
20 20
                     $rs = mysqli_query($conn, "show session variables like 'collation_server'");
21 21
                 }
Please login to merge, or discard this patch.
install/src/controllers/connection/databasetest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 $output = $_lang["status_checking_database"];
9 9
 if (!$conn = mysqli_connect($host, $uid, $pwd)) {
10
-    $output .= '<span id="database_fail" style="color:#FF0000;">' . $_lang['status_failed'] . '</span>';
10
+    $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed'].'</span>';
11 11
 } else {
12 12
     $database_name = mysqli_real_escape_string($conn, $_POST['database_name']);
13 13
     $database_name = str_replace("`", "", $database_name);
@@ -18,22 +18,22 @@  discard block
 block discarded – undo
18 18
     if (!@ mysqli_select_db($conn, $database_name)) {
19 19
         // create database
20 20
         $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
21
-        $query = "CREATE DATABASE `" . $database_name . "` CHARACTER SET " . $database_charset . " COLLATE " . $database_collation . ";";
21
+        $query = "CREATE DATABASE `".$database_name."` CHARACTER SET ".$database_charset." COLLATE ".$database_collation.";";
22 22
 
23 23
         if (!mysqli_query($conn, $query)) {
24
-            $output .= '<span id="database_fail" style="color:#FF0000;">' . $_lang['status_failed_could_not_create_database'] . '</span>';
24
+            $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_could_not_create_database'].'</span>';
25 25
         } else {
26
-            $output .= '<span id="database_pass" style="color:#80c000;">' . $_lang['status_passed_database_created'] . '</span>';
26
+            $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed_database_created'].'</span>';
27 27
         }
28 28
     } elseif (($installMode == 0) && (mysqli_query($conn,
29 29
             "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) {
30
-        $output .= '<span id="database_fail" style="color:#FF0000;">' . $_lang['status_failed_table_prefix_already_in_use'] . '</span>';
30
+        $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_table_prefix_already_in_use'].'</span>';
31 31
     } elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn,
32 32
             "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) {
33
-        $output .= '<span id="database_fail" style="color:#FF0000;">' . sprintf($_lang['status_failed_database_collation_does_not_match'],
34
-                $row[1]) . '</span>';
33
+        $output .= '<span id="database_fail" style="color:#FF0000;">'.sprintf($_lang['status_failed_database_collation_does_not_match'],
34
+                $row[1]).'</span>';
35 35
     } else {
36
-        $output .= '<span id="database_pass" style="color:#80c000;">' . $_lang['status_passed'] . '</span>';
36
+        $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed'].'</span>';
37 37
     }
38 38
 }
39 39
 
Please login to merge, or discard this patch.
install/src/controllers/connection/servertest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
 $output = $_lang["status_connecting"];
8 8
 if (function_exists('mysqli_connect')) {
9 9
     if (!$conn = @mysqli_connect($host, $uid, $pwd)) {
10
-        $output .= '<span id="server_fail" style="color:#FF0000;"> ' . $_lang['status_failed'] . '</span>';
10
+        $output .= '<span id="server_fail" style="color:#FF0000;"> '.$_lang['status_failed'].'</span>';
11 11
     } else {
12
-        $output .= '<span id="server_pass" style="color:#80c000;"> ' . $_lang['status_passed_server'] . '</span>';
12
+        $output .= '<span id="server_pass" style="color:#80c000;"> '.$_lang['status_passed_server'].'</span>';
13 13
 
14 14
         // Mysql version check
15 15
         if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) {
16
-            $output .= '<br /><span style="color:#FF0000;"> ' . $_lang['mysql_5051'] . '</span>';
16
+            $output .= '<br /><span style="color:#FF0000;"> '.$_lang['mysql_5051'].'</span>';
17 17
         }
18 18
         // Mode check
19 19
         $mysqlmode = mysqli_query($conn, "SELECT @@session.sql_mode");
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
                 }
27 27
             }
28 28
             if ($strictMode) {
29
-                $output .= '<br /><span style="color:#FF0000;"> ' . $_lang['strict_mode'] . '</span>';
29
+                $output .= '<br /><span style="color:#FF0000;"> '.$_lang['strict_mode'].'</span>';
30 30
             }
31 31
         }
32 32
     }
33 33
 } else {
34
-    $output .= '<span id="server_fail" style="color:#FF0000;"> ' . $_lang['status_failed_mysqli'] . '</span>';
34
+    $output .= '<span id="server_fail" style="color:#FF0000;"> '.$_lang['status_failed_mysqli'].'</span>';
35 35
 }
36 36
 echo $output;
Please login to merge, or discard this patch.
install/src/controllers/language.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$content = file_get_contents(dirname(__DIR__) . '/template/actions/language.tpl');
3
+$content = file_get_contents(dirname(__DIR__).'/template/actions/language.tpl');
4 4
 $content = parse($content, array(
5 5
     'langOptions' => getLangOptions($install_language))
6 6
 );
7
-$content = parse($content, $_lang,'[%','%]');
7
+$content = parse($content, $_lang, '[%', '%]');
8 8
 
9 9
 echo $content;
Please login to merge, or discard this patch.
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/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.