Completed
Push — develop ( dd48c1...053968 )
by Maxim
06:38 queued 01:16
created
manager/includes/controls/datasetpager.class.php 1 patch
Braces   +21 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,7 +10,8 @@  discard block
 block discarded – undo
10 10
 
11 11
 $__DataSetPagerCnt = 0;
12 12
 
13
-class DataSetPager {
13
+class DataSetPager
14
+{
14 15
 
15 16
 	public $ds; // datasource
16 17
     public $pageSize;
@@ -31,7 +32,8 @@  discard block
 block discarded – undo
31 32
     public $renderPagerFnc;
32 33
     public $renderPagerFncArgs;
33 34
 
34
-    public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) {
35
+    public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1)
36
+    {
35 37
 		global $_PAGE; // use view state object
36 38
 
37 39
 		global $__DataSetPagerCnt;
@@ -61,35 +63,42 @@  discard block
 block discarded – undo
61 63
 		$this->pager = '';
62 64
 	}
63 65
 
64
-    public function getRenderedPager() {
66
+    public function getRenderedPager()
67
+    {
65 68
 		return $this->pager;
66 69
 	}
67 70
 
68
-    public function getRenderedRows() {
71
+    public function getRenderedRows()
72
+    {
69 73
 		return $this->rows;
70 74
 	}
71 75
 
72
-    public function setDataSource($ds) {
76
+    public function setDataSource($ds)
77
+    {
73 78
 		$this->ds = $ds;
74 79
 	}
75 80
 
76
-    public function setPageSize($ps) {
81
+    public function setPageSize($ps)
82
+    {
77 83
 		$this->pageSize = $ps;
78 84
 	}
79 85
 
80
-    public function setRenderRowFnc($fncName, $args = "") {
86
+    public function setRenderRowFnc($fncName, $args = "")
87
+    {
81 88
 		$this->renderRowFnc = &$fncName;
82 89
 		$this->renderRowFncArgs = $args;    // extra agruments
83 90
 
84 91
 
85 92
 	}
86 93
 
87
-    public function setRenderPagerFnc($fncName, $args = "") {
94
+    public function setRenderPagerFnc($fncName, $args = "")
95
+    {
88 96
 		$this->renderPagerFnc = $fncName;
89 97
 		$this->renderPagerFncArgs = $args;    // extra agruments
90 98
 	}
91 99
 
92
-    public function render() {
100
+    public function render()
101
+    {
93 102
 		global $modx, $_PAGE;
94 103
 
95 104
 		$isDataset = $modx->db->isResult($this->ds);
@@ -142,8 +151,10 @@  discard block
 block discarded – undo
142 151
 					$url = $_SERVER['PHP_SELF'] . '?';
143 152
 				}
144 153
 				$i = 0;
145
-				foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) {
154
+				foreach($_GET as $n => $v) {
155
+				    if($n != 'dpgn' . $this->id) {
146 156
 					$i++;
157
+				}
147 158
 					$url .= (($i > 1) ? "&" : "") . "$n=$v";
148 159
 				}
149 160
 				if($i >= 1) {
Please login to merge, or discard this patch.
manager/includes/error.class.inc.php 1 patch
Braces   +23 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // this is the old error handler. Here for legacy, until i replace all the old errors.
3
-class errorHandler{
3
+class errorHandler
4
+{
4 5
 
5 6
     /**
6 7
      * @var int
@@ -15,7 +16,8 @@  discard block
 block discarded – undo
15 16
      */
16 17
     public $errormessage;
17 18
 
18
-    public function __construct() {
19
+    public function __construct()
20
+    {
19 21
 
20 22
 		$_lang = $this->include_lang('errormsg');
21 23
 
@@ -50,25 +52,31 @@  discard block
 block discarded – undo
50 52
 	);
51 53
 	}
52 54
 
53
-	function include_lang($context='common') {
55
+	function include_lang($context='common')
56
+	{
54 57
 		global $modx;
55 58
 		$_lang = array();
56 59
 
57 60
 		$context = trim($context,'/');
58
-		if(strpos($context,'..')!==false) return;
61
+		if(strpos($context,'..')!==false) {
62
+		    return;
63
+		}
59 64
 
60
-		if($context === 'common')
61
-			$lang_path = MODX_MANAGER_PATH . 'includes/lang/';
62
-		else
63
-			$lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/";
65
+		if($context === 'common') {
66
+					$lang_path = MODX_MANAGER_PATH . 'includes/lang/';
67
+		} else {
68
+					$lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/";
69
+		}
64 70
 		include_once($lang_path . 'english.inc.php');
65 71
 		$manager_language = $modx->config['manager_language'];
66
-		if(is_file("{$lang_path}{$manager_language}.inc.php"))
67
-			include_once("{$lang_path}{$manager_language}.inc.php");
72
+		if(is_file("{$lang_path}{$manager_language}.inc.php")) {
73
+					include_once("{$lang_path}{$manager_language}.inc.php");
74
+		}
68 75
 		return $_lang;
69 76
 	}
70 77
 
71
-	function setError($errorcode, $custommessage=""){
78
+	function setError($errorcode, $custommessage="")
79
+	{
72 80
 		$this->errorcode=$errorcode;
73 81
 		$this->errormessage=$this->errors[$errorcode];
74 82
 		if($custommessage!="") {
@@ -76,11 +84,13 @@  discard block
 block discarded – undo
76 84
 		}
77 85
 	}
78 86
 
79
-	function getError() {
87
+	function getError()
88
+	{
80 89
 		return $this->errorcode;
81 90
 	}
82 91
 
83
-	function dumpError(){
92
+	function dumpError()
93
+	{
84 94
 ?>
85 95
 	<html>
86 96
 	<head>
Please login to merge, or discard this patch.
manager/includes/tmplvars.commands.inc.php 1 patch
Braces   +22 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@  discard block
 block discarded – undo
14 14
     'DIRECTORY'
15 15
 );
16 16
 
17
-function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) {
17
+function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array())
18
+{
18 19
     global $modx;
19 20
     $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier;
20 21
     $nvalue = trim($value);
21
-    if (substr($nvalue, 0, 1) != '@')
22
-        return $value;
23
-    elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') {
22
+    if (substr($nvalue, 0, 1) != '@') {
23
+            return $value;
24
+    } elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') {
24 25
         return '@Bindings is disabled.';
25
-    }
26
-    else {
26
+    } else {
27 27
         list ($cmd, $param) = ParseCommand($nvalue);
28 28
         $cmd = trim($cmd);
29 29
         $param = parseTvValues($param, $tvsArray);
@@ -39,10 +39,11 @@  discard block
 block discarded – undo
39 39
 
40 40
             case "DOCUMENT" : // retrieve a document and process it's content
41 41
                 $rs = $modx->getDocument($param);
42
-                if (is_array($rs))
43
-                    $output = $rs['content'];
44
-                else
45
-                    $output = "Unable to locate document $param";
42
+                if (is_array($rs)) {
43
+                                    $output = $rs['content'];
44
+                } else {
45
+                                    $output = "Unable to locate document $param";
46
+                }
46 47
                 break;
47 48
 
48 49
             case "SELECT" : // selects a record from the cms database
@@ -72,8 +73,10 @@  discard block
 block discarded – undo
72 73
 
73 74
                     // Grab document regardless of publish status
74 75
                     $doc = $modx->getPageInfo($parent_id, 0, 'id,parent,published');
75
-                    if ($doc['parent'] != 0 && !$doc['published'])
76
-                        continue; // hide unpublished docs if we're not at the top
76
+                    if ($doc['parent'] != 0 && !$doc['published']) {
77
+                                            continue;
78
+                    }
79
+                    // hide unpublished docs if we're not at the top
77 80
 
78 81
                     $tv = $modx->getTemplateVar($name, '*', $doc['id'], $doc['published']);
79 82
 
@@ -117,10 +120,13 @@  discard block
 block discarded – undo
117 120
     }
118 121
 }
119 122
 
120
-function ProcessFile($file) {
123
+function ProcessFile($file)
124
+{
121 125
     // get the file
122 126
 	$buffer = @file_get_contents($file);
123
-	if ($buffer===false) $buffer = " Could not retrieve document '$file'.";
127
+	if ($buffer===false) {
128
+	    $buffer = " Could not retrieve document '$file'.";
129
+	}
124 130
     return $buffer;
125 131
 }
126 132
 
@@ -129,10 +135,8 @@  discard block
 block discarded – undo
129 135
 {
130 136
     global $BINDINGS;
131 137
     $binding_array = array();
132
-    foreach($BINDINGS as $cmd)
133
-    {
134
-        if(strpos($binding_string,'@'.$cmd)===0)
135
-        {
138
+    foreach($BINDINGS as $cmd) {
139
+        if(strpos($binding_string,'@'.$cmd)===0) {
136 140
             $code = substr($binding_string,strlen($cmd)+1);
137 141
             $binding_array = array($cmd,trim($code));
138 142
             break;
Please login to merge, or discard this patch.
manager/includes/rss.inc.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@  discard block
 block discarded – undo
29 29
 // include MagPieRSS
30 30
 require_once(MODX_MANAGER_PATH.'media/rss/rss_fetch.inc');
31 31
 // Convert relative path into absolute url
32
-function rel2abs( $rel, $base ) {
32
+function rel2abs( $rel, $base )
33
+{
33 34
 	// parse base URL  and convert to local variables: $scheme, $host,  $path
34 35
     $tmp = parse_url( $base );
35 36
     extract( $tmp );
@@ -64,7 +65,7 @@  discard block
 block discarded – undo
64 65
 foreach ($urls as $section=>$url) {
65 66
 	$output = '';
66 67
     $rss = @fetch_rss($url);
67
-    if( !$rss ){
68
+    if( !$rss ) {
68 69
     	$feedData[$section] = 'Failed to retrieve ' . $url;
69 70
     	continue;
70 71
 	}
Please login to merge, or discard this patch.
manager/includes/tmplvars.format.inc.php 1 patch
Braces   +21 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,7 +5,8 @@  discard block
 block discarded – undo
5 5
  */
6 6
 
7 7
 // Added by Raymond 20-Jan-2005
8
-function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '') {
8
+function getTVDisplayFormat($name, $value, $format, $paramstring = "", $tvtype = "", $docid = "", $sep = '')
9
+{
9 10
 
10 11
 	global $modx;
11 12
     $o = '';
@@ -49,7 +50,9 @@  discard block
 block discarded – undo
49 50
 					if(isset($params['align']) && $params['align'] != 'none') {
50 51
 						$attr['align'] = $params['align'];
51 52
 					}
52
-					foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
53
+					foreach($attr as $k => $v) {
54
+					    $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
55
+					}
53 56
 					$attributes .= ' ' . $params['attrib'];
54 57
 
55 58
 					// Output the image with attributes
@@ -118,7 +121,9 @@  discard block
 block discarded – undo
118 121
 						'style' => $params['style'],
119 122
 						'target' => $params['target'],
120 123
 					);
121
-					foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
124
+					foreach($attr as $k => $v) {
125
+					    $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
126
+					}
122 127
 					$attributes .= ' ' . $params['attrib']; // add extra
123 128
 
124 129
 					// Output the link
@@ -147,7 +152,9 @@  discard block
 block discarded – undo
147 152
 					'class' => $params['class'],
148 153
 					'style' => $params['style'],
149 154
 				);
150
-				foreach($attr as $k => $v) $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
155
+				foreach($attr as $k => $v) {
156
+				    $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
157
+				}
151 158
 				$attributes .= ' ' . $params['attrib']; // add extra
152 159
 
153 160
 				// Output the HTML Tag
@@ -327,19 +334,24 @@  discard block
 block discarded – undo
327 334
 	return $o;
328 335
 }
329 336
 
330
-function decodeParamValue($s) {
337
+function decodeParamValue($s)
338
+{
331 339
 	$s = str_replace("%3D", '=', $s); // =
332 340
 	$s = str_replace("%26", '&', $s); // &
333 341
 	return $s;
334 342
 }
335 343
 
336 344
 // returns an array if a delimiter is present. returns array is a recordset is present
337
-function parseInput($src, $delim = "||", $type = "string", $columns = true) { // type can be: string, array
345
+function parseInput($src, $delim = "||", $type = "string", $columns = true)
346
+{
347
+// type can be: string, array
338 348
 	global $modx;
339 349
 	if($modx->db->isResult($src)) {
340 350
 		// must be a recordset
341 351
 		$rows = array();
342
-		while($cols = $modx->db->getRow($src, 'num')) $rows[] = ($columns) ? $cols : implode(" ", $cols);
352
+		while($cols = $modx->db->getRow($src, 'num')) {
353
+		    $rows[] = ($columns) ? $cols : implode(" ", $cols);
354
+		}
343 355
 		return ($type == "array") ? $rows : implode($delim, $rows);
344 356
 	} else {
345 357
 		// must be a text
@@ -351,7 +363,8 @@  discard block
 block discarded – undo
351 363
 	}
352 364
 }
353 365
 
354
-function getUnixtimeFromDateString($value) {
366
+function getUnixtimeFromDateString($value)
367
+{
355 368
 	$timestamp = false;
356 369
 	// Check for MySQL or legacy style date
357 370
 	$date_match_1 = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})\ ([0-9]{2}):([0-9]{2}):([0-9]{2})$/';
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,20 +1,29 @@
 block discarded – undo
1 1
 <?php
2
-class DATEPICKER {
3
-    public function getDP() {
2
+class DATEPICKER
3
+{
4
+    public function getDP()
5
+    {
4 6
         global $modx;
5 7
 
6 8
         $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl');
7
-        if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode();
9
+        if(!isset($modx->config['lang_code'])) {
10
+            $modx->config['lang_code'] = $this->getLangCode();
11
+        }
8 12
 		$modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy';
9 13
         return $modx->mergeSettingsContent($load_script);
10 14
     }
11
-    public function getLangCode() {
15
+    public function getLangCode()
16
+    {
12 17
         global $modx, $modx_lang_attribute;
13 18
 
14
-        if(!$modx_lang_attribute) return 'en';
19
+        if(!$modx_lang_attribute) {
20
+            return 'en';
21
+        }
15 22
 
16 23
         $lc = $modx_lang_attribute;
17
-        if($lc === 'uk') return 'ru';
24
+        if($lc === 'uk') {
25
+            return 'ru';
26
+        }
18 27
         $dp_path = str_replace('\\','/',dirname(__FILE__));
19 28
 
20 29
         return (is_file("{$dp_path}/i18n/datepicker.{$lc}.js")) ? $modx_lang_attribute : 'en';
Please login to merge, or discard this patch.
manager/processors/save_settings.processor.php 1 patch
Braces   +18 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,39 +9,27 @@  discard block
 block discarded – undo
9 9
 // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972
10 10
 unset($_POST);
11 11
 
12
-if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false)
13
-{
12
+if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) {
14 13
 	$htaccess        = $modx->config['base_path'] . '.htaccess';
15 14
 	$sample_htaccess = $modx->config['base_path'] . 'ht.access';
16 15
 	$dir = '/' . trim($modx->config['base_url'],'/');
17
-	if(is_file($htaccess))
18
-	{
16
+	if(is_file($htaccess)) {
19 17
 		$_ = file_get_contents($htaccess);
20
-		if(strpos($_,'RewriteBase')===false)
21
-		{
18
+		if(strpos($_,'RewriteBase')===false) {
22 19
 			$warnings[] = $_lang["settings_friendlyurls_alert2"];
23
-		}
24
-		elseif(is_writable($htaccess))
25
-		{
20
+		} elseif(is_writable($htaccess)) {
26 21
 			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
27
-			if(!@file_put_contents($htaccess,$_))
28
-			{
22
+			if(!@file_put_contents($htaccess,$_)) {
29 23
 				$warnings[] = $_lang["settings_friendlyurls_alert2"];
30 24
 			}
31 25
 		}
32
-	}
33
-	elseif(is_file($sample_htaccess))
34
-	{
35
-		if(!@rename($sample_htaccess,$htaccess))
36
-        {
26
+	} elseif(is_file($sample_htaccess)) {
27
+		if(!@rename($sample_htaccess,$htaccess)) {
37 28
         	$warnings[] = $_lang["settings_friendlyurls_alert"];
38
-		}
39
-		elseif($modx->config['base_url']!=='/')
40
-		{
29
+		} elseif($modx->config['base_url']!=='/') {
41 30
 			$_ = file_get_contents($htaccess);
42 31
 			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
43
-			if(!@file_put_contents($htaccess,$_))
44
-			{
32
+			if(!@file_put_contents($htaccess,$_)) {
45 33
 				$warnings[] = $_lang["settings_friendlyurls_alert2"];
46 34
 			}
47 35
 		}
@@ -70,7 +58,7 @@  discard block
 block discarded – undo
70 58
 	foreach ($data as $k => $v) {
71 59
 		switch ($k) {
72 60
             case 'settings_version':{
73
-                if($modx->getVersionData('version')!=$data['settings_version']){
61
+                if($modx->getVersionData('version')!=$data['settings_version']) {
74 62
                     $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version');
75 63
                     $v = $modx->getVersionData('version');
76 64
                 }
@@ -131,7 +119,9 @@  discard block
 block discarded – undo
131 119
 
132 120
 		$modx->config[$k] = $v;
133 121
 
134
-		if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
122
+		if(!empty($k)) {
123
+		    $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
124
+		}
135 125
 	}
136 126
 
137 127
 	// Run a single query to save all the values
@@ -145,8 +135,11 @@  discard block
 block discarded – undo
145 135
 		$oldtemplate = (int)$data['old_template'];
146 136
 		$tbl = $modx->getFullTableName('site_content');
147 137
 		$reset = $data['reset_template'];
148
-		if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
149
-		else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
138
+		if($reset==1) {
139
+		    $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
140
+		} else if($reset==2) {
141
+		    $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
142
+		}
150 143
 	}
151 144
 
152 145
 	// empty cache
Please login to merge, or discard this patch.
manager/processors/save_plugin.processor.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -177,7 +177,9 @@  discard block
 block discarded – undo
177 177
     // save selected system events
178 178
     $formEventList = array();
179 179
     foreach ($sysevents as $evtId) {
180
-        if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId);
180
+        if(!preg_match('@^[1-9][0-9]*$@',$evtId)) {
181
+            $evtId = getEventIdByName($evtId);
182
+        }
181 183
         if ($mode == '101') {
182 184
             $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'");
183 185
         } else {
@@ -203,10 +205,14 @@  discard block
 block discarded – undo
203 205
     $dbEventList = array();
204 206
     $del = array();
205 207
     while($row = $modx->db->getRow($rs)) {
206
-        if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid'];
208
+        if(!in_array($row['evtid'], $evtids)) {
209
+            $del[] = $row['evtid'];
210
+        }
207 211
     }
208 212
 
209
-    if(empty($del)) return;
213
+    if(empty($del)) {
214
+        return;
215
+    }
210 216
 
211 217
     foreach($del as $delid) {
212 218
         $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id));
@@ -218,7 +224,9 @@  discard block
 block discarded – undo
218 224
     global $modx;
219 225
     static $eventIds=array();
220 226
 
221
-    if(isset($eventIds[$name])) return $eventIds[$name];
227
+    if(isset($eventIds[$name])) {
228
+        return $eventIds[$name];
229
+    }
222 230
 
223 231
     $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames');
224 232
     while ($row = $modx->db->getRow($rs)) {
Please login to merge, or discard this patch.
manager/processors/cache_sync.class.processor.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,8 @@  discard block
 block discarded – undo
47 47
     }
48 48
 
49 49
     public function getParents($id, $path = '')
50
-    { // modx:returns child's parent
50
+    {
51
+// modx:returns child's parent
51 52
         global $modx;
52 53
         if (empty($this->aliases)) {
53 54
             $f = "id, IF(alias='', id, alias) AS alias, parent, alias_visible";
@@ -404,7 +405,8 @@  discard block
 block discarded – undo
404 405
                         $_ = trim($_);
405 406
                     }
406 407
                     $lastChar = substr($_, -1);
407
-                    if (!in_array($lastChar, $chars)) {// ,320,327,288,284,289
408
+                    if (!in_array($lastChar, $chars)) {
409
+// ,320,327,288,284,289
408 410
                         if (!in_array($prev_token, array(T_FOREACH, T_WHILE, T_FOR, T_BOOLEAN_AND, T_BOOLEAN_OR, T_DOUBLE_ARROW))) {
409 411
                             $_ .= ' ';
410 412
                         }
Please login to merge, or discard this patch.