Completed
Pull Request — develop (#522)
by Agel_Nash
07:16
created
manager/includes/header.inc.php 2 patches
Spacing   +22 added lines, -22 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
 $mxla = $modx_lang_attribute ? $modx_lang_attribute : 'en';
@@ -17,31 +17,31 @@  discard block
 block discarded – undo
17 17
 }
18 18
 
19 19
 if (!empty($_COOKIE['MODX_themeColor'])) {
20
-    $body_class .= ' ' . $_COOKIE['MODX_themeColor'];
20
+    $body_class .= ' '.$_COOKIE['MODX_themeColor'];
21 21
 }
22 22
 
23
-$css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime;
23
+$css = 'media/style/'.$modx->config['manager_theme'].'/style.css?v='.$lastInstallTime;
24 24
 
25 25
 if ($modx->config['manager_theme'] == 'default') {
26
-    if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
27
-        require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php';
26
+    if (!file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css') && is_writable(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css')) {
27
+        require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php';
28 28
         $minifier = new Formatter\CSSMinify();
29
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css');
30
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css');
31
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css');
32
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css');
33
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css');
34
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css');
35
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css');
36
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css');
37
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css');
38
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css');
39
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css');
29
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css');
30
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css');
31
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css');
32
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css');
33
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css');
34
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css');
35
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css');
36
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css');
37
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css');
38
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css');
39
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css');
40 40
         $css = $minifier->minify();
41
-        file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css);
41
+        file_put_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css', $css);
42 42
     }
43
-    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
44
-        $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime;
43
+    if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) {
44
+        $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime;
45 45
     }
46 46
 }
47 47
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     <meta http-equiv="X-UA-Compatible" content="IE=edge" />
57 57
     <link rel="stylesheet" type="text/css" href="<?= $css ?>" />
58 58
     <script type="text/javascript" src="media/script/tabpane.js"></script>
59
-    <?= sprintf('<script type="text/javascript" src="%s"></script>' . "\n", $modx->config['mgr_jquery_path']) ?>
59
+    <?= sprintf('<script type="text/javascript" src="%s"></script>'."\n", $modx->config['mgr_jquery_path']) ?>
60 60
     <?php if ($modx->config['show_picker'] != "0") { ?>
61 61
         <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/color.switcher.js" type="text/javascript"></script>
62 62
     <?php } ?>
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     <?php } ?>
69 69
 
70 70
     <!-- OnManagerMainFrameHeaderHTMLBlock -->
71
-    <?= $onManagerMainFrameHeaderHTMLBlock . "\n" ?>
71
+    <?= $onManagerMainFrameHeaderHTMLBlock."\n" ?>
72 72
 
73 73
     <script type="text/javascript">
74 74
       /* <![CDATA[ */
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 
365 365
           <?php
366 366
           if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
367
-              echo 'doRefresh(' . $_REQUEST['r'] . ");\n";
367
+              echo 'doRefresh('.$_REQUEST['r'].");\n";
368 368
           }
369 369
           ?>
370 370
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -8 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
 $mxla = $modx_lang_attribute ? $modx_lang_attribute : 'en';
@@ -9,21 +9,21 @@  discard block
 block discarded – undo
9 9
 $modx_textdir = isset($modx_textdir) ? $modx_textdir : null;
10 10
 $onManagerMainFrameHeaderHTMLBlock = is_array($evtOut) ? implode("\n", $evtOut) : '';
11 11
 $textdir = $modx_textdir === 'rtl' ? 'rtl' : 'ltr';
12
-if (!isset($modx->config['mgr_jquery_path'])) {
12
+if (!isset($modx->config['mgr_jquery_path'])) {
13 13
     $modx->config['mgr_jquery_path'] = 'media/script/jquery/jquery.min.js';
14 14
 }
15
-if (!isset($modx->config['mgr_date_picker_path'])) {
15
+if (!isset($modx->config['mgr_date_picker_path'])) {
16 16
     $modx->config['mgr_date_picker_path'] = 'media/script/air-datepicker/datepicker.inc.php';
17 17
 }
18 18
 
19
-if (!empty($_COOKIE['MODX_themeColor'])) {
19
+if (!empty($_COOKIE['MODX_themeColor'])) {
20 20
     $body_class .= ' ' . $_COOKIE['MODX_themeColor'];
21 21
 }
22 22
 
23 23
 $css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime;
24 24
 
25
-if ($modx->config['manager_theme'] == 'default') {
26
-    if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
25
+if ($modx->config['manager_theme'] == 'default') {
26
+    if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
27 27
         require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php';
28 28
         $minifier = new Formatter\CSSMinify();
29 29
         $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css');
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         $css = $minifier->minify();
41 41
         file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css);
42 42
     }
43
-    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
43
+    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
44 44
         $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime;
45 45
     }
46 46
 }
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
         stopWorker();
364 364
 
365 365
           <?php
366
-          if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
366
+          if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
367 367
               echo 'doRefresh(' . $_REQUEST['r'] . ");\n";
368 368
           }
369 369
           ?>
Please login to merge, or discard this patch.
manager/includes/secure_web_documents.inc.php 2 patches
Spacing   +7 added lines, -7 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
 
@@ -12,19 +12,19 @@  discard block
 block discarded – undo
12 12
  *
13 13
  */
14 14
 
