Completed
Push — develop ( acc675...3313cf )
by Dmytro
12:18
created
install/src/controllers/options.php 1 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.
install/src/controllers/install.php 1 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
 define('MODX_CLI', false);
@@ -70,13 +70,15 @@  discard block
 block discarded – undo
70 70
 
71 71
 // get base path and url
72 72
 $a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"])));
73
-if (count($a) > 1)
73
+if (count($a) > 1) {
74 74
     array_pop($a);
75
+}
75 76
 $url = implode("install", $a);
76 77
 reset($a);
77 78
 $a = explode("install", str_replace("\\", "/", realpath(__DIR__)));
78
-if (count($a) > 1)
79
+if (count($a) > 1) {
79 80
     array_pop($a);
81
+}
80 82
 $pth = implode("install", $a);
81 83
 unset ($a);
82 84
 $base_url = $url . (substr($url, -1) != "/" ? "/" : "");
@@ -97,7 +99,9 @@  discard block
 block discarded – undo
97 99
     echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>";
98 100
     $create = true;
99 101
 } else {
100
-    if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset);
102
+    if (function_exists('mysqli_set_charset')) {
103
+        mysqli_set_charset($conn, $database_charset);
104
+    }
101 105
     mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}");
102 106
     echo '<span class="ok">'.$_lang['ok']."</span></p>";
103 107
 }
@@ -199,7 +203,7 @@  discard block
 block discarded – undo
199 203
 // custom or not
200 204
 if (file_exists(__DIR__."/../../assets/cache/siteManager.php")) {
201 205
     $mgrdir = 'include_once(__DIR__."/../../assets/cache/siteManager.php");';
202
-}else{
206
+} else {
203 207
     $mgrdir = 'define(\'MGR_DIR\', \'manager\');';
204 208
 }
205 209
 
@@ -335,7 +339,9 @@  discard block
 block discarded – undo
335 339
                         echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
336 340
                         return;
337 341
                     }
338
-                    if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
342
+                    if(!is_null($save_sql_id_as)) {
343
+                        $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
344
+                    }
339 345
                     echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
340 346
                 }
341 347
             }
@@ -429,9 +435,9 @@  discard block
 block discarded – undo
429 435
             $overwrite = mysqli_real_escape_string($conn, $moduleChunk[4]);
430 436
             $filecontent = $moduleChunk[2];
431 437
 
432
-            if (!file_exists($filecontent))
433
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
434
-            else {
438
+            if (!file_exists($filecontent)) {
439
+                            echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
440
+            } else {
435 441
 
436 442
                 // Create the category if it does not already exist
437 443
                 $category_id = getCreateDbCategory($category, $sqlParser);
@@ -483,9 +489,9 @@  discard block
 block discarded – undo
483 489
             $guid = mysqli_real_escape_string($conn, $moduleModule[4]);
484 490
             $shared = mysqli_real_escape_string($conn, $moduleModule[5]);
485 491
             $category = mysqli_real_escape_string($conn, $moduleModule[6]);
486
-            if (!file_exists($filecontent))
487
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
488
-            else {
492
+            if (!file_exists($filecontent)) {
493
+                            echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
494
+            } else {
489 495
 
490 496
                 // Create the category if it does not already exist
491 497
                 $category = getCreateDbCategory($category, $sqlParser);
@@ -535,9 +541,9 @@  discard block
 block discarded – undo
535 541
                 // parse comma-separated legacy names and prepare them for sql IN clause
536 542
                 $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'";
537 543
             }
538
-            if (!file_exists($filecontent))
539
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
540
-            else {
544
+            if (!file_exists($filecontent)) {
545
+                            echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
546
+            } else {
541 547
 
542 548
                 // disable legacy versions based on legacy_names provided
543 549
                 if(!empty($leg_names)) {
@@ -556,7 +562,7 @@  discard block
 block discarded – undo
556 562
                     $insert = true;
557 563
                     while($row = mysqli_fetch_assoc($rs)) {
558 564
                         $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
559
-                        if($row['description'] == $desc){
565
+                        if($row['description'] == $desc) {
560 566
                             if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
561 567
                                 echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
562 568
                                 return;
@@ -614,9 +620,9 @@  discard block
 block discarded – undo
614 620
             $filecontent = $moduleSnippet[2];
615 621
             $properties = $moduleSnippet[3];
616 622
             $category = mysqli_real_escape_string($conn, $moduleSnippet[4]);
617
-            if (!file_exists($filecontent))
618
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
619
-            else {
623
+            if (!file_exists($filecontent)) {
624
+                            echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
625
+            } else {
620 626
 
621 627
                 // Create the category if it does not already exist
622 628
                 $category = getCreateDbCategory($category, $sqlParser);
@@ -724,13 +730,16 @@  discard block
 block discarded – undo
724 730
 }
725 731
 
726 732
 // call back function
727
-if ($callBackFnc != "")
733
+if ($callBackFnc != "") {
728 734
     $callBackFnc ($sqlParser);
735
+}
729 736
 
730 737
 // Setup the MODX API -- needed for the cache processor
731 738
 define('MODX_API_MODE', true);
732 739
 define('MODX_BASE_PATH', $base_path);
733
-if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
740
+if (!defined('MODX_MANAGER_PATH')) {
741
+    define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
742
+}
734 743
 $database_type = 'mysqli';
735 744
 // initiate a new document parser
736 745
 include_once('../'.MGR_DIR.'/includes/document.parser.class.inc.php');
Please login to merge, or discard this patch.