Completed
Pull Request — develop (#714)
by Agel_Nash
15:06 queued 06:49
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
 
@@ -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.