Completed
Push — develop ( 49fa03...44ee86 )
by Dmytro
14s
created
manager/index.php 1 patch
Braces   +37 added lines, -18 removed lines patch added patch discarded remove patch
@@ -61,9 +61,13 @@  discard block
 block discarded – undo
61 61
 $mgr_dir   = substr($self_dir,strrpos($self_dir,'/')+1);
62 62
 $base_path = str_replace($mgr_dir . '/index.php','',$self);
63 63
 $site_mgr_path = $base_path . 'assets/cache/siteManager.php';
64
-if(is_file($site_mgr_path)) include_once($site_mgr_path);
64
+if(is_file($site_mgr_path)) {
65
+    include_once($site_mgr_path);
66
+}
65 67
 $site_hostnames_path = $base_path . 'assets/cache/siteHostnames.php';
66
-if(is_file($site_hostnames_path)) include_once($site_hostnames_path);
68
+if(is_file($site_hostnames_path)) {
69
+    include_once($site_hostnames_path);
70
+}
67 71
 if(!defined('MGR_DIR') || MGR_DIR!==$mgr_dir) {
68 72
 	$src = "<?php\n";
69 73
 	$src .= "define('MGR_DIR', '{$mgr_dir}');\n";
@@ -117,9 +121,15 @@  discard block
 block discarded – undo
117 121
 $incPath = str_replace("\\","/",dirname(__FILE__)."/includes/"); // Mod by Raymond
118 122
 set_include_path(get_include_path() . PATH_SEPARATOR . $incPath);
119 123
 
120
-if (!defined('ENT_COMPAT')) define('ENT_COMPAT', 2);
121
-if (!defined('ENT_NOQUOTES')) define('ENT_NOQUOTES', 0);
122
-if (!defined('ENT_QUOTES')) define('ENT_QUOTES', 3);
124
+if (!defined('ENT_COMPAT')) {
125
+    define('ENT_COMPAT', 2);
126
+}
127
+if (!defined('ENT_NOQUOTES')) {
128
+    define('ENT_NOQUOTES', 0);
129
+}
130
+if (!defined('ENT_QUOTES')) {
131
+    define('ENT_QUOTES', 3);
132
+}
123 133
 
124 134
 // set the document_root :|
125 135
 if(!isset($_SERVER['DOCUMENT_ROOT']) || empty($_SERVER['DOCUMENT_ROOT'])) {
@@ -182,10 +192,11 @@  discard block
 block discarded – undo
182 192
 
183 193
 $s = array('[+MGR_DIR+]');
184 194
 $r = array(MGR_DIR);
185
-foreach($_lang as $k=>$v)
186
-{
187
-	if(strpos($v,'[+')!==false) $_lang[$k] = str_replace($s, $r, $v);
188
-}
195
+foreach($_lang as $k=>$v) {
196
+	if(strpos($v,'[+')!==false) {
197
+	    $_lang[$k] = str_replace($s, $r, $v);
198
+	}
199
+	}
189 200
 
190 201
 // send the charset header
191 202
 header('Content-Type: text/html; charset='.$modx_manager_charset);
@@ -198,7 +209,7 @@  discard block
 block discarded – undo
198 209
 include_once "accesscontrol.inc.php";
199 210
 
200 211
 // double check the session
201
-if(!isset($_SESSION['mgrValidated'])){
212
+if(!isset($_SESSION['mgrValidated'])) {
202 213
 	echo "Not Logged In!";
203 214
 	exit;
204 215
 }
@@ -215,7 +226,9 @@  discard block
 block discarded – undo
215 226
 }
216 227
 
217 228
 // Initialize System Alert Message Queque
218
-if (!isset($_SESSION['SystemAlertMsgQueque'])) $_SESSION['SystemAlertMsgQueque'] = array();
229
+if (!isset($_SESSION['SystemAlertMsgQueque'])) {
230
+    $_SESSION['SystemAlertMsgQueque'] = array();
231
+}
219 232
 $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque'];
220 233
 
221 234
 // first we check to see if this is a frameset request
@@ -223,7 +236,7 @@  discard block
 block discarded – undo
223 236
 	// this looks to be a top-level frameset request, so let's serve up a frameset
224 237
 	if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/frames/1.php")) {
225 238
 		include_once "media/style/".$manager_theme."/frames/1.php";
226
-	}else{
239
+	} else {
227 240
 		include_once "frames/1.php";
228 241
 	}
229 242
 	exit;
@@ -231,10 +244,15 @@  discard block
 block discarded – undo
231 244
 
232 245
 // OK, let's retrieve the action directive from the request
233 246
 $option = array('min_range'=>1,'max_range'=>2000);
234
-if(isset($_GET['a']) && isset($_POST['a'])) $modx->webAlertAndQuit($_lang['error_double_action']);
235
-elseif(isset($_GET['a']))  $action = filter_input(INPUT_GET, 'a',FILTER_VALIDATE_INT,$option);
236
-elseif(isset($_POST['a'])) $action = filter_input(INPUT_POST,'a',FILTER_VALIDATE_INT,$option);
237
-else                       $action = null;
247
+if(isset($_GET['a']) && isset($_POST['a'])) {
248
+    $modx->webAlertAndQuit($_lang['error_double_action']);
249
+} elseif(isset($_GET['a'])) {
250
+    $action = filter_input(INPUT_GET, 'a',FILTER_VALIDATE_INT,$option);
251
+} elseif(isset($_POST['a'])) {
252
+    $action = filter_input(INPUT_POST,'a',FILTER_VALIDATE_INT,$option);
253
+} else {
254
+    $action = null;
255
+}
238 256
 
239 257
 if (isset($_POST['updateMsgCount']) && $modx->hasPermission('messages')) {
240 258
 	include_once 'messageCount.inc.php';
@@ -264,11 +282,12 @@  discard block
 block discarded – undo
264 282
 $modx->invokeEvent("OnManagerPageInit", array("action" => $action));
265 283
 
266 284
 // return element filepath
267
-function includeFileProcessor ($filepath,$manager_theme) {
285
+function includeFileProcessor ($filepath,$manager_theme)
286
+{
268 287
 	$element = "";
269 288
 	if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath)) {
270 289
 		$element = MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath;
271
-	}else{
290
+	} else {
272 291
 		$element = $filepath;
273 292
 	}
274 293
 	return $element;
Please login to merge, or discard this patch.
manager/frames/tree.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  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 />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 // invoke OnManagerTreeInit event
7 7
 $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST);
8
-if(is_array($evtOut)) {
8
+if(is_array($evtOut)) {
9 9
 	echo implode("\n", $evtOut);
10 10
 }
11 11
 ?>
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		<?php
55 55
 		// invoke OnManagerTreePrerender event
56 56
 		$evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->db->escape($_REQUEST));
57
-		if(is_array($evtOut)) {
57
+		if(is_array($evtOut)) {
58 58
 			echo implode("\n", $evtOut);
59 59
 		}
60 60
 		?>
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		<?php
67 67
 		// invoke OnManagerTreeRender event
68 68
 		$evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->db->escape($_REQUEST));
69
-		if(is_array($evtOut)) {
69
+		if(is_array($evtOut)) {
70 70
 			echo implode("\n", $evtOut);
71 71
 		}
72 72
 		?>
Please login to merge, or discard this patch.
install/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.
manager/actions/bkmanager.static.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -597,7 +597,9 @@
 block discarded – undo
597 597
                 $insertdump = $lf;
598 598
                 $insertdump .= "INSERT INTO `{$tblval}` VALUES (";
599 599
                 $arr = $this->object2Array($row);
600
-                if( ! is_array($arr)) $arr = array();
600
+                if( ! is_array($arr)) {
601
+                    $arr = array();
602
+                }
601 603
                 foreach ($arr as $key => $value) {
602 604
                     if (is_null($value)) {
603 605
                         $value = 'NULL';
Please login to merge, or discard this patch.
manager/includes/document.parser.class.inc.php 1 patch
Braces   +55 added lines, -26 removed lines patch added patch discarded remove patch
@@ -695,13 +695,15 @@  discard block
 block discarded – undo
695 695
             $this->virtualDir = '';
696 696
         }
697 697
 
698
-        if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
698
+        if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) {
699
+/* we got an ID returned, check to make sure it's not an alias */
699 700
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
700 701
             if ($this->config['use_alias_path'] == 1) {
701 702
                 if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
702 703
                     $this->documentMethod = 'id';
703 704
                     return $q;
704
-                } else { /* not a valid id in terms of virtualDir, treat as alias */
705
+                } else {
706
+/* not a valid id in terms of virtualDir, treat as alias */
705 707
                     $this->documentMethod = 'alias';
706 708
                     return $q;
707 709
                 }
@@ -709,7 +711,8 @@  discard block
 block discarded – undo
709 711
                 $this->documentMethod = 'id';
710 712
                 return $q;
711 713
             }
712
-        } else { /* we didn't get an ID back, so instead we assume it's an alias */
714
+        } else {
715
+/* we didn't get an ID back, so instead we assume it's an alias */
713 716
             if ($this->config['friendly_alias_urls'] != 1) {
714 717
                 $q = $qOrig;
715 718
             }
@@ -739,13 +742,14 @@  discard block
 block discarded – undo
739 742
      * @param $id
740 743
      * @return array|mixed|null|string
741 744
      */
742
-    public function makePageCacheKey($id){
745
+    public function makePageCacheKey($id)
746
+    {
743 747
         $hash = $id;
744 748
         $tmp = null;
745 749
         $params = array();
746
-        if(!empty($this->systemCacheKey)){
750
+        if(!empty($this->systemCacheKey)) {
747 751
             $hash = $this->systemCacheKey;
748
-        }else {
752
+        } else {
749 753
             if (!empty($_GET)) {
750 754
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
751 755
                 $params = $_GET;
@@ -754,7 +758,7 @@  discard block
 block discarded – undo
754 758
             }
755 759
         }
756 760
         $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
757
-        if (is_array($evtOut) && count($evtOut) > 0){
761
+        if (is_array($evtOut) && count($evtOut) > 0) {
758 762
             $tmp = array_pop($evtOut);
759 763
         }
760 764
         return empty($tmp) ? $hash : $tmp;
@@ -1165,10 +1169,18 @@  discard block
 block discarded – undo
1165 1169
             return array();
1166 1170
         }
1167 1171
         $spacer = md5('<<<EVO>>>');
1168
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1169
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1170
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1171
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1172
+        if($left==='{{' && strpos($content,';}}')!==false) {
1173
+            $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1174
+        }
1175
+        if($left==='{{' && strpos($content,'{{}}')!==false) {
1176
+            $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1177
+        }
1178
+        if($left==='[[' && strpos($content,']]]]')!==false) {
1179
+            $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1180
+        }
1181
+        if($left==='[[' && strpos($content,']]]')!==false) {
1182
+            $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1183
+        }
1172 1184
 
1173 1185
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1174 1186
         $pos[']]>'] = strpos($content, ']]>');
@@ -1221,7 +1233,8 @@  discard block
 block discarded – undo
1221 1233
                         }
1222 1234
                     }
1223 1235
 
1224
-                    if (!in_array($fetch, $tags)) {  // Avoid double Matches
1236
+                    if (!in_array($fetch, $tags)) {
1237
+// Avoid double Matches
1225 1238
                         $tags[] = $fetch; // Fetch
1226 1239
                     };
1227 1240
                     $fetch = ''; // and reset
@@ -1239,7 +1252,9 @@  discard block
 block discarded – undo
1239 1252
             }
1240 1253
         }
1241 1254
         foreach($tags as $i=>$tag) {
1242
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1255
+            if(strpos($tag,$spacer)!==false) {
1256
+                $tags[$i] = str_replace($spacer, '', $tag);
1257
+            }
1243 1258
         }
1244 1259
         return $tags;
1245 1260
     }
@@ -1279,7 +1294,10 @@  discard block
 block discarded – undo
1279 1294
         }
