Completed
Pull Request — develop (#740)
by Maxim
08:32
created
manager/media/calendar/datepicker.inc.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,10 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-class DATEPICKER {
4
-	function __construct() {
3
+class DATEPICKER
4
+{
5
+	function __construct()
6
+	{
5 7
 	}
6 8
 
7
-	function getDP() {
9
+	function getDP()
10
+	{
8 11
 		$modx = evolutionCMS(); global $_lang;
9 12
 
10 13
 		$tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl');
Please login to merge, or discard this patch.
manager/media/style/common/moo-datepicker/datepicker.inc.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,11 @@
 block discarded – undo
1 1
 <?php
2
-class DATEPICKER {
3
-    function __construct() {
2
+class DATEPICKER
3
+{
4
+    function __construct()
5
+    {
4 6
     }
5
-    function getDP() {
7
+    function getDP()
8
+    {
6 9
         $modx = evolutionCMS(); global$_lang;
7 10
 
8 11
         $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl');
Please login to merge, or discard this patch.
manager/media/script/air-datepicker/datepicker.inc.php 1 patch
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,13 +1,17 @@  discard block
 block discarded – undo
1 1
 <?php
2
-class DATEPICKER {
2
+class DATEPICKER
3
+{
3 4
     /**
4 5
      * @return string
5 6
      */
6
-    public function getDP() {
7
+    public function getDP()
8
+    {
7 9
         $modx = evolutionCMS();
8 10
 
9 11
         $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl');
10
-        if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode();
12
+        if(!isset($modx->config['lang_code'])) {
13
+            $modx->config['lang_code'] = $this->getLangCode();
14
+        }
11 15
 		$modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy';
12 16
         return $modx->mergeSettingsContent($load_script);
13 17
     }
@@ -15,13 +19,18 @@  discard block
 block discarded – undo
15 19
     /**
16 20
      * @return string
17 21
      */
18
-    public function getLangCode() {
22
+    public function getLangCode()
23
+    {
19 24
         $modx = evolutionCMS(); global $modx_lang_attribute;
20 25
 
21
-        if(!$modx_lang_attribute) return 'en';
26
+        if(!$modx_lang_attribute) {
27
+            return 'en';
28
+        }
22 29
 
23 30
         $lc = $modx_lang_attribute;
24
-        if($lc === 'uk') return 'ru';
31
+        if($lc === 'uk') {
32
+            return 'ru';
33
+        }
25 34
         $dp_path = str_replace('\\','/',dirname(__FILE__));
26 35
 
27 36
         return (is_file("{$dp_path}/i18n/datepicker.{$lc}.js")) ? $modx_lang_attribute : 'en';
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab6_filemanager_settings.inc.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,9 @@
 block discarded – undo
113 113
         <?php
114 114
             // invoke OnMiscSettingsRender event
115 115
             $evtOut = $modx->invokeEvent('OnFileManagerSettingsRender');
116
-            if(is_array($evtOut)) echo implode("",$evtOut);
116
+            if(is_array($evtOut)) {
117
+                echo implode("",$evtOut);
118
+            }
117 119
         ?>
118 120
     </td>
119 121
   </tr>
Please login to merge, or discard this patch.
manager/includes/header.inc.php 1 patch
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />
4 4
     Please use the EVO Content Manager instead of accessing this file directly.");
5 5
 }
@@ -10,26 +10,26 @@  discard block
 block discarded – undo
10 10
 $modx_textdir = isset($modx_textdir) ? $modx_textdir : null;
11 11
 $onManagerMainFrameHeaderHTMLBlock = is_array($evtOut) ? implode("\n", $evtOut) : '';
12 12
 $textdir = $modx_textdir === 'rtl' ? 'rtl' : 'ltr';
13
-if (!isset($modx->config['mgr_jquery_path'])) {
13
+if (!isset($modx->config['mgr_jquery_path'])) {
14 14
     $modx->config['mgr_jquery_path'] = 'media/script/jquery/jquery.min.js';
15 15
 }
16
-if (!isset($modx->config['mgr_date_picker_path'])) {
16
+if (!isset($modx->config['mgr_date_picker_path'])) {
17 17
     $modx->config['mgr_date_picker_path'] = 'media/script/air-datepicker/datepicker.inc.php';
18 18
 }
19 19
 
20 20
 $body_class = '';
21 21
 $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness');
22
-if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) {
22
+if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) {
23 23
     $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']];
24
-} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) {
24
+} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) {
25 25
     $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']];
26 26
 }
27 27
 
28 28
 $css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime;
29 29
 
30
-if ($modx->config['manager_theme'] == 'default') {
30
+if ($modx->config['manager_theme'] == 'default') {
31 31
     if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')
32
-        && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
32
+        && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
33 33
         $files = array(
34 34
             'bootstrap' => MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css',
35 35
             'font-awesome' => MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css',
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             'source' => 'manager',
49 49
             'theme' => $modx->config['manager_theme']
50 50
         ));
51
-        switch (true) {
51
+        switch (true) {
52 52
             case empty($evtOut):
53 53
             case is_array($evtOut) && count($evtOut) === 0:
54 54
                 break;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             $css
67 67
         );
68 68
     }
69
-    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
69
+    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
70 70
         $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime;
71 71
     }
72 72
 }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     <script src="media/script/main.js"></script>
125 125
     <script>
126 126
         <?php
127
-        if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
127
+        if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
128 128
             echo 'doRefresh(' . $_REQUEST['r'] . ");\n";
129 129
         }
130 130
         ?>
Please login to merge, or discard this patch.
install/src/controllers/mode.php 1 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 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/summary.php 1 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.
install/src/sqlParser.class.php 1 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.