Completed
Pull Request — develop (#747)
by
unknown
07:43
created
manager/processors/save_tmplvars.processor.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  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
 if (!$modx->hasPermission('save_template')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = (int)$_POST['id'];
9
+$id = (int) $_POST['id'];
10 10
 $name = $modx->getDatabase()->escape(trim($_POST['name']));
11 11
 $description = $modx->getDatabase()->escape($_POST['description']);
12 12
 $caption = $modx->getDatabase()->escape($_POST['caption']);
@@ -17,17 +17,17 @@  discard block
 block discarded – undo
17 17
 $display = $modx->getDatabase()->escape($_POST['display']);
18 18
 $params = $modx->getDatabase()->escape($_POST['params']);
19 19
 $locked = $_POST['locked'] == 'on' ? 1 : 0;
20
-$origin = isset($_REQUEST['or']) ? (int)$_REQUEST['or'] : 76;
21
-$originId = isset($_REQUEST['oid']) ? (int)$_REQUEST['oid'] : null;
20
+$origin = isset($_REQUEST['or']) ? (int) $_REQUEST['or'] : 76;
21
+$originId = isset($_REQUEST['oid']) ? (int) $_REQUEST['oid'] : null;
22 22
 $currentdate = time() + $modx->config['server_offset_time'];
23 23
 
24 24
 //Kyle Jaebker - added category support
25 25
 if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) {
26
-    $categoryid = (int)$_POST['categoryid'];
26
+    $categoryid = (int) $_POST['categoryid'];
27 27
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
28 28
     $categoryid = 0;
29 29
 } else {
30
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
30
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
31 31
     $categoryid = checkCategory($_POST['newcategory']);
32 32
     if (!$categoryid) {
33 33
         $categoryid = newCategory($_POST['newcategory']);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         // finished emptying cache - redirect
100 100
         if ($_POST['stay'] != '') {
101 101
             $a = ($_POST['stay'] == '2') ? "301&id=$newid" : "300";
102
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
102
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
103 103
             header($header);
104 104
         } else {
105 105
             $header = "Location: index.php?a=76&r=2";
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
         // finished emptying cache - redirect
161 161
         if ($_POST['stay'] != '') {
162 162
             $a = ($_POST['stay'] == '2') ? "301&id=$id" : "300";
163
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'] . "&or=" . $origin . "&oid=" . $originId;
163
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']."&or=".$origin."&oid=".$originId;
164 164
             header($header);
165 165
         } else {
166 166
             $modx->unlockElement(2, $id);
167
-            $header = "Location: index.php?a=" . $origin . "&r=2" . (empty($originId) ? '' : '&id=' . $originId);
167
+            $header = "Location: index.php?a=".$origin."&r=2".(empty($originId) ? '' : '&id='.$originId);
168 168
             header($header);
169 169
         }
170 170
 
Please login to merge, or discard this patch.
manager/processors/save_htmlsnippet.processor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  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
 if (!$modx->hasPermission('save_chunk')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = (int)$_POST['id'];
9
+$id = (int) $_POST['id'];
10 10
 $snippet = $modx->getDatabase()->escape($_POST['post']);
11 11
 $name = $modx->getDatabase()->escape(trim($_POST['name']));
12 12
 $description = $modx->getDatabase()->escape($_POST['description']);
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
 
17 17
 //Kyle Jaebker - added category support
18 18
 if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) {
19
-    $categoryid = (int)$_POST['categoryid'];
19
+    $categoryid = (int) $_POST['categoryid'];
20 20
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
21 21
     $categoryid = 0;
22 22
 } else {
23
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
23
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
24 24
     $categoryid = checkCategory($_POST['newcategory']);
25 25
     if (!$categoryid) {
26 26
         $categoryid = newCategory($_POST['newcategory']);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         // finished emptying cache - redirect
81 81
         if ($_POST['stay'] != '') {
82 82
             $a = ($_POST['stay'] == '2') ? "78&id=$newid" : "77";
83
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
83
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
84 84
             header($header);
85 85
         } else {
86 86
             $header = "Location: index.php?a=76&r=2";
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         // finished emptying cache - redirect
130 130
         if ($_POST['stay'] != '') {
131 131
             $a = ($_POST['stay'] == '2') ? "78&id=$id" : "77";
132
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
132
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
133 133
             header($header);
134 134
         } else {
135 135
             $modx->unlockElement(3, $id);
Please login to merge, or discard this patch.
index.php 3 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
  * Initialize Document Parsing
45 45
  * -----------------------------
46 46
  */
47
-if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
47
+if (!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
48 48
 
49
-$base_path = str_replace('\\','/',dirname(__FILE__)) . '/';
50
-if(is_file($base_path . 'assets/cache/siteManager.php'))
51
-    include_once($base_path . 'assets/cache/siteManager.php');
52
-if(!defined('MGR_DIR') && is_dir("{$base_path}manager"))
49
+$base_path = str_replace('\\', '/', dirname(__FILE__)).'/';
50
+if (is_file($base_path.'assets/cache/siteManager.php'))
51
+    include_once($base_path.'assets/cache/siteManager.php');
52
+if (!defined('MGR_DIR') && is_dir("{$base_path}manager"))
53 53
 	define('MGR_DIR', 'manager');
54
-if(is_file($base_path . 'assets/cache/siteHostnames.php'))
55
-    include_once($base_path . 'assets/cache/siteHostnames.php');
56
-if(!defined('MODX_SITE_HOSTNAMES'))
54
+if (is_file($base_path.'assets/cache/siteHostnames.php'))
55
+    include_once($base_path.'assets/cache/siteHostnames.php');
56
+if (!defined('MODX_SITE_HOSTNAMES'))
57 57
 	define('MODX_SITE_HOSTNAMES', '');
58 58
 
59 59
 // get start time
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 // set some settings, and address some IE issues
66 66
 @ini_set('url_rewriter.tags', '');
67 67
 @ini_set('session.use_trans_sid', 0);
68
-@ini_set('session.use_only_cookies',1);
68
+@ini_set('session.use_only_cookies', 1);
69 69
 session_cache_limiter('');
70 70
 header('P3P: CP="NOI NID ADMa OUR IND UNI COM NAV"'); // header for weird cookie stuff. Blame IE.
71 71
 header('Cache-Control: private, must-revalidate');
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
  */
78 78
 
79 79
 define('IN_PARSER_MODE', true);
80
-if ( ! defined('IN_MANAGER_MODE')) {
80
+if (!defined('IN_MANAGER_MODE')) {
81 81
 	define('IN_MANAGER_MODE', false);
82 82
 }
83 83
 if (!defined('MODX_API_MODE')) {
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 }
86 86
 
87 87
 // get the required includes
88
-if(! isset($database_user) || $database_user==="") {
89
-    $rt = @include_once(__DIR__ . '/' . MGR_DIR . '/includes/config.inc.php');
88
+if (!isset($database_user) || $database_user === "") {
89
+    $rt = @include_once(__DIR__.'/'.MGR_DIR.'/includes/config.inc.php');
90 90
     $path = 'install/src/template/not_installed.tpl';
91 91
     // Be sure config.inc.php is there and that it contains some important values
92 92
     if (!$rt || !$database_type || !$database_server || !$database_user || !$dbase) {
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
 $modx->stopOnNotice = false;
123 123
 
124 124
 // Don't show PHP errors to the public
125
-if(!isset($_SESSION['mgrValidated']) || !$_SESSION['mgrValidated']) {
126
-    @ini_set("display_errors","0");
125
+if (!isset($_SESSION['mgrValidated']) || !$_SESSION['mgrValidated']) {
126
+    @ini_set("display_errors", "0");
127 127
 }
128 128
 
129
-if(MODX_CLI){
129
+if (MODX_CLI) {
130 130
     @set_time_limit(0);
131
-    @ini_set('max_execution_time',0);
131
+    @ini_set('max_execution_time', 0);
132 132
 }
133 133
 
134 134
 // execute the parser if index.php was not included
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,17 +44,23 @@  discard block
 block discarded – undo
44 44
  * Initialize Document Parsing
45 45
  * -----------------------------
46 46
  */
47
-if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
47
+if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) {
48
+    $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
49
+}
48 50
 
49 51
 $base_path = str_replace('\\','/',dirname(__FILE__)) . '/';
50
-if(is_file($base_path . 'assets/cache/siteManager.php'))
52
+if(is_file($base_path . 'assets/cache/siteManager.php')) {
51 53
     include_once($base_path . 'assets/cache/siteManager.php');
52
-if(!defined('MGR_DIR') && is_dir("{$base_path}manager"))
54
+}
55
+if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) {
53 56
 	define('MGR_DIR', 'manager');
54
-if(is_file($base_path . 'assets/cache/siteHostnames.php'))
57
+}
58
+if(is_file($base_path . 'assets/cache/siteHostnames.php')) {
55 59
     include_once($base_path . 'assets/cache/siteHostnames.php');
56
-if(!defined('MODX_SITE_HOSTNAMES'))
60
+}
61
+if(!defined('MODX_SITE_HOSTNAMES')) {
57 62
 	define('MODX_SITE_HOSTNAMES', '');
63
+}
58 64
 
59 65
 // get start time
60 66
 $mstart = memory_get_usage();
@@ -126,7 +132,7 @@  discard block
 block discarded – undo
126 132
     @ini_set("display_errors","0");
127 133
 }
128 134
 
129
-if(MODX_CLI){
135
+if(MODX_CLI) {
130 136
     @set_time_limit(0);
131 137
     @ini_set('max_execution_time',0);
132 138
 }
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 if(is_file($base_path . 'assets/cache/siteManager.php'))
51 51
     include_once($base_path . 'assets/cache/siteManager.php');
52 52
 if(!defined('MGR_DIR') && is_dir("{$base_path}manager"))
53
-	define('MGR_DIR', 'manager');
53
+    define('MGR_DIR', 'manager');
54 54
 if(is_file($base_path . 'assets/cache/siteHostnames.php'))
55 55
     include_once($base_path . 'assets/cache/siteHostnames.php');
56 56
 if(!defined('MODX_SITE_HOSTNAMES'))
57
-	define('MODX_SITE_HOSTNAMES', '');
57
+    define('MODX_SITE_HOSTNAMES', '');
58 58
 
59 59
 // get start time
60 60
 $mstart = memory_get_usage();
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 define('IN_PARSER_MODE', true);
80 80
 if ( ! defined('IN_MANAGER_MODE')) {
81
-	define('IN_MANAGER_MODE', false);
81
+    define('IN_MANAGER_MODE', false);
82 82
 }
83 83
 if (!defined('MODX_API_MODE')) {
84 84
     define('MODX_API_MODE', false);
Please login to merge, or discard this patch.
manager/includes/src/Legacy/Modifiers.php 3 patches
Doc Comments   +26 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     /**
102 102
      * @param string $mode
103 103
      * @param string $modifiers
104
-     * @return bool|string
104
+     * @return false|string
105 105
      */
106 106
     public function _getDelim($mode, $modifiers)
107 107
     {
@@ -151,6 +151,13 @@  discard block
 block discarded – undo
151 151
         }
152 152
     }
153 153
 
154
+    /**
155
+     * @param string $mode
156
+     * @param false|string $delim
157
+     * @param string $modifiers
158
+     *
159
+     * @return string
160
+     */
154 161
     public function _getRemainModifiers($mode, $delim, $modifiers)
155 162
     {
156 163
         if ($delim) {
@@ -187,6 +194,9 @@  discard block
 block discarded – undo
187 194
         return substr($string, strpos($string, $delim) + $len);
188 195
     }
189 196
 
197
+    /**
198
+     * @param string $modifiers
199
+     */
190 200
     public function splitEachModifiers($modifiers)
191 201
     {
192 202
         $modx = evolutionCMS();
@@ -259,6 +269,10 @@  discard block
 block discarded – undo
259 269
         return $result;
260 270
     }
261 271
 
272
+    /**
273
+     * @param string $key
274
+     * @param string $value
275
+     */
262 276
     public function parsePhx($key, $value, $modifiers)
263 277
     {
264 278
         $modx = evolutionCMS();
@@ -340,6 +354,10 @@  discard block
 block discarded – undo
340 354
         }
341 355
     }
342 356
 
357
+    /**
358
+     * @param string $cmd
359
+     * @param string $opt
360
+     */
343 361
     public function getValueFromPreset($key, $value, $cmd, $opt)
344 362
     {
345 363
         $modx = evolutionCMS();
@@ -1285,6 +1303,9 @@  discard block
 block discarded – undo
1285 1303
         return $value;
1286 1304
     }
1287 1305
 
1306
+    /**
1307
+     * @param string $cmd
1308
+     */
1288 1309
     public function includeMdfFile($cmd)
1289 1310
     {
1290 1311
         $modx = evolutionCMS();
@@ -1477,6 +1498,10 @@  discard block
 block discarded – undo
1477 1498
     }
1478 1499
 
1479 1500
     // Sets a placeholder variable which can only be access by Modifiers
1501
+
1502
+    /**
1503
+     * @param string $value
1504
+     */
1480 1505
     public function setModifiersVariable($key, $value)
1481 1506
     {
1482 1507
         if ($key != 'phx' && $key != 'dummy') {
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -199,7 +199,8 @@  discard block
 block discarded – undo
199 199
             $c = substr($modifiers, 0, 1);
200 200
             $modifiers = substr($modifiers, 1);
201 201
 
202
-            if ($c === ':' && preg_match('@^(!?[<>=]{1,2})@', $modifiers, $match)) { // :=, :!=, :<=, :>=, :!<=, :!>=
202
+            if ($c === ':' && preg_match('@^(!?[<>=]{1,2})@', $modifiers, $match)) {
203
+// :=, :!=, :<=, :>=, :!<=, :!>=
203 204
                 $c = substr($modifiers, strlen($match[1]), 1);
204 205
                 $debuginfo = "#i=0 #c=[{$c}] #m=[{$modifiers}]";
205 206
                 if ($c === '(') {
@@ -215,7 +216,8 @@  discard block
 block discarded – undo
215 216
                 $result[] = array('cmd' => trim($match[1]), 'opt' => $opt, 'debuginfo' => $debuginfo);
216 217
                 $cmd = '';
217 218
             } elseif (in_array($c, array('+', '-', '*', '/')) && preg_match('@^[0-9]+@', $modifiers,
218
-                    $match)) { // :+3, :-3, :*3 ...
219
+                    $match)) {
220
+// :+3, :-3, :*3 ...
219 221
                 $modifiers = substr($modifiers, strlen($match[0]));
220 222
                 $result[] = array('cmd' => 'math', 'opt' => '%s' . $c . $match[0]);
221 223
                 $cmd = '';
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         }
83 83
         $this->srcValue = $value;
84 84
         $modifiers = trim($modifiers);
85
-        $modifiers = ':' . trim($modifiers, ':');
85
+        $modifiers = ':'.trim($modifiers, ':');
86 86
         $modifiers = str_replace(array("\r\n", "\r"), "\n", $modifiers);
87 87
         $modifiers = $this->splitEachModifiers($modifiers);
88 88
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     {
130 130
         if ($delim) {
131 131
             if ($mode == '(') {
132
-                return substr($modifiers, 1, strpos($modifiers, $delim . ')') - 1);
132
+                return substr($modifiers, 1, strpos($modifiers, $delim.')') - 1);
133 133
             }
134 134
 
135 135
             return substr($modifiers, 1, strpos($modifiers, $delim, 1) - 1);
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     {
156 156
         if ($delim) {
157 157
             if ($mode == '(') {
158
-                return $this->_fetchContent($modifiers, $delim . ')');
158
+                return $this->_fetchContent($modifiers, $delim.')');
159 159
             } else {
160 160
                 $modifiers = trim($modifiers);
161 161
                 $modifiers = substr($modifiers, 1);
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             } elseif (in_array($c, array('+', '-', '*', '/')) && preg_match('@^[0-9]+@', $modifiers,
218 218
                     $match)) { // :+3, :-3, :*3 ...
219 219
                 $modifiers = substr($modifiers, strlen($match[0]));
220
-                $result[] = array('cmd' => 'math', 'opt' => '%s' . $c . $match[0]);
220
+                $result[] = array('cmd' => 'math', 'opt' => '%s'.$c.$match[0]);
221 221
                 $cmd = '';
222 222
             } elseif ($c === '(' || $c === '=') {
223 223
                 $modifiers = $m1 = trim($modifiers);
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         }
333 333
 
334 334
         $_ = explode(',',
335
-            $this->condModifiers . ',_default,default,if,input,or,and,show,this,select,switch,then,else,id,ifempty,smart_desc,smart_description,summary');
335
+            $this->condModifiers.',_default,default,if,input,or,and,show,this,select,switch,then,else,id,ifempty,smart_desc,smart_description,summary');
336 336
         if (in_array($cmd, $_)) {
337 337
             return false;
338 338
         } else {
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             case 'eq':
366 366
             case 'is':
367 367
             case 'equals':
368
-                $this->condition[] = (int)($value == $opt);
368
+                $this->condition[] = (int) ($value == $opt);
369 369
                 break;
370 370
             case 'neq':
371 371
             case 'ne':
@@ -373,59 +373,59 @@  discard block
 block discarded – undo
373 373
             case 'isnot':
374 374
             case 'isnt':
375 375
             case 'not':
376
-                $this->condition[] = (int)($value != $opt);
376
+                $this->condition[] = (int) ($value != $opt);
377 377
                 break;
378 378
             case '%':
379
-                $this->condition[] = (int)($value % $opt == 0);
379
+                $this->condition[] = (int) ($value % $opt == 0);
380 380
                 break;
381 381
             case 'isempty':
382
-                $this->condition[] = (int)(empty($value));
382
+                $this->condition[] = (int) (empty($value));
383 383
                 break;
384 384
             case 'isntempty':
385 385
             case 'isnotempty':
386
-                $this->condition[] = (int)(!empty($value));
386
+                $this->condition[] = (int) (!empty($value));
387 387
                 break;
388 388
             case '>=':
389 389
             case 'gte':
390 390
             case 'eg':
391 391
             case 'isgte':
392
-                $this->condition[] = (int)($value >= $opt);
392
+                $this->condition[] = (int) ($value >= $opt);
393 393
                 break;
394 394
             case '<=':
395 395
             case 'lte':
396 396
             case 'el':
397 397
             case 'islte':
398
-                $this->condition[] = (int)($value <= $opt);
398
+                $this->condition[] = (int) ($value <= $opt);
399 399
                 break;
400 400
             case '>':
401 401
             case 'gt':
402 402
             case 'greaterthan':
403 403
             case 'isgreaterthan':
404 404
             case 'isgt':
405
-                $this->condition[] = (int)($value > $opt);
405
+                $this->condition[] = (int) ($value > $opt);
406 406
                 break;
407 407
             case '<':
408 408
             case 'lt':
409 409
             case 'lowerthan':
410 410
             case 'islowerthan':
411 411
             case 'islt':
412
-                $this->condition[] = (int)($value < $opt);
412
+                $this->condition[] = (int) ($value < $opt);
413 413
                 break;
414 414
             case 'find':
415
-                $this->condition[] = (int)(strpos($value, $opt) !== false);
415
+                $this->condition[] = (int) (strpos($value, $opt) !== false);
416 416
                 break;
417 417
             case 'inarray':
418 418
             case 'in_array':
419 419
             case 'in':
420 420
                 $opt = explode(',', $opt);
421
-                $this->condition[] = (int)(in_array($value, $opt) !== false);
421
+                $this->condition[] = (int) (in_array($value, $opt) !== false);
422 422
                 break;
423 423
             case 'wildcard_match':
424 424
             case 'wcard_match':
425 425
             case 'wildcard':
426 426
             case 'wcard':
427 427
             case 'fnmatch':
428
-                $this->condition[] = (int)(fnmatch($opt, $value) !== false);
428
+                $this->condition[] = (int) (fnmatch($opt, $value) !== false);
429 429
                 break;
430 430
             case 'is_file':
431 431
             case 'is_dir':
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
                 if (strpos($path, $modx->config['base_path']) === false) {
444 444
                     $path = ltrim($path, '/');
445 445
                 }
446
-                $this->condition[] = (int)($cmd($path) !== false);
446
+                $this->condition[] = (int) ($cmd($path) !== false);
447 447
                 break;
448 448
             case 'is_image':
449 449
                 if (!$opt) {
@@ -456,13 +456,13 @@  discard block
 block discarded – undo
456 456
                     break;
457 457
                 }
458 458
                 $_ = getimagesize($path);
459
-                $this->condition[] = (int)($_[0]);
459
+                $this->condition[] = (int) ($_[0]);
460 460
                 break;
461 461
             case 'regex':
462 462
             case 'preg':
463 463
             case 'preg_match':
464 464
             case 'isinrole':
465
-                $this->condition[] = (int)(preg_match($opt, $value));
465
+                $this->condition[] = (int) (preg_match($opt, $value));
466 466
                 break;
467 467
             case 'ir':
468 468
             case 'memberof':
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
             case 'show':
480 480
             case 'this':
481 481
                 $conditional = implode(' ', $this->condition);
482
-                $isvalid = (int)(eval("return ({$conditional});"));
482
+                $isvalid = (int) (eval("return ({$conditional});"));
483 483
                 if ($isvalid) {
484 484
                     return $this->srcValue;
485 485
                 }
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
                 return null;
488 488
             case 'then':
489 489
                 $conditional = implode(' ', $this->condition);
490
-                $isvalid = (int)eval("return ({$conditional});");
490
+                $isvalid = (int) eval("return ({$conditional});");
491 491
                 if ($isvalid) {
492 492
                     return $opt;
493 493
                 }
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
                 return null;
496 496
             case 'else':
497 497
                 $conditional = implode(' ', $this->condition);
498
-                $isvalid = (int)eval("return ({$conditional});");
498
+                $isvalid = (int) eval("return ({$conditional});");
499 499
                 if (!$isvalid) {
500 500
                     return $opt;
501 501
                 }
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
                 return $this->strpos($value, $opt);
655 655
             case 'wordwrap':
656 656
                 // default: 70
657
-                $wrapat = (int)$opt > 0 ? (int)$opt : 70;
657
+                $wrapat = (int) $opt > 0 ? (int) $opt : 70;
658 658
                 if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
659 659
                     return $this->includeMdfFile('wordwrap');
660 660
                 } else {
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
                 if (strpos($opt, ',') !== false) {
687 687
                     list($b, $e) = explode(',', $opt, 2);
688 688
 
689
-                    return $this->substr($value, $b, (int)$e);
689
+                    return $this->substr($value, $b, (int) $e);
690 690
                 } else {
691 691
                     return $this->substr($value, $opt);
692 692
                 }
@@ -705,9 +705,9 @@  discard block
 block discarded – undo
705 705
                     $str = '';
706 706
                 }
707 707
                 if (preg_match('/^[1-9][0-9]*$/', $len)) {
708
-                    return $this->substr($value, 0, $len) . $str;
708
+                    return $this->substr($value, 0, $len).$str;
709 709
                 } elseif (preg_match('/^\-[1-9][0-9]*$/', $len)) {
710
-                    return $str . $this->substr($value, $len);
710
+                    return $str.$this->substr($value, $len);
711 711
                 }
712 712
                 break;
713 713
             case 'summary':
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
             case 'concatenate':
773 773
             case '.':
774 774
                 if ($value !== '') {
775
-                    return $value . $opt;
775
+                    return $value.$opt;
776 776
                 }
777 777
                 break;
778 778
             case 'sprintf':
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
             case 'money_format':
791 791
                 setlocale(LC_MONETARY, setlocale(LC_TIME, 0));
792 792
                 if ($value !== '') {
793
-                    return money_format($opt, (double)$value);
793
+                    return money_format($opt, (double) $value);
794 794
                 }
795 795
                 break;
796 796
             case 'tobool':
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
                 return strtotime($value);
866 866
             #####  mathematical function
867 867
             case 'toint':
868
-                return (int)$value;
868
+                return (int) $value;
869 869
             case 'tofloat':
870 870
                 return floatval($value);
871 871
             case 'round':
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
                 return $cmd($value);
884 884
             case 'math':
885 885
             case 'calc':
886
-                $value = (int)$value;
886
+                $value = (int) $value;
887 887
                 if (empty($value)) {
888 888
                     $value = '0';
889 889
                 }
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
                 $where = implode(' AND ', $where);
1027 1027
                 $children = $modx->getDocumentChildren($value, $published, '0', 'id', $where);
1028 1028
                 $result = array();
1029
-                foreach ((array)$children as $child) {
1029
+                foreach ((array) $children as $child) {
1030 1030
                     $result[] = $child['id'];
1031 1031
                 }
1032 1032
 
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
                     $opt .= '/';
1131 1131
                 }
1132 1132
 
1133
-                $filename = MODX_BASE_PATH . $opt . $filename;
1133
+                $filename = MODX_BASE_PATH.$opt.$filename;
1134 1134
 
1135 1135
                 if (is_file($filename)) {
1136 1136
                     clearstatcache();
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
         $value = $this->value;
1292 1292
         $opt = $this->opt;
1293 1293
 
1294
-        return include(MODX_MANAGER_PATH . "includes/extenders/modifiers/mdf_{$cmd}.inc.php");
1294
+        return include(MODX_MANAGER_PATH."includes/extenders/modifiers/mdf_{$cmd}.inc.php");
1295 1295
     }
1296 1296
 
1297 1297
     public function getValueFromElement($key, $value, $cmd, $opt)
@@ -1307,13 +1307,13 @@  discard block
 block discarded – undo
1307 1307
                 $row = $modx->getDatabase()->getRow($result);
1308 1308
                 $php = $row['snippet'];
1309 1309
             } elseif ($total == 0) {
1310
-                $assets_path = MODX_BASE_PATH . 'assets/';
1311
-                if (is_file($assets_path . "modifiers/mdf_{$cmd}.inc.php")) {
1312
-                    $modifiers_path = $assets_path . "modifiers/mdf_{$cmd}.inc.php";
1313
-                } elseif (is_file($assets_path . "plugins/phx/modifiers/{$cmd}.phx.php")) {
1314
-                    $modifiers_path = $assets_path . "plugins/phx/modifiers/{$cmd}.phx.php";
1315
-                } elseif (is_file(MODX_MANAGER_PATH . "includes/extenders/modifiers/mdf_{$cmd}.inc.php")) {
1316
-                    $modifiers_path = MODX_MANAGER_PATH . "includes/extenders/modifiers/mdf_{$cmd}.inc.php";
1310
+                $assets_path = MODX_BASE_PATH.'assets/';
1311
+                if (is_file($assets_path."modifiers/mdf_{$cmd}.inc.php")) {
1312
+                    $modifiers_path = $assets_path."modifiers/mdf_{$cmd}.inc.php";
1313
+                } elseif (is_file($assets_path."plugins/phx/modifiers/{$cmd}.phx.php")) {
1314
+                    $modifiers_path = $assets_path."plugins/phx/modifiers/{$cmd}.phx.php";
1315
+                } elseif (is_file(MODX_MANAGER_PATH."includes/extenders/modifiers/mdf_{$cmd}.inc.php")) {
1316
+                    $modifiers_path = MODX_MANAGER_PATH."includes/extenders/modifiers/mdf_{$cmd}.inc.php";
1317 1317
                 } else {
1318 1318
                     $modifiers_path = false;
1319 1319
                 }
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
                         $php = substr($php, 0, -2);
1332 1332
                     }
1333 1333
                     if ($this->elmName !== '') {
1334
-                        $modx->snippetCache[$this->elmName . 'Props'] = '';
1334
+                        $modx->snippetCache[$this->elmName.'Props'] = '';
1335 1335
                     }
1336 1336
                 } else {
1337 1337
                     $php = false;
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
             $custom = eval($php);
1369 1369
             $msg = ob_get_contents();
1370 1370
             if ($value === $this->bt) {
1371
-                $value = $msg . $custom;
1371
+                $value = $msg.$custom;
1372 1372
             }
1373 1373
             ob_end_clean();
1374 1374
         } elseif ($html !== false && isset($value) && $value !== '') {
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
     public function ucfirst($str)
1543 1543
     {
1544 1544
         if (function_exists('mb_strtoupper')) {
1545
-            return mb_strtoupper($this->substr($str, 0, 1)) . $this->substr($str, 1, $this->strlen($str));
1545
+            return mb_strtoupper($this->substr($str, 0, 1)).$this->substr($str, 1, $this->strlen($str));
1546 1546
         }
1547 1547
 
1548 1548
         return ucfirst($str);
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
     public function lcfirst($str)
1552 1552
     {
1553 1553
         if (function_exists('mb_strtolower')) {
1554
-            return mb_strtolower($this->substr($str, 0, 1)) . $this->substr($str, 1, $this->strlen($str));
1554
+            return mb_strtolower($this->substr($str, 0, 1)).$this->substr($str, 1, $this->strlen($str));
1555 1555
         }
1556 1556
 
1557 1557
         return lcfirst($str);
Please login to merge, or discard this patch.
manager/actions/mutate_module_resources.dynamic.php 2 patches
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
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
 if(!$modx->hasPermission('edit_module')) {
7
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
8 8
 }
9 9
 
10 10
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
@@ -26,91 +26,91 @@  discard block
 block discarded – undo
26 26
 // check to see the  editor isn't locked
27 27
 $rs = $modx->getDatabase()->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'");
28 28
 if($username = $modx->getDatabase()->getValue($rs)) {
29
-	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module'));
29
+    $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module'));
30 30
 }
31 31
 // end check for lock
32 32
 
33 33
 // take action
34 34
 switch($_REQUEST['op']) {
35
-	case 'add':
36
-		// convert ids to numbers
37
-		$opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids'])));
38
-
39
-		if(count($opids) > 0) {
40
-			// 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs
41
-			$rt = strtolower($_REQUEST["rt"]);
42
-			if($rt == 'chunk') {
43
-				$type = 10;
44
-			}
45
-			if($rt == 'doc') {
46
-				$type = 20;
47
-			}
48
-			if($rt == 'plug') {
49
-				$type = 30;
50
-			}
51
-			if($rt == 'snip') {
52
-				$type = 40;
53
-			}
54
-			if($rt == 'tpl') {
55
-				$type = 50;
56
-			}
57
-			if($rt == 'tv') {
58
-				$type = 60;
59
-			}
60
-			$modx->getDatabase()->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'");
61
-			foreach($opids as $opid) {
62
-				$modx->getDatabase()->insert(array(
63
-					'module' => $id,
64
-					'resource' => $opid,
65
-					'type' => $type,
66
-				), $tbl_site_module_depobj);
67
-			}
68
-		}
69
-		break;
70
-	case 'del':
71
-		// convert ids to numbers
72
-		$opids = array_filter(array_map('intval', $_REQUEST['depid']));
73
-
74
-		// get resources that needs to be removed
75
-		$ds = $modx->getDatabase()->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")");
76
-		// loop through resources and look for plugins and snippets
77
-		$plids = array();
78
-		$snid = array();
79
-		while($row = $modx->getDatabase()->getRow($ds)) {
80
-			if($row['type'] == '30') {
81
-				$plids[$i] = $row['resource'];
82
-			}
83
-			if($row['type'] == '40') {
84
-				$snids[$i] = $row['resource'];
85
-			}
86
-		}
87
-		// get guid
88
-		$ds = $modx->getDatabase()->select('guid', $tbl_site_modules, "id='{$id}'");
89
-		$guid = $modx->getDatabase()->getValue($ds);
90
-		// reset moduleguid for deleted resources
91
-		if(($cp = count($plids)) || ($cs = count($snids))) {
92
-			if($cp) {
93
-				$modx->getDatabase()->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'");
94
-			}
95
-			if($cs) {
96
-				$modx->getDatabase()->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'");
97
-			}
98
-			// reset cache
99
-			$modx->clearCache('full');
100
-		}
101
-		$modx->getDatabase()->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")");
102
-		break;
35
+    case 'add':
36
+        // convert ids to numbers
37
+        $opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids'])));
38
+
39
+        if(count($opids) > 0) {
40
+            // 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs
41
+            $rt = strtolower($_REQUEST["rt"]);
42
+            if($rt == 'chunk') {
43
+                $type = 10;
44
+            }
45
+            if($rt == 'doc') {
46
+                $type = 20;
47
+            }
48
+            if($rt == 'plug') {
49
+                $type = 30;
50
+            }
51
+            if($rt == 'snip') {
52
+                $type = 40;
53
+            }
54
+            if($rt == 'tpl') {
55
+                $type = 50;
56
+            }
57
+            if($rt == 'tv') {
58
+                $type = 60;
59
+            }
60
+            $modx->getDatabase()->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'");
61
+            foreach($opids as $opid) {
62
+                $modx->getDatabase()->insert(array(
63
+                    'module' => $id,
64
+                    'resource' => $opid,
65
+                    'type' => $type,
66
+                ), $tbl_site_module_depobj);
67
+            }
68
+        }
69
+        break;
70
+    case 'del':
71
+        // convert ids to numbers
72
+        $opids = array_filter(array_map('intval', $_REQUEST['depid']));
73
+
74
+        // get resources that needs to be removed
75
+        $ds = $modx->getDatabase()->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")");
76
+        // loop through resources and look for plugins and snippets
77
+        $plids = array();
78
+        $snid = array();
79
+        while($row = $modx->getDatabase()->getRow($ds)) {
80
+            if($row['type'] == '30') {
81
+                $plids[$i] = $row['resource'];
82
+            }
83
+            if($row['type'] == '40') {
84
+                $snids[$i] = $row['resource'];
85
+            }
86
+        }
87
+        // get guid
88
+        $ds = $modx->getDatabase()->select('guid', $tbl_site_modules, "id='{$id}'");
89
+        $guid = $modx->getDatabase()->getValue($ds);
90
+        // reset moduleguid for deleted resources
91
+        if(($cp = count($plids)) || ($cs = count($snids))) {
92
+            if($cp) {
93
+                $modx->getDatabase()->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'");
94
+            }
95
+            if($cs) {
96
+                $modx->getDatabase()->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'");
97
+            }
98
+            // reset cache
99
+            $modx->clearCache('full');
100
+        }
101
+        $modx->getDatabase()->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")");
102
+        break;
103 103
 }
104 104
 
105 105
 // load record
106 106
 $rs = $modx->getDatabase()->select('*', $tbl_site_modules, "id = '{$id}'");
107 107
 $content = $modx->getDatabase()->getRow($rs);
108 108
 if(!$content) {
109
-	$modx->webAlertAndQuit("Module not found for id '{$id}'.");
109
+    $modx->webAlertAndQuit("Module not found for id '{$id}'.");
110 110
 }
111 111
 $_SESSION['itemname'] = $content['name'];
112 112
 if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
113
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
113
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
114 114
 }
115 115
 
116 116
 ?>
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 				<tr>
204 204
 					<td valign="top" align="left">
205 205
 						<?php
206
-						$ds = $modx->getDatabase()->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name,
206
+                        $ds = $modx->getDatabase()->select("smd.id,COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) as name,
207 207
 				CASE smd.type
208 208
 					WHEN 10 THEN 'Chunk'
209 209
 					WHEN 20 THEN 'Document'
@@ -218,17 +218,17 @@  discard block
 block discarded – undo
218 218
 					LEFT JOIN {$tbl_site_snippets} AS ss ON ss.id = smd.resource AND smd.type = '40'
219 219
 					LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = '50'
220 220
 					LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = '60'", "smd.module={$id}", "smd.type,name");
221
-						$grd = new \EvolutionCMS\Support\DataGrid('', $ds, 0); // set page size to 0 t show all items
222
-						$grd->noRecordMsg = $_lang["no_records_found"];
223
-						$grd->cssClass = "grid";
224
-						$grd->columnHeaderClass = "gridHeader";
225
-						$grd->itemClass = "gridItem";
226
-						$grd->altItemClass = "gridAltItem";
227
-						$grd->columns = $_lang["element_name"] . " ," . $_lang["type"];
228
-						$grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]";
229
-						$grd->fields = "name,type";
230
-						echo $grd->render();
231
-						?>
221
+                        $grd = new \EvolutionCMS\Support\DataGrid('', $ds, 0); // set page size to 0 t show all items
222
+                        $grd->noRecordMsg = $_lang["no_records_found"];
223
+                        $grd->cssClass = "grid";
224
+                        $grd->columnHeaderClass = "gridHeader";
225
+                        $grd->itemClass = "gridItem";
226
+                        $grd->altItemClass = "gridAltItem";
227
+                        $grd->columns = $_lang["element_name"] . " ," . $_lang["type"];
228
+                        $grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]";
229
+                        $grd->fields = "name,type";
230
+                        echo $grd->render();
231
+                        ?>
232 232
 					</td>
233 233
 					<td valign="top" style="width: 150px;">
234 234
 						<a class="btn btn-block btn-danger text-left" style="margin-bottom:10px;" href="javascript:;" onclick="removeDependencies();return false;"><i class="<?php echo $_style["actions_delete"] ?>"></i> <?php echo $_lang['remove']; ?></a>
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  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
-if(!$modx->hasPermission('edit_module')) {
6
+if (!$modx->hasPermission('edit_module')) {
7 7
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
8 8
 }
9 9
 
10
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
10
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
11 11
 
12 12
 // Get table names (alphabetical)
13 13
 $tbl_active_users = $modx->getDatabase()->getFullTableName('active_users');
@@ -24,41 +24,41 @@  discard block
 block discarded – undo
24 24
 $modx->getManagerApi()->initPageViewState();
25 25
 
26 26
 // check to see the  editor isn't locked
27
-$rs = $modx->getDatabase()->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='" . $modx->getLoginUserID() . "'");
28
-if($username = $modx->getDatabase()->getValue($rs)) {
27
+$rs = $modx->getDatabase()->select('username', $tbl_active_users, "action=108 AND id='{$id}' AND internalKey!='".$modx->getLoginUserID()."'");
28
+if ($username = $modx->getDatabase()->getValue($rs)) {
29 29
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $username, 'module'));
30 30
 }
31 31
 // end check for lock
32 32
 
33 33
 // take action
34
-switch($_REQUEST['op']) {
34
+switch ($_REQUEST['op']) {
35 35
 	case 'add':
36 36
 		// convert ids to numbers
37 37
 		$opids = array_filter(array_map('intval', explode(',', $_REQUEST['newids'])));
38 38
 
39
-		if(count($opids) > 0) {
39
+		if (count($opids) > 0) {
40 40
 			// 1-snips, 2-tpls, 3-tvs, 4-chunks, 5-plugins, 6-docs
41 41
 			$rt = strtolower($_REQUEST["rt"]);
42
-			if($rt == 'chunk') {
42
+			if ($rt == 'chunk') {
43 43
 				$type = 10;
44 44
 			}
45
-			if($rt == 'doc') {
45
+			if ($rt == 'doc') {
46 46
 				$type = 20;
47 47
 			}
48
-			if($rt == 'plug') {
48
+			if ($rt == 'plug') {
49 49
 				$type = 30;
50 50
 			}
51
-			if($rt == 'snip') {
51
+			if ($rt == 'snip') {
52 52
 				$type = 40;
53 53
 			}
54
-			if($rt == 'tpl') {
54
+			if ($rt == 'tpl') {
55 55
 				$type = 50;
56 56
 			}
57
-			if($rt == 'tv') {
57
+			if ($rt == 'tv') {
58 58
 				$type = 60;
59 59
 			}
60
-			$modx->getDatabase()->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (" . implode(',', $opids) . ") AND type='{$type}'");
61
-			foreach($opids as $opid) {
60
+			$modx->getDatabase()->delete($tbl_site_module_depobj, "module='{$id}' AND resource IN (".implode(',', $opids).") AND type='{$type}'");
61
+			foreach ($opids as $opid) {
62 62
 				$modx->getDatabase()->insert(array(
63 63
 					'module' => $id,
64 64
 					'resource' => $opid,
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 		$opids = array_filter(array_map('intval', $_REQUEST['depid']));
73 73
 
74 74
 		// get resources that needs to be removed
75
-		$ds = $modx->getDatabase()->select('*', $tbl_site_module_depobj, "id IN (" . implode(",", $opids) . ")");
75
+		$ds = $modx->getDatabase()->select('*', $tbl_site_module_depobj, "id IN (".implode(",", $opids).")");
76 76
 		// loop through resources and look for plugins and snippets
77 77
 		$plids = array();
78 78
 		$snid = array();
79
-		while($row = $modx->getDatabase()->getRow($ds)) {
80
-			if($row['type'] == '30') {
79
+		while ($row = $modx->getDatabase()->getRow($ds)) {
80
+			if ($row['type'] == '30') {
81 81
 				$plids[$i] = $row['resource'];
82 82
 			}
83
-			if($row['type'] == '40') {
83
+			if ($row['type'] == '40') {
84 84
 				$snids[$i] = $row['resource'];
85 85
 			}
86 86
 		}
@@ -88,28 +88,28 @@  discard block
 block discarded – undo
88 88
 		$ds = $modx->getDatabase()->select('guid', $tbl_site_modules, "id='{$id}'");
89 89
 		$guid = $modx->getDatabase()->getValue($ds);
90 90
 		// reset moduleguid for deleted resources
91
-		if(($cp = count($plids)) || ($cs = count($snids))) {
92
-			if($cp) {
93
-				$modx->getDatabase()->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $plids) . ") AND moduleguid='{$guid}'");
91
+		if (($cp = count($plids)) || ($cs = count($snids))) {
92
+			if ($cp) {
93
+				$modx->getDatabase()->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (".implode(',', $plids).") AND moduleguid='{$guid}'");
94 94
 			}
95
-			if($cs) {
96
-				$modx->getDatabase()->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (" . implode(',', $snids) . ") AND moduleguid='{$guid}'");
95
+			if ($cs) {
96
+				$modx->getDatabase()->update(array('moduleguid' => ''), $tbl_site_plugins, "id IN (".implode(',', $snids).") AND moduleguid='{$guid}'");
97 97
 			}
98 98
 			// reset cache
99 99
 			$modx->clearCache('full');
100 100
 		}
101
-		$modx->getDatabase()->delete($tbl_site_module_depobj, "id IN (" . implode(',', $opids) . ")");
101
+		$modx->getDatabase()->delete($tbl_site_module_depobj, "id IN (".implode(',', $opids).")");
102 102
 		break;
103 103
 }
104 104
 
105 105
 // load record
106 106
 $rs = $modx->getDatabase()->select('*', $tbl_site_modules, "id = '{$id}'");
107 107
 $content = $modx->getDatabase()->getRow($rs);
108
-if(!$content) {
108
+if (!$content) {
109 109
 	$modx->webAlertAndQuit("Module not found for id '{$id}'.");
110 110
 }
111 111
 $_SESSION['itemname'] = $content['name'];
112
-if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
112
+if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
113 113
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
114 114
 }
115 115
 
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 	<input type="hidden" name="id" value="<?php echo $content['id']; ?>" />
189 189
 
190 190
 	<h1>
191
-		<i class="fa fa-cogs"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['module_resource_title']) ?>
191
+		<i class="fa fa-cogs"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['module_resource_title']) ?>
192 192
 	</h1>
193 193
 
194 194
 	<?php echo $_style['actionbuttons']['dynamic']['close'] ?>
195 195
 
196 196
 	<div class="section">
197
-		<div class="sectionHeader"><?php echo $content["name"] . " - " . $_lang['module_resource_title']; ?></div>
197
+		<div class="sectionHeader"><?php echo $content["name"]." - ".$_lang['module_resource_title']; ?></div>
198 198
 		<div class="sectionBody">
199 199
 			<p><?php echo $_lang['module_resource_msg']; ?></p>
200 200
 			<br />
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 						$grd->columnHeaderClass = "gridHeader";
225 225
 						$grd->itemClass = "gridItem";
226 226
 						$grd->altItemClass = "gridAltItem";
227
-						$grd->columns = $_lang["element_name"] . " ," . $_lang["type"];
227
+						$grd->columns = $_lang["element_name"]." ,".$_lang["type"];
228 228
 						$grd->colTypes = "template:<input type='checkbox' name='depid[]' value='[+id+]'> [+value+]";
229 229
 						$grd->fields = "name,type";
230 230
 						echo $grd->render();
Please login to merge, or discard this patch.
manager/actions/resource_selector.static.php 1 patch
Spacing   +5 added lines, -5 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 />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if (!$modx->hasPermission('edit_module')) {
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 }
65 65
 
66
-include_once MODX_MANAGER_PATH . "includes/header.inc.php";
66
+include_once MODX_MANAGER_PATH."includes/header.inc.php";
67 67
 ?>
68 68
 <script language="JavaScript" type="text/javascript">
69 69
     function saveSelection()
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 </script>
139 139
 
140 140
 <h1>
141
-    <?= $title . " - " . $_lang['element_selector_title'] ?><i class="fa fa-question-circle help"></i>
141
+    <?= $title." - ".$_lang['element_selector_title'] ?><i class="fa fa-question-circle help"></i>
142 142
 </h1>
143 143
 
144 144
 <div id="actions">
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
                     $grd->columnHeaderClass = "tableHeader";
184 184
                     $grd->itemClass = "tableItem";
185 185
                     $grd->altItemClass = "tableAltItem";
186
-                    $grd->columns = $_lang["name"] . " ," . $_lang["description"];
187
-                    $grd->colTypes = "template:<input type='" . ($sm == 'm' ? 'checkbox' : 'radio') . "' name='id[]' value='[+id+]' onclick='setCheckbox(this);'> [+value+]";
186
+                    $grd->columns = $_lang["name"]." ,".$_lang["description"];
187
+                    $grd->colTypes = "template:<input type='".($sm == 'm' ? 'checkbox' : 'radio')."' name='id[]' value='[+id+]' onclick='setCheckbox(this);'> [+value+]";
188 188
                     $grd->colWidths = "45%";
189 189
                     $grd->fields = "name,description";
190 190
                     if ($_REQUEST['listmode'] == '1') {
Please login to merge, or discard this patch.
manager/includes/functions/helper.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!function_exists('createGUID')) {
3
+if (!function_exists('createGUID')) {
4 4
     /**
5 5
      * create globally unique identifiers (guid)
6 6
      *
@@ -8,22 +8,22 @@  discard block
 block discarded – undo
8 8
      */
9 9
     function createGUID()
10 10
     {
11
-        srand((double)microtime() * 1000000);
11
+        srand((double) microtime() * 1000000);
12 12
         $r = rand();
13
-        $u = uniqid(getmypid() . $r . (double)microtime() * 1000000, 1);
13
+        $u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1);
14 14
         $m = md5($u);
15 15
 
16 16
         return $m;
17 17
     }
18 18
 }
19 19
 
20
-if(!function_exists('generate_password')) {
20
+if (!function_exists('generate_password')) {
21 21
 // Generate password
22 22
     function generate_password($length = 10)
23 23
     {
24 24
         $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789";
25 25
         $ps_len = strlen($allowable_characters);
26
-        mt_srand((double)microtime() * 1000000);
26
+        mt_srand((double) microtime() * 1000000);
27 27
         $pass = "";
28 28
         for ($i = 0; $i < $length; $i++) {
29 29
             $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)];
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     }
34 34
 }
35 35
 
36
-if (! function_exists('entities')) {
36
+if (!function_exists('entities')) {
37 37
     /**
38 38
      * @param  string $string
39 39
      * @param  string $charset
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     }
46 46
 }
47 47
 
48
-if (! function_exists('get_by_key')) {
48
+if (!function_exists('get_by_key')) {
49 49
     /**
50 50
      * @param mixed $data
51 51
      * @param string|int $key
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         if (is_array($data) && (is_int($key) || is_string($key)) && $key !== '' && array_key_exists($key, $data)) {
60 60
             $out = $data[$key];
61 61
         }
62
-        if (! empty($validate) && is_callable($validate)) {
62
+        if (!empty($validate) && is_callable($validate)) {
63 63
             $out = (($validate($out) === true) ? $out : $default);
64 64
         }
65 65
         return $out;
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     /**
38 38
      * @param  string $string
39 39
      * @param  string $charset
40
-     * @return mixed
40
+     * @return string
41 41
      */
42 42
     function entities($string, $charset = 'UTF-8')
43 43
     {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 if (! function_exists('get_by_key')) {
49 49
     /**
50 50
      * @param mixed $data
51
-     * @param string|int $key
51
+     * @param string|null $key
52 52
      * @param mixed $default
53 53
      * @param Closure $validate
54 54
      * @return mixed
Please login to merge, or discard this patch.
manager/includes/src/Support/MysqlDumper.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
         // Set line feed
75 75
         $lf = "\n";
76
-        $tempfile_path = $modx->config['base_path'] . 'assets/backup/temp.php';
76
+        $tempfile_path = $modx->config['base_path'].'assets/backup/temp.php';
77 77
 
78 78
         $result = $modx->getDatabase()->query('SHOW TABLES');
79 79
         $tables = $this->result2Array(0, $result);
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 
87 87
         // Set header
88 88
         $output = "#{$lf}";
89
-        $output .= "# " . addslashes($modx->getPhpCompat()->entities($modx->config['site_name'])) . " Database Dump{$lf}";
89
+        $output .= "# ".addslashes($modx->getPhpCompat()->entities($modx->config['site_name']))." Database Dump{$lf}";
90 90
         $output .= "# MODX Version:{$version['version']}{$lf}";
91 91
         $output .= "# {$lf}";
92 92
         $output .= "# Host: {$this->database_server}{$lf}";
93
-        $output .= "# Generation Time: " . $modx->toDateFormat(time()) . $lf;
94
-        $output .= "# Server version: " . $modx->getDatabase()->getVersion() . $lf;
95
-        $output .= "# PHP Version: " . phpversion() . $lf;
93
+        $output .= "# Generation Time: ".$modx->toDateFormat(time()).$lf;
94
+        $output .= "# Server version: ".$modx->getDatabase()->getVersion().$lf;
95
+        $output .= "# PHP Version: ".phpversion().$lf;
96 96
         $output .= "# Database: `{$this->dbname}`{$lf}";
97
-        $output .= "# Description: " . trim($_REQUEST['backup_title']) . "{$lf}";
97
+        $output .= "# Description: ".trim($_REQUEST['backup_title'])."{$lf}";
98 98
         $output .= "#";
99 99
         file_put_contents($tempfile_path, $output, FILE_APPEND | LOCK_EX);
100 100
         $output = '';
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                 }
114 114
             }
115 115
             if ($callBack === 'snapshot') {
116
-                if (!preg_match('@^' . $modx->getDatabase()->config['table_prefix'] . '@', $tblval)) {
116
+                if (!preg_match('@^'.$modx->getDatabase()->config['table_prefix'].'@', $tblval)) {
117 117
                     continue;
118 118
                 }
119 119
             }
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
                         ), '\\n', $value);
151 151
                         $value = "'{$value}'";
152 152
                     }
153
-                    $insertdump .= $value . ',';
153
+                    $insertdump .= $value.',';
154 154
                 }
155
-                $output .= rtrim($insertdump, ',') . ");\n";
155
+                $output .= rtrim($insertdump, ',').");\n";
156 156
                 if (1048576 < strlen($output)) {
157 157
                     file_put_contents($tempfile_path, $output, FILE_APPEND | LOCK_EX);
158 158
                     $output = '';
Please login to merge, or discard this patch.
manager/processors/duplicate_htmlsnippet.processor.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
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
 if(!$modx->hasPermission('new_chunk')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // count duplicates
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 
20 20
 // duplicate htmlsnippet
21 21
 $newid = $modx->getDatabase()->insert(
22
-	array(
23
-		'name'=>'',
24
-		'description'=>'',
25
-		'snippet'=>'',
26
-		'category'=>'',
27
-		), $modx->getDatabase()->getFullTableName('site_htmlsnippets'), // Insert into
28
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'name'=>'',
24
+        'description'=>'',
25
+        'snippet'=>'',
26
+        'category'=>'',
27
+        ), $modx->getDatabase()->getFullTableName('site_htmlsnippets'), // Insert into
28
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from
29 29
 
30 30
 // Set the item name for logger
31 31
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$newid}'"));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  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
-if(!$modx->hasPermission('new_chunk')) {
5
+if (!$modx->hasPermission('new_chunk')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10
-if($id==0) {
9
+$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // count duplicates
15 15
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$id}'"));
16 16
 $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
17
+if ($count >= 1) $count = ' '.($count + 1);
18 18
 else $count = '';
19 19
 
20 20
 // duplicate htmlsnippet
@@ -32,5 +32,5 @@  discard block
 block discarded – undo
32 32
 $_SESSION['itemname'] = $name;
33 33
 
34 34
 // finish duplicating - redirect to new chunk
35
-$header="Location: index.php?r=2&a=78&id=$newid";
35
+$header = "Location: index.php?r=2&a=78&id=$newid";
36 36
 header($header);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,11 @@
 block discarded – undo
14 14
 // count duplicates
15 15
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$id}'"));
16 16
 $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
18
-else $count = '';
17
+if($count>=1) {
18
+    $count = ' '.($count+1);
19
+} else {
20
+    $count = '';
21
+}
19 22
 
20 23
 // duplicate htmlsnippet
21 24
 $newid = $modx->getDatabase()->insert(
Please login to merge, or discard this patch.