1280 1295
 
1281 1296
         foreach ($matches[1] as $i => $key) {
1282
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1297
+            if(strpos($key,'[+')!==false) {
1298
+                continue;
1299
+            }
1300
+            // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1283 1301
             if (substr($key, 0, 1) == '#') {
1284 1302
                 $key = substr($key, 1);
1285 1303
             } // remove # for QuickEdit format
@@ -2004,7 +2022,8 @@  discard block
 block discarded – undo
2004 2022
      * @return mixed|string
2005 2023
      */
2006 2024
     public function _getSGVar($value)
2007
-    { // Get super globals
2025
+    {
2026
+// Get super globals
2008 2027
         $key = $value;
2009 2028
         $_ = $this->config['enable_filter'];
2010 2029
         $this->config['enable_filter'] = 1;
@@ -2409,7 +2428,8 @@  discard block
 block discarded – undo
2409 2428
         if ($this->config['friendly_urls'] == 1) {
2410 2429
             $aliases = array();
2411 2430
             if (is_array($this->documentListing)) {
2412
-                foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site!
2431
+                foreach ($this->documentListing as $path => $docid) {
2432
+// This is big Loop on large site!
2413 2433
                     $aliases[$docid] = $path;
2414 2434
                     $isfolder[$docid] = $this->aliasListing[$docid]['isfolder'];
2415 2435
                 }
@@ -2442,7 +2462,7 @@  discard block
 block discarded – undo
2442 2462
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2443 2463
             $pref = $this->config['friendly_url_prefix'];
2444 2464
             $suff = $this->config['friendly_url_suffix'];
2445
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2465
+            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){
2446 2466
                 global $modx;
2447 2467
                 $thealias = $aliases[$m[1]];
2448 2468
                 $thefolder = $isfolder[$m[1]];
@@ -4214,7 +4234,8 @@  discard block
 block discarded – undo
4214 4234
         if (isset ($this->snippetCache[$snippetName])) {
4215 4235
             $snippet = $this->snippetCache[$snippetName];
4216 4236
             $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4217
-        } else { // not in cache so let's check the db
4237
+        } else {
4238
+// not in cache so let's check the db
4218 4239
             $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "'  AND ss.disabled=0;";
4219 4240
             $result = $this->db->query($sql);
4220 4241
             if ($this->db->getRecordCount($result) == 1) {
@@ -4718,7 +4739,7 @@  discard block
 block discarded – undo
4718 4739
             $result = $this->db->makeArray($rs);
4719 4740
 
4720 4741
             // get default/built-in template variables
4721
-            if(is_array($docRow)){
4742
+            if(is_array($docRow)) {
4722 4743
                 ksort($docRow);
4723 4744
 
4724 4745
                 foreach ($docRow as $key => $value) {
@@ -5197,12 +5218,16 @@  discard block
 block discarded – undo
5197 5218
             return '';
5198 5219
         } // nothing to register
5199 5220
         if (!is_array($options)) {
5200
-            if (is_bool($options))  // backward compatibility with old plaintext parameter
5221
+            if (is_bool($options)) {
5222
+                // backward compatibility with old plaintext parameter
5201 5223
             {
5202 5224
                 $options = array('plaintext' => $options);
5203
-            } elseif (is_string($options)) // Also allow script name as 2nd param
5225
+            }
5226
+            } elseif (is_string($options)) {
5227
+                // Also allow script name as 2nd param
5204 5228
             {
5205 5229
                 $options = array('name' => $options);
5230
+            }
5206 5231
             } else {
5207 5232
                 $options = array();
5208 5233
             }
@@ -5214,7 +5239,8 @@  discard block
 block discarded – undo
5214 5239
         unset($overwritepos); // probably unnecessary--just making sure
5215 5240
 
5216 5241
         $useThisVer = true;
5217
-        if (isset($this->loadedjscripts[$key])) { // a matching script was found
5242
+        if (isset($this->loadedjscripts[$key])) {
5243
+// a matching script was found
5218 5244
             // if existing script is a startup script, make sure the candidate is also a startup script
5219 5245
             if ($this->loadedjscripts[$key]['startup']) {
5220 5246
                 $startup = true;
@@ -5234,7 +5260,8 @@  discard block
 block discarded – undo
5234 5260
                     // overwrite the old script (the position may be important for dependent scripts)
5235 5261
                     $overwritepos = $this->loadedjscripts[$key]['pos'];
5236 5262
                 }
5237
-            } else { // Use the original version
5263
+            } else {
5264
+// Use the original version
5238 5265
                 if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) {
5239 5266
                     // need to move the exisiting script to the head
5240 5267
                     $version = $this->loadedjscripts[$key][$version];
@@ -5358,7 +5385,8 @@  discard block
 block discarded – undo
5358 5385
         }
5359 5386
 
5360 5387
         $results = null;
5361
-        foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop
5388
+        foreach ($this->pluginEvent[$evtName] as $pluginName) {
5389
+// start for loop
5362 5390
             if ($this->dumpPlugins) {
5363 5391
                 $eventtime = $this->getMicroTime();
5364 5392
             }
@@ -5906,7 +5934,8 @@  discard block
 block discarded – undo
5906 5934
      * @return bool
5907 5935
      */
5908 5936
     public function isSafeCode($phpcode = '', $safe_functions = '')
5909
-    { // return true or false
5937
+    {
5938
+// return true or false
5910 5939
         if ($safe_functions == '') {
5911 5940
             return false;
5912 5941
         }
@@ -6322,7 +6351,7 @@  discard block
 block discarded – undo
6322 6351
             $args = array_pad(array(), $_, '$var');
6323 6352
             $args = implode(", ", $args);
6324 6353
             $modx = &$this;
6325
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6354
+            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){
6326 6355
                 $arg = $val['args'][$tmp - 1];
6327 6356
                 switch (true) {
6328 6357
                     case is_null($arg): {
Please login to merge, or discard this patch.
install/actions/action_connection.php 1 patch
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,21 +9,24 @@
 block discarded – undo
9 9
     $table_prefix = base_convert(rand(10, 20), 10, 36).substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), rand(0, 33), 3).'_';
10 10
 } else {
11 11
     $database_name = '';
12
-    if (!is_file($base_path.MGR_DIR.'/includes/config.inc.php')) $upgradeable = 0;
13
-    else {
12
+    if (!is_file($base_path.MGR_DIR.'/includes/config.inc.php')) {
13
+        $upgradeable = 0;
14
+    } else {
14 15
         // Include the file so we can test its validity
15 16
         include($base_path.MGR_DIR.'/includes/config.inc.php');
16 17
         // We need to have all connection settings - but prefix may be empty so we have to ignore it
17 18
         if ($dbase) {
18 19
             $database_name = trim($dbase, '`');
19
-            if (!$conn = mysqli_connect($database_server, $database_user, $database_password))
20
-                $upgradeable = (isset($_POST['installmode']) && $_POST['installmode']=='new') ? 0 : 2;
21
-            elseif (! mysqli_select_db($conn, trim($dbase, '`')))
22
-                $upgradeable = (isset($_POST['installmode']) && $_POST['installmode']=='new') ? 0 : 2;
23
-            else
24
-                $upgradeable = 1;
20
+            if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) {
21
+                            $upgradeable = (isset($_POST['installmode']) && $_POST['installmode']=='new') ? 0 : 2;
22
+            } elseif (! mysqli_select_db($conn, trim($dbase, '`'))) {
23
+                            $upgradeable = (isset($_POST['installmode']) && $_POST['installmode']=='new') ? 0 : 2;
24
+            } else {
25
+                            $upgradeable = 1;
26
+            }
27
+        } else {
28
+            $upgradable= 2;
25 29
         }
26
-        else $upgradable= 2;
27 30
     }
28 31
 }
29 32
 
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_moduser.inc.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 $userid = (int)$value;
3 3
 if (!isset($modx->filter->cache['ui'][$userid])) {
4
-    if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid));
5
-    else             $user = $modx->getUserInfo($userid);
4
+    if ($userid < 0) {
5
+        $user = $modx->getWebUserInfo(abs($userid));
6
+    } else {
7
+        $user = $modx->getUserInfo($userid);
8
+    }
6 9
     $modx->filter->cache['ui'][$userid] = $user;
7 10
 } else {
8 11
     $user = $modx->filter->cache['ui'][$userid];
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_summary.inc.php 1 patch
Braces   +28 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,9 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(strpos($opt,',')) list($limit,$delim) = explode(',', $opt);
3
-elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';}
4
-else {$limit=124;$delim='';}
2
+if(strpos($opt,',')) {
3
+    list($limit,$delim) = explode(',', $opt);
4
+} elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} else {$limit=124;$delim='';}
5 5
 
6
-if($delim==='') $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.';
6
+if($delim==='') {
7
+    $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.';
8
+}
7 9
 $limit = (int)$limit;
8 10
 
9 11
 $content = $modx->filter->parseDocumentSource($value);
@@ -11,8 +13,9 @@  discard block
 block discarded – undo
11 13
 $content = strip_tags($content);
12 14
 
13 15
 $content = str_replace(array("\r\n","\r","\n","\t",'&nbsp;'),' ',$content);
14
-if(preg_match('/\s+/',$content))
16
+if(preg_match('/\s+/',$content)) {
15 17
     $content = preg_replace('/\s+/',' ',$content);
18
+}
16 19
 $content = trim($content);
17 20
 
18 21
 $pos = $modx->filter->strpos($content, $delim);
@@ -21,23 +24,35 @@  discard block
 block discarded – undo
21 24
     $_ = explode($delim, $content);
22 25
     $text = '';
23 26
     foreach($_ as $v) {
24
-        if($limit <= $modx->filter->strlen($text.$v.$delim)) break;
27
+        if($limit <= $modx->filter->strlen($text.$v.$delim)) {
28
+            break;
29
+        }
25 30
         $text .= $v.$delim;
26 31
     }
27
-    if($text) $content = $text;
28
-}
32
+    if($text) {
33
+        $content = $text;
34
+    }
35
+    }
29 36
 
30 37
 if($limit<$modx->filter->strlen($content) && strpos($content,' ')!==false) {
31 38
     $_ = explode(' ', $content);
32 39
     $text = '';
33 40
     foreach($_ as $v) {
34
-        if($limit <= $modx->filter->strlen($text.$v.' ')) break;
41
+        if($limit <= $modx->filter->strlen($text.$v.' ')) {
42
+            break;
43
+        }
35 44
         $text .= $v . ' ';
36 45
     }
37
-    if($text!=='') $content = $text;
38
-}
46
+    if($text!=='') {
47
+        $content = $text;
48
+    }
49
+    }
39 50
 
40
-if($limit < $modx->filter->strlen($content)) $content = $modx->filter->substr($content, 0, $limit);
41
-if($modx->filter->substr($content,-1)==$delim) $content = rtrim($content,$delim) . $delim;
51
+if($limit < $modx->filter->strlen($content)) {
52
+    $content = $modx->filter->substr($content, 0, $limit);
53
+}
54
+if($modx->filter->substr($content,-1)==$delim) {
55
+    $content = rtrim($content,$delim) . $delim;
56
+}
42 57
 
43 58
 return $content;
Please login to merge, or discard this patch.
manager/includes/controls/datagrid.class.php 1 patch
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,8 @@  discard block
 block discarded – undo
10 10
 
11 11
 $__DataGridCnt = 0;
12 12
 
13
-class DataGrid {
13
+class DataGrid
14
+{
14 15
 
15 16
 	public $ds; // datasource
16 17
     public $id;
@@ -72,7 +73,8 @@  discard block
 block discarded – undo
72 73
      */
73 74
     public $cdelim;
74 75
 
75
-    public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) {
76
+    public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1)
77
+    {
76 78
 		global $__DataGridCnt;
77 79
 
78 80
 		// set id
@@ -88,11 +90,13 @@  discard block
 block discarded – undo
88 90
 		$this->pagerLocation = 'top-right';
89 91
 	}
90 92
 
91
-    public function setDataSource($ds) {
93
+    public function setDataSource($ds)
94
+    {
92 95
 		$this->ds = $ds;
93 96
 	}
94 97
 
95
-    public function render() {
98
+    public function render()
99
+    {
96 100
 		global $modx;
97 101
 		$columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : '';
98 102
 		$columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : "";
@@ -127,7 +131,9 @@  discard block
 block discarded – undo
127 131
 
128 132
 		if($this->_isDataset && !$this->columns) {
129 133
 			$cols = $modx->db->numFields($this->ds);
130
-			for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i);
134
+			for($i = 0; $i < $cols; $i++) {
135
+			    $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i);
136
+			}
131 137
 		}
132 138
 
133 139
 		// start grid
@@ -207,7 +213,8 @@  discard block
 block discarded – undo
207 213
 
208 214
 	// format column values
209 215
 
210
-    public function RenderRowFnc($n, $row) {
216
+    public function RenderRowFnc($n, $row)
217
+    {
211 218
 		if($this->_alt == 0) {
212 219
 			$Style = $this->_itemStyle;
213 220
 			$Class = $this->_itemClass;
@@ -237,7 +244,8 @@  discard block
 block discarded – undo
237 244
 		return $o;
238 245
 	}
239 246
 
240
-    public function formatColumnValue($row, $value, $type, &$align) {
247
+    public function formatColumnValue($row, $value, $type, &$align)
248
+    {
241 249
 		if(strpos($type, ":") !== false) {
242 250
 			list($type, $type_format) = explode(":", $type, 2);
243 251
 		}
Please login to merge, or discard this patch.