Completed
Pull Request — develop (#740)
by Maxim
08:32
created
index.php 1 patch
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.
manager/includes/src/Legacy/Modifiers.php 1 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.
install/src/controllers/install.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (file_exists(dirname(dirname(dirname(__DIR__))) . "/assets/cache/siteManager.php")) {
3
-    include_once(dirname(dirname(dirname(__DIR__))) . "/assets/cache/siteManager.php");
2
+if (file_exists(dirname(dirname(dirname(__DIR__)))."/assets/cache/siteManager.php")) {
3
+    include_once(dirname(dirname(dirname(__DIR__)))."/assets/cache/siteManager.php");
4 4
 } else {
5 5
     define('MGR_DIR', 'manager');
6 6
 }
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 // set timout limit
26 26
 @ set_time_limit(120); // used @ to prevent warning when using safe mode?
27 27
 
28
-$installMode = (int)$_POST['installmode'];
29
-$installData = (int)!empty($_POST['installdata']);
28
+$installMode = (int) $_POST['installmode'];
29
+$installData = (int) !empty($_POST['installdata']);
30 30
 
31 31
 // get db info from post
32 32
 $database_server = $_POST['databasehost'];
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
37 37
 $database_connection_charset = $_POST['database_connection_charset'];
38 38
 $database_connection_method = $_POST['database_connection_method'];
39
-$dbase = "`" . $_POST['database_name'] . "`";
39
+$dbase = "`".$_POST['database_name']."`";
40 40
 $table_prefix = $_POST['tableprefix'];
41 41
 $adminname = $_POST['cmsadmin'];
42 42
 $adminemail = $_POST['cmsadminemail'];
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 // set session name variable
48 48
 if (!isset ($site_sessionname)) {
49
-    $site_sessionname = 'SN' . uniqid('');
49
+    $site_sessionname = 'SN'.uniqid('');
50 50
 }
51 51
 
52 52
 // get base path and url
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 }
63 63
 $pth = implode('install', $a);
64 64
 unset ($a);
65
-$base_url = $url . (substr($url, -1) != '/' ? '/' : '');
66
-$base_path = $pth . (substr($pth, -1) != '/' ? '/' : '');
65
+$base_url = $url.(substr($url, -1) != '/' ? '/' : '');
66
+$base_path = $pth.(substr($pth, -1) != '/' ? '/' : '');
67 67
 
68 68
 // connect to the database
69 69
 $conn = @mysqli_connect($database_server, $database_user, $database_password);
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     if ($installLevel === 1) {
93 93
         // check table prefix
94 94
         if ($installMode === 0) {
95
-            $query = "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`";
95
+            $query = "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`";
96 96
             if (@mysqli_query($conn, $query)) {
97 97
                 $errors += 1;
98 98
             } else {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         // check status of Inherit Parent Template plugin
108 108
         $auto_template_logic = 'parent';
109 109
         if ($installMode !== 0) {
110
-            $query = "SELECT properties, disabled FROM " . $dbase . ".`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'";
110
+            $query = "SELECT properties, disabled FROM ".$dbase.".`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'";
111 111
             $rs = mysqli_query($conn, $query);
112 112
             $row = mysqli_fetch_row($rs);
113 113
             if (!$row) {
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
         }
131 131
 
132 132
         // open db connection
133
-        include dirname(__DIR__) . '/processor/result.php';
134
-        include_once dirname(__DIR__) . '/sqlParser.class.php';
133
+        include dirname(__DIR__).'/processor/result.php';
134
+        include_once dirname(__DIR__).'/sqlParser.class.php';
135 135
         $sqlParser = new SqlParser(
136 136
             $database_server,
137 137
             $database_user,
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
         $confph['lastInstallTime'] = time();
178 178
         $confph['site_sessionname'] = $site_sessionname;
179 179
 
180
-        $configString = file_get_contents(dirname(dirname(__DIR__)) . '/stubs/config.tpl');
180
+        $configString = file_get_contents(dirname(dirname(__DIR__)).'/stubs/config.tpl');
181 181
         $configString = parse($configString, $confph);
182 182
 
183
-        $filename = dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/config.inc.php';
183
+        $filename = dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/config.inc.php';
184 184
         $configFileFailed = false;
185 185
         if (@ !$handle = fopen($filename, 'w')) {
186 186
             $configFileFailed = true;
@@ -208,13 +208,13 @@  discard block
 block discarded – undo
208 208
             $siteid = uniqid('');
209 209
             mysqli_query(
210 210
                     $sqlParser->conn,
211
-                "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"
211
+                "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"
212 212
             );
213 213
         } else {
214 214
             // update site_id if missing
215 215
             $ds = mysqli_query(
216 216
                     $sqlParser->conn,
217
-                "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"
217
+                "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'"
218 218
             );
219 219
             if ($ds) {
220 220
                 $r = mysqli_fetch_assoc($ds);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                     $siteid = uniqid('');
224 224
                     mysqli_query(
225 225
                             $sqlParser->conn,
226
-                        "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"
226
+                        "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"
227 227
                     );
228 228
                 }
229 229
             }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     if ($installLevel === 5 && (isset ($_POST['template']) || $installData)) {
250 250
         $selTemplates = $_POST['template'];
251 251
         foreach ($moduleTemplates as $k => $moduleTemplate) {
252
-            if (! is_array($moduleTemplate)) {
252
+            if (!is_array($moduleTemplate)) {
253 253
                 continue;
254 254
             }
255 255
             $installDataLevel['templates'][$moduleTemplate[0]] = array(
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
                     $template = mysqli_real_escape_string($conn, $template);
288 288
 
289 289
                     // See if the template already exists
290
-                    $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'";
290
+                    $query = "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'";
291 291
                     $rs = mysqli_query($sqlParser->conn, $query);
292 292
 
293 293
                     if (mysqli_num_rows($rs)) {
294 294
                         $installDataLevel['templates'][$moduleTemplate[0]]['type'] = 'update';
295
-                        $query = "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;";
295
+                        $query = "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;";
296 296
                         if (!mysqli_query($sqlParser->conn, $query)) {
297 297
                             $errors += 1;
298 298
                             $installDataLevel['templates'][$moduleTemplate[0]]['error'] = array(
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                         if (!is_null($save_sql_id_as)) {
306 306
                             $sql_id = @mysqli_insert_id($sqlParser->conn);
307 307
                             if (!$sql_id) {
308
-                                $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;";
308
+                                $query = "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;";
309 309
                                 $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, $query));
310 310
                                 $sql_id = $idQuery['id'];
311 311
                             }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
                         }
314 314
                     } else {
315 315
                         $installDataLevel['templates'][$moduleTemplate[0]]['type'] = 'create';
316
-                        $query = "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');";
316
+                        $query = "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');";
317 317
                         if (!@mysqli_query($sqlParser->conn, $query)) {
318 318
                             $errors += 1;
319 319
                             $installDataLevel['templates'][$moduleTemplate[0]]['error'] = array(
@@ -378,12 +378,12 @@  discard block
 block discarded – undo
378 378
                 // Create the category if it does not already exist
379 379
                 $category = getCreateDbCategory($category, $sqlParser);
380 380
 
381
-                $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'";
382
-                $rs = mysqli_query($sqlParser->conn,$query);
381
+                $query = "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'";
382
+                $rs = mysqli_query($sqlParser->conn, $query);
383 383
                 if (mysqli_num_rows($rs)) {
384 384
                     $installDataLevel['tvs'][$moduleTV[0]]['type'] = 'update';
385 385
                     while ($row = mysqli_fetch_assoc($rs)) {
386
-                        $query = "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};";
386
+                        $query = "UPDATE $dbase.`".$table_prefix."site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};";
387 387
                         if (!mysqli_query($sqlParser->conn, $query)) {
388 388
                             $installDataLevel['tvs'][$moduleTV[0]]['error'] = array(
389 389
                                 'type' => 'sql',
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
                     }
397 397
                 } else {
398 398
                     $installDataLevel['tvs'][$moduleTV[0]]['type'] = 'create';
399
-                    $q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
399
+                    $q = "INSERT INTO $dbase.`".$table_prefix."site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
400 400
                     if (!mysqli_query($sqlParser->conn, $q)) {
401 401
                         $installDataLevel['tvs'][$moduleTV[0]]['error'] = array(
402 402
                             'type' => 'sql',
@@ -413,23 +413,23 @@  discard block
 block discarded – undo
413 413
                 if (count($assignments) > 0) {
414 414
 
415 415
                     // remove existing tv -> template assignments
416
-                    $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name' AND description='$desc';";
416
+                    $query = "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';";
417 417
                     $ds = mysqli_query($sqlParser->conn, $query);
418 418
                     $row = mysqli_fetch_assoc($ds);
419 419
                     $id = $row["id"];
420
-                    $query = 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\'';
420
+                    $query = 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\'';
421 421
                     mysqli_query($sqlParser->conn, $query);
422 422
 
423 423
                     // add tv -> template assignments
424 424
                     foreach ($assignments as $assignment) {
425 425
                         $template = mysqli_real_escape_string($conn, $assignment);
426
-                        $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$template';";
426
+                        $query = "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$template';";
427 427
                         $ts = mysqli_query($sqlParser->conn, $query);
428 428
                         if ($ds && $ts) {
429 429
                             $tRow = mysqli_fetch_assoc($ts);
430 430
                             $templateId = $tRow['id'];
431
-                            $query = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)";
432
-                            mysqli_query($sqlParser->conn,$query);
431
+                            $query = "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)";
432
+                            mysqli_query($sqlParser->conn, $query);
433 433
                         }
434 434
                     }
435 435
                 }
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['chunk']) || $installData)) {
442 442
         $selChunks = $_POST['chunk'];
443 443
         foreach ($moduleChunks as $k => $moduleChunk) {
444
-            if (! is_array($moduleChunk)) {
444
+            if (!is_array($moduleChunk)) {
445 445
                 continue;
446 446
             }
447 447
             $installDataLevel['chunks'][$moduleChunk[0]] = array(
@@ -479,14 +479,14 @@  discard block
 block discarded – undo
479 479
                     $chunk = mysqli_real_escape_string($conn, $chunk);
480 480
                     $rs = mysqli_query(
481 481
                         $sqlParser->conn,
482
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"
482
+                        "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'"
483 483
                     );
484 484
                     $count_original_name = mysqli_num_rows($rs);
485 485
                     if ($overwrite == 'false') {
486
-                        $newname = $name . '-' . str_replace('.', '_', $modx_version);
486
+                        $newname = $name.'-'.str_replace('.', '_', $modx_version);
487 487
                         $rs = mysqli_query(
488 488
                             $sqlParser->conn,
489
-                            "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"
489
+                            "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'"
490 490
                         );
491 491
                         $count_new_name = mysqli_num_rows($rs);
492 492
                     }
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
                     if ($update) {
495 495
                         $installDataLevel['chunks'][$moduleChunk[0]]['type'] = 'update';
496 496
                         if (!mysqli_query($sqlParser->conn,
497
-                            "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
497
+                            "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
498 498
                             $errors += 1;
499 499
                             $installDataLevel['chunks'][$moduleChunk[0]]['error'] = array(
500 500
                                 'type' => 'sql',
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
                         } else {
512 512
                             $installDataLevel['chunks'][$moduleChunk[0]]['type'] = 'create';
513 513
                         }
514
-                        $query = "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);";
514
+                        $query = "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);";
515 515
                         if (!mysqli_query($sqlParser->conn, $query)) {
516 516
                             $errors += 1;
517 517
                             $installDataLevel['chunks'][$moduleChunk[0]]['error'] = array(
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['module']) || $installData)) {
535 535
         $selModules = $_POST['module'];
536 536
         foreach ($moduleModules as $k => $moduleModule) {
537
-            if (! is_array($moduleModule)) {
537
+            if (!is_array($moduleModule)) {
538 538
                 continue;
539 539
             }
540 540
             $installDataLevel['modules'][$moduleModule[0]] = array(
@@ -573,13 +573,13 @@  discard block
 block discarded – undo
573 573
                     // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab
574 574
                     $module = mysqli_real_escape_string($conn, $module);
575 575
                     $rs = mysqli_query($sqlParser->conn,
576
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'");
576
+                        "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'");
577 577
                     if (mysqli_num_rows($rs)) {
578 578
                         $installDataLevel['modules'][$moduleModule[0]]['type'] = 'update';
579 579
                         $row = mysqli_fetch_assoc($rs);
580 580
                         $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
581 581
                         if (!mysqli_query($sqlParser->conn,
582
-                            "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
582
+                            "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
583 583
                             $installDataLevel['modules'][$moduleModule[0]]['error'] = array(
584 584
                                 'type' => 'sql',
585 585
                                 'content' => mysqli_error($sqlParser->conn)
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
                         $installDataLevel['modules'][$moduleModule[0]]['type'] = 'create';
592 592
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
593 593
                         if (!mysqli_query($sqlParser->conn,
594
-                            "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
594
+                            "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
595 595
                             $installDataLevel['modules'][$moduleModule[0]]['error'] = array(
596 596
                                 'type' => 'sql',
597 597
                                 'content' => mysqli_error($sqlParser->conn)
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['plugin']) || $installData)) {
612 612
         $selPlugs = $_POST['plugin'];
613 613
         foreach ($modulePlugins as $k => $modulePlugin) {
614
-            if (! is_array($modulePlugin)) {
614
+            if (!is_array($modulePlugin)) {
615 615
                 continue;
616 616
             }
617 617
             $installDataLevel['plugins'][$modulePlugin[0]] = array(
@@ -645,12 +645,12 @@  discard block
 block discarded – undo
645 645
                 $disabled = $modulePlugin[9];
646 646
                 if (array_key_exists(7, $modulePlugin)) {
647 647
                     // parse comma-separated legacy names and prepare them for sql IN clause
648
-                    $leg_names = "'" . implode(
648
+                    $leg_names = "'".implode(
649 649
                             "','",
650 650
                             preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))
651
-                        ) . "'";
651
+                        )."'";
652 652
                 }
653
-                if (! file_exists($filecontent)) {
653
+                if (!file_exists($filecontent)) {
654 654
                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
655 655
                         'type' => 'file_not_found'
656 656
                     );
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 
659 659
                     // disable legacy versions based on legacy_names provided
660 660
                     if (!empty($leg_names)) {
661
-                        $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
661
+                        $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
662 662
                         $rs = mysqli_query($sqlParser->conn, $update_query);
663 663
                     }
664 664
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
                     $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
669 669
                     $plugin = removeDocblock($plugin, 'plugin');
670 670
                     $plugin = mysqli_real_escape_string($conn, $plugin);
671
-                    $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'";
671
+                    $query = "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'";
672 672
                     $rs = mysqli_query($sqlParser->conn, $query);
673 673
                     if (mysqli_num_rows($rs)) {
674 674
                         $installDataLevel['plugins'][$modulePlugin[0]]['type'] = 'update';
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
                         while ($row = mysqli_fetch_assoc($rs)) {
677 677
                             $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
678 678
                             if ($row['description'] == $desc) {
679
-                                $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};";
679
+                                $query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};";
680 680
                                 if (!mysqli_query($sqlParser->conn, $query)) {
681 681
                                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
682 682
                                         'type' => 'sql',
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
                                 }
688 688
                                 $insert = false;
689 689
                             } else {
690
-                                $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};";
690
+                                $query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};";
691 691
                                 if (!mysqli_query($sqlParser->conn, $query)) {
692 692
                                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
693 693
                                         'type' => 'sql',
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
                         }
701 701
                         if ($insert === true) {
702 702
                             $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
703
-                            $query = "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);";
703
+                            $query = "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);";
704 704
                             if (!mysqli_query($sqlParser->conn, $query)) {
705 705
                                 $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
706 706
                                     'type' => 'sql',
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
                     } else {
714 714
                         $installDataLevel['plugins'][$modulePlugin[0]]['type'] = 'create';
715 715
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
716
-                        $query = "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);";
716
+                        $query = "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);";
717 717
                         if (!mysqli_query($sqlParser->conn, $query)) {
718 718
                             $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
719 719
                                 'type' => 'sql',
@@ -725,17 +725,17 @@  discard block
 block discarded – undo
725 725
                     }
726 726
                     // add system events
727 727
                     if (count($events) > 0) {
728
-                        $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name' AND description='$desc';";
728
+                        $query = "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';";
729 729
                         $ds = mysqli_query($sqlParser->conn, $query);
730 730
                         if ($ds) {
731 731
                             $row = mysqli_fetch_assoc($ds);
732 732
                             $id = $row["id"];
733 733
                             // remove existing events
734
-                            $query = 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\'';
734
+                            $query = 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\'';
735 735
                             mysqli_query($sqlParser->conn, $query);
736 736
                             // add new events
737
-                            $query = "INSERT INTO $dbase.`" . $table_prefix . "site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`" . $table_prefix . "system_eventnames` se WHERE name IN ('" . implode("','", $events) . "')";
738
-                            mysqli_query($sqlParser->conn,$query);
737
+                            $query = "INSERT INTO $dbase.`".$table_prefix."site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`".$table_prefix."system_eventnames` se WHERE name IN ('".implode("','", $events)."')";
738
+                            mysqli_query($sqlParser->conn, $query);
739 739
                         }
740 740
                     }
741 741
                 }
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['snippet']) || $installData)) {
750 750
         $selSnips = $_POST['snippet'];
751 751
         foreach ($moduleSnippets as $k => $moduleSnippet) {
752
-            if (! is_array($moduleSnippet)) {
752
+            if (!is_array($moduleSnippet)) {
753 753
                 continue;
754 754
             }
755 755
             $installDataLevel['snippets'][$moduleSnippet[0]] = array(
@@ -784,13 +784,13 @@  discard block
 block discarded – undo
784 784
                     $snippet = removeDocblock($snippet, 'snippet');
785 785
                     $snippet = mysqli_real_escape_string($conn, $snippet);
786 786
                     $rs = mysqli_query($sqlParser->conn,
787
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'");
787
+                        "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'");
788 788
                     if (mysqli_num_rows($rs)) {
789 789
                         $installDataLevel['snippets'][$moduleSnippet[0]]['type'] = 'update';
790 790
                         $row = mysqli_fetch_assoc($rs);
791 791
                         $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
792 792
                         if (!mysqli_query($sqlParser->conn,
793
-                            "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
793
+                            "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
794 794
                             $installDataLevel['snippets'][$moduleSnippet[0]]['error'] = array(
795 795
                                 'type' => 'sql',
796 796
                                 'content' => mysqli_error($sqlParser->conn)
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
                         $installDataLevel['snippets'][$moduleSnippet[0]]['type'] = 'create';
803 803
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
804 804
                         if (!mysqli_query($sqlParser->conn,
805
-                            "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
805
+                            "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
806 806
                             $installDataLevel['snippets'][$moduleSnippet[0]]['error'] = array(
807 807
                                 'type' => 'sql',
808 808
                                 'content' => mysqli_error($sqlParser->conn)
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
                     'content' => '' //dependency name or error message
870 870
                 )*/
871 871
             );
872
-            $query = 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"';
872
+            $query = 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"';
873 873
             $ds = mysqli_query($sqlParser->conn, $query);
874 874
             if (!$ds) {
875 875
                 $installDependencyLevel[$dependency['module']]['error'] = array(
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
                 $moduleGuid = $row["guid"];
885 885
             }
886 886
             // get extra id
887
-            $query = 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"';
887
+            $query = 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"';
888 888
             $ds = mysqli_query($sqlParser->conn, $query);
889 889
             if (!$ds) {
890 890
                 $installDependencyLevel[$dependency['module']]['error'] = array(
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
                 $extraId = $row["id"];
899 899
             }
900 900
             // setup extra as module dependency
901
-            $query = 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1';
901
+            $query = 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1';
902 902
             $ds = mysqli_query($sqlParser->conn, $query);
903 903
             if (!$ds) {
904 904
                 $installDependencyLevel[$dependency['module']]['error'] = array(
@@ -909,17 +909,17 @@  discard block
 block discarded – undo
909 909
                 break;
910 910
             } else {
911 911
                 if (mysqli_num_rows($ds) === 0) {
912
-                    $query = 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')';
912
+                    $query = 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')';
913 913
                     mysqli_query($sqlParser->conn, $query);
914 914
                     $installDependencyLevel[$dependency['module']]['type'] = 'create';
915 915
                 } else {
916
-                    $query = 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'];
916
+                    $query = 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` SET module = '.$moduleId.', resource = '.$extraId.', type = '.$dependency['type'].' WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'];
917 917
                     mysqli_query($sqlParser->conn, $query);
918 918
                     $installDependencyLevel[$dependency['module']]['type'] = 'update';
919 919
                 }
920 920
                 if ($dependency['type'] == 30 || $dependency['type'] == 40) {
921 921
                     // set extra guid for plugins and snippets
922
-                    $query = 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1';
922
+                    $query = 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1';
923 923
                     $ds = mysqli_query($sqlParser->conn, $query);
924 924
                     if (!$ds) {
925 925
                         $installDependencyLevel[$dependency['module']]['extra'] = array(
@@ -930,8 +930,8 @@  discard block
 block discarded – undo
930 930
                         break;
931 931
                     } else {
932 932
                         if (mysqli_num_rows($ds) != 0) {
933
-                            $query = 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId;
934
-                            $ds= mysqli_query($sqlParser->conn, $query);
933
+                            $query = 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId;
934
+                            $ds = mysqli_query($sqlParser->conn, $query);
935 935
                             $installDependencyLevel[$dependency['module']]['extra'] = array(
936 936
                                 'type' => 'done',
937 937
                                 'content' => $dependency['name']
@@ -953,28 +953,28 @@  discard block
 block discarded – undo
953 953
         }
954 954
 
955 955
         // Setup the MODX API -- needed for the cache processor
956
-        if (file_exists(dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/config_mutator.php')) {
957
-            require_once dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/config_mutator.php';
956
+        if (file_exists(dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/config_mutator.php')) {
957
+            require_once dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/config_mutator.php';
958 958
         }
959 959
         define('MODX_API_MODE', true);
960 960
         if (!defined('MODX_BASE_PATH')) {
961 961
             define('MODX_BASE_PATH', $base_path);
962 962
         }
963 963
         if (!defined('MODX_MANAGER_PATH')) {
964
-            define('MODX_MANAGER_PATH', $base_path . MGR_DIR . '/');
964
+            define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
965 965
         }
966 966
         $database_type = 'mysqli';
967 967
         // initiate a new document parser
968 968
         if (!defined('EVO_BOOTSTRAP_FILE')) {
969 969
             define('EVO_BOOTSTRAP_FILE',
970
-                dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/bootstrap.php');
971
-            require_once dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/bootstrap.php';
970
+                dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/bootstrap.php');
971
+            require_once dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/bootstrap.php';
972 972
         }
973 973
 
974
-        if (! defined('EVO_SERVICES_FILE')) {
975
-            define('EVO_SERVICES_FILE', dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/services.php');
974
+        if (!defined('EVO_SERVICES_FILE')) {
975
+            define('EVO_SERVICES_FILE', dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/services.php');
976 976
         }
977
-        if (! defined('MODX_CLASS')) {
977
+        if (!defined('MODX_CLASS')) {
978 978
             define('MODX_CLASS', '\EvolutionCMS\Core');
979 979
         }
980 980
         
@@ -982,25 +982,25 @@  discard block
 block discarded – undo
982 982
         $modx->getDatabase()->connect();
983 983
         // always empty cache after install
984 984
         $sync = new EvolutionCMS\Cache();
985
-        $sync->setCachepath(dirname(dirname(dirname(__DIR__))) . '/assets/cache/');
985
+        $sync->setCachepath(dirname(dirname(dirname(__DIR__))).'/assets/cache/');
986 986
         $sync->setReport(false);
987 987
         $sync->emptyCache(); // first empty the cache
988 988
 
989 989
         // try to chmod the cache go-rwx (for suexeced php)
990
-        @chmod(dirname(dirname(dirname(__DIR__))) . '/assets/cache/siteCache.idx.php', 0600);
991
-        @chmod(dirname(dirname(dirname(__DIR__))) . '/assets/cache/sitePublishing.idx.php', 0600);
990
+        @chmod(dirname(dirname(dirname(__DIR__))).'/assets/cache/siteCache.idx.php', 0600);
991
+        @chmod(dirname(dirname(dirname(__DIR__))).'/assets/cache/sitePublishing.idx.php', 0600);
992 992
 
993 993
         // remove any locks on the manager functions so initial manager login is not blocked
994
-        mysqli_query($conn, "TRUNCATE TABLE `" . $table_prefix . "active_users`");
994
+        mysqli_query($conn, "TRUNCATE TABLE `".$table_prefix."active_users`");
995 995
 
996 996
         // close db connection
997 997
         $sqlParser->close();
998 998
 
999 999
         // andrazk 20070416 - release manager access
1000
-        if (file_exists(dirname(dirname(dirname(__DIR__))) . '/assets/cache/installProc.inc.php')) {
1001
-            @chmod(dirname(dirname(dirname(__DIR__))) . '/assets/cache/installProc.inc.php', 0755);
1002
-            unlink(dirname(dirname(dirname(__DIR__))) . '/assets/cache/installProc.inc.php');
1000
+        if (file_exists(dirname(dirname(dirname(__DIR__))).'/assets/cache/installProc.inc.php')) {
1001
+            @chmod(dirname(dirname(dirname(__DIR__))).'/assets/cache/installProc.inc.php', 0755);
1002
+            unlink(dirname(dirname(dirname(__DIR__))).'/assets/cache/installProc.inc.php');
1003 1003
         }
1004 1004
     }
1005 1005
 }
1006
-include_once dirname(__DIR__) . '/template/actions/install.php';
1006
+include_once dirname(__DIR__).'/template/actions/install.php';
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/actions/eventlog.dynamic.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  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('view_eventlog')) {
5
+if (!$modx->hasPermission('view_eventlog')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 $modx->getManagerApi()->initPageViewState();
16 16
 
17 17
 // get and save search string
18
-if($_REQUEST['op'] == 'reset') {
18
+if ($_REQUEST['op'] == 'reset') {
19 19
 	$sqlQuery = $query = '';
20 20
 	$_PAGE['vs']['search'] = '';
21 21
 } else {
22 22
 	$sqlQuery = $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search'];
23
-	if(!is_numeric($sqlQuery)) {
23
+	if (!is_numeric($sqlQuery)) {
24 24
 		$sqlQuery = $modx->getDatabase()->escape($query);
25 25
 	}
26 26
 	$_PAGE['vs']['search'] = $query;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 					<?php
127 127
 					$ds = $modx->getDatabase()->select("el.id, ELT(el.type , 'text-info {$_style['actions_info']}' , 'text-warning {$_style['actions_triangle']}' , 'text-danger {$_style['actions_error']}' ) as icon, el.createdon, el.source, el.eventid,IFNULL(wu.username,mu.username) as username", "{$tbl_event_log} AS el 
128 128
 			LEFT JOIN {$tbl_manager_users} AS mu ON mu.id=el.user AND el.usertype=0
129
-			LEFT JOIN {$tbl_web_users} AS wu ON wu.id=el.user AND el.usertype=1", ($sqlQuery ? "" . (is_numeric($sqlQuery) ? "(eventid='{$sqlQuery}') OR " : '') . "(source LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "createdon DESC");
129
+			LEFT JOIN {$tbl_web_users} AS wu ON wu.id=el.user AND el.usertype=1", ($sqlQuery ? "".(is_numeric($sqlQuery) ? "(eventid='{$sqlQuery}') OR " : '')."(source LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "createdon DESC");
130 130
 					$grd = new \EvolutionCMS\Support\DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items
131 131
 					$grd->pagerClass = '';
132 132
 					$grd->pageClass = 'page-item';
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 					$grd->itemClass = "tableItem";
138 138
 					$grd->altItemClass = "tableAltItem";
139 139
 					$grd->fields = "type,source,createdon,eventid,username";
140
-					$grd->columns = $_lang['type'] . " ," . $_lang['source'] . " ," . $_lang['date'] . " ," . $_lang['event_id'] . " ," . $_lang['sysinfo_userid'];
140
+					$grd->columns = $_lang['type']." ,".$_lang['source']." ,".$_lang['date']." ,".$_lang['event_id']." ,".$_lang['sysinfo_userid'];
141 141
 					$grd->colWidths = "1%,,1%,1%,1%";
142 142
 					$grd->colAligns = "center,,,center,center";
143
-					$grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang['click_to_context'] . "'><i class='[+icon+]'></i></a>||template:<a href='index.php?a=115&id=[+id+]' title='" . $_lang['click_to_view_details'] . "'>[+source+]</a>||date: " . $modx->toDateFormat(null, 'formatOnly') . ' %I:%M %p';
144
-					if($listmode == '1') {
143
+					$grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='".$_lang['click_to_context']."'><i class='[+icon+]'></i></a>||template:<a href='index.php?a=115&id=[+id+]' title='".$_lang['click_to_view_details']."'>[+source+]</a>||date: ".$modx->toDateFormat(null, 'formatOnly').' %I:%M %p';
144
+					if ($listmode == '1') {
145 145
 						$grd->pageSize = 0;
146 146
 					}
147
-					if($_REQUEST['op'] == 'reset') {
147
+					if ($_REQUEST['op'] == 'reset') {
148 148
 						$grd->pageNumber = 1;
149 149
 					}
150 150
 					// render grid
Please login to merge, or discard this patch.
manager/includes/functions/tv.php 1 patch
Spacing   +75 added lines, -75 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('ProcessTVCommand')) {
3
+if (!function_exists('ProcessTVCommand')) {
4 4
     /**
5 5
      * @param string $value
6 6
      * @param string $name
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     function ProcessTVCommand($value, $name = '', $docid = '', $src = 'docform', $tvsArray = array())
13 13
     {
14 14
         $modx = evolutionCMS();
15
-        $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier;
15
+        $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier;
16 16
         $nvalue = trim($value);
17 17
         if (substr($nvalue, 0, 1) != '@') {
18 18
             return $value;
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
                         // if an inherited value is found and if there is content following the @INHERIT binding
78 78
                         // remove @INHERIT and output that following content. This content could contain other
79 79
                         // @ bindings, that are processed in the next step
80
-                        if ((string)$tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) {
81
-                            $output = trim(str_replace('@INHERIT', '', (string)$tv['value']));
80
+                        if ((string) $tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) {
81
+                            $output = trim(str_replace('@INHERIT', '', (string) $tv['value']));
82 82
                             break 2;
83 83
                         }
84 84
                     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
                 case 'DIRECTORY' :
88 88
                     $files = array();
89
-                    $path = $modx->config['base_path'] . $param;
89
+                    $path = $modx->config['base_path'].$param;
90 90
                     if (substr($path, -1, 1) != '/') {
91 91
                         $path .= '/';
92 92
                     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     }
118 118
 }
119 119
 
120
-if (! function_exists('ProcessFile')) {
120
+if (!function_exists('ProcessFile')) {
121 121
     /**
122 122
      * @param $file
123 123
      * @return string
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     }
135 135
 }
136 136
 
137
-if (! function_exists('ParseCommand')) {
137
+if (!function_exists('ParseCommand')) {
138 138
     /**
139 139
      * ParseCommand - separate @ cmd from params
140 140
      *
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
         $binding_array = array();
157 157
         foreach ($BINDINGS as $cmd) {
158
-            if (strpos($binding_string, '@' . $cmd) === 0) {
158
+            if (strpos($binding_string, '@'.$cmd) === 0) {
159 159
                 $code = substr($binding_string, strlen($cmd) + 1);
160 160
                 $binding_array = array($cmd, trim($code));
161 161
                 break;
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     }
167 167
 }
168 168
 
169
-if (! function_exists('parseTvValues')) {
169
+if (!function_exists('parseTvValues')) {
170 170
     /**
171 171
      * Parse MODX Template-Variables
172 172
      *
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     }
198 198
 }
199 199
 
200
-if (! function_exists('getTVDisplayFormat')) {
200
+if (!function_exists('getTVDisplayFormat')) {
201 201
     /**
202 202
      * @param string $name
203 203
      * @param string $value
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $o = '';
216 216
 
217 217
         // process any TV commands in value
218
-        $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier;
218
+        $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier;
219 219
         $value = ProcessTVCommand($value, $name, $docid);
220 220
 
221 221
         $params = array();
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
                             $attr['align'] = $params['align'];
255 255
                         }
256 256
                         foreach ($attr as $k => $v) {
257
-                            $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
257
+                            $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
258 258
                         }
259
-                        $attributes .= ' ' . $params['attrib'];
259
+                        $attributes .= ' '.$params['attrib'];
260 260
 
261 261
                         // Output the image with attributes
262
-                        $o .= '<img' . rtrim($attributes) . ' />';
262
+                        $o .= '<img'.rtrim($attributes).' />';
263 263
                     }
264 264
                 }
265 265
                 break;
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
                             'target' => $params['target'],
332 332
                         );
333 333
                         foreach ($attr as $k => $v) {
334
-                            $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
334
+                            $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
335 335
                         }
336
-                        $attributes .= ' ' . $params['attrib']; // add extra
336
+                        $attributes .= ' '.$params['attrib']; // add extra
337 337
 
338 338
                         // Output the link
339
-                        $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->getPhpCompat()->htmlspecialchars($params['text']) : $name) . '</a>';
339
+                        $o .= '<a'.rtrim($attributes).'>'.($params['text'] ? $modx->getPhpCompat()->htmlspecialchars($params['text']) : $name).'</a>';
340 340
                     }
341 341
                 }
342 342
                 break;
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
                         'style' => $params['style'],
363 363
                     );
364 364
                     foreach ($attr as $k => $v) {
365
-                        $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
365
+                        $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
366 366
                     }
367
-                    $attributes .= ' ' . $params['attrib']; // add extra
367
+                    $attributes .= ' '.$params['attrib']; // add extra
368 368
 
369 369
                     // Output the HTML Tag
370
-                    $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>';
370
+                    $o .= '<'.$tagname.rtrim($attributes).'>'.$tagvalue.'</'.$tagname.'>';
371 371
                 }
372 372
                 break;
373 373
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                 $w = $params['w'] ? $params['w'] : '100%';
377 377
                 $h = $params['h'] ? $params['h'] : '400px';
378 378
                 $richtexteditor = $params['edt'] ? $params['edt'] : "";
379
-                $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">';
379
+                $o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">';
380 380
                 $o .= $modx->getPhpCompat()->htmlspecialchars($value);
381 381
                 $o .= '</textarea></div>';
382 382
                 $replace_richtext = array($id);
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
             case "viewport":
405 405
                 $value = parseInput($value);
406
-                $id = '_' . time();
406
+                $id = '_'.time();
407 407
                 if (!$params['vpid']) {
408 408
                     $params['vpid'] = $id;
409 409
                 }
@@ -417,35 +417,35 @@  discard block
 block discarded – undo
417 417
                     $h = "100%";
418 418
                 }
419 419
                 if ($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) {
420
-                    $autoMode = "3";  //both
420
+                    $autoMode = "3"; //both
421 421
                 } else {
422 422
                     if ($params['awidth'] == 'Yes') {
423 423
                         $autoMode = "1"; //width only
424 424
                     } else {
425 425
                         if ($params['aheight'] == 'Yes') {
426
-                            $autoMode = "2";    //height only
426
+                            $autoMode = "2"; //height only
427 427
                         }
428 428
                     }
429 429
                 }
430 430
 
431
-                $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array(
431
+                $modx->regClientStartupScript(MODX_MANAGER_URL."media/script/bin/viewport.js", array(
432 432
                     'name'      => 'viewport',
433 433
                     'version'   => '0',
434 434
                     'plaintext' => false
435 435
                 ));
436
-                $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' ";
436
+                $o = $sTag." id='".$params['vpid']."' name='".$params['vpid']."' ";
437 437
                 if ($params['class']) {
438
-                    $o .= " class='" . $params['class'] . "' ";
438
+                    $o .= " class='".$params['class']."' ";
439 439
                 }
440 440
                 if ($params['style']) {
441
-                    $o .= " style='" . $params['style'] . "' ";
441
+                    $o .= " style='".$params['style']."' ";
442 442
                 }
443 443
                 if ($params['attrib']) {
444
-                    $o .= $params['attrib'] . " ";
444
+                    $o .= $params['attrib']." ";
445 445
                 }
446
-                $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' ";
447
-                $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' ";
448
-                $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' ";
446
+                $o .= "scrolling='".($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto"))."' ";
447
+                $o .= "src='".$value."' frameborder='".$params['borsize']."' ";
448
+                $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'".$params['vpid']."\\',".$autoMode.")',100);\" width='".$w."' height='".$h."' ";
449 449
                 $o .= ">";
450 450
                 $o .= $eTag;
451 451
                 break;
@@ -497,16 +497,16 @@  discard block
 block discarded – undo
497 497
                 $o = '';
498 498
                 /* If we are loading a file */
499 499
                 if (substr($params['output'], 0, 5) == "@FILE") {
500
-                    $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6));
500
+                    $file_name = MODX_BASE_PATH.trim(substr($params['output'], 6));
501 501
                     if (!file_exists($file_name)) {
502
-                        $widget_output = $file_name . ' does not exist';
502
+                        $widget_output = $file_name.' does not exist';
503 503
                     } else {
504 504
                         $widget_output = file_get_contents($file_name);
505 505
                     }
506 506
                 } elseif (substr($params['output'], 0, 8) == '@INCLUDE') {
507
-                    $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9));
507
+                    $file_name = MODX_BASE_PATH.trim(substr($params['output'], 9));
508 508
                     if (!file_exists($file_name)) {
509
-                        $widget_output = $file_name . ' does not exist';
509
+                        $widget_output = $file_name.' does not exist';
510 510
                     } else {
511 511
                         /* The included file needs to set $widget_output. Can be string, array, object */
512 512
                         include $file_name;
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
     }
549 549
 }
550 550
 
551
-if (! function_exists('decodeParamValue')) {
551
+if (!function_exists('decodeParamValue')) {
552 552
     /**
553 553
      * @param string $s
554 554
      * @return string
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
     }
562 562
 }
563 563
 
564
-if (! function_exists('parseInput')) {
564
+if (!function_exists('parseInput')) {
565 565
     /**
566 566
      * returns an array if a delimiter is present. returns array is a recordset is present
567 567
      *
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
     }
594 594
 }
595 595
 
596
-if (! function_exists('getUnixtimeFromDateString')) {
596
+if (!function_exists('getUnixtimeFromDateString')) {
597 597
     /**
598 598
      * @param string $value
599 599
      * @return bool|false|int
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
     }
622 622
 }
623 623
 
624
-if (! function_exists('renderFormElement')) {
624
+if (!function_exists('renderFormElement')) {
625 625
     /**
626 626
      * DISPLAY FORM ELEMENTS
627 627
      *
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
         $field_style = '',
645 645
         $row = array(),
646 646
         $tvsArray = array()
647
-    ) {
647
+    ){
648 648
         $modx = evolutionCMS();
649 649
         global $_style;
650 650
         global $_lang;
@@ -664,22 +664,22 @@  discard block
 block discarded – undo
664 664
 
665 665
                 case "text": // handler for regular text boxes
666 666
                 case "rawtext"; // non-htmlentity converted text boxes
667
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />';
667
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" />';
668 668
                     break;
669 669
                 case "email": // handles email input fields
670
-                    $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>';
670
+                    $field_html .= '<input type="email" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%"/>';
671 671
                     break;
672 672
                 case "number": // handles the input of numbers
673
-                    $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
673
+                    $field_html .= '<input type="number" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
674 674
                     break;
675 675
                 case "textareamini": // handler for textarea mini boxes
676
-                    $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '</textarea>';
676
+                    $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">'.$modx->getPhpCompat()->htmlspecialchars($field_value).'</textarea>';
677 677
                     break;
678 678
                 case "textarea": // handler for textarea boxes
679 679
                 case "rawtextarea": // non-htmlentity convertex textarea boxes
680 680
                 case "htmlarea": // handler for textarea boxes (deprecated)
681 681
                 case "richtext": // handler for textarea boxes
682
-                    $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '</textarea>';
682
+                    $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">'.$modx->getPhpCompat()->htmlspecialchars($field_value).'</textarea>';
683 683
                     break;
684 684
                 case "date":
685 685
                     $field_id = str_replace(array(
@@ -689,12 +689,12 @@  discard block
 block discarded – undo
689 689
                     if ($field_value == '') {
690 690
                         $field_value = 0;
691 691
                     }
692
-                    $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />';
693
-                    $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>';
692
+                    $field_html .= '<input id="tv'.$field_id.'" name="tv'.$field_id.'" class="DatePicker" type="text" value="'.($field_value == 0 || !isset($field_value) ? "" : $field_value).'" onblur="documentDirty=true;" />';
693
+                    $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].value=\'\';document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="'.$_style["actions_calendar_delete"].'"></i></a>';
694 694
 
695 695
                     break;
696 696
                 case "dropdown": // handler for select boxes
697
-                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">';
697
+                    $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">';
698 698
                     $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
699 699
                         $tvsArray));
700 700
                     while (list($item, $itemvalue) = each($index_list)) {
@@ -702,12 +702,12 @@  discard block
 block discarded – undo
702 702
                         if (strlen($itemvalue) == 0) {
703 703
                             $itemvalue = $item;
704 704
                         }
705
-                        $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>';
705
+                        $field_html .= '<option value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($item).'</option>';
706 706
                     }
707 707
                     $field_html .= "</select>";
708 708
                     break;
709 709
                 case "listbox": // handler for select boxes
710
-                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">';
710
+                    $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">';
711 711
                     $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
712 712
                         $tvsArray));
713 713
                     while (list($item, $itemvalue) = each($index_list)) {
@@ -715,13 +715,13 @@  discard block
 block discarded – undo
715 715
                         if (strlen($itemvalue) == 0) {
716 716
                             $itemvalue = $item;
717 717
                         }
718
-                        $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>';
718
+                        $field_html .= '<option value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($item).'</option>';
719 719
                     }
720 720
                     $field_html .= "</select>";
721 721
                     break;
722 722
                 case "listbox-multiple": // handler for select boxes where you can choose multiple items
723 723
                     $field_value = explode("||", $field_value);
724
-                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
724
+                    $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
725 725
                     $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
726 726
                         $tvsArray));
727 727
                     while (list($item, $itemvalue) = each($index_list)) {
@@ -729,8 +729,8 @@  discard block
 block discarded – undo
729 729
                         if (strlen($itemvalue) == 0) {
730 730
                             $itemvalue = $item;
731 731
                         }
732
-                        $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue,
733
-                                $field_value) ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>';
732
+                        $field_html .= '<option value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue,
733
+                                $field_value) ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($item).'</option>';
734 734
                     }
735 735
                     $field_html .= "</select>";
736 736
                     break;
@@ -742,17 +742,17 @@  discard block
 block discarded – undo
742 742
                         'ftp://'   => 'ftp://',
743 743
                         'mailto:'  => 'mailto:'
744 744
                     );
745
-                    $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">';
745
+                    $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_id.'_prefix" name="tv'.$field_id.'_prefix" onchange="documentDirty=true;">';
746 746
                     foreach ($urls as $k => $v) {
747 747
                         if (strpos($field_value, $v) === false) {
748
-                            $field_html .= '<option value="' . $v . '">' . $k . '</option>';
748
+                            $field_html .= '<option value="'.$v.'">'.$k.'</option>';
749 749
                         } else {
750 750
                             $field_value = str_replace($v, '', $field_value);
751
-                            $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>';
751
+                            $field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>';
752 752
                         }
753 753
                     }
754 754
                     $field_html .= '</select></td><td>';
755
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>';
755
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;" /></td></tr></table>';
756 756
                     break;
757 757
                 case 'checkbox': // handles check boxes
758 758
                     $values = !is_array($field_value) ? explode('||', $field_value) : $field_value;
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
                         if (strlen($itemvalue) == 0) {
795 795
                             $itemvalue = $item;
796 796
                         }
797
-                        $field_html .= '<input type="radio" value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />';
797
+                        $field_html .= '<input type="radio" value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'" id="tv_'.$i.'" name="tv'.$field_id.'" '.($itemvalue == $field_value ? 'checked="checked"' : '').' onchange="documentDirty=true;" /><label for="tv_'.$i.'" class="radio">'.$item.'</label><br />';
798 798
                         $i++;
799 799
                     }
800 800
                     break;
@@ -824,13 +824,13 @@  discard block
 block discarded – undo
824 824
 									lastImageCtrl = ctrl;
825 825
 									var w = screen.width * 0.5;
826 826
 									var h = screen.height * 0.5;
827
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h);
827
+									OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h);
828 828
 								}
829 829
 								function BrowseFileServer(ctrl) {
830 830
 									lastFileCtrl = ctrl;
831 831
 									var w = screen.width * 0.5;
832 832
 									var h = screen.height * 0.5;
833
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h);
833
+									OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h);
834 834
 								}
835 835
 								function SetUrlChange(el) {
836 836
 									if ('createEvent' in document) {
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 						</script>";
865 865
                         $ResourceManagerLoaded = true;
866 866
                     }
867
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />';
867
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'"  value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseServer(\'tv'.$field_id.'\')" />';
868 868
                     break;
869 869
                 case "file": // handles the input of file uploads
870 870
                     /* Modified by Timon for use with resource browser */
@@ -894,13 +894,13 @@  discard block
 block discarded – undo
894 894
 									lastImageCtrl = ctrl;
895 895
 									var w = screen.width * 0.5;
896 896
 									var h = screen.height * 0.5;
897
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h);
897
+									OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h);
898 898
 								}
899 899
 								function BrowseFileServer(ctrl) {
900 900
 									lastFileCtrl = ctrl;
901 901
 									var w = screen.width * 0.5;
902 902
 									var h = screen.height * 0.5;
903
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h);
903
+									OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h);
904 904
 								}
905 905
 								function SetUrlChange(el) {
906 906
 									if ('createEvent' in document) {
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
 						</script>";
935 935
                         $ResourceManagerLoaded = true;
936 936
                     }
937
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />';
937
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'"  value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseFileServer(\'tv'.$field_id.'\')" />';
938 938
 
939 939
                     break;
940 940
 
@@ -942,16 +942,16 @@  discard block
 block discarded – undo
942 942
                     $custom_output = '';
943 943
                     /* If we are loading a file */
944 944
                     if (substr($field_elements, 0, 5) == "@FILE") {
945
-                        $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6));
945
+                        $file_name = MODX_BASE_PATH.trim(substr($field_elements, 6));
946 946
                         if (!file_exists($file_name)) {
947
-                            $custom_output = $file_name . ' does not exist';
947
+                            $custom_output = $file_name.' does not exist';
948 948
                         } else {
949 949
                             $custom_output = file_get_contents($file_name);
950 950
                         }
951 951
                     } elseif (substr($field_elements, 0, 8) == '@INCLUDE') {
952
-                        $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9));
952
+                        $file_name = MODX_BASE_PATH.trim(substr($field_elements, 9));
953 953
                         if (!file_exists($file_name)) {
954
-                            $custom_output = $file_name . ' does not exist';
954
+                            $custom_output = $file_name.' does not exist';
955 955
                         } else {
956 956
                             ob_start();
957 957
                             include $file_name;
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
                         $chunk_name = trim(substr($field_elements, 7));
963 963
                         $chunk_body = $modx->getChunk($chunk_name);
964 964
                         if ($chunk_body == false) {
965
-                            $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')';
965
+                            $custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')';
966 966
                         } else {
967 967
                             $custom_output = $chunk_body;
968 968
                         }
@@ -987,15 +987,15 @@  discard block
 block discarded – undo
987 987
                     break;
988 988
 
989 989
                 default: // the default handler -- for errors, mostly
990
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />';
990
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />';
991 991
 
992 992
             } // end switch statement
993 993
         } else {
994 994
             $custom = explode(":", $field_type);
995 995
             $custom_output = '';
996
-            $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php';
996
+            $file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php';
997 997
             if (!file_exists($file_name)) {
998
-                $custom_output = $file_name . ' does not exist';
998
+                $custom_output = $file_name.' does not exist';
999 999
             } else {
1000 1000
                 ob_start();
1001 1001
                 include $file_name;
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
     } // end renderFormElement function
1020 1020
 }
1021 1021
 
1022
-if (! function_exists('ParseIntputOptions')) {
1022
+if (!function_exists('ParseIntputOptions')) {
1023 1023
     /**
1024 1024
      * @param string|array|mysqli_result $v
1025 1025
      * @return array
Please login to merge, or discard this patch.
manager/includes/functions/helper.php 1 patch
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.
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/includes/manager.lockout.inc.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,75 +1,75 @@
 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->getManagerApi()->action!='8' && isset($_SESSION['mgrValidated'])){
6
+if ($modx->getManagerApi()->action != '8' && isset($_SESSION['mgrValidated'])) {
7 7
 
8
-    $homeurl = $modx->makeUrl($manager_login_startup>0 ? $manager_login_startup:$site_start);
8
+    $homeurl = $modx->makeUrl($manager_login_startup > 0 ? $manager_login_startup : $site_start);
9 9
     $logouturl = MODX_MANAGER_URL.'index.php?a=8';
10 10
 
11
-    $modx->setPlaceholder('modx_charset',$modx_manager_charset);
12
-    $modx->setPlaceholder('theme',$manager_theme);
11
+    $modx->setPlaceholder('modx_charset', $modx_manager_charset);
12
+    $modx->setPlaceholder('theme', $manager_theme);
13 13
 
14
-    $modx->setPlaceholder('site_name',$modx->getPhpCompat()->entities($site_name));
15
-    $modx->setPlaceholder('logo_slogan',$_lang["logo_slogan"]);
16
-    $modx->setPlaceholder('manager_lockout_message',$_lang["manager_lockout_message"]);
14
+    $modx->setPlaceholder('site_name', $modx->getPhpCompat()->entities($site_name));
15
+    $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]);
16
+    $modx->setPlaceholder('manager_lockout_message', $_lang["manager_lockout_message"]);
17 17
 
18
-    $modx->setPlaceholder('home',$_lang["home"]);
19
-    $modx->setPlaceholder('homeurl',$homeurl);
20
-    $modx->setPlaceholder('logout',$_lang["logout"]);
21
-    $modx->setPlaceholder('logouturl',$logouturl);
22
-    $modx->setPlaceholder('manager_theme_url',MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/');
23
-    $modx->setPlaceholder('year',date('Y'));
18
+    $modx->setPlaceholder('home', $_lang["home"]);
19
+    $modx->setPlaceholder('homeurl', $homeurl);
20
+    $modx->setPlaceholder('logout', $_lang["logout"]);
21
+    $modx->setPlaceholder('logouturl', $logouturl);
22
+    $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/');
23
+    $modx->setPlaceholder('year', date('Y'));
24 24
 
25 25
     // load template
26
-    if(!isset($modx->config['manager_lockout_tpl']) || empty($modx->config['manager_lockout_tpl'])) {
27
-    	$modx->config['manager_lockout_tpl'] = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl';
26
+    if (!isset($modx->config['manager_lockout_tpl']) || empty($modx->config['manager_lockout_tpl'])) {
27
+    	$modx->config['manager_lockout_tpl'] = MODX_MANAGER_PATH.'media/style/common/manager.lockout.tpl';
28 28
     }
29 29
 
30 30
     $target = $modx->config['manager_lockout_tpl'];
31 31
     $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
32 32
     $target = $modx->mergeSettingsContent($target);
33 33
 
34
-    if(substr($target,0,1)==='@') {
35
-    	if(substr($target,0,6)==='@CHUNK') {
36
-    		$target = trim(substr($target,7));
34
+    if (substr($target, 0, 1) === '@') {
35
+    	if (substr($target, 0, 6) === '@CHUNK') {
36
+    		$target = trim(substr($target, 7));
37 37
     		$lockout_tpl = $modx->getChunk($target);
38 38
     	}
39
-    	elseif(substr($target,0,5)==='@FILE') {
40
-    		$target = trim(substr($target,6));
39
+    	elseif (substr($target, 0, 5) === '@FILE') {
40
+    		$target = trim(substr($target, 6));
41 41
     		$lockout_tpl = file_get_contents($target);
42 42
     	}
43 43
 	} else {
44 44
     	$chunk = $modx->getChunk($target);
45
-    	if($chunk!==false && !empty($chunk)) {
45
+    	if ($chunk !== false && !empty($chunk)) {
46 46
     		$lockout_tpl = $chunk;
47 47
     	}
48
-    	elseif(is_file(MODX_BASE_PATH . $target)) {
49
-    		$target = MODX_BASE_PATH . $target;
48
+    	elseif (is_file(MODX_BASE_PATH.$target)) {
49
+    		$target = MODX_BASE_PATH.$target;
50 50
     		$lockout_tpl = file_get_contents($target);
51 51
     	}
52
-    	elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl')) {
53
-    		$target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/manager.lockout.tpl';
52
+    	elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/manager.lockout.tpl')) {
53
+    		$target = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/manager.lockout.tpl';
54 54
     		$lockout_tpl = file_get_contents($target);
55 55
     	}
56
-	elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl')) {
57
-		$target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/templates/actions/manager.lockout.tpl';
56
+	elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/templates/actions/manager.lockout.tpl')) {
57
+		$target = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/templates/actions/manager.lockout.tpl';
58 58
 		$login_tpl = file_get_contents($target);
59 59
 	}
60
-    	elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html')) { // ClipperCMS compatible
61
-    		$target = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/manager.lockout.html';
60
+    	elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/manager.lockout.html')) { // ClipperCMS compatible
61
+    		$target = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/manager.lockout.html';
62 62
     		$lockout_tpl = file_get_contents($target);
63 63
     	}
64 64
     	else {
65
-    		$target = MODX_MANAGER_PATH . 'media/style/common/manager.lockout.tpl';
65
+    		$target = MODX_MANAGER_PATH.'media/style/common/manager.lockout.tpl';
66 66
     		$lockout_tpl = file_get_contents($target);
67 67
     	}
68 68
 	}
69 69
 
70 70
     // merge placeholders
71 71
     $lockout_tpl = $modx->mergePlaceholderContent($lockout_tpl);
72
-    $regx = strpos($lockout_tpl,'[[+')!==false ? '~\[\[\+(.*?)\]\]~' : '~\[\+(.*?)\+\]~'; // little tweak for newer parsers
72
+    $regx = strpos($lockout_tpl, '[[+') !== false ? '~\[\[\+(.*?)\]\]~' : '~\[\+(.*?)\+\]~'; // little tweak for newer parsers
73 73
     $lockout_tpl = preg_replace($regx, '', $lockout_tpl); //cleanup
74 74
 
75 75
     echo $lockout_tpl;
Please login to merge, or discard this patch.