15
-function secureWebDocument($docid='') {
15
+function secureWebDocument($docid = ''){
16 16
 	global $modx;
17 17
 
18
-	$modx->db->update('privateweb = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privateweb = 1"));
18
+	$modx->db->update('privateweb = 0', $modx->getFullTableName("site_content"), ($docid > 0 ? "id='$docid'" : "privateweb = 1"));
19 19
 	$rs = $modx->db->select(
20 20
 		'DISTINCT sc.id',
21 21
 		$modx->getFullTableName("site_content")." sc
22 22
 			LEFT JOIN ".$modx->getFullTableName("document_groups")." dg ON dg.document = sc.id
23 23
 			LEFT JOIN ".$modx->getFullTableName("webgroup_access")." wga ON wga.documentgroup = dg.document_group",
24
-		($docid>0 ? " sc.id='{$docid}' AND ":"")."wga.id>0"
24
+		($docid > 0 ? " sc.id='{$docid}' AND " : "")."wga.id>0"
25 25
 		);
26
-	$ids = $modx->db->getColumn("id",$rs);
27
-	if(count($ids)>0) {
28
-		$modx->db->update('privateweb = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ",$ids).")");
26
+	$ids = $modx->db->getColumn("id", $rs);
27
+	if (count($ids) > 0) {
28
+		$modx->db->update('privateweb = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ", $ids).")");
29 29
 	}
30 30
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@
 block discarded – undo
12 12
  *
13 13
  */
14 14
 
15
-function secureWebDocument($docid='') {
15
+function secureWebDocument($docid='')
16
+{
16 17
 	global $modx;
17 18
 
18 19
 	$modx->db->update('privateweb = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privateweb = 1"));
Please login to merge, or discard this patch.
manager/includes/user_settings.inc.php 2 patches
Spacing   +2 added lines, -2 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
 
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 	$which_browser_default = $which_browser;
19 19
 	while ($row = $modx->db->getRow($rs)) {
20
-		if($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') $row['setting_value'] = $which_browser_default;
20
+		if ($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') $row['setting_value'] = $which_browser_default;
21 21
 		$settings[$row['setting_name']] = $row['setting_value'];
22 22
 		if (isset($modx->config)) {
23 23
 			$modx->config[$row['setting_name']] = $row['setting_value'];
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 
18 18
 	$which_browser_default = $which_browser;
19 19
 	while ($row = $modx->db->getRow($rs)) {
20
-		if($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') $row['setting_value'] = $which_browser_default;
20
+		if($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') {
21
+		    $row['setting_value'] = $which_browser_default;
22
+		}
21 23
 		$settings[$row['setting_name']] = $row['setting_value'];
22 24
 		if (isset($modx->config)) {
23 25
 			$modx->config[$row['setting_name']] = $row['setting_value'];
Please login to merge, or discard this patch.
manager/includes/accesscontrol.inc.php 2 patches
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -1,193 +1,193 @@
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
7
-	header('HTTP/1.0 404 Not Found');
8
-	exit;
7
+    header('HTTP/1.0 404 Not Found');
8
+    exit;
9 9
 }
10 10
 
11 11
 if(isset($_SESSION['mgrValidated']) && $_SESSION['usertype'] != 'manager') {
12
-	//		if (isset($_COOKIE[session_name()])) {
13
-	//			setcookie(session_name(), '', 0, MODX_BASE_URL);
14
-	//		}
15
-	@session_destroy();
16
-	// start session
17
-	//	    startCMSSession();
12
+    //		if (isset($_COOKIE[session_name()])) {
13
+    //			setcookie(session_name(), '', 0, MODX_BASE_URL);
14
+    //		}
15
+    @session_destroy();
16
+    // start session
17
+    //	    startCMSSession();
18 18
 }
19 19
 
20 20
 // andrazk 20070416 - if installer is running, destroy active sessions
21 21
 if(file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) {
22
-	include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
23
-	if(isset($installStartTime)) {
24
-		if((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard
25
-			unset($installStartTime);
26
-			@ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755);
27
-			unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
28
-		} else {
29
-			if($_SERVER['REQUEST_METHOD'] != 'POST') {
30
-				if(isset($_COOKIE[session_name()])) {
31
-					session_unset();
32
-					@session_destroy();
33
-					//					setcookie(session_name(), '', 0, MODX_BASE_URL);
34
-				}
35
-				$installGoingOn = 1;
36
-			}
37
-		}
38
-	}
22
+    include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
23
+    if(isset($installStartTime)) {
24
+        if((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard
25
+            unset($installStartTime);
26
+            @ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755);
27
+            unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
28
+        } else {
29
+            if($_SERVER['REQUEST_METHOD'] != 'POST') {
30
+                if(isset($_COOKIE[session_name()])) {
31
+                    session_unset();
32
+                    @session_destroy();
33
+                    //					setcookie(session_name(), '', 0, MODX_BASE_URL);
34
+                }
35
+                $installGoingOn = 1;
36
+            }
37
+        }
38
+    }
39 39
 }
40 40
 
41 41
 // andrazk 20070416 - if session started before install and was not destroyed yet
42 42
 if(isset($lastInstallTime)) {
43
-	if(isset($_SESSION['mgrValidated'])) {
44
-		if(isset($_SESSION['modx.session.created.time'])) {
45
-			if($_SESSION['modx.session.created.time'] < $lastInstallTime) {
46
-				if($_SERVER['REQUEST_METHOD'] != 'POST') {
47
-					if(isset($_COOKIE[session_name()])) {
48
-						session_unset();
49
-						@session_destroy();
50
-						//						setcookie(session_name(), '', 0, MODX_BASE_URL);
51
-					}
52
-					header('HTTP/1.0 307 Redirect');
53
-					header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2');
54
-				}
55
-			}
56
-		}
57
-	}
43
+    if(isset($_SESSION['mgrValidated'])) {
44
+        if(isset($_SESSION['modx.session.created.time'])) {
45
+            if($_SESSION['modx.session.created.time'] < $lastInstallTime) {
46
+                if($_SERVER['REQUEST_METHOD'] != 'POST') {
47
+                    if(isset($_COOKIE[session_name()])) {
48
+                        session_unset();
49
+                        @session_destroy();
50
+                        //						setcookie(session_name(), '', 0, MODX_BASE_URL);
51
+                    }
52
+                    header('HTTP/1.0 307 Redirect');
53
+                    header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2');
54
+                }
55
+            }
56
+        }
57
+    }
58 58
 }
59 59
 
60 60
 if(!isset($_SESSION['mgrValidated'])) {
61
-	if(isset($manager_language)) {
62
-		// establish fallback to English default
63
-		include_once "lang/english.inc.php";
64
-		// include localized overrides
65
-		include_once "lang/" . $manager_language . ".inc.php";
66
-	} else {
67
-		include_once "lang/english.inc.php";
68
-	}
69
-
70
-	$modx->setPlaceholder('modx_charset', $modx_manager_charset);
71
-	$modx->setPlaceholder('theme', $manager_theme);
61
+    if(isset($manager_language)) {
62
+        // establish fallback to English default
63
+        include_once "lang/english.inc.php";
64
+        // include localized overrides
65
+        include_once "lang/" . $manager_language . ".inc.php";
66
+    } else {
67
+        include_once "lang/english.inc.php";
68
+    }
69
+
70
+    $modx->setPlaceholder('modx_charset', $modx_manager_charset);
71
+    $modx->setPlaceholder('theme', $manager_theme);
72 72
     $modx->setPlaceholder('favicon', (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico'));
73 73
 
74
-	// invoke OnManagerLoginFormPrerender event
75
-	$evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender');
76
-	$html = is_array($evtOut) ? implode('', $evtOut) : '';
77
-	$modx->setPlaceholder('OnManagerLoginFormPrerender', $html);
78
-
79
-	$modx->setPlaceholder('site_name', $site_name);
80
-	$modx->setPlaceholder('manager_path', MGR_DIR);
81
-	$modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]);
82
-	$modx->setPlaceholder('login_message', $_lang["login_message"]);
83
-	$modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/');
84
-	$modx->setPlaceholder('year', date('Y'));
85
-	$modx->setPlaceholder('manager_theme_style', (isset($_COOKIE['MODX_themeColor']) ? $_COOKIE['MODX_themeColor'] : ''));
86
-
87
-	// andrazk 20070416 - notify user of install/update
88
-	if(isset($_GET['installGoingOn'])) {
89
-		$installGoingOn = $_GET['installGoingOn'];
90
-	}
91
-	if(isset($installGoingOn)) {
92
-		switch($installGoingOn) {
93
-			case 1 :
94
-				$modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>");
95
-				break;
96
-			case 2 :
97
-				$modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>");
98
-				break;
99
-		}
100
-	}
101
-
102
-	if($modx->config['use_captcha'] == 1) {
103
-		$modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]);
104
-		$modx->setPlaceholder('captcha_image', '<a href="' . MODX_MANAGER_URL . '" class="loginCaptcha"><img id="captcha_image" src="' . MODX_MANAGER_URL . 'includes/veriword.php?rand=' . rand() . '" alt="' . $_lang["login_captcha_message"] . '" /></a>');
105
-		$modx->setPlaceholder('captcha_input', '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />');
106
-	}
107
-
108
-	// login info
109
-	$uid = isset($_COOKIE['modx_remember_manager']) ? preg_replace('/[^a-zA-Z0-9\-_@\.]*/', '', $_COOKIE['modx_remember_manager']) : '';
110
-	$modx->setPlaceholder('uid', $uid);
111
-	$modx->setPlaceholder('username', $_lang["username"]);
112
-	$modx->setPlaceholder('password', $_lang["password"]);
113
-
114
-	// remember me
115
-	$html = isset($_COOKIE['modx_remember_manager']) ? 'checked="checked"' : '';
116
-	$modx->setPlaceholder('remember_me', $html);
117
-	$modx->setPlaceholder('remember_username', $_lang["remember_username"]);
118
-	$modx->setPlaceholder('login_button', $_lang["login_button"]);
119
-
120
-	// invoke OnManagerLoginFormRender event
121
-	$evtOut = $modx->invokeEvent('OnManagerLoginFormRender');
122
-	$html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : '';
123
-	$modx->setPlaceholder('OnManagerLoginFormRender', $html);
124
-
125
-	// load template
126
-	$target = $modx->getConfig('manager_login_tpl');
127
-	$target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
128
-	$target = $modx->mergeSettingsContent($target);
129
-
130
-	$login_tpl = null;
131
-	if(substr($target, 0, 1) === '@') {
132
-		if(substr($target, 0, 6) === '@CHUNK') {
133
-			$target = trim(substr($target, 7));
134
-			$login_tpl = $modx->getChunk($target);
135
-		} elseif(substr($target, 0, 5) === '@FILE') {
136
-			$target = trim(substr($target, 6));
137
-			$login_tpl = file_get_contents($target);
138
-		}
139
-	} else {
140
-		$theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/';
141
-		if(is_file($theme_path . 'style.php')) {
142
-			include($theme_path . 'style.php');
143
-		}
144
-		$chunk = $modx->getChunk($target);
145
-		if($chunk !== false && !empty($chunk)) {
146
-			$login_tpl = $chunk;
147
-		} elseif(is_file(MODX_BASE_PATH . $target)) {
148
-			$target = MODX_BASE_PATH . $target;
149
-			$login_tpl = file_get_contents($target);
150
-		} elseif(is_file($target)) {
151
-			$login_tpl = file_get_contents($target);
152
-		} elseif(is_file($theme_path . 'login.tpl')) {
153
-			$target = $theme_path . 'login.tpl';
154
-			$login_tpl = file_get_contents($target);
155
-		} elseif(is_file($theme_path . 'templates/actions/login.tpl')) {
156
-			$target = $theme_path . 'templates/actions/login.tpl';
157
-			$login_tpl = file_get_contents($target);
158
-		} elseif(is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible
159
-			$target = $theme_path . 'html/login.html';
160
-			$login_tpl = file_get_contents($target);
161
-		} else {
162
-			$target = MODX_MANAGER_PATH . 'media/style/common/login.tpl';
163
-			$login_tpl = file_get_contents($target);
164
-		}
165
-	}
166
-
167
-	// merge placeholders
168
-	$login_tpl = $modx->mergePlaceholderContent($login_tpl);
169
-	$regx = strpos($login_tpl, '[[+') !== false ? '~\[\[\+(.*?)\]\]~' : '~\[\+(.*?)\+\]~'; // little tweak for newer parsers
170
-	$login_tpl = preg_replace($regx, '', $login_tpl); //cleanup
171
-
172
-	echo $login_tpl;
173
-
174
-	exit;
74
+    // invoke OnManagerLoginFormPrerender event
75
+    $evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender');
76
+    $html = is_array($evtOut) ? implode('', $evtOut) : '';
77
+    $modx->setPlaceholder('OnManagerLoginFormPrerender', $html);
78
+
79
+    $modx->setPlaceholder('site_name', $site_name);
80
+    $modx->setPlaceholder('manager_path', MGR_DIR);
81
+    $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]);
82
+    $modx->setPlaceholder('login_message', $_lang["login_message"]);
83
+    $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/');
84
+    $modx->setPlaceholder('year', date('Y'));
85
+    $modx->setPlaceholder('manager_theme_style', (isset($_COOKIE['MODX_themeColor']) ? $_COOKIE['MODX_themeColor'] : ''));
86
+
87
+    // andrazk 20070416 - notify user of install/update
88
+    if(isset($_GET['installGoingOn'])) {
89
+        $installGoingOn = $_GET['installGoingOn'];
90
+    }
91
+    if(isset($installGoingOn)) {
92
+        switch($installGoingOn) {
93
+            case 1 :
94
+                $modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>");
95
+                break;
96
+            case 2 :
97
+                $modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>");
98
+                break;
99
+        }
100
+    }
101
+
102
+    if($modx->config['use_captcha'] == 1) {
103
+        $modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]);
104
+        $modx->setPlaceholder('captcha_image', '<a href="' . MODX_MANAGER_URL . '" class="loginCaptcha"><img id="captcha_image" src="' . MODX_MANAGER_URL . 'includes/veriword.php?rand=' . rand() . '" alt="' . $_lang["login_captcha_message"] . '" /></a>');
105
+        $modx->setPlaceholder('captcha_input', '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />');
106
+    }
107
+
108
+    // login info
109
+    $uid = isset($_COOKIE['modx_remember_manager']) ? preg_replace('/[^a-zA-Z0-9\-_@\.]*/', '', $_COOKIE['modx_remember_manager']) : '';
110
+    $modx->setPlaceholder('uid', $uid);
111
+    $modx->setPlaceholder('username', $_lang["username"]);
112
+    $modx->setPlaceholder('password', $_lang["password"]);
113
+
114
+    // remember me
115
+    $html = isset($_COOKIE['modx_remember_manager']) ? 'checked="checked"' : '';
116
+    $modx->setPlaceholder('remember_me', $html);
117
+    $modx->setPlaceholder('remember_username', $_lang["remember_username"]);
118
+    $modx->setPlaceholder('login_button', $_lang["login_button"]);
119
+
120
+    // invoke OnManagerLoginFormRender event
121
+    $evtOut = $modx->invokeEvent('OnManagerLoginFormRender');
122
+    $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : '';
123
+    $modx->setPlaceholder('OnManagerLoginFormRender', $html);
124
+
125
+    // load template
126
+    $target = $modx->getConfig('manager_login_tpl');
127
+    $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
128
+    $target = $modx->mergeSettingsContent($target);
129
+
130
+    $login_tpl = null;
131
+    if(substr($target, 0, 1) === '@') {
132
+        if(substr($target, 0, 6) === '@CHUNK') {
133
+            $target = trim(substr($target, 7));
134
+            $login_tpl = $modx->getChunk($target);
135
+        } elseif(substr($target, 0, 5) === '@FILE') {
136
+            $target = trim(substr($target, 6));
137
+            $login_tpl = file_get_contents($target);
138
+        }
139
+    } else {
140
+        $theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/';
141
+        if(is_file($theme_path . 'style.php')) {
142
+            include($theme_path . 'style.php');
143
+        }
144
+        $chunk = $modx->getChunk($target);
145
+        if($chunk !== false && !empty($chunk)) {
146
+            $login_tpl = $chunk;
147
+        } elseif(is_file(MODX_BASE_PATH . $target)) {
148
+            $target = MODX_BASE_PATH . $target;
149
+            $login_tpl = file_get_contents($target);
150
+        } elseif(is_file($target)) {
151
+            $login_tpl = file_get_contents($target);
152
+        } elseif(is_file($theme_path . 'login.tpl')) {
153
+            $target = $theme_path . 'login.tpl';
154
+            $login_tpl = file_get_contents($target);
155
+        } elseif(is_file($theme_path . 'templates/actions/login.tpl')) {
156
+            $target = $theme_path . 'templates/actions/login.tpl';
157
+            $login_tpl = file_get_contents($target);
158
+        } elseif(is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible
159
+            $target = $theme_path . 'html/login.html';
160
+            $login_tpl = file_get_contents($target);
161
+        } else {
162
+            $target = MODX_MANAGER_PATH . 'media/style/common/login.tpl';
163
+            $login_tpl = file_get_contents($target);
164
+        }
165
+    }
166
+
167
+    // merge placeholders
168
+    $login_tpl = $modx->mergePlaceholderContent($login_tpl);
169
+    $regx = strpos($login_tpl, '[[+') !== false ? '~\[\[\+(.*?)\]\]~' : '~\[\+(.*?)\+\]~'; // little tweak for newer parsers
170
+    $login_tpl = preg_replace($regx, '', $login_tpl); //cleanup
171
+
172
+    echo $login_tpl;
173
+
174
+    exit;
175 175
 
176 176
 } else {
177
-	// Update table active_user_sessions
178
-	$modx->updateValidatedUserSession();
179
-
180
-	// Update last action in table active_users
181
-	$itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : '';
182
-	$lasthittime = time();
183
-	$action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1;
184
-
185
-	if($action !== 1) {
186
-		if(!intval($itemid)) {
187
-			$itemid = null;
188
-		}
189
-		$sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", $modx->getFullTableName('active_users') // Table
190
-			, session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action, $itemid == null ? var_export(null, true) : $itemid);
191
-		$modx->db->query($sql);
192
-	}
177
+    // Update table active_user_sessions
178
+    $modx->updateValidatedUserSession();
179
+
180
+    // Update last action in table active_users
181
+    $itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : '';
182
+    $lasthittime = time();
183
+    $action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1;
184
+
185
+    if($action !== 1) {
186
+        if(!intval($itemid)) {
187
+            $itemid = null;
188
+        }
189
+        $sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", $modx->getFullTableName('active_users') // Table
190
+            , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action, $itemid == null ? var_export(null, true) : $itemid);
191
+        $modx->db->query($sql);
192
+    }
193 193
 }
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6
-if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
6
+if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
7 7
 	header('HTTP/1.0 404 Not Found');
8 8
 	exit;
9 9
 }
10 10
 
11
-if(isset($_SESSION['mgrValidated']) && $_SESSION['usertype'] != 'manager') {
11
+if (isset($_SESSION['mgrValidated']) && $_SESSION['usertype'] != 'manager') {
12 12
 	//		if (isset($_COOKIE[session_name()])) {
13 13
 	//			setcookie(session_name(), '', 0, MODX_BASE_URL);
14 14
 	//		}
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
18 18
 }
19 19
 
20 20
 // andrazk 20070416 - if installer is running, destroy active sessions
21
-if(file_exists(MODX_BASE_PATH . 'assets/cache/installProc.inc.php')) {
22
-	include_once(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
23
-	if(isset($installStartTime)) {
24
-		if((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard
21
+if (file_exists(MODX_BASE_PATH.'assets/cache/installProc.inc.php')) {
22
+	include_once(MODX_BASE_PATH.'assets/cache/installProc.inc.php');
23
+	if (isset($installStartTime)) {
24
+		if ((time() - $installStartTime) > 5 * 60) { // if install flag older than 5 minutes, discard
25 25
 			unset($installStartTime);
26
-			@ chmod(MODX_BASE_PATH . 'assets/cache/installProc.inc.php', 0755);
27
-			unlink(MODX_BASE_PATH . 'assets/cache/installProc.inc.php');
26
+			@ chmod(MODX_BASE_PATH.'assets/cache/installProc.inc.php', 0755);
27
+			unlink(MODX_BASE_PATH.'assets/cache/installProc.inc.php');
28 28
 		} else {
29
-			if($_SERVER['REQUEST_METHOD'] != 'POST') {
30
-				if(isset($_COOKIE[session_name()])) {
29
+			if ($_SERVER['REQUEST_METHOD'] != 'POST') {
30
+				if (isset($_COOKIE[session_name()])) {
31 31
 					session_unset();
32 32
 					@session_destroy();
33 33
 					//					setcookie(session_name(), '', 0, MODX_BASE_URL);
@@ -39,37 +39,37 @@  discard block
 block discarded – undo
39 39
 }
40 40
 
41 41
 // andrazk 20070416 - if session started before install and was not destroyed yet
42
-if(isset($lastInstallTime)) {
43
-	if(isset($_SESSION['mgrValidated'])) {
44
-		if(isset($_SESSION['modx.session.created.time'])) {
45
-			if($_SESSION['modx.session.created.time'] < $lastInstallTime) {
46
-				if($_SERVER['REQUEST_METHOD'] != 'POST') {
47
-					if(isset($_COOKIE[session_name()])) {
42
+if (isset($lastInstallTime)) {
43
+	if (isset($_SESSION['mgrValidated'])) {
44
+		if (isset($_SESSION['modx.session.created.time'])) {
45
+			if ($_SESSION['modx.session.created.time'] < $lastInstallTime) {
46
+				if ($_SERVER['REQUEST_METHOD'] != 'POST') {
47
+					if (isset($_COOKIE[session_name()])) {
48 48
 						session_unset();
49 49
 						@session_destroy();
50 50
 						//						setcookie(session_name(), '', 0, MODX_BASE_URL);
51 51
 					}
52 52
 					header('HTTP/1.0 307 Redirect');
53
-					header('Location: ' . MODX_MANAGER_URL . 'index.php?installGoingOn=2');
53
+					header('Location: '.MODX_MANAGER_URL.'index.php?installGoingOn=2');
54 54
 				}
55 55
 			}
56 56
 		}
57 57
 	}
58 58
 }
59 59
 
60
-if(!isset($_SESSION['mgrValidated'])) {
61
-	if(isset($manager_language)) {
60
+if (!isset($_SESSION['mgrValidated'])) {
61
+	if (isset($manager_language)) {
62 62
 		// establish fallback to English default
63 63
 		include_once "lang/english.inc.php";
64 64
 		// include localized overrides
65
-		include_once "lang/" . $manager_language . ".inc.php";
65
+		include_once "lang/".$manager_language.".inc.php";
66 66
 	} else {
67 67
 		include_once "lang/english.inc.php";
68 68
 	}
69 69
 
70 70
 	$modx->setPlaceholder('modx_charset', $modx_manager_charset);
71 71
 	$modx->setPlaceholder('theme', $manager_theme);
72
-    $modx->setPlaceholder('favicon', (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico'));
72
+    $modx->setPlaceholder('favicon', (file_exists(MODX_BASE_PATH.'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/'.$modx->config['manager_theme'].'/images/favicon.ico'));
73 73
 
74 74
 	// invoke OnManagerLoginFormPrerender event
75 75
 	$evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender');
@@ -80,29 +80,29 @@  discard block
 block discarded – undo
80 80
 	$modx->setPlaceholder('manager_path', MGR_DIR);
81 81
 	$modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]);
82 82
 	$modx->setPlaceholder('login_message', $_lang["login_message"]);
83
-	$modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/');
83
+	$modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/');
84 84
 	$modx->setPlaceholder('year', date('Y'));
85 85
 	$modx->setPlaceholder('manager_theme_style', (isset($_COOKIE['MODX_themeColor']) ? $_COOKIE['MODX_themeColor'] : ''));
86 86
 
87 87
 	// andrazk 20070416 - notify user of install/update
88
-	if(isset($_GET['installGoingOn'])) {
88
+	if (isset($_GET['installGoingOn'])) {
89 89
 		$installGoingOn = $_GET['installGoingOn'];
90 90
 	}
91
-	if(isset($installGoingOn)) {
92
-		switch($installGoingOn) {
91
+	if (isset($installGoingOn)) {
92
+		switch ($installGoingOn) {
93 93
 			case 1 :
94
-				$modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>");
94
+				$modx->setPlaceholder('login_message', "<p><span class=\"fail\">".$_lang["login_cancelled_install_in_progress"]."</p><p>".$_lang["login_message"]."</p>");
95 95
 				break;
96 96
 			case 2 :
97
-				$modx->setPlaceholder('login_message', "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>");
97
+				$modx->setPlaceholder('login_message', "<p><span class=\"fail\">".$_lang["login_cancelled_site_was_updated"]."</p><p>".$_lang["login_message"]."</p>");
98 98
 				break;
99 99
 		}
100 100
 	}
101 101
 
102
-	if($modx->config['use_captcha'] == 1) {
102
+	if ($modx->config['use_captcha'] == 1) {
103 103
 		$modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]);
104
-		$modx->setPlaceholder('captcha_image', '<a href="' . MODX_MANAGER_URL . '" class="loginCaptcha"><img id="captcha_image" src="' . MODX_MANAGER_URL . 'includes/veriword.php?rand=' . rand() . '" alt="' . $_lang["login_captcha_message"] . '" /></a>');
105
-		$modx->setPlaceholder('captcha_input', '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />');
104
+		$modx->setPlaceholder('captcha_image', '<a href="'.MODX_MANAGER_URL.'" class="loginCaptcha"><img id="captcha_image" src="'.MODX_MANAGER_URL.'includes/veriword.php?rand='.rand().'" alt="'.$_lang["login_captcha_message"].'" /></a>');
105
+		$modx->setPlaceholder('captcha_input', '<label>'.$_lang["captcha_code"].'</label> <input type="text" name="captcha_code" tabindex="3" value="" />');
106 106
 	}
107 107
 
108 108
 	// login info
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 	// invoke OnManagerLoginFormRender event
121 121
 	$evtOut = $modx->invokeEvent('OnManagerLoginFormRender');
122
-	$html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : '';
122
+	$html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">'.implode('', $evtOut).'</div>' : '';
123 123
 	$modx->setPlaceholder('OnManagerLoginFormRender', $html);
124 124
 
125 125
 	// load template
@@ -128,38 +128,38 @@  discard block
 block discarded – undo
128 128
 	$target = $modx->mergeSettingsContent($target);
129 129
 
130 130
 	$login_tpl = null;
131
-	if(substr($target, 0, 1) === '@') {
132
-		if(substr($target, 0, 6) === '@CHUNK') {
131
+	if (substr($target, 0, 1) === '@') {
132
+		if (substr($target, 0, 6) === '@CHUNK') {
133 133
 			$target = trim(substr($target, 7));
134 134
 			$login_tpl = $modx->getChunk($target);
135
-		} elseif(substr($target, 0, 5) === '@FILE') {
135
+		} elseif (substr($target, 0, 5) === '@FILE') {
136 136
 			$target = trim(substr($target, 6));
137 137
 			$login_tpl = file_get_contents($target);
138 138
 		}
139 139
 	} else {
140
-		$theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/';
141
-		if(is_file($theme_path . 'style.php')) {
142
-			include($theme_path . 'style.php');
140
+		$theme_path = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/';
141
+		if (is_file($theme_path.'style.php')) {
142
+			include($theme_path.'style.php');
143 143
 		}
144 144
 		$chunk = $modx->getChunk($target);
145
-		if($chunk !== false && !empty($chunk)) {
145
+		if ($chunk !== false && !empty($chunk)) {
146 146
 			$login_tpl = $chunk;
147
-		} elseif(is_file(MODX_BASE_PATH . $target)) {
148
-			$target = MODX_BASE_PATH . $target;
147
+		} elseif (is_file(MODX_BASE_PATH.$target)) {
148
+			$target = MODX_BASE_PATH.$target;
149 149
 			$login_tpl = file_get_contents($target);
150
-		} elseif(is_file($target)) {
150
+		} elseif (is_file($target)) {
151 151
 			$login_tpl = file_get_contents($target);
152
-		} elseif(is_file($theme_path . 'login.tpl')) {
153
-			$target = $theme_path . 'login.tpl';
152
+		} elseif (is_file($theme_path.'login.tpl')) {
153
+			$target = $theme_path.'login.tpl';
154 154
 			$login_tpl = file_get_contents($target);
155
-		} elseif(is_file($theme_path . 'templates/actions/login.tpl')) {
156
-			$target = $theme_path . 'templates/actions/login.tpl';
155
+		} elseif (is_file($theme_path.'templates/actions/login.tpl')) {
156
+			$target = $theme_path.'templates/actions/login.tpl';
157 157
 			$login_tpl = file_get_contents($target);
158
-		} elseif(is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible
159
-			$target = $theme_path . 'html/login.html';
158
+		} elseif (is_file($theme_path.'html/login.html')) { // ClipperCMS compatible
159
+			$target = $theme_path.'html/login.html';
160 160
 			$login_tpl = file_get_contents($target);
161 161
 		} else {
162
-			$target = MODX_MANAGER_PATH . 'media/style/common/login.tpl';
162
+			$target = MODX_MANAGER_PATH.'media/style/common/login.tpl';
163 163
 			$login_tpl = file_get_contents($target);
164 164
 		}
165 165
 	}
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 	$lasthittime = time();
183 183
 	$action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1;
184 184
 
185
-	if($action !== 1) {
186
-		if(!intval($itemid)) {
185
+	if ($action !== 1) {
186
+		if (!intval($itemid)) {
187 187
 			$itemid = null;
188 188
 		}
189 189
 		$sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)", $modx->getFullTableName('active_users') // Table
Please login to merge, or discard this patch.
manager/includes/debug.inc.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 // show debug information
7
-if(isset($enable_debug) && $enable_debug==true) {
7
+if (isset($enable_debug) && $enable_debug == true) {
8 8
 	?>
9 9
 	<script language="javascript">
10 10
 	//document.onload = removeDebug();
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	}
36 36
 	</style>
37 37
 	<?php
38
-	$mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart);
38
+	$mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart);
39 39
 	?>
40 40
 	<div class='debug' id='debug' name='debug' onClick="removeDebugDiv();">
41 41
 		<table border="0" cellspacing="0" cellpadding="0">
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		  </tr>
45 45
 		  <tr>
46 46
 			<td width="70">Time taken</td>
47
-			<td width="80"><?php echo printf ("%6.5f s", $totaltime); ?></td>
47
+			<td width="80"><?php echo printf("%6.5f s", $totaltime); ?></td>
48 48
 		  </tr>
49 49
 		</table>
50 50
 	</div>
Please login to merge, or discard this patch.
manager/includes/footer.inc.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 global $SystemAlertMsgQueque;
6 6
 // display system alert window if messages are available
7 7
 if(count($SystemAlertMsgQueque) > 0) {
8
-	include "sysalert.display.inc.php";
8
+    include "sysalert.display.inc.php";
9 9
 }
10 10
 ?>
11 11
 <script type='text/javascript'>
@@ -19,17 +19,17 @@  discard block
 block discarded – undo
19 19
 </script>
20 20
 <?php
21 21
 if(in_array($modx->manager->action, array(
22
-	85,
23
-	27,
24
-	4,
25
-	72,
26
-	13,
27
-	11,
28
-	12,
29
-	87,
30
-	88
22
+    85,
23
+    27,
24
+    4,
25
+    72,
26
+    13,
27
+    11,
28
+    12,
29
+    87,
30
+    88
31 31
 ))) {
32
-	echo $modx->manager->loadDatePicker($modx->config['mgr_date_picker_path']);
32
+    echo $modx->manager->loadDatePicker($modx->config['mgr_date_picker_path']);
33 33
 }
34 34
 ?>
35 35
 </body>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  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
 global $SystemAlertMsgQueque;
6 6
 // display system alert window if messages are available
7
-if(count($SystemAlertMsgQueque) > 0) {
7
+if (count($SystemAlertMsgQueque) > 0) {
8 8
 	include "sysalert.display.inc.php";
9 9
 }
10 10
 ?>
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	});
19 19
 </script>
20 20
 <?php
21
-if(in_array($modx->manager->action, array(
21
+if (in_array($modx->manager->action, array(
22 22
 	85,
23 23
 	27,
24 24
 	4,
Please login to merge, or discard this patch.
manager/includes/document.parser.class.inc.php 2 patches
Spacing   +252 added lines, -252 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     function __call($method_name, $arguments)
128 128
     {
129
-        include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php');
129
+        include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php');
130 130
         if (method_exists($this->old, $method_name)) {
131 131
             $error_type = 1;
132 132
         } else {
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
             $info = debug_backtrace();
145 145
             $m[] = $msg;
146 146
             if (!empty($this->currentSnippet)) {
147
-                $m[] = 'Snippet - ' . $this->currentSnippet;
147
+                $m[] = 'Snippet - '.$this->currentSnippet;
148 148
             } elseif (!empty($this->event->activePlugin)) {
149
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
149
+                $m[] = 'Plugin - '.$this->event->activePlugin;
150 150
             }
151 151
             $m[] = $this->decoded_request_uri;
152
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
152
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
153 153
             $msg = implode('<br />', $m);
154 154
             $this->logEvent(0, $error_type, $msg, $title);
155 155
         }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     {
167 167
         $flag = false;
168 168
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) {
169
-            $flag = (bool)$this->{$connector}->conn;
169
+            $flag = (bool) $this->{$connector}->conn;
170 170
         }
171 171
         return $flag;
172 172
     }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         }
194 194
         if (!$out && $flag) {
195 195
             $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
196
-            $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
196
+            $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
197 197
             $out = is_file($filename) ? include $filename : false;
198 198
         }
199 199
         if ($out && !in_array($extname, $this->extensions)) {
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
     function getMicroTime()
211 211
     {
212 212
         list ($usec, $sec) = explode(' ', microtime());
213
-        return ((float)$usec + (float)$sec);
213
+        return ((float) $usec + (float) $sec);
214 214
     }
215 215
 
216 216
     /**
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
             // append the redirect count string to the url
234 234
             $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0;
235 235
             if ($currentNumberOfRedirects > 3) {
236
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
236
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
237 237
             } else {
238 238
                 $currentNumberOfRedirects += 1;
239 239
                 if (strpos($url, "?") > 0) {
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
             }
245 245
         }
246 246
         if ($type == 'REDIRECT_REFRESH') {
247
-            $header = 'Refresh: 0;URL=' . $url;
247
+            $header = 'Refresh: 0;URL='.$url;
248 248
         } elseif ($type == 'REDIRECT_META') {
249
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
249
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
250 250
             echo $header;
251 251
             exit;
252 252
         } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) {
@@ -254,10 +254,10 @@  discard block
 block discarded – undo
254 254
             global $base_url, $site_url;
255 255
             if (substr($url, 0, strlen($base_url)) == $base_url) {
256 256
                 // append $site_url to make it work with Location:
257
-                $url = $site_url . substr($url, strlen($base_url));
257
+                $url = $site_url.substr($url, strlen($base_url));
258 258
             }
259 259
             if (strpos($url, "\n") === false) {
260
-                $header = 'Location: ' . $url;
260
+                $header = 'Location: '.$url;
261 261
             } else {
262 262
                 $this->messageQuit('No newline allowed in redirect url.');
263 263
             }
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
 
367 367
     private function recoverySiteCache()
368 368
     {
369
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
370
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
369
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
370
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
371 371
 
372 372
         if (is_file($site_cache_path)) {
373 373
             include($site_cache_path);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
             return;
377 377
         }
378 378
 
379
-        include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
379
+        include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
380 380
         $cache = new synccache();
381 381
         $cache->setCachepath($site_cache_dir);
382 382
         $cache->setReport(false);
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
                 $this->invokeEvent("OnBeforeManagerPageInit");
428 428
             }
429 429
 
430
-            if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) {
431
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
430
+            if (isset ($_SESSION[$usrType.'UsrConfigSet'])) {
431
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
432 432
             } else {
433 433
                 if ($usrType == 'web') {
434 434
                     $from = $tbl_web_user_settings;
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
449 449
                 }
450 450
                 if (isset ($usrType)) {
451
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
451
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
452 452
                 } // store user settings in session
453 453
             }
454 454
         }
@@ -593,10 +593,10 @@  discard block
 block discarded – undo
593 593
         $suf = $this->config['friendly_url_suffix'];
594 594
         $pre = preg_quote($pre, '/');
595 595
         $suf = preg_quote($suf, '/');
596
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
596
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
597 597
             $q = $_[1];
598 598
         }
599
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
599
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
600 600
             $q = $_[1];
601 601
         }
602 602
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
         if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
619 619
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
620 620
             if ($this->config['use_alias_path'] == 1) {
621
-                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
621
+                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
622 622
                     $this->documentMethod = 'id';
623 623
                     return $q;
624 624
                 } else { /* not a valid id in terms of virtualDir, treat as alias */
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
      */
653 653
     public function getHashFile($key)
654 654
     {
655
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
655
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
656 656
     }
657 657
 
658 658
     /**
@@ -663,9 +663,9 @@  discard block
 block discarded – undo
663 663
         $hash = $id;
664 664
         $tmp = null;
665 665
         $params = array();
666
-        if(!empty($this->systemCacheKey)){
666
+        if (!empty($this->systemCacheKey)) {
667 667
             $hash = $this->systemCacheKey;
668
-        }else {
668
+        } else {
669 669
             if (!empty($_GET)) {
670 670
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
671 671
                 $params = $_GET;
@@ -673,8 +673,8 @@  discard block
 block discarded – undo
673 673
                 $hash .= '_'.md5(http_build_query($params));
674 674
             }
675 675
         }
676
-        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
677
-        if (is_array($evtOut) && count($evtOut) > 0){
676
+        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
677
+        if (is_array($evtOut) && count($evtOut) > 0) {
678 678
             $tmp = array_pop($evtOut);
679 679
         }
680 680
         return empty($tmp) ? $hash : $tmp;
@@ -816,12 +816,12 @@  discard block
 block discarded – undo
816 816
         if ($js = $this->getRegisteredClientStartupScripts()) {
817 817
             // change to just before closing </head>
818 818
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
819
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
819
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
820 820
         }
821 821
 
822 822
         // Insert jscripts & html block into template - template must have a </body> tag
823 823
         if ($js = $this->getRegisteredClientScripts()) {
824
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
824
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
825 825
         }
826 826
         // End fix by sirlancelot
827 827
 
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
         // send out content-type and content-disposition headers
833 833
         if (IN_PARSER_MODE == "true") {
834 834
             $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
835
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
835
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
836 836
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
837 837
             //                header('HTTP/1.0 404 Not Found');
838 838
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
                     $name = preg_replace('|-+|', '-', $name);
851 851
                     $name = trim($name, '-');
852 852
                 }
853
-                $header = 'Content-Disposition: attachment; filename=' . $name;
853
+                $header = 'Content-Disposition: attachment; filename='.$name;
854 854
                 header($header);
855 855
             }
856 856
         }
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
 
859 859
         $stats = $this->getTimerStats($this->tstart);
860 860
 
861
-        $out =& $this->documentOutput;
861
+        $out = & $this->documentOutput;
862 862
         $out = str_replace("[^q^]", $stats['queries'], $out);
863 863
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
864 864
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -897,17 +897,17 @@  discard block
 block discarded – undo
897 897
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
898 898
                 $tt += $t;
899 899
             }
900
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />";
900
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />";
901 901
             echo $this->snippetsCode;
902 902
         }
903 903
         if ($this->dumpPlugins) {
904 904
             $ps = "";
905 905
             $tt = 0;
906 906
             foreach ($this->pluginsTime as $s => $t) {
907
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
907
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
908 908
                 $tt += $t;
909 909
             }
910
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
910
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />";
911 911
             echo $this->pluginsCode;
912 912
         }
913 913
 
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
         $srcTags = explode(',', $tags);
934 934
         $repTags = array();
935 935
         foreach ($srcTags as $tag) {
936
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
936
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
937 937
         }
938 938
         return array($srcTags, $repTags);
939 939
     }
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
956 956
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
957 957
         $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0;
958
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
958
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
959 959
 
960 960
         return $stats;
961 961
     }
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
     {
989 989
         $cacheRefreshTime = 0;
990 990
         $recent_update = 0;
991
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
991
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
992 992
         $this->recentUpdate = $recent_update;
993 993
 
994 994
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1042,8 +1042,8 @@  discard block
 block discarded – undo
1042 1042
                 }
1043 1043
 
1044 1044
                 $docObjSerial = serialize($this->documentObject);
1045
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1046
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1045
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1046
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1047 1047
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1048 1048
             }
1049 1049
         }
@@ -1085,16 +1085,16 @@  discard block
 block discarded – undo
1085 1085
             return array();
1086 1086
         }
1087 1087
         $spacer = md5('<<<EVO>>>');
1088
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1089
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1090
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1091
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1088
+        if ($left === '{{' && strpos($content, ';}}') !== false)  $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content);
1089
+        if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content);
1090
+        if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content);
1091
+        if ($left === '[[' && strpos($content, ']]]') !== false)  $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content);
1092 1092
 
1093 1093
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1094 1094
         $pos[']]>'] = strpos($content, ']]>');
1095 1095
 
1096 1096
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1097
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1097
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1098 1098
         }
1099 1099
 
1100 1100
         $lp = explode($left, $content);
@@ -1158,8 +1158,8 @@  discard block
 block discarded – undo
1158 1158
                 }
1159 1159
             }
1160 1160
         }
1161
-        foreach($tags as $i=>$tag) {
1162
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1161
+        foreach ($tags as $i=>$tag) {
1162
+            if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag);
1163 1163
         }
1164 1164
         return $tags;
1165 1165
     }
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
         }
1200 1200
 
1201 1201
         foreach ($matches[1] as $i => $key) {
1202
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1202
+            if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1203 1203
             if (substr($key, 0, 1) == '#') {
1204 1204
                 $key = substr($key, 1);
1205 1205
             } // remove # for QuickEdit format
@@ -1219,8 +1219,8 @@  discard block
 block discarded – undo
1219 1219
             }
1220 1220
 
1221 1221
             if (is_array($value)) {
1222
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php');
1223
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
1222
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php');
1223
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
1224 1224
                 $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]);
1225 1225
             }
1226 1226
 
@@ -1231,8 +1231,8 @@  discard block
 block discarded – undo
1231 1231
 
1232 1232
             if (strpos($content, $s) !== false) {
1233 1233
                 $content = str_replace($s, $value, $content);
1234
-            } elseif($this->debug) {
1235
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1234
+            } elseif ($this->debug) {
1235
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1236 1236
             }
1237 1237
         }
1238 1238
 
@@ -1399,8 +1399,8 @@  discard block
 block discarded – undo
1399 1399
             $s = &$matches[0][$i];
1400 1400
             if (strpos($content, $s) !== false) {
1401 1401
                 $content = str_replace($s, $value, $content);
1402
-            } elseif($this->debug) {
1403
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1402
+            } elseif ($this->debug) {
1403
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1404 1404
             }
1405 1405
         }
1406 1406
         return $content;
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
             }
1454 1454
 
1455 1455
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1456
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1456
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1457 1457
             if ($this->config['enable_at_syntax']) {
1458 1458
                 $value = $this->mergeConditionalTagsContent($value);
1459 1459
             }
@@ -1468,8 +1468,8 @@  discard block
 block discarded – undo
1468 1468
             $s = &$matches[0][$i];
1469 1469
             if (strpos($content, $s) !== false) {
1470 1470
                 $content = str_replace($s, $value, $content);
1471
-            } elseif($this->debug) {
1472
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1471
+            } elseif ($this->debug) {
1472
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1473 1473
             }
1474 1474
         }
1475 1475
         return $content;
@@ -1527,8 +1527,8 @@  discard block
 block discarded – undo
1527 1527
             $s = &$matches[0][$i];
1528 1528
             if (strpos($content, $s) !== false) {
1529 1529
                 $content = str_replace($s, $value, $content);
1530
-            } elseif($this->debug) {
1531
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1530
+            } elseif ($this->debug) {
1531
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1532 1532
             }
1533 1533
         }
1534 1534
         return $content;
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
             return $content;
1553 1553
         }
1554 1554
 
1555
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1555
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1556 1556
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content);
1557 1557
 
1558 1558
         $pieces = explode('<@IF:', $content);
@@ -1563,7 +1563,7 @@  discard block
 block discarded – undo
1563 1563
             }
1564 1564
             list($cmd, $text) = explode('>', $split, 2);
1565 1565
             $cmd = str_replace("'", "\'", $cmd);
1566
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1566
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1567 1567
             $content .= $text;
1568 1568
         }
1569 1569
         $pieces = explode('<@ELSEIF:', $content);
@@ -1574,13 +1574,13 @@  discard block
 block discarded – undo
1574 1574
             }
1575 1575
             list($cmd, $text) = explode('>', $split, 2);
1576 1576
             $cmd = str_replace("'", "\'", $cmd);
1577
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1577
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1578 1578
             $content .= $text;
1579 1579
         }
1580 1580
 
1581 1581
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1582 1582
         ob_start();
1583
-        $content = eval('?>' . $content);
1583
+        $content = eval('?>'.$content);
1584 1584
         $content = ob_get_clean();
1585 1585
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content);
1586 1586
 
@@ -1705,7 +1705,7 @@  discard block
 block discarded – undo
1705 1705
         $matches = $this->getTagsFromContent($content, $left, $right);
1706 1706
         if (!empty($matches)) {
1707 1707
             foreach ($matches[0] as $i => $v) {
1708
-                $addBreakMatches[$i] = $v . "\n";
1708
+                $addBreakMatches[$i] = $v."\n";
1709 1709
             }
1710 1710
             $content = str_replace($addBreakMatches, '', $content);
1711 1711
             if (strpos($content, $left) !== false) {
@@ -1738,8 +1738,8 @@  discard block
 block discarded – undo
1738 1738
             $s = &$matches[0][$i];
1739 1739
             if (strpos($content, $s) !== false) {
1740 1740
                 $content = str_replace($s, $v, $content);
1741
-            } elseif($this->debug) {
1742
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1741
+            } elseif ($this->debug) {
1742
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1743 1743
             }
1744 1744
         }
1745 1745
         return $content;
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
                 $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;
1801 1801
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg);
1802 1802
                 if ($this->isBackend()) {
1803
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
1803
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
1804 1804
                 }
1805 1805
             }
1806 1806
         } else {
@@ -1846,7 +1846,7 @@  discard block
 block discarded – undo
1846 1846
                 $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;
1847 1847
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo);
1848 1848
                 if ($this->isBackend()) {
1849
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
1849
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
1850 1850
                 }
1851 1851
             }
1852 1852
         }
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
         if (is_array($return) || is_object($return)) {
1855 1855
             return $return;
1856 1856
         } else {
1857
-            return $echo . $return;
1857
+            return $echo.$return;
1858 1858
         }
1859 1859
     }
1860 1860
 
@@ -1892,8 +1892,8 @@  discard block
 block discarded – undo
1892 1892
                 }
1893 1893
                 if (strpos($content, $s) !== false) {
1894 1894
                     $content = str_replace($s, $value, $content);
1895
-                } elseif($this->debug) {
1896
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1895
+                } elseif ($this->debug) {
1896
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
1897 1897
                 }
1898 1898
                 continue;
1899 1899
             }
@@ -1904,8 +1904,8 @@  discard block
 block discarded – undo
1904 1904
 
1905 1905
             if (strpos($content, $s) !== false) {
1906 1906
                 $content = str_replace($s, $value, $content);
1907
-            } elseif($this->debug) {
1908
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1907
+            } elseif ($this->debug) {
1908
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
1909 1909
             }
1910 1910
         }
1911 1911
 
@@ -1997,7 +1997,7 @@  discard block
 block discarded – undo
1997 1997
             $eventtime = sprintf('%2.2f ms', $eventtime * 1000);
1998 1998
             $code = str_replace("\t", '  ', $this->htmlspecialchars($value));
1999 1999
             $piece = str_replace("\t", '  ', $this->htmlspecialchars($piece));
2000
-            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2000
+            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2001 2001
             $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', $snippetObject['name'], $eventtime, $piece, $print_r_params, $code);
2002 2002
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
2003 2003
         }
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
             $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where);
2242 2242
             $count = $this->db->getRecordCount($rs);
2243 2243
             if (1 < $count) {
2244
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2244
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2245 2245
             }
2246 2246
             if ($count) {
2247 2247
                 $row = $this->db->getRow($rs);
@@ -2267,7 +2267,7 @@  discard block
 block discarded – undo
2267 2267
     function toAlias($text)
2268 2268
     {
2269 2269
         $suff = $this->config['friendly_url_suffix'];
2270
-        return str_replace(array('.xml' . $suff, '.rss' . $suff, '.js' . $suff, '.css' . $suff, '.txt' . $suff, '.json' . $suff, '.pdf' . $suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2270
+        return str_replace(array('.xml'.$suff, '.rss'.$suff, '.js'.$suff, '.css'.$suff, '.txt'.$suff, '.json'.$suff, '.pdf'.$suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2271 2271
     }
2272 2272
 
2273 2273
     /**
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
                 $suff = '/';
2300 2300
             }
2301 2301
 
2302
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2302
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2303 2303
         }
2304 2304
 
2305 2305
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
                 preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match);
2337 2337
                 $ids = implode(',', array_unique($match['1']));
2338 2338
                 if ($ids) {
2339
-                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2339
+                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2340 2340
                     while ($row = $this->db->getRow($res)) {
2341 2341
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2342 2342
                             $parent = $row['parent'];
@@ -2347,7 +2347,7 @@  discard block
 block discarded – undo
2347 2347
                                 $parent = $this->aliasListing[$parent]['parent'];
2348 2348
                             }
2349 2349
 
2350
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2350
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2351 2351
                         } else {
2352 2352
                             $aliases[$row['id']] = $row['alias'];
2353 2353
                         }
@@ -2359,7 +2359,7 @@  discard block
 block discarded – undo
2359 2359
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2360 2360
             $pref = $this->config['friendly_url_prefix'];
2361 2361
             $suff = $this->config['friendly_url_suffix'];
2362
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2362
+            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2363 2363
                 global $modx;
2364 2364
                 $thealias = $aliases[$m[1]];
2365 2365
                 $thefolder = $isfolder[$m[1]];
@@ -2375,7 +2375,7 @@  discard block
 block discarded – undo
2375 2375
 
2376 2376
         } else {
2377 2377
             $in = '!\[\~([0-9]+)\~\]!is';
2378
-            $out = "index.php?id=" . '\1';
2378
+            $out = "index.php?id=".'\1';
2379 2379
             $documentSource = preg_replace($in, $out, $documentSource);
2380 2380
         }
2381 2381
 
@@ -2396,7 +2396,7 @@  discard block
 block discarded – undo
2396 2396
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2397 2397
         $len_base_url = strlen($this->config['base_url']);
2398 2398
 
2399
-        $url_path = $q;//LANG
2399
+        $url_path = $q; //LANG
2400 2400
 
2401 2401
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2402 2402
             $url_path = substr($url_path, $len_base_url);
@@ -2408,7 +2408,7 @@  discard block
 block discarded – undo
2408 2408
             $strictURL = substr($strictURL, $len_base_url);
2409 2409
         }
2410 2410
         $http_host = $_SERVER['HTTP_HOST'];
2411
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2411
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2412 2412
 
2413 2413
         $site_url = $this->config['site_url'];
2414 2414
 
@@ -2424,7 +2424,7 @@  discard block
 block discarded – undo
2424 2424
                 }
2425 2425
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2426 2426
                     if (empty($_POST)) {
2427
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2427
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2428 2428
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2429 2429
                             exit(0);
2430 2430
                         }
@@ -2487,7 +2487,7 @@  discard block
 block discarded – undo
2487 2487
                 $docgrp = implode(",", $docgrp);
2488 2488
             }
2489 2489
             // get document
2490
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2490
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2491 2491
             $rs = $this->db->select('sc.*', "{$tblsc} sc
2492 2492
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2493 2493
             if ($this->db->getRecordCount($rs) < 1) {
@@ -2523,9 +2523,9 @@  discard block
 block discarded – undo
2523 2523
             }
2524 2524
             if ($documentObject['template']) {
2525 2525
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2526
-                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv
2527
-                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2528
-                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2526
+                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv
2527
+                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2528
+                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2529 2529
                 $tmplvars = array();
2530 2530
                 while ($row = $this->db->getRow($rs)) {
2531 2531
                     $tmplvars[$row['name']] = array(
@@ -2571,7 +2571,7 @@  discard block
 block discarded – undo
2571 2571
                 $st = md5($source);
2572 2572
             }
2573 2573
             if ($this->dumpSnippets == 1) {
2574
-                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2574
+                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2575 2575
             }
2576 2576
 
2577 2577
             // invoke OnParseDocument event
@@ -2657,7 +2657,7 @@  discard block
 block discarded – undo
2657 2657
 
2658 2658
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
2659 2659
             if ($this->config['use_alias_path'] == 1) {
2660
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
2660
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
2661 2661
                 if (isset($this->documentListing[$alias])) {
2662 2662
                     $this->documentIdentifier = $this->documentListing[$alias];
2663 2663
                 } else {
@@ -2718,7 +2718,7 @@  discard block
 block discarded – undo
2718 2718
                 } else {
2719 2719
                     $docAlias = $this->db->escape($this->documentIdentifier);
2720 2720
                     $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'");
2721
-                    $this->documentIdentifier = (int)$this->db->getValue($rs);
2721
+                    $this->documentIdentifier = (int) $this->db->getValue($rs);
2722 2722
                 }
2723 2723
             }
2724 2724
             $this->documentMethod = 'id';
@@ -2771,7 +2771,7 @@  discard block
 block discarded – undo
2771 2771
                 $_REQUEST[$n] = $_GET[$n] = $v;
2772 2772
             }
2773 2773
         }
2774
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
2774
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
2775 2775
         $this->q = $qp['path'];
2776 2776
         return $qp['path'];
2777 2777
     }
@@ -2865,7 +2865,7 @@  discard block
 block discarded – undo
2865 2865
             $this->sendErrorPage();
2866 2866
         } else {
2867 2867
             // Inculde the necessary files to check document permissions
2868
-            include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
2868
+            include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
2869 2869
             $udperms = new udperms();
2870 2870
             $udperms->user = $this->getLoginUserID();
2871 2871
             $udperms->document = $this->documentIdentifier;
@@ -2919,7 +2919,7 @@  discard block
 block discarded – undo
2919 2919
         while ($id && $height--) {
2920 2920
             $thisid = $id;
2921 2921
             if ($this->config['aliaslistingfolder'] == 1) {
2922
-                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1");
2922
+                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1");
2923 2923
                 if (!$id || $id == '0') {
2924 2924
                     break;
2925 2925
                 }
@@ -2970,15 +2970,15 @@  discard block
 block discarded – undo
2970 2970
 
2971 2971
         if ($this->config['aliaslistingfolder'] == 1) {
2972 2972
 
2973
-            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'");
2973
+            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'");
2974 2974
             $idx = array();
2975 2975
             while ($row = $this->db->getRow($res)) {
2976 2976
                 $pAlias = '';
2977 2977
                 if (isset($this->aliasListing[$row['parent']])) {
2978
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
2979
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
2978
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
2979
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
2980 2980
                 };
2981
-                $children[$pAlias . $row['alias']] = $row['id'];
2981
+                $children[$pAlias.$row['alias']] = $row['id'];
2982 2982
                 if ($row['isfolder'] == 1) {
2983 2983
                     $idx[] = $row['id'];
2984 2984
                 }
@@ -3010,7 +3010,7 @@  discard block
 block discarded – undo
3010 3010
                 $depth--;
3011 3011
 
3012 3012
                 foreach ($documentMap_cache[$id] as $childId) {
3013
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3013
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3014 3014
                     if (!strlen($pkey)) {
3015 3015
                         $pkey = "{$childId}";
3016 3016
                     }
@@ -3039,7 +3039,7 @@  discard block
 block discarded – undo
3039 3039
         if (substr(strtolower($url), 0, 11) == "javascript:") {
3040 3040
             $fnc = substr($url, 11);
3041 3041
         } elseif ($url) {
3042
-            $fnc = "window.location.href='" . addslashes($url) . "';";
3042
+            $fnc = "window.location.href='".addslashes($url)."';";
3043 3043
         } else {
3044 3044
             $fnc = "history.back(-1);";
3045 3045
         }
@@ -3048,7 +3048,7 @@  discard block
 block discarded – undo
3048 3048
             <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\">
3049 3049
             <script>
3050 3050
                 function __alertQuit() {
3051
-                    alert('" . addslashes($msg) . "');
3051
+                    alert('".addslashes($msg)."');
3052 3052
                     {$fnc}
3053 3053
                 }
3054 3054
                 window.setTimeout('__alertQuit();',100);
@@ -3072,7 +3072,7 @@  discard block
 block discarded – undo
3072 3072
         if ($pms) {
3073 3073
             $state = ($pms[$pm] == 1);
3074 3074
         }
3075
-        return (int)$state;
3075
+        return (int) $state;
3076 3076
     }
3077 3077
 
3078 3078
     /**
@@ -3153,7 +3153,7 @@  discard block
 block discarded – undo
3153 3153
             $this->lockedElements = array();
3154 3154
             $this->cleanupExpiredLocks();
3155 3155
 
3156
-            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul
3156
+            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul
3157 3157
                 LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3158 3158
             while ($row = $this->db->getRow($rs)) {
3159 3159
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3189,7 +3189,7 @@  discard block
 block discarded – undo
3189 3189
             foreach ($rs as $row) {
3190 3190
                 $userSids[] = $row['sid'];
3191 3191
             }
3192
-            $userSids = "'" . implode("','", $userSids) . "'";
3192
+            $userSids = "'".implode("','", $userSids)."'";
3193 3193
             $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3194 3194
         } else {
3195 3195
             $this->db->delete($this->getFullTableName('active_user_locks'));
@@ -3386,8 +3386,8 @@  discard block
 block discarded – undo
3386 3386
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3387 3387
             if ($this->config['send_errormail'] <= $type) {
3388 3388
                 $this->sendmail(array(
3389
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3390
-                    'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3389
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3390
+                    'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3391 3391
                     'type' => 'text'
3392 3392
                 ));
3393 3393
             }
@@ -3435,7 +3435,7 @@  discard block
 block discarded – undo
3435 3435
             $p['fromname'] = $userinfo['username'];
3436 3436
         }
3437 3437
         if ($msg === '' && !isset($p['body'])) {
3438
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3438
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3439 3439
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3440 3440
             $p['body'] = $msg;
3441 3441
         }
@@ -3475,8 +3475,8 @@  discard block
 block discarded – undo
3475 3475
             $files = array();
3476 3476
         }
3477 3477
         foreach ($files as $f) {
3478
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3479
-                $this->mail->AddAttachment(MODX_BASE_PATH . $f);
3478
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3479
+                $this->mail->AddAttachment(MODX_BASE_PATH.$f);
3480 3480
             }
3481 3481
         }
3482 3482
         $rs = $this->mail->send();
@@ -3521,7 +3521,7 @@  discard block
 block discarded – undo
3521 3521
      */
3522 3522
     function isFrontend()
3523 3523
     {
3524
-        return ! $this->isBackend();
3524
+        return !$this->isBackend();
3525 3525
     }
3526 3526
 
3527 3527
     /**
@@ -3546,14 +3546,14 @@  discard block
 block discarded – undo
3546 3546
         $tblsc = $this->getFullTableName("site_content");
3547 3547
         $tbldg = $this->getFullTableName("document_groups");
3548 3548
         // modify field names to use sc. table reference
3549
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3550
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3549
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3550
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3551 3551
         // get document groups for current user
3552 3552
         if ($docgrp = $this->getUserDocGroups()) {
3553 3553
             $docgrp = implode(",", $docgrp);
3554 3554
         }
3555 3555
         // build query
3556
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3556
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3557 3557
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3558 3558
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3559 3559
         $resourceArray = $this->db->makeArray($result);
@@ -3583,14 +3583,14 @@  discard block
 block discarded – undo
3583 3583
         $tbldg = $this->getFullTableName("document_groups");
3584 3584
 
3585 3585
         // modify field names to use sc. table reference
3586
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3587
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3586
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3587
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3588 3588
         // get document groups for current user
3589 3589
         if ($docgrp = $this->getUserDocGroups()) {
3590 3590
             $docgrp = implode(",", $docgrp);
3591 3591
         }
3592 3592
         // build query
3593
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3593
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3594 3594
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3595 3595
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3596 3596
         $resourceArray = $this->db->makeArray($result);
@@ -3625,16 +3625,16 @@  discard block
 block discarded – undo
3625 3625
             return $this->tmpCache[__FUNCTION__][$cacheKey];
3626 3626
         }
3627 3627
 
3628
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
3629
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
3628
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
3629
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
3630 3630
 
3631 3631
         if ($where != '') {
3632
-            $where = 'AND ' . $where;
3632
+            $where = 'AND '.$where;
3633 3633
         }
3634 3634
 
3635 3635
         // modify field names to use sc. table reference
3636
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3637
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3636
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3637
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3638 3638
 
3639 3639
         // get document groups for current user
3640 3640
         if ($docgrp = $this->getUserDocGroups()) {
@@ -3642,7 +3642,7 @@  discard block
 block discarded – undo
3642 3642
         }
3643 3643
 
3644 3644
         // build query
3645
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3645
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3646 3646
 
3647 3647
         $tblsc = $this->getFullTableName('site_content');
3648 3648
         $tbldg = $this->getFullTableName('document_groups');
@@ -3694,10 +3694,10 @@  discard block
 block discarded – undo
3694 3694
             return false;
3695 3695
         } else {
3696 3696
             // modify field names to use sc. table reference
3697
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3698
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3697
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3698
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3699 3699
             if ($where != '') {
3700
-                $where = 'AND ' . $where;
3700
+                $where = 'AND '.$where;
3701 3701
             }
3702 3702
 
3703 3703
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -3708,13 +3708,13 @@  discard block
 block discarded – undo
3708 3708
                 $docgrp = implode(',', $docgrp);
3709 3709
             }
3710 3710
 
3711
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3711
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3712 3712
 
3713 3713
             $tblsc = $this->getFullTableName('site_content');
3714 3714
             $tbldg = $this->getFullTableName('document_groups');
3715 3715
 
3716 3716
             $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3717
-                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3717
+                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3718 3718
 
3719 3719
             $resourceArray = $this->db->makeArray($result);
3720 3720
 
@@ -3819,12 +3819,12 @@  discard block
 block discarded – undo
3819 3819
             $tbldg = $this->getFullTableName("document_groups");
3820 3820
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
3821 3821
             // modify field names to use sc. table reference
3822
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3822
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3823 3823
             // get document groups for current user
3824 3824
             if ($docgrp = $this->getUserDocGroups()) {
3825 3825
                 $docgrp = implode(",", $docgrp);
3826 3826
             }
3827
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3827
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3828 3828
             $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
3829 3829
             $pageInfo = $this->db->getRow($result);
3830 3830
 
@@ -3871,7 +3871,7 @@  discard block
 block discarded – undo
3871 3871
     {
3872 3872
         if ($this->currentSnippet) {
3873 3873
             $tbl = $this->getFullTableName("site_snippets");
3874
-            $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1);
3874
+            $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1);
3875 3875
             if ($snippetId = $this->db->getValue($rs)) {
3876 3876
                 return $snippetId;
3877 3877
             }
@@ -3898,23 +3898,23 @@  discard block
 block discarded – undo
3898 3898
      */
3899 3899
     function clearCache($type = '', $report = false)
3900 3900
     {
3901
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
3901
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
3902 3902
         if (is_array($type)) {
3903 3903
             foreach ($type as $_) {
3904 3904
                 $this->clearCache($_, $report);
3905 3905
             }
3906 3906
         } elseif ($type == 'full') {
3907
-            include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
3907
+            include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
3908 3908
             $sync = new synccache();
3909 3909
             $sync->setCachepath($cache_dir);
3910 3910
             $sync->setReport($report);
3911 3911
             $sync->emptyCache();
3912 3912
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
3913 3913
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
3914
-            $file_name = "docid_" . $key . "_*.pageCache.php";
3915
-            $cache_path = $cache_dir . $file_name;
3914
+            $file_name = "docid_".$key."_*.pageCache.php";
3915
+            $cache_path = $cache_dir.$file_name;
3916 3916
             $files = glob($cache_path);
3917
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
3917
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
3918 3918
             foreach ($files as $file) {
3919 3919
                 if (!is_file($file)) {
3920 3920
                     continue;
@@ -3922,7 +3922,7 @@  discard block
 block discarded – undo
3922 3922
                 unlink($file);
3923 3923
             }
3924 3924
         } else {
3925
-            $files = glob($cache_dir . '*');
3925
+            $files = glob($cache_dir.'*');
3926 3926
             foreach ($files as $file) {
3927 3927
                 $name = basename($file);
3928 3928
                 if (strpos($name, '.pageCache.php') === false) {
@@ -3991,7 +3991,7 @@  discard block
 block discarded – undo
3991 3991
                         $f_url_suffix = '/';
3992 3992
                     }
3993 3993
 
3994
-                    $alPath = !empty ($al['path']) ? $al['path'] . '/' : '';
3994
+                    $alPath = !empty ($al['path']) ? $al['path'].'/' : '';
3995 3995
 
3996 3996
                     if ($al && $al['alias']) {
3997 3997
                         $alias = $al['alias'];
@@ -3999,7 +3999,7 @@  discard block
 block discarded – undo
3999 3999
 
4000 4000
                 }
4001 4001
 
4002
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4002
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4003 4003
                 $url = "{$alias}{$args}";
4004 4004
             } else {
4005 4005
                 $url = "index.php?id={$id}{$args}";
@@ -4018,7 +4018,7 @@  discard block
 block discarded – undo
4018 4018
             }
4019 4019
 
4020 4020
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4021
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4021
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4022 4022
         }
4023 4023
 
4024 4024
         //fix strictUrl by Bumkaka
@@ -4027,9 +4027,9 @@  discard block
 block discarded – undo
4027 4027
         }
4028 4028
 
4029 4029
         if ($this->config['xhtml_urls']) {
4030
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4030
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4031 4031
         } else {
4032
-            $url = $host . $virtualDir . $url;
4032
+            $url = $host.$virtualDir.$url;
4033 4033
         }
4034 4034
 
4035 4035
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4053,21 +4053,21 @@  discard block
 block discarded – undo
4053 4053
         if (isset($this->aliasListing[$id])) {
4054 4054
             $out = $this->aliasListing[$id];
4055 4055
         } else {
4056
-            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4056
+            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id);
4057 4057
             if ($this->db->getRecordCount($q) == '1') {
4058 4058
                 $q = $this->db->getRow($q);
4059 4059
                 $this->aliasListing[$id] = array(
4060
-                    'id' => (int)$q['id'],
4060
+                    'id' => (int) $q['id'],
4061 4061
                     'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],
4062
-                    'parent' => (int)$q['parent'],
4063
-                    'isfolder' => (int)$q['isfolder'],
4062
+                    'parent' => (int) $q['parent'],
4063
+                    'isfolder' => (int) $q['isfolder'],
4064 4064
                 );
4065 4065
                 if ($this->aliasListing[$id]['parent'] > 0) {
4066 4066
                     //fix alias_path_usage
4067 4067
                     if ($this->config['use_alias_path'] == '1') {
4068 4068
                         //&& $tmp['path'] != '' - fix error slash with epty path
4069 4069
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4070
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4070
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4071 4071
                     } else {
4072 4072
                         $this->aliasListing[$id]['path'] = '';
4073 4073
                     }
@@ -4108,7 +4108,7 @@  discard block
 block discarded – undo
4108 4108
         $out = array();
4109 4109
         if (empty($this->version) || !is_array($this->version)) {
4110 4110
             //include for compatibility modx version < 1.0.10
4111
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4111
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4112 4112
             $this->version = array();
4113 4113
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4114 4114
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4130,18 +4130,18 @@  discard block
 block discarded – undo
4130 4130
     {
4131 4131
         if (isset ($this->snippetCache[$snippetName])) {
4132 4132
             $snippet = $this->snippetCache[$snippetName];
4133
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4133
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4134 4134
         } else { // not in cache so let's check the db
4135
-            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "'  AND ss.disabled=0;";
4135
+            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."'  AND ss.disabled=0;";
4136 4136
             $result = $this->db->query($sql);
4137 4137
             if ($this->db->getRecordCount($result) == 1) {
4138 4138
                 $row = $this->db->getRow($result);
4139 4139
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4140 4140
                 $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));
4141
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4141
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4142 4142
             } else {
4143 4143
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4144
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4144
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4145 4145
             }
4146 4146
         }
4147 4147
         // load default params/properties
@@ -4244,8 +4244,8 @@  discard block
 block discarded – undo
4244 4244
             }
4245 4245
             if (strpos($tpl, $s) !== false) {
4246 4246
                 $tpl = str_replace($s, $value, $tpl);
4247
-            } elseif($this->debug) {
4248
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4247
+            } elseif ($this->debug) {
4248
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4249 4249
             }
4250 4250
         }
4251 4251
 
@@ -4294,7 +4294,7 @@  discard block
 block discarded – undo
4294 4294
             case 'CODE':
4295 4295
                 break;
4296 4296
             case 'FILE':
4297
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4297
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4298 4298
                 break;
4299 4299
             case 'CHUNK':
4300 4300
                 $template = $this->getChunk($template);
@@ -4347,7 +4347,7 @@  discard block
 block discarded – undo
4347 4347
         }
4348 4348
 
4349 4349
         if (empty($mode)) {
4350
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4350
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4351 4351
         } elseif ($mode == 'dateOnly') {
4352 4352
             $strTime = strftime($dateFormat, $timestamp);
4353 4353
         } elseif ($mode == 'formatOnly') {
@@ -4443,7 +4443,7 @@  discard block
 block discarded – undo
4443 4443
                     if ($v === 'value') {
4444 4444
                         unset($_[$i]);
4445 4445
                     } else {
4446
-                        $_[$i] = 'tv.' . $v;
4446
+                        $_[$i] = 'tv.'.$v;
4447 4447
                     }
4448 4448
                 }
4449 4449
                 $fields = join(',', $_);
@@ -4452,12 +4452,12 @@  discard block
 block discarded – undo
4452 4452
             }
4453 4453
 
4454 4454
             if ($tvsort != '') {
4455
-                $tvsort = 'tv.' . join(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4455
+                $tvsort = 'tv.'.join(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4456 4456
             }
4457 4457
             if ($tvidnames == "*") {
4458 4458
                 $query = "tv.id<>0";
4459 4459
             } else {
4460
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . join("','", $tvidnames) . "')";
4460
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".join("','", $tvidnames)."')";
4461 4461
             }
4462 4462
 
4463 4463
             $this->getUserDocGroups();
@@ -4601,7 +4601,7 @@  discard block
 block discarded – undo
4601 4601
             return $this->tmpCache[__FUNCTION__][$cacheKey];
4602 4602
         }
4603 4603
 
4604
-        if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) {
4604
+        if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) {
4605 4605
             return false;
4606 4606
         } else {
4607 4607
 
@@ -4619,23 +4619,23 @@  discard block
 block discarded – undo
4619 4619
             }
4620 4620
 
4621 4621
             // get user defined template variables
4622
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4623
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4622
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4623
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4624 4624
 
4625 4625
             if ($idnames == '*') {
4626 4626
                 $query = 'tv.id<>0';
4627 4627
             } else {
4628
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
4628
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
4629 4629
             }
4630 4630
 
4631
-            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv
4632
-                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
4633
-                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4631
+            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv
4632
+                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
4633
+                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4634 4634
 
4635 4635
             $result = $this->db->makeArray($rs);
4636 4636
 
4637 4637
             // get default/built-in template variables
4638
-            if(is_array($docRow)){
4638
+            if (is_array($docRow)) {
4639 4639
                 ksort($docRow);
4640 4640
 
4641 4641
                 foreach ($docRow as $key => $value) {
@@ -4673,7 +4673,7 @@  discard block
 block discarded – undo
4673 4673
      */
4674 4674
     function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '')
4675 4675
     {
4676
-        if (is_array($idnames) && empty($idnames) ) {
4676
+        if (is_array($idnames) && empty($idnames)) {
4677 4677
             return false;
4678 4678
         } else {
4679 4679
             $output = array();
@@ -4686,9 +4686,9 @@  discard block
 block discarded – undo
4686 4686
             if ($result == false) {
4687 4687
                 return false;
4688 4688
             } else {
4689
-                $baspath = MODX_MANAGER_PATH . 'includes';
4690
-                include_once $baspath . '/tmplvars.format.inc.php';
4691
-                include_once $baspath . '/tmplvars.commands.inc.php';
4689
+                $baspath = MODX_MANAGER_PATH.'includes';
4690
+                include_once $baspath.'/tmplvars.format.inc.php';
4691
+                include_once $baspath.'/tmplvars.commands.inc.php';
4692 4692
 
4693 4693
                 for ($i = 0; $i < count($result); $i++) {
4694 4694
                     $row = $result[$i];
@@ -4713,7 +4713,7 @@  discard block
 block discarded – undo
4713 4713
      */
4714 4714
     function getFullTableName($tbl)
4715 4715
     {
4716
-        return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`";
4716
+        return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`";
4717 4717
     }
4718 4718
 
4719 4719
     /**
@@ -4792,7 +4792,7 @@  discard block
 block discarded – undo
4792 4792
     function getCachePath()
4793 4793
     {
4794 4794
         global $base_url;
4795
-        $pth = $base_url . $this->getCacheFolder();
4795
+        $pth = $base_url.$this->getCacheFolder();
4796 4796
         return $pth;
4797 4797
     }
4798 4798
 
@@ -4844,8 +4844,8 @@  discard block
 block discarded – undo
4844 4844
         $out = false;
4845 4845
 
4846 4846
         if (!empty($context)) {
4847
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4848
-                $out = $_SESSION[$context . 'InternalKey'];
4847
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4848
+                $out = $_SESSION[$context.'InternalKey'];
4849 4849
             }
4850 4850
         } else {
4851 4851
             switch (true) {
@@ -4873,8 +4873,8 @@  discard block
 block discarded – undo
4873 4873
         $out = false;
4874 4874
 
4875 4875
         if (!empty($context)) {
4876
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4877
-                $out = $_SESSION[$context . 'Shortname'];
4876
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4877
+                $out = $_SESSION[$context.'Shortname'];
4878 4878
             }
4879 4879
         } else {
4880 4880
             switch (true) {
@@ -4945,8 +4945,8 @@  discard block
 block discarded – undo
4945 4945
      */
4946 4946
     function getWebUserInfo($uid)
4947 4947
     {
4948
-        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu
4949
-                INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
4948
+        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu
4949
+                INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
4950 4950
         if ($row = $this->db->getRow($rs)) {
4951 4951
             if (!isset($row['usertype']) or !$row["usertype"]) {
4952 4952
                 $row["usertype"] = "web";
@@ -4982,7 +4982,7 @@  discard block
 block discarded – undo
4982 4982
         } else if (is_array($dg)) {
4983 4983
             // resolve ids to names
4984 4984
             $dgn = array();
4985
-            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")");
4985
+            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")");
4986 4986
             while ($row = $this->db->getRow($ds)) {
4987 4987
                 $dgn[] = $row['name'];
4988 4988
             }
@@ -5010,7 +5010,7 @@  discard block
 block discarded – undo
5010 5010
         $rt = false;
5011 5011
         if ($_SESSION["webValidated"] == 1) {
5012 5012
             $tbl = $this->getFullTableName("web_users");
5013
-            $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5013
+            $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5014 5014
             if ($row = $this->db->getRow($ds)) {
5015 5015
                 if ($row["password"] == md5($oldPwd)) {
5016 5016
                     if (strlen($newPwd) < 6) {
@@ -5020,7 +5020,7 @@  discard block
 block discarded – undo
5020 5020
                     } else {
5021 5021
                         $this->db->update(array(
5022 5022
                             'password' => $this->db->escape($newPwd),
5023
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5023
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5024 5024
                         // invoke OnWebChangePassword event
5025 5025
                         $this->invokeEvent("OnWebChangePassword", array(
5026 5026
                             "userid" => $row["id"],
@@ -5051,8 +5051,8 @@  discard block
 block discarded – undo
5051 5051
         // check cache
5052 5052
         $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5053 5053
         if (!is_array($grpNames)) {
5054
-            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn
5055
-                    INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5054
+            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn
5055
+                    INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5056 5056
             $grpNames = $this->db->getColumn("name", $rs);
5057 5057
             // save to cache
5058 5058
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5085,7 +5085,7 @@  discard block
 block discarded – undo
5085 5085
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5086 5086
             $this->sjscripts[$nextpos] = $src;
5087 5087
         } else {
5088
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5088
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5089 5089
         }
5090 5090
     }
5091 5091
 
@@ -5164,7 +5164,7 @@  discard block
 block discarded – undo
5164 5164
         }
5165 5165
 
5166 5166
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5167
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5167
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5168 5168
         }
5169 5169
         if ($startup) {
5170 5170
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5310,7 +5310,7 @@  discard block
 block discarded – undo
5310 5310
                 $eventtime = $this->getMicroTime() - $eventtime;
5311 5311
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000);
5312 5312
                 foreach ($parameter as $k => $v) {
5313
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5313
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5314 5314
                 }
5315 5315
                 $this->pluginsCode .= '</fieldset><br />';
5316 5316
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5338,13 +5338,13 @@  discard block
 block discarded – undo
5338 5338
         $plugin = array();
5339 5339
         if (isset ($this->pluginCache[$pluginName])) {
5340 5340
             $pluginCode = $this->pluginCache[$pluginName];
5341
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5341
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5342 5342
         } else {
5343 5343
             $pluginName = $this->db->escape($pluginName);
5344 5344
             $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0");
5345 5345
             if ($row = $this->db->getRow($result)) {
5346 5346
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5347
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5347
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5348 5348
             } else {
5349 5349
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5350 5350
                 $pluginProperties = '';
@@ -5451,7 +5451,7 @@  discard block
 block discarded – undo
5451 5451
     function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5452 5452
     {
5453 5453
         $params = array();
5454
-        $fullpath = $element_dir . '/' . $filename;
5454
+        $fullpath = $element_dir.'/'.$filename;
5455 5455
         if (is_readable($fullpath)) {
5456 5456
             $tpl = @fopen($fullpath, "r");
5457 5457
             if ($tpl) {
@@ -5618,8 +5618,8 @@  discard block
 block discarded – undo
5618 5618
         $ph = array('site_url' => MODX_SITE_URL);
5619 5619
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5620 5620
         $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i';
5621
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5622
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5621
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5622
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5623 5623
         foreach ($parsed as $key => $val) {
5624 5624
             if (is_array($val)) {
5625 5625
                 foreach ($val as $key2 => $val2) {
@@ -5628,7 +5628,7 @@  discard block
 block discarded – undo
5628 5628
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
5629 5629
                     }
5630 5630
                     if (preg_match($regexEmail, $val2, $url)) {
5631
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
5631
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
5632 5632
                     }
5633 5633
                     $parsed[$key][$key2] = $val2;
5634 5634
                 }
@@ -5638,7 +5638,7 @@  discard block
 block discarded – undo
5638 5638
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
5639 5639
                 }
5640 5640
                 if (preg_match($regexEmail, $val, $url)) {
5641
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
5641
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
5642 5642
                 }
5643 5643
                 $parsed[$key] = $val;
5644 5644
             }
@@ -5652,32 +5652,32 @@  discard block
 block discarded – undo
5652 5652
         );
5653 5653
 
5654 5654
         $nl = "\n";
5655
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
5656
-        $list .= '<p>' . $nl;
5657
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
5658
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
5659
-        $list .= '</p><br/>' . $nl;
5660
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
5661
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
5662
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
5663
-        $list .= '<br/>' . $nl;
5655
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
5656
+        $list .= '<p>'.$nl;
5657
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
5658
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
5659
+        $list .= '</p><br/>'.$nl;
5660
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
5661
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
5662
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
5663
+        $list .= '<br/>'.$nl;
5664 5664
         $first = true;
5665 5665
         foreach ($arrayParams as $param => $label) {
5666 5666
             if (isset($parsed[$param])) {
5667 5667
                 if ($first) {
5668
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
5669
-                    $list .= '<ul class="docBlockList">' . $nl;
5668
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
5669
+                    $list .= '<ul class="docBlockList">'.$nl;
5670 5670
                     $first = false;
5671 5671
                 }
5672
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
5673
-                $list .= '        <ul>' . $nl;
5672
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
5673
+                $list .= '        <ul>'.$nl;
5674 5674
                 foreach ($parsed[$param] as $val) {
5675
-                    $list .= '            <li>' . $val . '</li>' . $nl;
5675
+                    $list .= '            <li>'.$val.'</li>'.$nl;
5676 5676
                 }
5677
-                $list .= '        </ul></li>' . $nl;
5677
+                $list .= '        </ul></li>'.$nl;
5678 5678
             }
5679 5679
         }
5680
-        $list .= !$first ? '</ul>' . $nl : '';
5680
+        $list .= !$first ? '</ul>'.$nl : '';
5681 5681
 
5682 5682
         return $list;
5683 5683
     }
@@ -5753,7 +5753,7 @@  discard block
 block discarded – undo
5753 5753
      */
5754 5754
     function addSnippet($name, $phpCode)
5755 5755
     {
5756
-        $this->snippetCache['#' . $name] = $phpCode;
5756
+        $this->snippetCache['#'.$name] = $phpCode;
5757 5757
     }
5758 5758
 
5759 5759
     /**
@@ -5762,7 +5762,7 @@  discard block
 block discarded – undo
5762 5762
      */
5763 5763
     function addChunk($name, $text)
5764 5764
     {
5765
-        $this->chunkCache['#' . $name] = $text;
5765
+        $this->chunkCache['#'.$name] = $text;
5766 5766
     }
5767 5767
 
5768 5768
     /**
@@ -5798,7 +5798,7 @@  discard block
 block discarded – undo
5798 5798
         }
5799 5799
 
5800 5800
         if (!$isSafe) {
5801
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
5801
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
5802 5802
             $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50)));
5803 5803
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
5804 5804
             return;
@@ -5812,7 +5812,7 @@  discard block
 block discarded – undo
5812 5812
             return 'array()';
5813 5813
         }
5814 5814
 
5815
-        $output = $echo . $return;
5815
+        $output = $echo.$return;
5816 5816
         modx_sanitize_gpc($output);
5817 5817
         return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous
5818 5818
     }
@@ -5830,8 +5830,8 @@  discard block
 block discarded – undo
5830 5830
 
5831 5831
         $safe = explode(',', $safe_functions);
5832 5832
 
5833
-        $phpcode = rtrim($phpcode, ';') . ';';
5834
-        $tokens = token_get_all('<?php ' . $phpcode);
5833
+        $phpcode = rtrim($phpcode, ';').';';
5834
+        $tokens = token_get_all('<?php '.$phpcode);
5835 5835
         foreach ($tokens as $i => $token) {
5836 5836
             if (!is_array($token)) {
5837 5837
                 continue;
@@ -5867,7 +5867,7 @@  discard block
 block discarded – undo
5867 5867
     function atBindFileContent($str = '')
5868 5868
     {
5869 5869
 
5870
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
5870
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
5871 5871
 
5872 5872
         if (stripos($str, '@FILE') !== 0) {
5873 5873
             return $str;
@@ -5890,7 +5890,7 @@  discard block
 block discarded – undo
5890 5890
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
5891 5891
 
5892 5892
         foreach ($search_path as $path) {
5893
-            $file_path = MODX_BASE_PATH . $path . $str;
5893
+            $file_path = MODX_BASE_PATH.$path.$str;
5894 5894
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
5895 5895
                 return $errorMsg;
5896 5896
             } elseif (is_file($file_path)) {
@@ -5904,7 +5904,7 @@  discard block
 block discarded – undo
5904 5904
             return $errorMsg;
5905 5905
         }
5906 5906
 
5907
-        $content = (string)file_get_contents($file_path);
5907
+        $content = (string) file_get_contents($file_path);
5908 5908
         if ($content === false) {
5909 5909
             return $errorMsg;
5910 5910
         }
@@ -6017,22 +6017,22 @@  discard block
 block discarded – undo
6017 6017
 
6018 6018
         $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6019 6019
         $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6020
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6020
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6021 6021
         $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6022 6022
         $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6023 6023
         $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6024 6024
         if ($is_error) {
6025 6025
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6026 6026
             if ($msg != 'PHP Parse Error') {
6027
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6027
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6028 6028
             }
6029 6029
         } else {
6030 6030
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6031
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6031
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6032 6032
         }
6033 6033
 
6034 6034
         if (!empty ($query)) {
6035
-            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">' . $query . '</span></div>';
6035
+            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">'.$query.'</span></div>';
6036 6036
         }
6037 6037
 
6038 6038
         $errortype = array(
@@ -6055,13 +6055,13 @@  discard block
 block discarded – undo
6055 6055
 
6056 6056
         if (!empty($nr) || !empty($file)) {
6057 6057
             if ($text != '') {
6058
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6058
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6059 6059
             }
6060 6060
             if ($output != '') {
6061
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6061
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6062 6062
             }
6063 6063
             if ($nr !== '') {
6064
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6064
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6065 6065
             }
6066 6066
             if ($file) {
6067 6067
                 $table[] = array('File', $file);
@@ -6081,7 +6081,7 @@  discard block
 block discarded – undo
6081 6081
         }
6082 6082
 
6083 6083
         if (!empty($this->event->activePlugin)) {
6084
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6084
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6085 6085
         }
6086 6086
 
6087 6087
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6091,17 +6091,17 @@  discard block
 block discarded – undo
6091 6091
         $table[] = array('REQUEST_URI', $request_uri);
6092 6092
 
6093 6093
         if ($this->manager->action) {
6094
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6094
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6095 6095
             global $action_list;
6096 6096
             $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : '';
6097 6097
 
6098
-            $table[] = array('Manager action', $this->manager->action . $actionName);
6098
+            $table[] = array('Manager action', $this->manager->action.$actionName);
6099 6099
         }
6100 6100
 
6101 6101
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6102 6102
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6103 6103
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6104
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6104
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6105 6105
         }
6106 6106
         $table[] = array('Referer', $referer);
6107 6107
         $table[] = array('User Agent', $ua);
@@ -6122,7 +6122,7 @@  discard block
 block discarded – undo
6122 6122
 
6123 6123
         $mem = memory_get_peak_usage(true);
6124 6124
         $total_mem = $mem - $this->mstart;
6125
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6125
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6126 6126
 
6127 6127
         $queryTime = $this->queryTime;
6128 6128
         $phpTime = $totalTime - $queryTime;
@@ -6143,18 +6143,18 @@  discard block
 block discarded – undo
6143 6143
         $str .= $this->get_backtrace(debug_backtrace());
6144 6144
         // Log error
6145 6145
         if (!empty($this->currentSnippet)) {
6146
-            $source = 'Snippet - ' . $this->currentSnippet;
6146
+            $source = 'Snippet - '.$this->currentSnippet;
6147 6147
         } elseif (!empty($this->event->activePlugin)) {
6148
-            $source = 'Plugin - ' . $this->event->activePlugin;
6148
+            $source = 'Plugin - '.$this->event->activePlugin;
6149 6149
         } elseif ($source !== '') {
6150
-            $source = 'Parser - ' . $source;
6150
+            $source = 'Parser - '.$source;
6151 6151
         } elseif ($query !== '') {
6152 6152
             $source = 'SQL Query';
6153 6153
         } else {
6154 6154
             $source = 'Parser';
6155 6155
         }
6156 6156
         if ($msg) {
6157
-            $source .= ' / ' . $msg;
6157
+            $source .= ' / '.$msg;
6158 6158
         }
6159 6159
         if (isset($actionName) && !empty($actionName)) {
6160 6160
             $source .= $actionName;
@@ -6186,12 +6186,12 @@  discard block
 block discarded – undo
6186 6186
 
6187 6187
         // Display error
6188 6188
         if (isset($_SESSION['mgrValidated'])) {
6189
-            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' &raquo; ' . $release_date . '</title>
6189
+            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' &raquo; '.$release_date.'</title>
6190 6190
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6191
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6191
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6192 6192
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6193 6193
                  </head><body>
6194
-                 ' . $str . '</body></html>';
6194
+                 ' . $str.'</body></html>';
6195 6195
 
6196 6196
         } else {
6197 6197
             echo 'Error';
@@ -6229,7 +6229,7 @@  discard block
 block discarded – undo
6229 6229
             switch ($val['type']) {
6230 6230
                 case '->':
6231 6231
                 case '::':
6232
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6232
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6233 6233
                     break;
6234 6234
                 default:
6235 6235
                     $functionName = $val['function'];
@@ -6239,7 +6239,7 @@  discard block
 block discarded – undo
6239 6239
             $args = array_pad(array(), $_, '$var');
6240 6240
             $args = implode(", ", $args);
6241 6241
             $modx = &$this;
6242
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6242
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6243 6243
                 $arg = $val['args'][$tmp - 1];
6244 6244
                 switch (true) {
6245 6245
                     case is_null($arg): {
@@ -6251,7 +6251,7 @@  discard block
 block discarded – undo
6251 6251
                         break;
6252 6252
                     }
6253 6253
                     case is_scalar($arg): {
6254
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6254
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6255 6255
                         break;
6256 6256
                     }
6257 6257
                     case is_bool($arg): {
@@ -6259,23 +6259,23 @@  discard block
 block discarded – undo
6259 6259
                         break;
6260 6260
                     }
6261 6261
                     case is_array($arg): {
6262
-                        $out = 'array $var' . $tmp;
6262
+                        $out = 'array $var'.$tmp;
6263 6263
                         break;
6264 6264
                     }
6265 6265
                     case is_object($arg): {
6266
-                        $out = get_class($arg) . ' $var' . $tmp;
6266
+                        $out = get_class($arg).' $var'.$tmp;
6267 6267
                         break;
6268 6268
                     }
6269 6269
                     default: {
6270
-                        $out = '$var' . $tmp;
6270
+                        $out = '$var'.$tmp;
6271 6271
                     }
6272 6272
                 }
6273 6273
                 $tmp++;
6274 6274
                 return $out;
6275 6275
             }, $args);
6276 6276
             $line = array(
6277
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6278
-                $path . " on line " . $val['line']
6277
+                "<strong>".$functionName."</strong>(".$args.")",
6278
+                $path." on line ".$val['line']
6279 6279
             );
6280 6280
             $table[] = array(implode("<br />", $line));
6281 6281
         }
@@ -6316,7 +6316,7 @@  discard block
 block discarded – undo
6316 6316
             $alias = strip_tags($alias); // strip HTML
6317 6317
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6318 6318
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6319
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6319
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6320 6320
             $alias = trim($alias, '-'); // trim excess
6321 6321
             return $alias;
6322 6322
         }
@@ -6332,7 +6332,7 @@  discard block
 block discarded – undo
6332 6332
         $precisions = count($sizes) - 1;
6333 6333
         foreach ($sizes as $unit => $bytes) {
6334 6334
             if ($size >= $bytes) {
6335
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6335
+                return number_format($size / $bytes, $precisions).' '.$unit;
6336 6336
             }
6337 6337
             $precisions--;
6338 6338
         }
@@ -6436,10 +6436,10 @@  discard block
 block discarded – undo
6436 6436
 
6437 6437
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6438 6438
             return false;
6439
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6440
-            $file_path = MODX_BASE_PATH . $str;
6441
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6442
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6439
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6440
+            $file_path = MODX_BASE_PATH.$str;
6441
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6442
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6443 6443
         } else {
6444 6444
             return false;
6445 6445
         }
@@ -6565,7 +6565,7 @@  discard block
 block discarded – undo
6565 6565
             $title = 'no title';
6566 6566
         }
6567 6567
         if (is_array($msg)) {
6568
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6568
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6569 6569
         } elseif ($msg === '') {
6570 6570
             $msg = $_SERVER['REQUEST_URI'];
6571 6571
         }
@@ -6610,7 +6610,7 @@  discard block
 block discarded – undo
6610 6610
         if (is_array($SystemAlertMsgQueque)) {
6611 6611
             $title = '';
6612 6612
             if ($this->name && $this->activePlugin) {
6613
-                $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>";
6613
+                $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>";
6614 6614
             }
6615 6615
             $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>";
6616 6616
         }
Please login to merge, or discard this patch.
Braces   +55 added lines, -26 removed lines patch added patch discarded remove patch
@@ -615,13 +615,15 @@  discard block
 block discarded – undo
615 615
             $this->virtualDir = '';
616 616
         }
617 617
 
618
-        if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
618
+        if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) {
619
+/* we got an ID returned, check to make sure it's not an alias */
619 620
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
620 621
             if ($this->config['use_alias_path'] == 1) {
621 622
                 if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
622 623
                     $this->documentMethod = 'id';
623 624
                     return $q;
624
-                } else { /* not a valid id in terms of virtualDir, treat as alias */
625
+                } else {
626
+/* not a valid id in terms of virtualDir, treat as alias */
625 627
                     $this->documentMethod = 'alias';
626 628
                     return $q;
627 629
                 }
@@ -629,7 +631,8 @@  discard block
 block discarded – undo
629 631
                 $this->documentMethod = 'id';
630 632
                 return $q;
631 633
             }
632
-        } else { /* we didn't get an ID back, so instead we assume it's an alias */
634
+        } else {
635
+/* we didn't get an ID back, so instead we assume it's an alias */
633 636
             if ($this->config['friendly_alias_urls'] != 1) {
634 637
                 $q = $qOrig;
635 638
             }
@@ -659,13 +662,14 @@  discard block
 block discarded – undo
659 662
      * @param $id
660 663
      * @return array|mixed|null|string
661 664
      */
662
-    public function makePageCacheKey($id){
665
+    public function makePageCacheKey($id)
666
+    {
663 667
         $hash = $id;
664 668
         $tmp = null;
665 669
         $params = array();
666
-        if(!empty($this->systemCacheKey)){
670
+        if(!empty($this->systemCacheKey)) {
667 671
             $hash = $this->systemCacheKey;
668
-        }else {
672
+        } else {
669 673
             if (!empty($_GET)) {
670 674
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
671 675
                 $params = $_GET;
@@ -674,7 +678,7 @@  discard block
 block discarded – undo
674 678
             }
675 679
         }
676 680
         $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
677
-        if (is_array($evtOut) && count($evtOut) > 0){
681
+        if (is_array($evtOut) && count($evtOut) > 0) {
678 682
             $tmp = array_pop($evtOut);
679 683
         }
680 684
         return empty($tmp) ? $hash : $tmp;
@@ -1085,10 +1089,18 @@  discard block
 block discarded – undo
1085 1089
             return array();
1086 1090
         }
1087 1091
         $spacer = md5('<<<EVO>>>');
1088
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1089
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1090
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1091
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1092
+        if($left==='{{' && strpos($content,';}}')!==false) {
1093
+            $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1094
+        }
1095
+        if($left==='{{' && strpos($content,'{{}}')!==false) {
1096
+            $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1097
+        }
1098
+        if($left==='[[' && strpos($content,']]]]')!==false) {
1099
+            $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1100
+        }
1101
+        if($left==='[[' && strpos($content,']]]')!==false) {
1102
+            $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1103
+        }
1092 1104
 
1093 1105
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1094 1106
         $pos[']]>'] = strpos($content, ']]>');
@@ -1141,7 +1153,8 @@  discard block
 block discarded – undo
1141 1153
                         }
1142 1154
                     }
1143 1155
 
1144
-                    if (!in_array($fetch, $tags)) {  // Avoid double Matches
1156
+                    if (!in_array($fetch, $tags)) {
1157
+// Avoid double Matches
1145 1158
                         $tags[] = $fetch; // Fetch
1146 1159
                     };
1147 1160
                     $fetch = ''; // and reset
@@ -1159,7 +1172,9 @@  discard block
 block discarded – undo
1159 1172
             }
1160 1173
         }
1161 1174
         foreach($tags as $i=>$tag) {
1162
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1175
+            if(strpos($tag,$spacer)!==false) {
1176
+                $tags[$i] = str_replace($spacer, '', $tag);
1177
+            }
1163 1178
         }
1164 1179
         return $tags;
1165 1180
     }
@@ -1199,7 +1214,10 @@  discard block
 block discarded – undo
1199 1214
         }
1200 1215
 
1201 1216
         foreach ($matches[1] as $i => $key) {
1202
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1217
+            if(strpos($key,'[+')!==false) {
1218
+                continue;
1219
+            }
1220
+            // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1203 1221
             if (substr($key, 0, 1) == '#') {
1204 1222
                 $key = substr($key, 1);
1205 1223
             } // remove # for QuickEdit format
@@ -1921,7 +1939,8 @@  discard block
 block discarded – undo
1921 1939
      * @return mixed|string
1922 1940
      */
1923 1941
     function _getSGVar($value)
1924
-    { // Get super globals
1942
+    {
1943
+// Get super globals
1925 1944
         $key = $value;
1926 1945
         $_ = $this->config['enable_filter'];
1927 1946
         $this->config['enable_filter'] = 1;
@@ -2326,7 +2345,8 @@  discard block
 block discarded – undo
2326 2345
         if ($this->config['friendly_urls'] == 1) {
2327 2346
             $aliases = array();
2328 2347
             if (is_array($this->documentListing)) {
2329
-                foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site!
2348
+                foreach ($this->documentListing as $path => $docid) {
2349
+// This is big Loop on large site!
2330 2350
                     $aliases[$docid] = $path;
2331 2351
                     $isfolder[$docid] = $this->aliasListing[$docid]['isfolder'];
2332 2352
                 }
@@ -2359,7 +2379,7 @@  discard block
 block discarded – undo
2359 2379
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2360 2380
             $pref = $this->config['friendly_url_prefix'];
2361 2381
             $suff = $this->config['friendly_url_suffix'];
2362
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2382
+            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){
2363 2383
                 global $modx;
2364 2384
                 $thealias = $aliases[$m[1]];
2365 2385
                 $thefolder = $isfolder[$m[1]];
@@ -4131,7 +4151,8 @@  discard block
 block discarded – undo
4131 4151
         if (isset ($this->snippetCache[$snippetName])) {
4132 4152
             $snippet = $this->snippetCache[$snippetName];
4133 4153
             $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4134
-        } else { // not in cache so let's check the db
4154
+        } else {
4155
+// not in cache so let's check the db
4135 4156
             $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "'  AND ss.disabled=0;";
4136 4157
             $result = $this->db->query($sql);
4137 4158
             if ($this->db->getRecordCount($result) == 1) {
@@ -4635,7 +4656,7 @@  discard block
 block discarded – undo
4635 4656
             $result = $this->db->makeArray($rs);
4636 4657
 
4637 4658
             // get default/built-in template variables
4638
-            if(is_array($docRow)){
4659
+            if(is_array($docRow)) {
4639 4660
                 ksort($docRow);
4640 4661
 
4641 4662
                 foreach ($docRow as $key => $value) {
@@ -5114,12 +5135,16 @@  discard block
 block discarded – undo
5114 5135
             return '';
5115 5136
         } // nothing to register
5116 5137
         if (!is_array($options)) {
5117
-            if (is_bool($options))  // backward compatibility with old plaintext parameter
5138
+            if (is_bool($options)) {
5139
+                // backward compatibility with old plaintext parameter
5118 5140
             {
5119 5141
                 $options = array('plaintext' => $options);
5120
-            } elseif (is_string($options)) // Also allow script name as 2nd param
5142
+            }
5143
+            } elseif (is_string($options)) {
5144
+                // Also allow script name as 2nd param
5121 5145
             {
5122 5146
                 $options = array('name' => $options);
5147
+            }
5123 5148
             } else {
5124 5149
                 $options = array();
5125 5150
             }
@@ -5131,7 +5156,8 @@  discard block
 block discarded – undo
5131 5156
         unset($overwritepos); // probably unnecessary--just making sure
5132 5157
 
5133 5158
         $useThisVer = true;
5134
-        if (isset($this->loadedjscripts[$key])) { // a matching script was found
5159
+        if (isset($this->loadedjscripts[$key])) {
5160
+// a matching script was found
5135 5161
             // if existing script is a startup script, make sure the candidate is also a startup script
5136 5162
             if ($this->loadedjscripts[$key]['startup']) {
5137 5163
                 $startup = true;
@@ -5151,7 +5177,8 @@  discard block
 block discarded – undo
5151 5177
                     // overwrite the old script (the position may be important for dependent scripts)
5152 5178
                     $overwritepos = $this->loadedjscripts[$key]['pos'];
5153 5179
                 }
5154
-            } else { // Use the original version
5180
+            } else {
5181
+// Use the original version
5155 5182
                 if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) {
5156 5183
                     // need to move the exisiting script to the head
5157 5184
                     $version = $this->loadedjscripts[$key][$version];
@@ -5275,7 +5302,8 @@  discard block
 block discarded – undo
5275 5302
         }
5276 5303
 
5277 5304
         $results = null;
5278
-        foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop
5305
+        foreach ($this->pluginEvent[$evtName] as $pluginName) {
5306
+// start for loop
5279 5307
             if ($this->dumpPlugins) {
5280 5308
                 $eventtime = $this->getMicroTime();
5281 5309
             }
@@ -5823,7 +5851,8 @@  discard block
 block discarded – undo
5823 5851
      * @return bool
5824 5852
      */
5825 5853
     function isSafeCode($phpcode = '', $safe_functions = '')
5826
-    { // return true or false
5854
+    {
5855
+// return true or false
5827 5856
         if ($safe_functions == '') {
5828 5857
             return false;
5829 5858
         }
@@ -6239,7 +6268,7 @@  discard block
 block discarded – undo
6239 6268
             $args = array_pad(array(), $_, '$var');
6240 6269
             $args = implode(", ", $args);
6241 6270
             $modx = &$this;
6242
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6271
+            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){
6243 6272
                 $arg = $val['args'][$tmp - 1];
6244 6273
                 switch (true) {
6245 6274
                     case is_null($arg): {
Please login to merge, or discard this patch.
manager/processors/export_site.processor.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if(!$modx->hasPermission('export_static')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $maxtime = (is_numeric($_POST['maxtime'])) ? $_POST['maxtime'] : 30;
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
 $modx->export->targetDir = $export_dir;
18 18
 
19 19
 if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path'])))
20
-	return $_lang['export_site.static.php6'];
20
+    return $_lang['export_site.static.php6'];
21 21
 elseif($modx->config['rb_base_dir'] === $export_dir . '/')
22
-	return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']);
22
+    return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']);
23 23
 elseif(!is_writable($export_dir))
24
-	return $_lang['export_site_target_unwritable'];
24
+    return $_lang['export_site_target_unwritable'];
25 25
 
26 26
 $modx->export->generate_mode = $_POST['generate_mode'];
27 27
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  ||$includenoncache!==$_POST['includenoncache']
38 38
  ||$repl_before!==$_POST['repl_before']
39 39
  ||$repl_after !==$_POST['repl_after']) {
40
-	$modx->clearCache('full');
40
+    $modx->clearCache('full');
41 41
 }
42 42
 
43 43
 $total = $modx->export->getTotal($_POST['ignore_ids'], $modx->config['export_includenoncache']);
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 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('export_static')) {
5
+if (!$modx->hasPermission('export_static')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -12,15 +12,15 @@  discard block
 block discarded – undo
12 12
 $modx->loadExtension('EXPORT_SITE');
13 13
 
14 14
 
15
-if(is_dir(MODX_BASE_PATH . 'temp'))       $export_dir = MODX_BASE_PATH . 'temp/export';
16
-elseif(is_dir(MODX_BASE_PATH . 'assets')) $export_dir = MODX_BASE_PATH . 'assets/export';
15
+if (is_dir(MODX_BASE_PATH.'temp'))       $export_dir = MODX_BASE_PATH.'temp/export';
16
+elseif (is_dir(MODX_BASE_PATH.'assets')) $export_dir = MODX_BASE_PATH.'assets/export';
17 17
 $modx->export->targetDir = $export_dir;
18 18
 
19
-if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path'])))
19
+if (strpos($modx->config['base_path'], "{$export_dir}/") === 0 && 0 <= strlen(str_replace("{$export_dir}/", '', $modx->config['base_path'])))
20 20
 	return $_lang['export_site.static.php6'];
21
-elseif($modx->config['rb_base_dir'] === $export_dir . '/')
22
-	return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']);
23
-elseif(!is_writable($export_dir))
21
+elseif ($modx->config['rb_base_dir'] === $export_dir.'/')
22
+	return $modx->parsePlaceholder($_lang['export_site.static.php7'], 'rb_base_url='.$modx->config['base_url'].$modx->config['rb_base_url']);
23
+elseif (!is_writable($export_dir))
24 24
 	return $_lang['export_site_target_unwritable'];
25 25
 
26 26
 $modx->export->generate_mode = $_POST['generate_mode'];
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 $repl_after      = $_POST['repl_after'];
34 34
 $includenoncache = $_POST['includenoncache'];
35 35
 
36
-if($ignore_ids!==$_POST['ignore_ids']
37
- ||$includenoncache!==$_POST['includenoncache']
38
- ||$repl_before!==$_POST['repl_before']
39
- ||$repl_after !==$_POST['repl_after']) {
36
+if ($ignore_ids !== $_POST['ignore_ids']
37
+ ||$includenoncache !== $_POST['includenoncache']
38
+ ||$repl_before !== $_POST['repl_before']
39
+ ||$repl_after !== $_POST['repl_after']) {
40 40
 	$modx->clearCache('full');
41 41
 }
42 42
 
@@ -52,5 +52,5 @@  discard block
 block discarded – undo
52 52
 
53 53
 $exportend = $modx->export->get_mtime();
54 54
 $totaltime = ($exportend - $modx->export->exportstart);
55
-$output .= sprintf ('<p>'.$_lang["export_site_time"].'</p>', round($totaltime, 3));
55
+$output .= sprintf('<p>'.$_lang["export_site_time"].'</p>', round($totaltime, 3));
56 56
 return $output;
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,16 +12,20 @@
 block discarded – undo
12 12
 $modx->loadExtension('EXPORT_SITE');
13 13
 
14 14
 
15
-if(is_dir(MODX_BASE_PATH . 'temp'))       $export_dir = MODX_BASE_PATH . 'temp/export';
16
-elseif(is_dir(MODX_BASE_PATH . 'assets')) $export_dir = MODX_BASE_PATH . 'assets/export';
15
+if(is_dir(MODX_BASE_PATH . 'temp')) {
16
+    $export_dir = MODX_BASE_PATH . 'temp/export';
17
+} elseif(is_dir(MODX_BASE_PATH . 'assets')) {
18
+    $export_dir = MODX_BASE_PATH . 'assets/export';
19
+}
17 20
 $modx->export->targetDir = $export_dir;
18 21
 
19
-if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path'])))
22
+if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path']))) {
20 23
 	return $_lang['export_site.static.php6'];
21
-elseif($modx->config['rb_base_dir'] === $export_dir . '/')
24
+} elseif($modx->config['rb_base_dir'] === $export_dir . '/') {
22 25
 	return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']);
23
-elseif(!is_writable($export_dir))
26
+} elseif(!is_writable($export_dir)) {
24 27
 	return $_lang['export_site_target_unwritable'];
28
+}
25 29
 
26 30
 $modx->export->generate_mode = $_POST['generate_mode'];
27 31
 
Please login to merge, or discard this patch.
manager/processors/delete_module.processor.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if(!$modx->hasPermission('delete_module')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? intval($_GET['id']) : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // Set the item name for logger
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 
18 18
 // invoke OnBeforeModFormDelete event
19 19
 $modx->invokeEvent("OnBeforeModFormDelete",
20
-	array(
21
-		"id"	=> $id
22
-	));
20
+    array(
21
+        "id"	=> $id
22
+    ));
23 23
 
24 24
 // delete the module.
25 25
 $modx->db->delete($modx->getFullTableName('site_modules'), "id='{$id}'");
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 // invoke OnModFormDelete event
34 34
 $modx->invokeEvent("OnModFormDelete",
35
-	array(
36
-		"id"	=> $id
37
-	));
35
+    array(
36
+        "id"	=> $id
37
+    ));
38 38
 
39 39
 // empty cache
40 40
 $modx->clearCache('full');
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('delete_module')) {
5
+if (!$modx->hasPermission('delete_module')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? intval($_GET['id']) : 0;
10
-if($id==0) {
9
+$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
@@ -40,5 +40,5 @@  discard block
 block discarded – undo
40 40
 $modx->clearCache('full');
41 41
 
42 42
 // finished emptying cache - redirect
43
-$header="Location: index.php?a=106&r=2";
43
+$header = "Location: index.php?a=106&r=2";
44 44
 header($header);
Please login to merge, or discard this patch.