Completed
Push — develop ( 7e4f1d...c463ba )
by Dmytro
11:42 queued 04:02
created
manager/includes/header.inc.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -20,37 +20,37 @@  discard block
 block discarded – undo
20 20
 $body_class = '';
21 21
 $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness');
22 22
 if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) {
23
-    $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']];
23
+    $body_class .= ' '.$theme_modes[$_COOKIE['MODX_themeMode']];
24 24
 } elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) {
25
-    $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']];
25
+    $body_class .= ' '.$theme_modes[$modx->config['manager_theme_mode']];
26 26
 }
27 27
 
28
-$css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime;
28
+$css = 'media/style/'.$modx->config['manager_theme'].'/style.css?v='.$lastInstallTime;
29 29
 
30 30
 if ($modx->config['manager_theme'] == 'default') {
31
-    if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')
32
-        && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
33
-        require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php';
31
+    if (!file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')
32
+        && is_writable(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css')) {
33
+        require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php';
34 34
         $minifier = new Formatter\CSSMinify();
35
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css');
36
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css');
37
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css');
38
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css');
39
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css');
40
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css');
41
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css');
42
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css');
43
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css');
44
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css');
45
-        $minifier->addFile(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css');
35
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css');
36
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css');
37
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css');
38
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css');
39
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css');
40
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css');
41
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css');
42
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css');
43
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css');
44
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css');
45
+        $minifier->addFile(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css');
46 46
         $css = $minifier->minify();
47 47
         file_put_contents(
48
-            MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css',
48
+            MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css',
49 49
             $css
50 50
         );
51 51
     }
52
-    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
53
-        $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime;
52
+    if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) {
53
+        $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime;
54 54
     }
55 55
 }
56 56
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
66 66
     <link rel="stylesheet" type="text/css" href="<?= $css ?>"/>
67 67
     <script type="text/javascript" src="media/script/tabpane.js"></script>
68
-    <?= sprintf('<script type="text/javascript" src="%s"></script>' . "\n", $modx->config['mgr_jquery_path']) ?>
68
+    <?= sprintf('<script type="text/javascript" src="%s"></script>'."\n", $modx->config['mgr_jquery_path']) ?>
69 69
     <?php if ($modx->config['show_picker'] != "0") { ?>
70 70
         <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/color.switcher.js"
71 71
                 type="text/javascript"></script>
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     <?php } ?>
79 79
 
80 80
     <!-- OnManagerMainFrameHeaderHTMLBlock -->
81
-    <?= $onManagerMainFrameHeaderHTMLBlock . "\n" ?>
81
+    <?= $onManagerMainFrameHeaderHTMLBlock."\n" ?>
82 82
 
83 83
     <script type="text/javascript">
84 84
       if (!evo) {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     <script>
108 108
         <?php
109 109
         if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
110
-            echo 'doRefresh(' . $_REQUEST['r'] . ");\n";
110
+            echo 'doRefresh('.$_REQUEST['r'].");\n";
111 111
         }
112 112
         ?>
113 113
     </script>
Please login to merge, or discard this patch.
Braces   +9 added lines, -9 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 />
4 4
     Please use the EVO Content Manager instead of accessing this file directly.");
5 5
 }
@@ -10,26 +10,26 @@  discard block
 block discarded – undo
10 10
 $modx_textdir = isset($modx_textdir) ? $modx_textdir : null;
11 11
 $onManagerMainFrameHeaderHTMLBlock = is_array($evtOut) ? implode("\n", $evtOut) : '';
12 12
 $textdir = $modx_textdir === 'rtl' ? 'rtl' : 'ltr';
13
-if (!isset($modx->config['mgr_jquery_path'])) {
13
+if (!isset($modx->config['mgr_jquery_path'])) {
14 14
     $modx->config['mgr_jquery_path'] = 'media/script/jquery/jquery.min.js';
15 15
 }
16
-if (!isset($modx->config['mgr_date_picker_path'])) {
16
+if (!isset($modx->config['mgr_date_picker_path'])) {
17 17
     $modx->config['mgr_date_picker_path'] = 'media/script/air-datepicker/datepicker.inc.php';
18 18
 }
19 19
 
20 20
 $body_class = '';
21 21
 $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness');
22
-if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) {
22
+if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) {
23 23
     $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']];
24
-} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) {
24
+} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) {
25 25
     $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']];
26 26
 }
27 27
 
28 28
 $css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime;
29 29
 
30
-if ($modx->config['manager_theme'] == 'default') {
30
+if ($modx->config['manager_theme'] == 'default') {
31 31
     if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')
32
-        && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
32
+        && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
33 33
         require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php';
34 34
         $minifier = new Formatter\CSSMinify();
35 35
         $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css');
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             $css
50 50
         );
51 51
     }
52
-    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
52
+    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
53 53
         $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime;
54 54
     }
55 55
 }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     <script src="media/script/main.js"></script>
107 107
     <script>
108 108
         <?php
109
-        if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
109
+        if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
110 110
             echo 'doRefresh(' . $_REQUEST['r'] . ");\n";
111 111
         }
112 112
         ?>
Please login to merge, or discard this patch.
manager/includes/accesscontrol.inc.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -102,19 +102,19 @@
 block discarded – undo
102 102
     $modx->setPlaceholder('login_form_position_class', 'loginbox-' . $modx->config['login_form_position']);
103 103
     
104 104
     switch ($modx->config['manager_theme_mode']) {
105
-      case '1':
105
+        case '1':
106 106
         $modx->setPlaceholder('manager_theme_style', 'lightness');
107 107
         break;
108
-      case '2':
108
+        case '2':
109 109
         $modx->setPlaceholder('manager_theme_style', 'light');
110 110
         break;
111
-      case '3':
111
+        case '3':
112 112
         $modx->setPlaceholder('manager_theme_style', 'dark');
113 113
         break;
114
-      case '4':
114
+        case '4':
115 115
         $modx->setPlaceholder('manager_theme_style', 'darkness');
116 116
         break;
117
-	}
117
+    }
118 118
 
119 119
     // andrazk 20070416 - notify user of install/update
120 120
     if (isset($_GET['installGoingOn'])) {
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@  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');
21
+if (file_exists(MODX_BASE_PATH.'assets/cache/installProc.inc.php')) {
22
+    include_once(MODX_BASE_PATH.'assets/cache/installProc.inc.php');
23 23
     if (isset($installStartTime)) {
24 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 29
             if ($_SERVER['REQUEST_METHOD'] != 'POST') {
30 30
                 if (isset($_COOKIE[session_name()])) {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
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
         }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
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
     }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     $modx->setPlaceholder('modx_charset', $modx_manager_charset);
71 71
     $modx->setPlaceholder('theme', $manager_theme);
72 72
     $modx->setPlaceholder('favicon',
73
-        (file_exists(MODX_BASE_PATH . 'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/' . $modx->config['manager_theme'] . '/images/favicon.ico'));
73
+        (file_exists(MODX_BASE_PATH.'favicon.ico') ? MODX_SITE_URL . 'favicon.ico' : 'media/style/'.$modx->config['manager_theme'].'/images/favicon.ico'));
74 74
 
75 75
     // invoke OnManagerLoginFormPrerender event
76 76
     $evtOut = $modx->invokeEvent('OnManagerLoginFormPrerender');
@@ -81,25 +81,25 @@  discard block
 block discarded – undo
81 81
     $modx->setPlaceholder('manager_path', MGR_DIR);
82 82
     $modx->setPlaceholder('logo_slogan', $_lang["logo_slogan"]);
83 83
     $modx->setPlaceholder('login_message', $_lang["login_message"]);
84
-    $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/');
84
+    $modx->setPlaceholder('manager_theme_url', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/');
85 85
     $modx->setPlaceholder('year', date('Y'));
86 86
 
87 87
     // set login logo image
88
-    if ( !empty($modx->config['login_logo']) ) {
89
-        $modx->setPlaceholder('login_logo', MODX_SITE_URL . $modx->config['login_logo']);
88
+    if (!empty($modx->config['login_logo'])) {
89
+        $modx->setPlaceholder('login_logo', MODX_SITE_URL.$modx->config['login_logo']);
90 90
     } else {
91
-        $modx->setPlaceholder('login_logo', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/login/default/login-logo.png');
91
+        $modx->setPlaceholder('login_logo', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/login/default/login-logo.png');
92 92
     }
93 93
 
94 94
     // set login background image
95
-    if ( !empty($modx->config['login_bg']) ) {
96
-        $modx->setPlaceholder('login_bg', MODX_SITE_URL . $modx->config['login_bg']);
95
+    if (!empty($modx->config['login_bg'])) {
96
+        $modx->setPlaceholder('login_bg', MODX_SITE_URL.$modx->config['login_bg']);
97 97
     } else {
98
-        $modx->setPlaceholder('login_bg', MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/login/default/login-background.jpg');
98
+        $modx->setPlaceholder('login_bg', MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/login/default/login-background.jpg');
99 99
     }
100 100
   
101 101
     // set form position css class
102
-    $modx->setPlaceholder('login_form_position_class', 'loginbox-' . $modx->config['login_form_position']);
102
+    $modx->setPlaceholder('login_form_position_class', 'loginbox-'.$modx->config['login_form_position']);
103 103
     
104 104
     switch ($modx->config['manager_theme_mode']) {
105 105
       case '1':
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
         switch ($installGoingOn) {
125 125
             case 1 :
126 126
                 $modx->setPlaceholder('login_message',
127
-                    "<p><span class=\"fail\">" . $_lang["login_cancelled_install_in_progress"] . "</p><p>" . $_lang["login_message"] . "</p>");
127
+                    "<p><span class=\"fail\">".$_lang["login_cancelled_install_in_progress"]."</p><p>".$_lang["login_message"]."</p>");
128 128
                 break;
129 129
             case 2 :
130 130
                 $modx->setPlaceholder('login_message',
131
-                    "<p><span class=\"fail\">" . $_lang["login_cancelled_site_was_updated"] . "</p><p>" . $_lang["login_message"] . "</p>");
131
+                    "<p><span class=\"fail\">".$_lang["login_cancelled_site_was_updated"]."</p><p>".$_lang["login_message"]."</p>");
132 132
                 break;
133 133
         }
134 134
     }
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
     if ($modx->config['use_captcha'] == 1) {
137 137
         $modx->setPlaceholder('login_captcha_message', $_lang["login_captcha_message"]);
138 138
         $modx->setPlaceholder('captcha_image',
139
-            '<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>');
139
+            '<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>');
140 140
         $modx->setPlaceholder('captcha_input',
141
-            '<label>' . $_lang["captcha_code"] . '</label> <input type="text" name="captcha_code" tabindex="3" value="" />');
141
+            '<label>'.$_lang["captcha_code"].'</label> <input type="text" name="captcha_code" tabindex="3" value="" />');
142 142
     }
143 143
 
144 144
     // login info
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
     // invoke OnManagerLoginFormRender event
158 158
     $evtOut = $modx->invokeEvent('OnManagerLoginFormRender');
159
-    $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">' . implode('', $evtOut) . '</div>' : '';
159
+    $html = is_array($evtOut) ? '<div id="onManagerLoginFormRender">'.implode('', $evtOut).'</div>' : '';
160 160
     $modx->setPlaceholder('OnManagerLoginFormRender', $html);
161 161
 
162 162
     // load template
@@ -174,29 +174,29 @@  discard block
 block discarded – undo
174 174
             $login_tpl = file_get_contents($target);
175 175
         }
176 176
     } else {
177
-        $theme_path = MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/';
178
-        if (is_file($theme_path . 'style.php')) {
179
-            include($theme_path . 'style.php');
177
+        $theme_path = MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/';
178
+        if (is_file($theme_path.'style.php')) {
179
+            include($theme_path.'style.php');
180 180
         }
181 181
         $chunk = $modx->getChunk($target);
182 182
         if ($chunk !== false && !empty($chunk)) {
183 183
             $login_tpl = $chunk;
184
-        } elseif (is_file(MODX_BASE_PATH . $target)) {
185
-            $target = MODX_BASE_PATH . $target;
184
+        } elseif (is_file(MODX_BASE_PATH.$target)) {
185
+            $target = MODX_BASE_PATH.$target;
186 186
             $login_tpl = file_get_contents($target);
187 187
         } elseif (is_file($target)) {
188 188
             $login_tpl = file_get_contents($target);
189
-        } elseif (is_file($theme_path . 'login.tpl')) {
190
-            $target = $theme_path . 'login.tpl';
189
+        } elseif (is_file($theme_path.'login.tpl')) {
190
+            $target = $theme_path.'login.tpl';
191 191
             $login_tpl = file_get_contents($target);
192
-        } elseif (is_file($theme_path . 'templates/actions/login.tpl')) {
193
-            $target = $theme_path . 'templates/actions/login.tpl';
192
+        } elseif (is_file($theme_path.'templates/actions/login.tpl')) {
193
+            $target = $theme_path.'templates/actions/login.tpl';
194 194
             $login_tpl = file_get_contents($target);
195
-        } elseif (is_file($theme_path . 'html/login.html')) { // ClipperCMS compatible
196
-            $target = $theme_path . 'html/login.html';
195
+        } elseif (is_file($theme_path.'html/login.html')) { // ClipperCMS compatible
196
+            $target = $theme_path.'html/login.html';
197 197
             $login_tpl = file_get_contents($target);
198 198
         } else {
199
-            $target = MODX_MANAGER_PATH . 'media/style/common/login.tpl';
199
+            $target = MODX_MANAGER_PATH.'media/style/common/login.tpl';
200 200
             $login_tpl = file_get_contents($target);
201 201
         }
202 202
     }
@@ -216,17 +216,17 @@  discard block
 block discarded – undo
216 216
     $modx->updateValidatedUserSession();
217 217
 
218 218
     // Update last action in table active_users
219
-    $itemid = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : '';
219
+    $itemid = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : '';
220 220
     $lasthittime = time();
221
-    $action = isset($_REQUEST['a']) ? (int)$_REQUEST['a'] : 1;
221
+    $action = isset($_REQUEST['a']) ? (int) $_REQUEST['a'] : 1;
222 222
 
223 223
     if ($action !== 1) {
224
-        if ((int)$itemid <= 0) {
224
+        if ((int) $itemid <= 0) {
225 225
             $itemid = null;
226 226
         }
227 227
         $sql = sprintf("REPLACE INTO %s (sid, internalKey, username, lasthit, action, id) VALUES ('%s', %d, '%s', %d, '%s', %s)",
228 228
             $modx->getFullTableName('active_users') // Table
229
-            , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string)$action,
229
+            , session_id(), $modx->getLoginUserID(), $_SESSION['mgrShortname'], $lasthittime, (string) $action,
230 230
             $itemid == null ? var_export(null, true) : $itemid);
231 231
         $modx->db->query($sql);
232 232
     }
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab4_manager_settings.inc.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                             }
57 57
                             $themename = $file;
58 58
                             $selectedtext = $themename == $manager_theme ? "selected='selected'" : "";
59
-                            echo "<option value='$themename' $selectedtext>" . ucwords(str_replace("_", " ", $themename)) . "</option>";
59
+                            echo "<option value='$themename' $selectedtext>".ucwords(str_replace("_", " ", $themename))."</option>";
60 60
                         }
61 61
                     }
62 62
                     $dir->close();
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             function BrowseServer() {
125 125
               var w = screen.width * 0.7;
126 126
               var h = screen.height * 0.7;
127
-              OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h);
127
+              OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h);
128 128
             }
129 129
 
130 130
             function SetUrl(url, width, height, alt) {
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             function BrowseServer() {
163 163
               var w = screen.width * 0.7;
164 164
               var h = screen.height * 0.7;
165
-              OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h);
165
+              OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h);
166 166
             }
167 167
 
168 168
             function SetUrl(url, width, height, alt) {
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
       <tr>
181 181
         <th><?php echo $_lang['login_form_position_title'] ?><br><small>[(login_form_position)]</small></th>
182 182
         <td>
183
-            <?php echo wrap_label($_lang['login_form_position_left'],form_radio('login_form_position', 'left'));?><br />
184
-            <?php echo wrap_label($_lang['login_form_position_center'], form_radio('login_form_position', 'center'));?><br />
185
-            <?php echo wrap_label($_lang['login_form_position_right'], form_radio('login_form_position', 'right'));?>
183
+            <?php echo wrap_label($_lang['login_form_position_left'], form_radio('login_form_position', 'left')); ?><br />
184
+            <?php echo wrap_label($_lang['login_form_position_center'], form_radio('login_form_position', 'center')); ?><br />
185
+            <?php echo wrap_label($_lang['login_form_position_right'], form_radio('login_form_position', 'right')); ?>
186 186
         </td>
187 187
       </tr>
188 188
          <tr>
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
       <tr>
195 195
         <th><?php echo $_lang['manager_menu_position_title'] ?><br><small>[(manager_menu_position)]</small></th>
196 196
         <td>
197
-            <?php echo wrap_label($_lang['manager_menu_position_top'],form_radio('manager_menu_position', 'top'));?><br />
198
-            <?php echo wrap_label($_lang['manager_menu_position_left'], form_radio('manager_menu_position', 'left'));?><br />
197
+            <?php echo wrap_label($_lang['manager_menu_position_top'], form_radio('manager_menu_position', 'top')); ?><br />
198
+            <?php echo wrap_label($_lang['manager_menu_position_left'], form_radio('manager_menu_position', 'left')); ?><br />
199 199
         </td>
200 200
       </tr>
201 201
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
             <td>
338 338
                 <select name="group_tvs" size="1" class="form-control">
339 339
                     <?php
340
-                    $tpl = '<option value="[+value+]" [+selected+]>[+title+]</option>' . "\n";
340
+                    $tpl = '<option value="[+value+]" [+selected+]>[+title+]</option>'."\n";
341 341
                     $option = explode(',', $_lang['settings_group_tv_options']);
342 342
                     $output = array();
343 343
                     foreach ($option as $k => $v) {
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
             <td>
411 411
                 <select name="resource_tree_node_name" size="1" class="inputBox">
412 412
                     <?php
413
-                    $tpl = '<option value="[+value+]" [+selected+]>[*[+value+]*]</option>' . "\n";
413
+                    $tpl = '<option value="[+value+]" [+selected+]>[*[+value+]*]</option>'."\n";
414 414
                     $option = array('pagetitle', 'longtitle', 'menutitle', 'alias', 'createdon', 'editedon', 'publishedon');
415 415
                     $output = array();
416 416
                     foreach ($option as $v) {
@@ -496,8 +496,8 @@  discard block
 block discarded – undo
496 496
                     $str = '';
497 497
                     foreach ($datetime_format_list as $value) {
498 498
                         $selectedtext = ($datetime_format == $value) ? ' selected' : '';
499
-                        $str .= '<option value="' . $value . '"' . $selectedtext . '>';
500
-                        $str .= $value . '</option>' . PHP_EOL;
499
+                        $str .= '<option value="'.$value.'"'.$selectedtext.'>';
500
+                        $str .= $value.'</option>'.PHP_EOL;
501 501
                     }
502 502
                     echo $str;
503 503
                     ?>
@@ -607,10 +607,10 @@  discard block
 block discarded – undo
607 607
                 <select name="which_editor" onChange="documentDirty=true;">
608 608
                     <?php
609 609
                     // invoke OnRichTextEditorRegister event
610
-                    echo "<option value='none'" . ($which_editor == 'none' ? " selected='selected'" : "") . ">" . $_lang['none'] . "</option>\n";
610
+                    echo "<option value='none'".($which_editor == 'none' ? " selected='selected'" : "").">".$_lang['none']."</option>\n";
611 611
                     if (is_array($evtOut)) {
612 612
                         foreach ($evtOut as $editor) {
613
-                            echo "<option value='$editor'" . ($which_editor == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
613
+                            echo "<option value='$editor'".($which_editor == $editor ? " selected='selected'" : "").">$editor</option>\n";
614 614
                         }
615 615
                     }
616 616
                     ?>
Please login to merge, or discard this patch.
manager/includes/document.parser.class.inc.php 2 patches
Spacing   +270 added lines, -270 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     function __call($method_name, $arguments)
207 207
     {
208
-        include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php');
208
+        include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php');
209 209
         if (method_exists($this->old, $method_name)) {
210 210
             $error_type = 1;
211 211
         } else {
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
             $info = debug_backtrace();
224 224
             $m[] = $msg;
225 225
             if (!empty($this->currentSnippet)) {
226
-                $m[] = 'Snippet - ' . $this->currentSnippet;
226
+                $m[] = 'Snippet - '.$this->currentSnippet;
227 227
             } elseif (!empty($this->event->activePlugin)) {
228
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
228
+                $m[] = 'Plugin - '.$this->event->activePlugin;
229 229
             }
230 230
             $m[] = $this->decoded_request_uri;
231
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
231
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
232 232
             $msg = implode('<br />', $m);
233 233
             $this->logEvent(0, $error_type, $msg, $title);
234 234
         }
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     {
246 246
         $flag = false;
247 247
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) {
248
-            $flag = (bool)$this->{$connector}->conn;
248
+            $flag = (bool) $this->{$connector}->conn;
249 249
         }
250 250
         return $flag;
251 251
     }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
         }
273 273
         if (!$out && $flag) {
274 274
             $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
275
-            $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
275
+            $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
276 276
             $out = is_file($filename) ? include $filename : false;
277 277
         }
278 278
         if ($out && !in_array($extname, $this->extensions)) {
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     public function getMicroTime()
290 290
     {
291 291
         list ($usec, $sec) = explode(' ', microtime());
292
-        return ((float)$usec + (float)$sec);
292
+        return ((float) $usec + (float) $sec);
293 293
     }
294 294
 
295 295
     /**
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
             // append the redirect count string to the url
314 314
             $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0;
315 315
             if ($currentNumberOfRedirects > 3) {
316
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
316
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
317 317
             } else {
318 318
                 $currentNumberOfRedirects += 1;
319 319
                 if (strpos($url, "?") > 0) {
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
             }
325 325
         }
326 326
         if ($type == 'REDIRECT_REFRESH') {
327
-            $header = 'Refresh: 0;URL=' . $url;
327
+            $header = 'Refresh: 0;URL='.$url;
328 328
         } elseif ($type == 'REDIRECT_META') {
329
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
329
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
330 330
             echo $header;
331 331
             exit;
332 332
         } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) {
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
             global $base_url, $site_url;
335 335
             if (substr($url, 0, strlen($base_url)) == $base_url) {
336 336
                 // append $site_url to make it work with Location:
337
-                $url = $site_url . substr($url, strlen($base_url));
337
+                $url = $site_url.substr($url, strlen($base_url));
338 338
             }
339 339
             if (strpos($url, "\n") === false) {
340
-                $header = 'Location: ' . $url;
340
+                $header = 'Location: '.$url;
341 341
             } else {
342 342
                 $this->messageQuit('No newline allowed in redirect url.');
343 343
             }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
             header($responseCode);
347 347
         }
348 348
 
349
-        if(!empty($header)) {
349
+        if (!empty($header)) {
350 350
             header($header);
351 351
         }
352 352
 
@@ -451,8 +451,8 @@  discard block
 block discarded – undo
451 451
 
452 452
     private function recoverySiteCache()
453 453
     {
454
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
455
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
454
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
455
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
456 456
 
457 457
         if (is_file($site_cache_path)) {
458 458
             include($site_cache_path);
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
             return;
462 462
         }
463 463
 
464
-        include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
464
+        include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
465 465
         $cache = new synccache();
466 466
         $cache->setCachepath($site_cache_dir);
467 467
         $cache->setReport(false);
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
                 $this->invokeEvent("OnBeforeManagerPageInit");
514 514
             }
515 515
 
516
-            if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) {
517
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
516
+            if (isset ($_SESSION[$usrType.'UsrConfigSet'])) {
517
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
518 518
             } else {
519 519
                 if ($usrType == 'web') {
520 520
                     $from = $tbl_web_user_settings;
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
535 535
                 }
536 536
                 if (isset ($usrType)) {
537
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
537
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
538 538
                 } // store user settings in session
539 539
             }
540 540
         }
@@ -679,10 +679,10 @@  discard block
 block discarded – undo
679 679
         $suf = $this->config['friendly_url_suffix'];
680 680
         $pre = preg_quote($pre, '/');
681 681
         $suf = preg_quote($suf, '/');
682
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
682
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
683 683
             $q = $_[1];
684 684
         }
685
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
685
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
686 686
             $q = $_[1];
687 687
         }
688 688
 
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         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 */
705 705
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
706 706
             if ($this->config['use_alias_path'] == 1) {
707
-                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))))) {
707
+                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))))) {
708 708
                     $this->documentMethod = 'id';
709 709
                     return $q;
710 710
                 } else { /* not a valid id in terms of virtualDir, treat as alias */
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
      */
739 739
     public function getHashFile($key)
740 740
     {
741
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
741
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
742 742
     }
743 743
 
744 744
     /**
@@ -749,9 +749,9 @@  discard block
 block discarded – undo
749 749
         $hash = $id;
750 750
         $tmp = null;
751 751
         $params = array();
752
-        if(!empty($this->systemCacheKey)){
752
+        if (!empty($this->systemCacheKey)) {
753 753
             $hash = $this->systemCacheKey;
754
-        }else {
754
+        } else {
755 755
             if (!empty($_GET)) {
756 756
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
757 757
                 $params = $_GET;
@@ -759,8 +759,8 @@  discard block
 block discarded – undo
759 759
                 $hash .= '_'.md5(http_build_query($params));
760 760
             }
761 761
         }
762
-        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
763
-        if (is_array($evtOut) && count($evtOut) > 0){
762
+        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
763
+        if (is_array($evtOut) && count($evtOut) > 0) {
764 764
             $tmp = array_pop($evtOut);
765 765
         }
766 766
         return empty($tmp) ? $hash : $tmp;
@@ -902,12 +902,12 @@  discard block
 block discarded – undo
902 902
         if ($js = $this->getRegisteredClientStartupScripts()) {
903 903
             // change to just before closing </head>
904 904
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
905
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
905
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
906 906
         }
907 907
 
908 908
         // Insert jscripts & html block into template - template must have a </body> tag
909 909
         if ($js = $this->getRegisteredClientScripts()) {
910
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
910
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
911 911
         }
912 912
         // End fix by sirlancelot
913 913
 
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
         // send out content-type and content-disposition headers
919 919
         if (IN_PARSER_MODE == "true") {
920 920
             $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
921
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
921
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
922 922
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
923 923
             //                header('HTTP/1.0 404 Not Found');
924 924
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
                     $name = preg_replace('|-+|', '-', $name);
937 937
                     $name = trim($name, '-');
938 938
                 }
939
-                $header = 'Content-Disposition: attachment; filename=' . $name;
939
+                $header = 'Content-Disposition: attachment; filename='.$name;
940 940
                 header($header);
941 941
             }
942 942
         }
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 
945 945
         $stats = $this->getTimerStats($this->tstart);
946 946
 
947
-        $out =& $this->documentOutput;
947
+        $out = & $this->documentOutput;
948 948
         $out = str_replace("[^q^]", $stats['queries'], $out);
949 949
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
950 950
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -983,17 +983,17 @@  discard block
 block discarded – undo
983 983
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
984 984
                 $tt += $t;
985 985
             }
986
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />";
986
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />";
987 987
             echo $this->snippetsCode;
988 988
         }
989 989
         if ($this->dumpPlugins) {
990 990
             $ps = "";
991 991
             $tt = 0;
992 992
             foreach ($this->pluginsTime as $s => $t) {
993
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
993
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
994 994
                 $tt += $t;
995 995
             }
996
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
996
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />";
997 997
             echo $this->pluginsCode;
998 998
         }
999 999
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
         $srcTags = explode(',', $tags);
1020 1020
         $repTags = array();
1021 1021
         foreach ($srcTags as $tag) {
1022
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1022
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1023 1023
         }
1024 1024
         return array($srcTags, $repTags);
1025 1025
     }
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1042 1042
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1043 1043
         $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0;
1044
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1044
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1045 1045
 
1046 1046
         return $stats;
1047 1047
     }
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
     {
1075 1075
         $cacheRefreshTime = 0;
1076 1076
         $recent_update = 0;
1077
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1077
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1078 1078
         $this->recentUpdate = $recent_update;
1079 1079
 
1080 1080
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
         // now, check for documents that need publishing
1086 1086
         $field = array('published' => 1, 'publishedon' => $timeNow);
1087 1087
         $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0";
1088
-        $result_pub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1088
+        $result_pub = $this->db->select('id', '[+prefix+]site_content', $where);
1089 1089
         $this->db->update($field, '[+prefix+]site_content', $where);
1090 1090
         if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc
1091 1091
             while ($row_pub = $this->db->getRow($result_pub)) {
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
         // now, check for documents that need un-publishing
1099 1099
         $field = array('published' => 0, 'publishedon' => 0);
1100 1100
         $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1";
1101
-        $result_unpub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1101
+        $result_unpub = $this->db->select('id', '[+prefix+]site_content', $where);
1102 1102
         $this->db->update($field, '[+prefix+]site_content', $where);
1103 1103
         if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc
1104 1104
             while ($row_unpub = $this->db->getRow($result_unpub)) {
@@ -1144,8 +1144,8 @@  discard block
 block discarded – undo
1144 1144
                 }
1145 1145
 
1146 1146
                 $docObjSerial = serialize($this->documentObject);
1147
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1148
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1147
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1148
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1149 1149
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1150 1150
             }
1151 1151
         }
@@ -1187,16 +1187,16 @@  discard block
 block discarded – undo
1187 1187
             return array();
1188 1188
         }
1189 1189
         $spacer = md5('<<<EVO>>>');
1190
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1191
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1192
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1193
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1190
+        if ($left === '{{' && strpos($content, ';}}') !== false)  $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content);
1191
+        if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content);
1192
+        if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content);
1193
+        if ($left === '[[' && strpos($content, ']]]') !== false)  $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content);
1194 1194
 
1195 1195
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1196 1196
         $pos[']]>'] = strpos($content, ']]>');
1197 1197
 
1198 1198
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1199
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1199
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1200 1200
         }
1201 1201
 
1202 1202
         $lp = explode($left, $content);
@@ -1260,8 +1260,8 @@  discard block
 block discarded – undo
1260 1260
                 }
1261 1261
             }
1262 1262
         }
1263
-        foreach($tags as $i=>$tag) {
1264
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1263
+        foreach ($tags as $i=>$tag) {
1264
+            if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag);
1265 1265
         }
1266 1266
         return $tags;
1267 1267
     }
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
         }
1302 1302
 
1303 1303
         foreach ($matches[1] as $i => $key) {
1304
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1304
+            if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1305 1305
             if (substr($key, 0, 1) == '#') {
1306 1306
                 $key = substr($key, 1);
1307 1307
             } // remove # for QuickEdit format
@@ -1321,8 +1321,8 @@  discard block
 block discarded – undo
1321 1321
             }
1322 1322
 
1323 1323
             if (is_array($value)) {
1324
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php');
1325
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
1324
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php');
1325
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
1326 1326
                 $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]);
1327 1327
             }
1328 1328
 
@@ -1333,8 +1333,8 @@  discard block
 block discarded – undo
1333 1333
 
1334 1334
             if (strpos($content, $s) !== false) {
1335 1335
                 $content = str_replace($s, $value, $content);
1336
-            } elseif($this->debug) {
1337
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1336
+            } elseif ($this->debug) {
1337
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1338 1338
             }
1339 1339
         }
1340 1340
 
@@ -1501,8 +1501,8 @@  discard block
 block discarded – undo
1501 1501
             $s = &$matches[0][$i];
1502 1502
             if (strpos($content, $s) !== false) {
1503 1503
                 $content = str_replace($s, $value, $content);
1504
-            } elseif($this->debug) {
1505
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1504
+            } elseif ($this->debug) {
1505
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1506 1506
             }
1507 1507
         }
1508 1508
         return $content;
@@ -1555,7 +1555,7 @@  discard block
 block discarded – undo
1555 1555
             }
1556 1556
 
1557 1557
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1558
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1558
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1559 1559
             if ($this->config['enable_at_syntax']) {
1560 1560
                 $value = $this->mergeConditionalTagsContent($value);
1561 1561
             }
@@ -1570,8 +1570,8 @@  discard block
 block discarded – undo
1570 1570
             $s = &$matches[0][$i];
1571 1571
             if (strpos($content, $s) !== false) {
1572 1572
                 $content = str_replace($s, $value, $content);
1573
-            } elseif($this->debug) {
1574
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1573
+            } elseif ($this->debug) {
1574
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1575 1575
             }
1576 1576
         }
1577 1577
         return $content;
@@ -1629,8 +1629,8 @@  discard block
 block discarded – undo
1629 1629
             $s = &$matches[0][$i];
1630 1630
             if (strpos($content, $s) !== false) {
1631 1631
                 $content = str_replace($s, $value, $content);
1632
-            } elseif($this->debug) {
1633
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1632
+            } elseif ($this->debug) {
1633
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1634 1634
             }
1635 1635
         }
1636 1636
         return $content;
@@ -1654,7 +1654,7 @@  discard block
 block discarded – undo
1654 1654
             return $content;
1655 1655
         }
1656 1656
 
1657
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1657
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1658 1658
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content);
1659 1659
 
1660 1660
         $pieces = explode('<@IF:', $content);
@@ -1665,7 +1665,7 @@  discard block
 block discarded – undo
1665 1665
             }
1666 1666
             list($cmd, $text) = explode('>', $split, 2);
1667 1667
             $cmd = str_replace("'", "\'", $cmd);
1668
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1668
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1669 1669
             $content .= $text;
1670 1670
         }
1671 1671
         $pieces = explode('<@ELSEIF:', $content);
@@ -1676,13 +1676,13 @@  discard block
 block discarded – undo
1676 1676
             }
1677 1677
             list($cmd, $text) = explode('>', $split, 2);
1678 1678
             $cmd = str_replace("'", "\'", $cmd);
1679
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1679
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1680 1680
             $content .= $text;
1681 1681
         }
1682 1682
 
1683 1683
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1684 1684
         ob_start();
1685
-        $content = eval('?>' . $content);
1685
+        $content = eval('?>'.$content);
1686 1686
         $content = ob_get_clean();
1687 1687
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content);
1688 1688
 
@@ -1807,7 +1807,7 @@  discard block
 block discarded – undo
1807 1807
         $matches = $this->getTagsFromContent($content, $left, $right);
1808 1808
         if (!empty($matches)) {
1809 1809
             foreach ($matches[0] as $i => $v) {
1810
-                $addBreakMatches[$i] = $v . "\n";
1810
+                $addBreakMatches[$i] = $v."\n";
1811 1811
             }
1812 1812
             $content = str_replace($addBreakMatches, '', $content);
1813 1813
             if (strpos($content, $left) !== false) {
@@ -1840,8 +1840,8 @@  discard block
 block discarded – undo
1840 1840
             $s = &$matches[0][$i];
1841 1841
             if (strpos($content, $s) !== false) {
1842 1842
                 $content = str_replace($s, $v, $content);
1843
-            } elseif($this->debug) {
1844
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1843
+            } elseif ($this->debug) {
1844
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1845 1845
             }
1846 1846
         }
1847 1847
         return $content;
@@ -1905,7 +1905,7 @@  discard block
 block discarded – undo
1905 1905
                 $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;
1906 1906
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg);
1907 1907
                 if ($this->isBackend()) {
1908
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
1908
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
1909 1909
                 }
1910 1910
             }
1911 1911
         } else {
@@ -1951,7 +1951,7 @@  discard block
 block discarded – undo
1951 1951
                 $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;
1952 1952
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo);
1953 1953
                 if ($this->isBackend()) {
1954
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
1954
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
1955 1955
                 }
1956 1956
             }
1957 1957
         }
@@ -1959,7 +1959,7 @@  discard block
 block discarded – undo
1959 1959
         if (is_array($return) || is_object($return)) {
1960 1960
             return $return;
1961 1961
         } else {
1962
-            return $echo . $return;
1962
+            return $echo.$return;
1963 1963
         }
1964 1964
     }
1965 1965
 
@@ -1997,8 +1997,8 @@  discard block
 block discarded – undo
1997 1997
                 }
1998 1998
                 if (strpos($content, $s) !== false) {
1999 1999
                     $content = str_replace($s, $value, $content);
2000
-                } elseif($this->debug) {
2001
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2000
+                } elseif ($this->debug) {
2001
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
2002 2002
                 }
2003 2003
                 continue;
2004 2004
             }
@@ -2009,8 +2009,8 @@  discard block
 block discarded – undo
2009 2009
 
2010 2010
             if (strpos($content, $s) !== false) {
2011 2011
                 $content = str_replace($s, $value, $content);
2012
-            } elseif($this->debug) {
2013
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2012
+            } elseif ($this->debug) {
2013
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
2014 2014
             }
2015 2015
         }
2016 2016
 
@@ -2101,7 +2101,7 @@  discard block
 block discarded – undo
2101 2101
             $eventtime = sprintf('%2.2f ms', $eventtime * 1000);
2102 2102
             $code = str_replace("\t", '  ', $this->htmlspecialchars($value));
2103 2103
             $piece = str_replace("\t", '  ', $this->htmlspecialchars($piece));
2104
-            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2104
+            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2105 2105
             $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);
2106 2106
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
2107 2107
         }
@@ -2345,7 +2345,7 @@  discard block
 block discarded – undo
2345 2345
             $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where);
2346 2346
             $count = $this->db->getRecordCount($rs);
2347 2347
             if (1 < $count) {
2348
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2348
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2349 2349
             }
2350 2350
             if ($count) {
2351 2351
                 $row = $this->db->getRow($rs);
@@ -2371,7 +2371,7 @@  discard block
 block discarded – undo
2371 2371
     public function toAlias($text)
2372 2372
     {
2373 2373
         $suff = $this->config['friendly_url_suffix'];
2374
-        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);
2374
+        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);
2375 2375
     }
2376 2376
 
2377 2377
     /**
@@ -2403,7 +2403,7 @@  discard block
 block discarded – undo
2403 2403
                 $suff = '/';
2404 2404
             }
2405 2405
 
2406
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2406
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2407 2407
         }
2408 2408
 
2409 2409
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2440,7 +2440,7 @@  discard block
 block discarded – undo
2440 2440
                 preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match);
2441 2441
                 $ids = implode(',', array_unique($match['1']));
2442 2442
                 if ($ids) {
2443
-                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2443
+                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2444 2444
                     while ($row = $this->db->getRow($res)) {
2445 2445
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2446 2446
                             $parent = $row['parent'];
@@ -2451,7 +2451,7 @@  discard block
 block discarded – undo
2451 2451
                                 $parent = $this->aliasListing[$parent]['parent'];
2452 2452
                             }
2453 2453
 
2454
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2454
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2455 2455
                         } else {
2456 2456
                             $aliases[$row['id']] = $row['alias'];
2457 2457
                         }
@@ -2463,7 +2463,7 @@  discard block
 block discarded – undo
2463 2463
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2464 2464
             $pref = $this->config['friendly_url_prefix'];
2465 2465
             $suff = $this->config['friendly_url_suffix'];
2466
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2466
+            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2467 2467
                 global $modx;
2468 2468
                 $thealias = $aliases[$m[1]];
2469 2469
                 $thefolder = $isfolder[$m[1]];
@@ -2479,7 +2479,7 @@  discard block
 block discarded – undo
2479 2479
 
2480 2480
         } else {
2481 2481
             $in = '!\[\~([0-9]+)\~\]!is';
2482
-            $out = "index.php?id=" . '\1';
2482
+            $out = "index.php?id=".'\1';
2483 2483
             $documentSource = preg_replace($in, $out, $documentSource);
2484 2484
         }
2485 2485
 
@@ -2500,7 +2500,7 @@  discard block
 block discarded – undo
2500 2500
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2501 2501
         $len_base_url = strlen($this->config['base_url']);
2502 2502
 
2503
-        $url_path = $q;//LANG
2503
+        $url_path = $q; //LANG
2504 2504
 
2505 2505
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2506 2506
             $url_path = substr($url_path, $len_base_url);
@@ -2512,7 +2512,7 @@  discard block
 block discarded – undo
2512 2512
             $strictURL = substr($strictURL, $len_base_url);
2513 2513
         }
2514 2514
         $http_host = $_SERVER['HTTP_HOST'];
2515
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2515
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2516 2516
 
2517 2517
         $site_url = $this->config['site_url'];
2518 2518
         $url_query_string = explode('?', $_SERVER['REQUEST_URI']);
@@ -2530,7 +2530,7 @@  discard block
 block discarded – undo
2530 2530
                 }
2531 2531
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2532 2532
                     if (empty($_POST)) {
2533
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2533
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2534 2534
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2535 2535
                             exit(0);
2536 2536
                         }
@@ -2589,7 +2589,7 @@  discard block
 block discarded – undo
2589 2589
                 $docgrp = implode(",", $docgrp);
2590 2590
             }
2591 2591
             // get document
2592
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2592
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2593 2593
             $rs = $this->db->select('sc.*', "{$tblsc} sc
2594 2594
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2595 2595
             if ($this->db->getRecordCount($rs) < 1) {
@@ -2625,9 +2625,9 @@  discard block
 block discarded – undo
2625 2625
             }
2626 2626
             if ($documentObject['template']) {
2627 2627
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2628
-                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv
2629
-                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2630
-                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2628
+                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv
2629
+                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2630
+                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2631 2631
                 $tmplvars = array();
2632 2632
                 while ($row = $this->db->getRow($rs)) {
2633 2633
                     $tmplvars[$row['name']] = array(
@@ -2673,7 +2673,7 @@  discard block
 block discarded – undo
2673 2673
                 $st = md5($source);
2674 2674
             }
2675 2675
             if ($this->dumpSnippets == 1) {
2676
-                $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>";
2676
+                $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>";
2677 2677
             }
2678 2678
 
2679 2679
             // invoke OnParseDocument event
@@ -2715,7 +2715,7 @@  discard block
 block discarded – undo
2715 2715
      */
2716 2716
     public function executeParser()
2717 2717
     {
2718
-        if(MODX_CLI) {
2718
+        if (MODX_CLI) {
2719 2719
             throw new RuntimeException('Call DocumentParser::executeParser on CLI mode');
2720 2720
         }
2721 2721
 
@@ -2761,7 +2761,7 @@  discard block
 block discarded – undo
2761 2761
 
2762 2762
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
2763 2763
             if ($this->config['use_alias_path'] == 1) {
2764
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
2764
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
2765 2765
                 if (isset($this->documentListing[$alias])) {
2766 2766
                     $this->documentIdentifier = $this->documentListing[$alias];
2767 2767
                 } else {
@@ -2822,7 +2822,7 @@  discard block
 block discarded – undo
2822 2822
                 } else {
2823 2823
                     $docAlias = $this->db->escape($this->documentIdentifier);
2824 2824
                     $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'");
2825
-                    $this->documentIdentifier = (int)$this->db->getValue($rs);
2825
+                    $this->documentIdentifier = (int) $this->db->getValue($rs);
2826 2826
                 }
2827 2827
             }
2828 2828
             $this->documentMethod = 'id';
@@ -2879,7 +2879,7 @@  discard block
 block discarded – undo
2879 2879
                 $_REQUEST[$n] = $_GET[$n] = $v;
2880 2880
             }
2881 2881
         }
2882
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
2882
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
2883 2883
         $this->q = $qp['path'];
2884 2884
         return $qp['path'];
2885 2885
     }
@@ -2973,7 +2973,7 @@  discard block
 block discarded – undo
2973 2973
             $this->sendErrorPage();
2974 2974
         } else {
2975 2975
             // Inculde the necessary files to check document permissions
2976
-            include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
2976
+            include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
2977 2977
             $udperms = new udperms();
2978 2978
             $udperms->user = $this->getLoginUserID();
2979 2979
             $udperms->document = $this->documentIdentifier;
@@ -3027,7 +3027,7 @@  discard block
 block discarded – undo
3027 3027
         while ($id && $height--) {
3028 3028
             $thisid = $id;
3029 3029
             if ($this->config['aliaslistingfolder'] == 1) {
3030
-                $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");
3030
+                $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");
3031 3031
                 if (!$id || $id == '0') {
3032 3032
                     break;
3033 3033
                 }
@@ -3078,15 +3078,15 @@  discard block
 block discarded – undo
3078 3078
 
3079 3079
         if ($this->config['aliaslistingfolder'] == 1) {
3080 3080
 
3081
-            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'");
3081
+            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'");
3082 3082
             $idx = array();
3083 3083
             while ($row = $this->db->getRow($res)) {
3084 3084
                 $pAlias = '';
3085 3085
                 if (isset($this->aliasListing[$row['parent']])) {
3086
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3087
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3086
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3087
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3088 3088
                 };
3089
-                $children[$pAlias . $row['alias']] = $row['id'];
3089
+                $children[$pAlias.$row['alias']] = $row['id'];
3090 3090
                 if ($row['isfolder'] == 1) {
3091 3091
                     $idx[] = $row['id'];
3092 3092
                 }
@@ -3118,7 +3118,7 @@  discard block
 block discarded – undo
3118 3118
                 $depth--;
3119 3119
 
3120 3120
                 foreach ($documentMap_cache[$id] as $childId) {
3121
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3121
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3122 3122
                     if (!strlen($pkey)) {
3123 3123
                         $pkey = "{$childId}";
3124 3124
                     }
@@ -3147,7 +3147,7 @@  discard block
 block discarded – undo
3147 3147
         if (substr(strtolower($url), 0, 11) == "javascript:") {
3148 3148
             $fnc = substr($url, 11);
3149 3149
         } elseif ($url) {
3150
-            $fnc = "window.location.href='" . addslashes($url) . "';";
3150
+            $fnc = "window.location.href='".addslashes($url)."';";
3151 3151
         } else {
3152 3152
             $fnc = "history.back(-1);";
3153 3153
         }
@@ -3156,7 +3156,7 @@  discard block
 block discarded – undo
3156 3156
             <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\">
3157 3157
             <script>
3158 3158
                 function __alertQuit() {
3159
-                    alert('" . addslashes($msg) . "');
3159
+                    alert('".addslashes($msg)."');
3160 3160
                     {$fnc}
3161 3161
                 }
3162 3162
                 window.setTimeout('__alertQuit();',100);
@@ -3178,9 +3178,9 @@  discard block
 block discarded – undo
3178 3178
         $state = 0;
3179 3179
         $pms = $_SESSION['mgrPermissions'];
3180 3180
         if ($pms) {
3181
-            $state = ((bool)$pms[$pm] === true);
3181
+            $state = ((bool) $pms[$pm] === true);
3182 3182
         }
3183
-        return (int)$state;
3183
+        return (int) $state;
3184 3184
     }
3185 3185
 
3186 3186
     /**
@@ -3193,8 +3193,8 @@  discard block
 block discarded – undo
3193 3193
      */
3194 3194
     public function elementIsLocked($type, $id, $includeThisUser = false)
3195 3195
     {
3196
-        $id = (int)$id;
3197
-        $type = (int)$type;
3196
+        $id = (int) $id;
3197
+        $type = (int) $type;
3198 3198
         if (!$type || !$id) {
3199 3199
             return null;
3200 3200
         }
@@ -3244,7 +3244,7 @@  discard block
 block discarded – undo
3244 3244
             return $lockedElements;
3245 3245
         }
3246 3246
 
3247
-        $type = (int)$type;
3247
+        $type = (int) $type;
3248 3248
         if (isset($lockedElements[$type])) {
3249 3249
             return $lockedElements[$type];
3250 3250
         } else {
@@ -3261,7 +3261,7 @@  discard block
 block discarded – undo
3261 3261
             $this->lockedElements = array();
3262 3262
             $this->cleanupExpiredLocks();
3263 3263
 
3264
-            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul
3264
+            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul
3265 3265
                 LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3266 3266
             while ($row = $this->db->getRow($rs)) {
3267 3267
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3284,7 +3284,7 @@  discard block
 block discarded – undo
3284 3284
     public function cleanupExpiredLocks()
3285 3285
     {
3286 3286
         // Clean-up active_user_sessions first
3287
-        $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3287
+        $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3288 3288
         $validSessionTimeLimit = $this->time - $timeout;
3289 3289
         $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3290 3290
 
@@ -3297,7 +3297,7 @@  discard block
 block discarded – undo
3297 3297
             foreach ($rs as $row) {
3298 3298
                 $userSids[] = $row['sid'];
3299 3299
             }
3300
-            $userSids = "'" . implode("','", $userSids) . "'";
3300
+            $userSids = "'".implode("','", $userSids)."'";
3301 3301
             $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3302 3302
         } else {
3303 3303
             $this->db->delete($this->getFullTableName('active_user_locks'));
@@ -3381,8 +3381,8 @@  discard block
 block discarded – undo
3381 3381
     public function lockElement($type, $id)
3382 3382
     {
3383 3383
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3384
-        $type = (int)$type;
3385
-        $id = (int)$id;
3384
+        $type = (int) $type;
3385
+        $id = (int) $id;
3386 3386
         if (!$type || !$id || !$userId) {
3387 3387
             return false;
3388 3388
         }
@@ -3403,8 +3403,8 @@  discard block
 block discarded – undo
3403 3403
     public function unlockElement($type, $id, $includeAllUsers = false)
3404 3404
     {
3405 3405
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3406
-        $type = (int)$type;
3407
-        $id = (int)$id;
3406
+        $type = (int) $type;
3407
+        $id = (int) $id;
3408 3408
         if (!$type || !$id) {
3409 3409
             return false;
3410 3410
         }
@@ -3471,8 +3471,8 @@  discard block
 block discarded – undo
3471 3471
         }
3472 3472
 
3473 3473
         $usertype = $this->isFrontend() ? 1 : 0;
3474
-        $evtid = (int)$evtid;
3475
-        $type = (int)$type;
3474
+        $evtid = (int) $evtid;
3475
+        $type = (int) $type;
3476 3476
 
3477 3477
         // Types: 1 = information, 2 = warning, 3 = error
3478 3478
         if ($type < 1) {
@@ -3494,8 +3494,8 @@  discard block
 block discarded – undo
3494 3494
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3495 3495
             if ($this->config['send_errormail'] <= $type) {
3496 3496
                 $this->sendmail(array(
3497
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3498
-                    'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3497
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3498
+                    'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3499 3499
                     'type' => 'text'
3500 3500
                 ));
3501 3501
             }
@@ -3543,7 +3543,7 @@  discard block
 block discarded – undo
3543 3543
             $p['fromname'] = $userinfo['username'];
3544 3544
         }
3545 3545
         if ($msg === '' && !isset($p['body'])) {
3546
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3546
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3547 3547
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3548 3548
             $p['body'] = $msg;
3549 3549
         }
@@ -3583,8 +3583,8 @@  discard block
 block discarded – undo
3583 3583
             $files = array();
3584 3584
         }
3585 3585
         foreach ($files as $f) {
3586
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3587
-                $this->mail->AddAttachment(MODX_BASE_PATH . $f);
3586
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3587
+                $this->mail->AddAttachment(MODX_BASE_PATH.$f);
3588 3588
             }
3589 3589
         }
3590 3590
         $rs = $this->mail->send();
@@ -3629,7 +3629,7 @@  discard block
 block discarded – undo
3629 3629
      */
3630 3630
     public function isFrontend()
3631 3631
     {
3632
-        return ! $this->isBackend();
3632
+        return !$this->isBackend();
3633 3633
     }
3634 3634
 
3635 3635
     /**
@@ -3654,14 +3654,14 @@  discard block
 block discarded – undo
3654 3654
         $tblsc = $this->getFullTableName("site_content");
3655 3655
         $tbldg = $this->getFullTableName("document_groups");
3656 3656
         // modify field names to use sc. table reference
3657
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3658
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3657
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3658
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3659 3659
         // get document groups for current user
3660 3660
         if ($docgrp = $this->getUserDocGroups()) {
3661 3661
             $docgrp = implode(",", $docgrp);
3662 3662
         }
3663 3663
         // build query
3664
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3664
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3665 3665
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3666 3666
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3667 3667
         $resourceArray = $this->db->makeArray($result);
@@ -3691,14 +3691,14 @@  discard block
 block discarded – undo
3691 3691
         $tbldg = $this->getFullTableName("document_groups");
3692 3692
 
3693 3693
         // modify field names to use sc. table reference
3694
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3695
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3694
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3695
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3696 3696
         // get document groups for current user
3697 3697
         if ($docgrp = $this->getUserDocGroups()) {
3698 3698
             $docgrp = implode(",", $docgrp);
3699 3699
         }
3700 3700
         // build query
3701
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3701
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3702 3702
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3703 3703
                 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}");
3704 3704
         $resourceArray = $this->db->makeArray($result);
@@ -3733,16 +3733,16 @@  discard block
 block discarded – undo
3733 3733
             return $this->tmpCache[__FUNCTION__][$cacheKey];
3734 3734
         }
3735 3735
 
3736
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
3737
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
3736
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
3737
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
3738 3738
 
3739 3739
         if ($where != '') {
3740
-            $where = 'AND ' . $where;
3740
+            $where = 'AND '.$where;
3741 3741
         }
3742 3742
 
3743 3743
         // modify field names to use sc. table reference
3744
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3745
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3744
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3745
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3746 3746
 
3747 3747
         // get document groups for current user
3748 3748
         if ($docgrp = $this->getUserDocGroups()) {
@@ -3750,7 +3750,7 @@  discard block
 block discarded – undo
3750 3750
         }
3751 3751
 
3752 3752
         // build query
3753
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3753
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3754 3754
 
3755 3755
         $tblsc = $this->getFullTableName('site_content');
3756 3756
         $tbldg = $this->getFullTableName('document_groups');
@@ -3802,10 +3802,10 @@  discard block
 block discarded – undo
3802 3802
             return false;
3803 3803
         } else {
3804 3804
             // modify field names to use sc. table reference
3805
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3806
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3805
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3806
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3807 3807
             if ($where != '') {
3808
-                $where = 'AND ' . $where;
3808
+                $where = 'AND '.$where;
3809 3809
             }
3810 3810
 
3811 3811
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -3816,13 +3816,13 @@  discard block
 block discarded – undo
3816 3816
                 $docgrp = implode(',', $docgrp);
3817 3817
             }
3818 3818
 
3819
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3819
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3820 3820
 
3821 3821
             $tblsc = $this->getFullTableName('site_content');
3822 3822
             $tbldg = $this->getFullTableName('document_groups');
3823 3823
 
3824 3824
             $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3825
-                    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);
3825
+                    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);
3826 3826
 
3827 3827
             $resourceArray = $this->db->makeArray($result);
3828 3828
 
@@ -3927,12 +3927,12 @@  discard block
 block discarded – undo
3927 3927
             $tbldg = $this->getFullTableName("document_groups");
3928 3928
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
3929 3929
             // modify field names to use sc. table reference
3930
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3930
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3931 3931
             // get document groups for current user
3932 3932
             if ($docgrp = $this->getUserDocGroups()) {
3933 3933
                 $docgrp = implode(",", $docgrp);
3934 3934
             }
3935
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3935
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3936 3936
             $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
3937 3937
             $pageInfo = $this->db->getRow($result);
3938 3938
 
@@ -3979,7 +3979,7 @@  discard block
 block discarded – undo
3979 3979
     {
3980 3980
         if ($this->currentSnippet) {
3981 3981
             $tbl = $this->getFullTableName("site_snippets");
3982
-            $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1);
3982
+            $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1);
3983 3983
             if ($snippetId = $this->db->getValue($rs)) {
3984 3984
                 return $snippetId;
3985 3985
             }
@@ -4006,23 +4006,23 @@  discard block
 block discarded – undo
4006 4006
      */
4007 4007
     public function clearCache($type = '', $report = false)
4008 4008
     {
4009
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
4009
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
4010 4010
         if (is_array($type)) {
4011 4011
             foreach ($type as $_) {
4012 4012
                 $this->clearCache($_, $report);
4013 4013
             }
4014 4014
         } elseif ($type == 'full') {
4015
-            include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
4015
+            include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
4016 4016
             $sync = new synccache();
4017 4017
             $sync->setCachepath($cache_dir);
4018 4018
             $sync->setReport($report);
4019 4019
             $sync->emptyCache();
4020 4020
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4021 4021
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4022
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4023
-            $cache_path = $cache_dir . $file_name;
4022
+            $file_name = "docid_".$key."_*.pageCache.php";
4023
+            $cache_path = $cache_dir.$file_name;
4024 4024
             $files = glob($cache_path);
4025
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4025
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4026 4026
             foreach ($files as $file) {
4027 4027
                 if (!is_file($file)) {
4028 4028
                     continue;
@@ -4030,7 +4030,7 @@  discard block
 block discarded – undo
4030 4030
                 unlink($file);
4031 4031
             }
4032 4032
         } else {
4033
-            $files = glob($cache_dir . '*');
4033
+            $files = glob($cache_dir.'*');
4034 4034
             foreach ($files as $file) {
4035 4035
                 $name = basename($file);
4036 4036
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4099,7 +4099,7 @@  discard block
 block discarded – undo
4099 4099
                         $f_url_suffix = '/';
4100 4100
                     }
4101 4101
 
4102
-                    $alPath = !empty ($al['path']) ? $al['path'] . '/' : '';
4102
+                    $alPath = !empty ($al['path']) ? $al['path'].'/' : '';
4103 4103
 
4104 4104
                     if ($al && $al['alias']) {
4105 4105
                         $alias = $al['alias'];
@@ -4107,7 +4107,7 @@  discard block
 block discarded – undo
4107 4107
 
4108 4108
                 }
4109 4109
 
4110
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4110
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4111 4111
                 $url = "{$alias}{$args}";
4112 4112
             } else {
4113 4113
                 $url = "index.php?id={$id}{$args}";
@@ -4126,7 +4126,7 @@  discard block
 block discarded – undo
4126 4126
             }
4127 4127
 
4128 4128
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4129
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4129
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4130 4130
         }
4131 4131
 
4132 4132
         //fix strictUrl by Bumkaka
@@ -4135,9 +4135,9 @@  discard block
 block discarded – undo
4135 4135
         }
4136 4136
 
4137 4137
         if ($this->config['xhtml_urls']) {
4138
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4138
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4139 4139
         } else {
4140
-            $url = $host . $virtualDir . $url;
4140
+            $url = $host.$virtualDir.$url;
4141 4141
         }
4142 4142
 
4143 4143
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4161,21 +4161,21 @@  discard block
 block discarded – undo
4161 4161
         if (isset($this->aliasListing[$id])) {
4162 4162
             $out = $this->aliasListing[$id];
4163 4163
         } else {
4164
-            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4164
+            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id);
4165 4165
             if ($this->db->getRecordCount($q) == '1') {
4166 4166
                 $q = $this->db->getRow($q);
4167 4167
                 $this->aliasListing[$id] = array(
4168
-                    'id' => (int)$q['id'],
4168
+                    'id' => (int) $q['id'],
4169 4169
                     'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],
4170
-                    'parent' => (int)$q['parent'],
4171
-                    'isfolder' => (int)$q['isfolder'],
4170
+                    'parent' => (int) $q['parent'],
4171
+                    'isfolder' => (int) $q['isfolder'],
4172 4172
                 );
4173 4173
                 if ($this->aliasListing[$id]['parent'] > 0) {
4174 4174
                     //fix alias_path_usage
4175 4175
                     if ($this->config['use_alias_path'] == '1') {
4176 4176
                         //&& $tmp['path'] != '' - fix error slash with epty path
4177 4177
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4178
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4178
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4179 4179
                     } else {
4180 4180
                         $this->aliasListing[$id]['path'] = '';
4181 4181
                     }
@@ -4216,7 +4216,7 @@  discard block
 block discarded – undo
4216 4216
         $out = array();
4217 4217
         if (empty($this->version) || !is_array($this->version)) {
4218 4218
             //include for compatibility modx version < 1.0.10
4219
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4219
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4220 4220
             $this->version = array();
4221 4221
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4222 4222
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4238,18 +4238,18 @@  discard block
 block discarded – undo
4238 4238
     {
4239 4239
         if (isset ($this->snippetCache[$snippetName])) {
4240 4240
             $snippet = $this->snippetCache[$snippetName];
4241
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4241
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4242 4242
         } else { // not in cache so let's check the db
4243
-            $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;";
4243
+            $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;";
4244 4244
             $result = $this->db->query($sql);
4245 4245
             if ($this->db->getRecordCount($result) == 1) {
4246 4246
                 $row = $this->db->getRow($result);
4247 4247
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4248 4248
                 $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));
4249
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4249
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4250 4250
             } else {
4251 4251
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4252
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4252
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4253 4253
             }
4254 4254
         }
4255 4255
         // load default params/properties
@@ -4349,8 +4349,8 @@  discard block
 block discarded – undo
4349 4349
             }
4350 4350
             if (strpos($tpl, $s) !== false) {
4351 4351
                 $tpl = str_replace($s, $value, $tpl);
4352
-            } elseif($this->debug) {
4353
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4352
+            } elseif ($this->debug) {
4353
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4354 4354
             }
4355 4355
         }
4356 4356
 
@@ -4399,7 +4399,7 @@  discard block
 block discarded – undo
4399 4399
             case 'CODE':
4400 4400
                 break;
4401 4401
             case 'FILE':
4402
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4402
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4403 4403
                 break;
4404 4404
             case 'CHUNK':
4405 4405
                 $template = $this->getChunk($template);
@@ -4432,7 +4432,7 @@  discard block
 block discarded – undo
4432 4432
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4433 4433
             return '-';
4434 4434
         }
4435
-        $timestamp = (int)$timestamp;
4435
+        $timestamp = (int) $timestamp;
4436 4436
 
4437 4437
         switch ($this->config['datetime_format']) {
4438 4438
             case 'YYYY/mm/dd':
@@ -4452,7 +4452,7 @@  discard block
 block discarded – undo
4452 4452
         }
4453 4453
 
4454 4454
         if (empty($mode)) {
4455
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4455
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4456 4456
         } elseif ($mode == 'dateOnly') {
4457 4457
             $strTime = strftime($dateFormat, $timestamp);
4458 4458
         } elseif ($mode == 'formatOnly') {
@@ -4506,7 +4506,7 @@  discard block
 block discarded – undo
4506 4506
             $S = 0;
4507 4507
         }
4508 4508
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4509
-        $timeStamp = (int)$timeStamp;
4509
+        $timeStamp = (int) $timeStamp;
4510 4510
         return $timeStamp;
4511 4511
     }
4512 4512
 
@@ -4548,7 +4548,7 @@  discard block
 block discarded – undo
4548 4548
                     if ($v === 'value') {
4549 4549
                         unset($_[$i]);
4550 4550
                     } else {
4551
-                        $_[$i] = 'tv.' . $v;
4551
+                        $_[$i] = 'tv.'.$v;
4552 4552
                     }
4553 4553
                 }
4554 4554
                 $fields = implode(',', $_);
@@ -4557,12 +4557,12 @@  discard block
 block discarded – undo
4557 4557
             }
4558 4558
 
4559 4559
             if ($tvsort != '') {
4560
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4560
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4561 4561
             }
4562 4562
             if ($tvidnames == "*") {
4563 4563
                 $query = "tv.id<>0";
4564 4564
             } else {
4565
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')";
4565
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')";
4566 4566
             }
4567 4567
 
4568 4568
             $this->getUserDocGroups();
@@ -4706,7 +4706,7 @@  discard block
 block discarded – undo
4706 4706
             return $this->tmpCache[__FUNCTION__][$cacheKey];
4707 4707
         }
4708 4708
 
4709
-        if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) {
4709
+        if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) {
4710 4710
             return false;
4711 4711
         } else {
4712 4712
 
@@ -4724,23 +4724,23 @@  discard block
 block discarded – undo
4724 4724
             }
4725 4725
 
4726 4726
             // get user defined template variables
4727
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4728
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4727
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4728
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4729 4729
 
4730 4730
             if ($idnames == '*') {
4731 4731
                 $query = 'tv.id<>0';
4732 4732
             } else {
4733
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
4733
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
4734 4734
             }
4735 4735
 
4736
-            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv
4737
-                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
4738
-                    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}" : ""));
4736
+            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv
4737
+                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
4738
+                    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}" : ""));
4739 4739
 
4740 4740
             $result = $this->db->makeArray($rs);
4741 4741
 
4742 4742
             // get default/built-in template variables
4743
-            if(is_array($docRow)){
4743
+            if (is_array($docRow)) {
4744 4744
                 ksort($docRow);
4745 4745
 
4746 4746
                 foreach ($docRow as $key => $value) {
@@ -4778,22 +4778,22 @@  discard block
 block discarded – undo
4778 4778
      */
4779 4779
     public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '')
4780 4780
     {
4781
-        if (is_array($idnames) && empty($idnames) ) {
4781
+        if (is_array($idnames) && empty($idnames)) {
4782 4782
             return false;
4783 4783
         } else {
4784 4784
             $output = array();
4785 4785
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
4786 4786
 
4787
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
4787
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
4788 4788
             // remove sort for speed
4789 4789
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
4790 4790
 
4791 4791
             if ($result == false) {
4792 4792
                 return false;
4793 4793
             } else {
4794
-                $baspath = MODX_MANAGER_PATH . 'includes';
4795
-                include_once $baspath . '/tmplvars.format.inc.php';
4796
-                include_once $baspath . '/tmplvars.commands.inc.php';
4794
+                $baspath = MODX_MANAGER_PATH.'includes';
4795
+                include_once $baspath.'/tmplvars.format.inc.php';
4796
+                include_once $baspath.'/tmplvars.commands.inc.php';
4797 4797
 
4798 4798
                 for ($i = 0; $i < count($result); $i++) {
4799 4799
                     $row = $result[$i];
@@ -4818,7 +4818,7 @@  discard block
 block discarded – undo
4818 4818
      */
4819 4819
     public function getFullTableName($tbl)
4820 4820
     {
4821
-        return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`";
4821
+        return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`";
4822 4822
     }
4823 4823
 
4824 4824
     /**
@@ -4897,7 +4897,7 @@  discard block
 block discarded – undo
4897 4897
     public function getCachePath()
4898 4898
     {
4899 4899
         global $base_url;
4900
-        $pth = $base_url . $this->getCacheFolder();
4900
+        $pth = $base_url.$this->getCacheFolder();
4901 4901
         return $pth;
4902 4902
     }
4903 4903
 
@@ -4949,8 +4949,8 @@  discard block
 block discarded – undo
4949 4949
         $out = false;
4950 4950
 
4951 4951
         if (!empty($context)) {
4952
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4953
-                $out = $_SESSION[$context . 'InternalKey'];
4952
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4953
+                $out = $_SESSION[$context.'InternalKey'];
4954 4954
             }
4955 4955
         } else {
4956 4956
             switch (true) {
@@ -4978,8 +4978,8 @@  discard block
 block discarded – undo
4978 4978
         $out = false;
4979 4979
 
4980 4980
         if (!empty($context)) {
4981
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4982
-                $out = $_SESSION[$context . 'Shortname'];
4981
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4982
+                $out = $_SESSION[$context.'Shortname'];
4983 4983
             }
4984 4984
         } else {
4985 4985
             switch (true) {
@@ -5050,8 +5050,8 @@  discard block
 block discarded – undo
5050 5050
      */
5051 5051
     public function getWebUserInfo($uid)
5052 5052
     {
5053
-        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu
5054
-                INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5053
+        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu
5054
+                INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5055 5055
         if ($row = $this->db->getRow($rs)) {
5056 5056
             if (!isset($row['usertype']) or !$row["usertype"]) {
5057 5057
                 $row["usertype"] = "web";
@@ -5087,7 +5087,7 @@  discard block
 block discarded – undo
5087 5087
         } else if (is_array($dg)) {
5088 5088
             // resolve ids to names
5089 5089
             $dgn = array();
5090
-            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")");
5090
+            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")");
5091 5091
             while ($row = $this->db->getRow($ds)) {
5092 5092
                 $dgn[] = $row['name'];
5093 5093
             }
@@ -5115,7 +5115,7 @@  discard block
 block discarded – undo
5115 5115
         $rt = false;
5116 5116
         if ($_SESSION["webValidated"] == 1) {
5117 5117
             $tbl = $this->getFullTableName("web_users");
5118
-            $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5118
+            $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5119 5119
             if ($row = $this->db->getRow($ds)) {
5120 5120
                 if ($row["password"] == md5($oldPwd)) {
5121 5121
                     if (strlen($newPwd) < 6) {
@@ -5125,7 +5125,7 @@  discard block
 block discarded – undo
5125 5125
                     } else {
5126 5126
                         $this->db->update(array(
5127 5127
                             'password' => $this->db->escape($newPwd),
5128
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5128
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5129 5129
                         // invoke OnWebChangePassword event
5130 5130
                         $this->invokeEvent("OnWebChangePassword", array(
5131 5131
                             "userid" => $row["id"],
@@ -5156,8 +5156,8 @@  discard block
 block discarded – undo
5156 5156
         // check cache
5157 5157
         $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5158 5158
         if (!is_array($grpNames)) {
5159
-            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn
5160
-                    INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5159
+            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn
5160
+                    INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5161 5161
             $grpNames = $this->db->getColumn("name", $rs);
5162 5162
             // save to cache
5163 5163
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5190,7 +5190,7 @@  discard block
 block discarded – undo
5190 5190
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5191 5191
             $this->sjscripts[$nextpos] = $src;
5192 5192
         } else {
5193
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5193
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5194 5194
         }
5195 5195
     }
5196 5196
 
@@ -5269,7 +5269,7 @@  discard block
 block discarded – undo
5269 5269
         }
5270 5270
 
5271 5271
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5272
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5272
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5273 5273
         }
5274 5274
         if ($startup) {
5275 5275
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5416,7 +5416,7 @@  discard block
 block discarded – undo
5416 5416
                 $eventtime = $this->getMicroTime() - $eventtime;
5417 5417
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000);
5418 5418
                 foreach ($parameter as $k => $v) {
5419
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5419
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5420 5420
                 }
5421 5421
                 $this->pluginsCode .= '</fieldset><br />';
5422 5422
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5444,13 +5444,13 @@  discard block
 block discarded – undo
5444 5444
         $plugin = array();
5445 5445
         if (isset ($this->pluginCache[$pluginName])) {
5446 5446
             $pluginCode = $this->pluginCache[$pluginName];
5447
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5447
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5448 5448
         } else {
5449 5449
             $pluginName = $this->db->escape($pluginName);
5450 5450
             $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0");
5451 5451
             if ($row = $this->db->getRow($result)) {
5452 5452
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5453
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5453
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5454 5454
             } else {
5455 5455
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5456 5456
                 $pluginProperties = '';
@@ -5557,7 +5557,7 @@  discard block
 block discarded – undo
5557 5557
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5558 5558
     {
5559 5559
         $params = array();
5560
-        $fullpath = $element_dir . '/' . $filename;
5560
+        $fullpath = $element_dir.'/'.$filename;
5561 5561
         if (is_readable($fullpath)) {
5562 5562
             $tpl = @fopen($fullpath, "r");
5563 5563
             if ($tpl) {
@@ -5724,8 +5724,8 @@  discard block
 block discarded – undo
5724 5724
         $ph = array('site_url' => MODX_SITE_URL);
5725 5725
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5726 5726
         $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';
5727
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5728
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5727
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5728
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5729 5729
         foreach ($parsed as $key => $val) {
5730 5730
             if (is_array($val)) {
5731 5731
                 foreach ($val as $key2 => $val2) {
@@ -5734,7 +5734,7 @@  discard block
 block discarded – undo
5734 5734
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
5735 5735
                     }
5736 5736
                     if (preg_match($regexEmail, $val2, $url)) {
5737
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
5737
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
5738 5738
                     }
5739 5739
                     $parsed[$key][$key2] = $val2;
5740 5740
                 }
@@ -5744,7 +5744,7 @@  discard block
 block discarded – undo
5744 5744
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
5745 5745
                 }
5746 5746
                 if (preg_match($regexEmail, $val, $url)) {
5747
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
5747
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
5748 5748
                 }
5749 5749
                 $parsed[$key] = $val;
5750 5750
             }
@@ -5758,32 +5758,32 @@  discard block
 block discarded – undo
5758 5758
         );
5759 5759
 
5760 5760
         $nl = "\n";
5761
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
5762
-        $list .= '<p>' . $nl;
5763
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
5764
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
5765
-        $list .= '</p><br/>' . $nl;
5766
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
5767
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
5768
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
5769
-        $list .= '<br/>' . $nl;
5761
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
5762
+        $list .= '<p>'.$nl;
5763
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
5764
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
5765
+        $list .= '</p><br/>'.$nl;
5766
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
5767
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
5768
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
5769
+        $list .= '<br/>'.$nl;
5770 5770
         $first = true;
5771 5771
         foreach ($arrayParams as $param => $label) {
5772 5772
             if (isset($parsed[$param])) {
5773 5773
                 if ($first) {
5774
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
5775
-                    $list .= '<ul class="docBlockList">' . $nl;
5774
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
5775
+                    $list .= '<ul class="docBlockList">'.$nl;
5776 5776
                     $first = false;
5777 5777
                 }
5778
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
5779
-                $list .= '        <ul>' . $nl;
5778
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
5779
+                $list .= '        <ul>'.$nl;
5780 5780
                 foreach ($parsed[$param] as $val) {
5781
-                    $list .= '            <li>' . $val . '</li>' . $nl;
5781
+                    $list .= '            <li>'.$val.'</li>'.$nl;
5782 5782
                 }
5783
-                $list .= '        </ul></li>' . $nl;
5783
+                $list .= '        </ul></li>'.$nl;
5784 5784
             }
5785 5785
         }
5786
-        $list .= !$first ? '</ul>' . $nl : '';
5786
+        $list .= !$first ? '</ul>'.$nl : '';
5787 5787
 
5788 5788
         return $list;
5789 5789
     }
@@ -5859,7 +5859,7 @@  discard block
 block discarded – undo
5859 5859
      */
5860 5860
     public function addSnippet($name, $phpCode)
5861 5861
     {
5862
-        $this->snippetCache['#' . $name] = $phpCode;
5862
+        $this->snippetCache['#'.$name] = $phpCode;
5863 5863
     }
5864 5864
 
5865 5865
     /**
@@ -5868,7 +5868,7 @@  discard block
 block discarded – undo
5868 5868
      */
5869 5869
     public function addChunk($name, $text)
5870 5870
     {
5871
-        $this->chunkCache['#' . $name] = $text;
5871
+        $this->chunkCache['#'.$name] = $text;
5872 5872
     }
5873 5873
 
5874 5874
     /**
@@ -5904,7 +5904,7 @@  discard block
 block discarded – undo
5904 5904
         }
5905 5905
 
5906 5906
         if (!$isSafe) {
5907
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
5907
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
5908 5908
             $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50)));
5909 5909
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
5910 5910
             return;
@@ -5918,7 +5918,7 @@  discard block
 block discarded – undo
5918 5918
             return 'array()';
5919 5919
         }
5920 5920
 
5921
-        $output = $echo . $return;
5921
+        $output = $echo.$return;
5922 5922
         modx_sanitize_gpc($output);
5923 5923
         return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous
5924 5924
     }
@@ -5936,8 +5936,8 @@  discard block
 block discarded – undo
5936 5936
 
5937 5937
         $safe = explode(',', $safe_functions);
5938 5938
 
5939
-        $phpcode = rtrim($phpcode, ';') . ';';
5940
-        $tokens = token_get_all('<?php ' . $phpcode);
5939
+        $phpcode = rtrim($phpcode, ';').';';
5940
+        $tokens = token_get_all('<?php '.$phpcode);
5941 5941
         foreach ($tokens as $i => $token) {
5942 5942
             if (!is_array($token)) {
5943 5943
                 continue;
@@ -5973,7 +5973,7 @@  discard block
 block discarded – undo
5973 5973
     public function atBindFileContent($str = '')
5974 5974
     {
5975 5975
 
5976
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
5976
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
5977 5977
 
5978 5978
         if (stripos($str, '@FILE') !== 0) {
5979 5979
             return $str;
@@ -5996,7 +5996,7 @@  discard block
 block discarded – undo
5996 5996
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
5997 5997
 
5998 5998
         foreach ($search_path as $path) {
5999
-            $file_path = MODX_BASE_PATH . $path . $str;
5999
+            $file_path = MODX_BASE_PATH.$path.$str;
6000 6000
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6001 6001
                 return $errorMsg;
6002 6002
             } elseif (is_file($file_path)) {
@@ -6010,7 +6010,7 @@  discard block
 block discarded – undo
6010 6010
             return $errorMsg;
6011 6011
         }
6012 6012
 
6013
-        $content = (string)file_get_contents($file_path);
6013
+        $content = (string) file_get_contents($file_path);
6014 6014
         if ($content === false) {
6015 6015
             return $errorMsg;
6016 6016
         }
@@ -6123,22 +6123,22 @@  discard block
 block discarded – undo
6123 6123
 
6124 6124
         $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6125 6125
         $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6126
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6126
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6127 6127
         $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6128 6128
         $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6129 6129
         $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6130 6130
         if ($is_error) {
6131 6131
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6132 6132
             if ($msg != 'PHP Parse Error') {
6133
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6133
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6134 6134
             }
6135 6135
         } else {
6136 6136
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6137
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6137
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6138 6138
         }
6139 6139
 
6140 6140
         if (!empty ($query)) {
6141
-            $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>';
6141
+            $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>';
6142 6142
         }
6143 6143
 
6144 6144
         $errortype = array(
@@ -6161,13 +6161,13 @@  discard block
 block discarded – undo
6161 6161
 
6162 6162
         if (!empty($nr) || !empty($file)) {
6163 6163
             if ($text != '') {
6164
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6164
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6165 6165
             }
6166 6166
             if ($output != '') {
6167
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6167
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6168 6168
             }
6169 6169
             if ($nr !== '') {
6170
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6170
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6171 6171
             }
6172 6172
             if ($file) {
6173 6173
                 $table[] = array('File', $file);
@@ -6187,7 +6187,7 @@  discard block
 block discarded – undo
6187 6187
         }
6188 6188
 
6189 6189
         if (!empty($this->event->activePlugin)) {
6190
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6190
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6191 6191
         }
6192 6192
 
6193 6193
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6197,17 +6197,17 @@  discard block
 block discarded – undo
6197 6197
         $table[] = array('REQUEST_URI', $request_uri);
6198 6198
 
6199 6199
         if ($this->manager->action) {
6200
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6200
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6201 6201
             global $action_list;
6202 6202
             $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : '';
6203 6203
 
6204
-            $table[] = array('Manager action', $this->manager->action . $actionName);
6204
+            $table[] = array('Manager action', $this->manager->action.$actionName);
6205 6205
         }
6206 6206
 
6207 6207
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6208 6208
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6209 6209
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6210
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6210
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6211 6211
         }
6212 6212
         $table[] = array('Referer', $referer);
6213 6213
         $table[] = array('User Agent', $ua);
@@ -6228,7 +6228,7 @@  discard block
 block discarded – undo
6228 6228
 
6229 6229
         $mem = memory_get_peak_usage(true);
6230 6230
         $total_mem = $mem - $this->mstart;
6231
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6231
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6232 6232
 
6233 6233
         $queryTime = $this->queryTime;
6234 6234
         $phpTime = $totalTime - $queryTime;
@@ -6249,18 +6249,18 @@  discard block
 block discarded – undo
6249 6249
         $str .= $this->get_backtrace(debug_backtrace());
6250 6250
         // Log error
6251 6251
         if (!empty($this->currentSnippet)) {
6252
-            $source = 'Snippet - ' . $this->currentSnippet;
6252
+            $source = 'Snippet - '.$this->currentSnippet;
6253 6253
         } elseif (!empty($this->event->activePlugin)) {
6254
-            $source = 'Plugin - ' . $this->event->activePlugin;
6254
+            $source = 'Plugin - '.$this->event->activePlugin;
6255 6255
         } elseif ($source !== '') {
6256
-            $source = 'Parser - ' . $source;
6256
+            $source = 'Parser - '.$source;
6257 6257
         } elseif ($query !== '') {
6258 6258
             $source = 'SQL Query';
6259 6259
         } else {
6260 6260
             $source = 'Parser';
6261 6261
         }
6262 6262
         if ($msg) {
6263
-            $source .= ' / ' . $msg;
6263
+            $source .= ' / '.$msg;
6264 6264
         }
6265 6265
         if (isset($actionName) && !empty($actionName)) {
6266 6266
             $source .= $actionName;
@@ -6292,12 +6292,12 @@  discard block
 block discarded – undo
6292 6292
 
6293 6293
         // Display error
6294 6294
         if (isset($_SESSION['mgrValidated'])) {
6295
-            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>
6295
+            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>
6296 6296
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6297
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6297
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6298 6298
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6299 6299
                  </head><body>
6300
-                 ' . $str . '</body></html>';
6300
+                 ' . $str.'</body></html>';
6301 6301
 
6302 6302
         } else {
6303 6303
             echo 'Error';
@@ -6335,7 +6335,7 @@  discard block
 block discarded – undo
6335 6335
             switch ($val['type']) {
6336 6336
                 case '->':
6337 6337
                 case '::':
6338
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6338
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6339 6339
                     break;
6340 6340
                 default:
6341 6341
                     $functionName = $val['function'];
@@ -6345,7 +6345,7 @@  discard block
 block discarded – undo
6345 6345
             $args = array_pad(array(), $_, '$var');
6346 6346
             $args = implode(", ", $args);
6347 6347
             $modx = &$this;
6348
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6348
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6349 6349
                 $arg = $val['args'][$tmp - 1];
6350 6350
                 switch (true) {
6351 6351
                     case is_null($arg): {
@@ -6357,7 +6357,7 @@  discard block
 block discarded – undo
6357 6357
                         break;
6358 6358
                     }
6359 6359
                     case is_scalar($arg): {
6360
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6360
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6361 6361
                         break;
6362 6362
                     }
6363 6363
                     case is_bool($arg): {
@@ -6365,23 +6365,23 @@  discard block
 block discarded – undo
6365 6365
                         break;
6366 6366
                     }
6367 6367
                     case is_array($arg): {
6368
-                        $out = 'array $var' . $tmp;
6368
+                        $out = 'array $var'.$tmp;
6369 6369
                         break;
6370 6370
                     }
6371 6371
                     case is_object($arg): {
6372
-                        $out = get_class($arg) . ' $var' . $tmp;
6372
+                        $out = get_class($arg).' $var'.$tmp;
6373 6373
                         break;
6374 6374
                     }
6375 6375
                     default: {
6376
-                        $out = '$var' . $tmp;
6376
+                        $out = '$var'.$tmp;
6377 6377
                     }
6378 6378
                 }
6379 6379
                 $tmp++;
6380 6380
                 return $out;
6381 6381
             }, $args);
6382 6382
             $line = array(
6383
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6384
-                $path . " on line " . $val['line']
6383
+                "<strong>".$functionName."</strong>(".$args.")",
6384
+                $path." on line ".$val['line']
6385 6385
             );
6386 6386
             $table[] = array(implode("<br />", $line));
6387 6387
         }
@@ -6422,7 +6422,7 @@  discard block
 block discarded – undo
6422 6422
             $alias = strip_tags($alias); // strip HTML
6423 6423
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6424 6424
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6425
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6425
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6426 6426
             $alias = trim($alias, '-'); // trim excess
6427 6427
             return $alias;
6428 6428
         }
@@ -6438,7 +6438,7 @@  discard block
 block discarded – undo
6438 6438
         $precisions = count($sizes) - 1;
6439 6439
         foreach ($sizes as $unit => $bytes) {
6440 6440
             if ($size >= $bytes) {
6441
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6441
+                return number_format($size / $bytes, $precisions).' '.$unit;
6442 6442
             }
6443 6443
             $precisions--;
6444 6444
         }
@@ -6542,10 +6542,10 @@  discard block
 block discarded – undo
6542 6542
 
6543 6543
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6544 6544
             return false;
6545
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6546
-            $file_path = MODX_BASE_PATH . $str;
6547
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6548
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6545
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6546
+            $file_path = MODX_BASE_PATH.$str;
6547
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6548
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6549 6549
         } else {
6550 6550
             return false;
6551 6551
         }
@@ -6671,7 +6671,7 @@  discard block
 block discarded – undo
6671 6671
             $title = 'no title';
6672 6672
         }
6673 6673
         if (is_array($msg)) {
6674
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6674
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6675 6675
         } elseif ($msg === '') {
6676 6676
             $msg = $_SERVER['REQUEST_URI'];
6677 6677
         }
@@ -6716,7 +6716,7 @@  discard block
 block discarded – undo
6716 6716
         if (is_array($SystemAlertMsgQueque)) {
6717 6717
             $title = '';
6718 6718
             if ($this->name && $this->activePlugin) {
6719
-                $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>";
6719
+                $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>";
6720 6720
             }
6721 6721
             $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>";
6722 6722
         }
Please login to merge, or discard this patch.
Braces   +59 added lines, -28 removed lines patch added patch discarded remove patch
@@ -701,13 +701,15 @@  discard block
 block discarded – undo
701 701
             $this->virtualDir = '';
702 702
         }
703 703
 
704
-        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 */
704
+        if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) {
705
+/* we got an ID returned, check to make sure it's not an alias */
705 706
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
706 707
             if ($this->config['use_alias_path'] == 1) {
707 708
                 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))))) {
708 709
                     $this->documentMethod = 'id';
709 710
                     return $q;
710
-                } else { /* not a valid id in terms of virtualDir, treat as alias */
711
+                } else {
712
+/* not a valid id in terms of virtualDir, treat as alias */
711 713
                     $this->documentMethod = 'alias';
712 714
                     return $q;
713 715
                 }
@@ -715,7 +717,8 @@  discard block
 block discarded – undo
715 717
                 $this->documentMethod = 'id';
716 718
                 return $q;
717 719
             }
718
-        } else { /* we didn't get an ID back, so instead we assume it's an alias */
720
+        } else {
721
+/* we didn't get an ID back, so instead we assume it's an alias */
719 722
             if ($this->config['friendly_alias_urls'] != 1) {
720 723
                 $q = $qOrig;
721 724
             }
@@ -745,13 +748,14 @@  discard block
 block discarded – undo
745 748
      * @param $id
746 749
      * @return array|mixed|null|string
747 750
      */
748
-    public function makePageCacheKey($id){
751
+    public function makePageCacheKey($id)
752
+    {
749 753
         $hash = $id;
750 754
         $tmp = null;
751 755
         $params = array();
752
-        if(!empty($this->systemCacheKey)){
756
+        if(!empty($this->systemCacheKey)) {
753 757
             $hash = $this->systemCacheKey;
754
-        }else {
758
+        } else {
755 759
             if (!empty($_GET)) {
756 760
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
757 761
                 $params = $_GET;
@@ -760,7 +764,7 @@  discard block
 block discarded – undo
760 764
             }
761 765
         }
762 766
         $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
763
-        if (is_array($evtOut) && count($evtOut) > 0){
767
+        if (is_array($evtOut) && count($evtOut) > 0) {
764 768
             $tmp = array_pop($evtOut);
765 769
         }
766 770
         return empty($tmp) ? $hash : $tmp;
@@ -1087,7 +1091,8 @@  discard block
 block discarded – undo
1087 1091
         $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0";
1088 1092
         $result_pub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1089 1093
         $this->db->update($field, '[+prefix+]site_content', $where);
1090
-        if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc
1094
+        if ($this->db->getRecordCount($result_pub) >= 1) {
1095
+//Event unPublished doc
1091 1096
             while ($row_pub = $this->db->getRow($result_pub)) {
1092 1097
                 $this->invokeEvent("OnDocUnPublished", array(
1093 1098
                     "docid" => $row_pub['id']
@@ -1100,7 +1105,8 @@  discard block
 block discarded – undo
1100 1105
         $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1";
1101 1106
         $result_unpub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1102 1107
         $this->db->update($field, '[+prefix+]site_content', $where);
1103
-        if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc
1108
+        if ($this->db->getRecordCount($result_unpub) >= 1) {
1109
+//Event unPublished doc
1104 1110
             while ($row_unpub = $this->db->getRow($result_unpub)) {
1105 1111
                 $this->invokeEvent("OnDocUnPublished", array(
1106 1112
                     "docid" => $row_unpub['id']
@@ -1187,10 +1193,18 @@  discard block
 block discarded – undo
1187 1193
             return array();
1188 1194
         }
1189 1195
         $spacer = md5('<<<EVO>>>');
1190
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1191
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1192
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1193
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1196
+        if($left==='{{' && strpos($content,';}}')!==false) {
1197
+            $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1198
+        }
1199
+        if($left==='{{' && strpos($content,'{{}}')!==false) {
1200
+            $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1201
+        }
1202
+        if($left==='[[' && strpos($content,']]]]')!==false) {
1203
+            $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1204
+        }
1205
+        if($left==='[[' && strpos($content,']]]')!==false) {
1206
+            $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1207
+        }
1194 1208
 
1195 1209
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1196 1210
         $pos[']]>'] = strpos($content, ']]>');
@@ -1243,7 +1257,8 @@  discard block
 block discarded – undo
1243 1257
                         }
1244 1258
                     }
1245 1259
 
1246
-                    if (!in_array($fetch, $tags)) {  // Avoid double Matches
1260
+                    if (!in_array($fetch, $tags)) {
1261
+// Avoid double Matches
1247 1262
                         $tags[] = $fetch; // Fetch
1248 1263
                     };
1249 1264
                     $fetch = ''; // and reset
@@ -1261,7 +1276,9 @@  discard block
 block discarded – undo
1261 1276
             }
1262 1277
         }
1263 1278
         foreach($tags as $i=>$tag) {
1264
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1279
+            if(strpos($tag,$spacer)!==false) {
1280
+                $tags[$i] = str_replace($spacer, '', $tag);
1281
+            }
1265 1282
         }
1266 1283
         return $tags;
1267 1284
     }
@@ -1301,7 +1318,10 @@  discard block
 block discarded – undo
1301 1318
         }
1302 1319
 
1303 1320
         foreach ($matches[1] as $i => $key) {
1304
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1321
+            if(strpos($key,'[+')!==false) {
1322
+                continue;
1323
+            }
1324
+            // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1305 1325
             if (substr($key, 0, 1) == '#') {
1306 1326
                 $key = substr($key, 1);
1307 1327
             } // remove # for QuickEdit format
@@ -2026,7 +2046,8 @@  discard block
 block discarded – undo
2026 2046
      * @return mixed|string
2027 2047
      */
2028 2048
     public function _getSGVar($value)
2029
-    { // Get super globals
2049
+    {
2050
+// Get super globals
2030 2051
         $key = $value;
2031 2052
         $_ = $this->config['enable_filter'];
2032 2053
         $this->config['enable_filter'] = 1;
@@ -2430,7 +2451,8 @@  discard block
 block discarded – undo
2430 2451
         if ($this->config['friendly_urls'] == 1) {
2431 2452
             $aliases = array();
2432 2453
             if (is_array($this->documentListing)) {
2433
-                foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site!
2454
+                foreach ($this->documentListing as $path => $docid) {
2455
+// This is big Loop on large site!
2434 2456
                     $aliases[$docid] = $path;
2435 2457
                     $isfolder[$docid] = $this->aliasListing[$docid]['isfolder'];
2436 2458
                 }
@@ -2463,7 +2485,7 @@  discard block
 block discarded – undo
2463 2485
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2464 2486
             $pref = $this->config['friendly_url_prefix'];
2465 2487
             $suff = $this->config['friendly_url_suffix'];
2466
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2488
+            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){
2467 2489
                 global $modx;
2468 2490
                 $thealias = $aliases[$m[1]];
2469 2491
                 $thefolder = $isfolder[$m[1]];
@@ -4239,7 +4261,8 @@  discard block
 block discarded – undo
4239 4261
         if (isset ($this->snippetCache[$snippetName])) {
4240 4262
             $snippet = $this->snippetCache[$snippetName];
4241 4263
             $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4242
-        } else { // not in cache so let's check the db
4264
+        } else {
4265
+// not in cache so let's check the db
4243 4266
             $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;";
4244 4267
             $result = $this->db->query($sql);
4245 4268
             if ($this->db->getRecordCount($result) == 1) {
@@ -4740,7 +4763,7 @@  discard block
 block discarded – undo
4740 4763
             $result = $this->db->makeArray($rs);
4741 4764
 
4742 4765
             // get default/built-in template variables
4743
-            if(is_array($docRow)){
4766
+            if(is_array($docRow)) {
4744 4767
                 ksort($docRow);
4745 4768
 
4746 4769
                 foreach ($docRow as $key => $value) {
@@ -5219,12 +5242,16 @@  discard block
 block discarded – undo
5219 5242
             return '';
5220 5243
         } // nothing to register
5221 5244
         if (!is_array($options)) {
5222
-            if (is_bool($options))  // backward compatibility with old plaintext parameter
5245
+            if (is_bool($options)) {
5246
+                // backward compatibility with old plaintext parameter
5223 5247
             {
5224 5248
                 $options = array('plaintext' => $options);
5225
-            } elseif (is_string($options)) // Also allow script name as 2nd param
5249
+            }
5250
+            } elseif (is_string($options)) {
5251
+                // Also allow script name as 2nd param
5226 5252
             {
5227 5253
                 $options = array('name' => $options);
5254
+            }
5228 5255
             } else {
5229 5256
                 $options = array();
5230 5257
             }
@@ -5236,7 +5263,8 @@  discard block
 block discarded – undo
5236 5263
         unset($overwritepos); // probably unnecessary--just making sure
5237 5264
 
5238 5265
         $useThisVer = true;
5239
-        if (isset($this->loadedjscripts[$key])) { // a matching script was found
5266
+        if (isset($this->loadedjscripts[$key])) {
5267
+// a matching script was found
5240 5268
             // if existing script is a startup script, make sure the candidate is also a startup script
5241 5269
             if ($this->loadedjscripts[$key]['startup']) {
5242 5270
                 $startup = true;
@@ -5256,7 +5284,8 @@  discard block
 block discarded – undo
5256 5284
                     // overwrite the old script (the position may be important for dependent scripts)
5257 5285
                     $overwritepos = $this->loadedjscripts[$key]['pos'];
5258 5286
                 }
5259
-            } else { // Use the original version
5287
+            } else {
5288
+// Use the original version
5260 5289
                 if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) {
5261 5290
                     // need to move the exisiting script to the head
5262 5291
                     $version = $this->loadedjscripts[$key][$version];
@@ -5381,7 +5410,8 @@  discard block
 block discarded – undo
5381 5410
         }
5382 5411
 
5383 5412
         $results = null;
5384
-        foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop
5413
+        foreach ($this->pluginEvent[$evtName] as $pluginName) {
5414
+// start for loop
5385 5415
             if ($this->dumpPlugins) {
5386 5416
                 $eventtime = $this->getMicroTime();
5387 5417
             }
@@ -5929,7 +5959,8 @@  discard block
 block discarded – undo
5929 5959
      * @return bool
5930 5960
      */
5931 5961
     public function isSafeCode($phpcode = '', $safe_functions = '')
5932
-    { // return true or false
5962
+    {
5963
+// return true or false
5933 5964
         if ($safe_functions == '') {
5934 5965
             return false;
5935 5966
         }
@@ -6345,7 +6376,7 @@  discard block
 block discarded – undo
6345 6376
             $args = array_pad(array(), $_, '$var');
6346 6377
             $args = implode(", ", $args);
6347 6378
             $modx = &$this;
6348
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6379
+            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){
6349 6380
                 $arg = $val['args'][$tmp - 1];
6350 6381
                 switch (true) {
6351 6382
                     case is_null($arg): {
Please login to merge, or discard this patch.
manager/actions/welcome.static.php 3 patches
Indentation   +236 added lines, -236 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
3
+    die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
4 4
 }
5 5
 
6 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8 8
 if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9
-	// seems to be a new install - send the user to the configuration page
10
-	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
9
+    // seems to be a new install - send the user to the configuration page
10
+    exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
12 12
 
13 13
 // set placeholders
@@ -17,92 +17,92 @@  discard block
 block discarded – undo
17 17
 
18 18
 // setup message info
19 19
 if($modx->hasPermission('messages')) {
20
-	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21
-	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22
-	$_SESSION['nrnewmessages'] = $nrnewmessages;
23
-
24
-	$msg = array();
25
-	$msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
27
-	$msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
29
-	$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30
-	$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31
-	$ph['MessageInfo'] = implode("\n", $msg);
20
+    include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21
+    $_SESSION['nrtotalmessages'] = $nrtotalmessages;
22
+    $_SESSION['nrnewmessages'] = $nrnewmessages;
23
+
24
+    $msg = array();
25
+    $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
+    $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
27
+    $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
+    $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
29
+    $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30
+    $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31
+    $ph['MessageInfo'] = implode("\n", $msg);
32 32
 }
33 33
 
34 34
 // setup icons
35 35
 if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36
-	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37
-	$ph['SecurityIcon'] = wrapIcon($icon, 75);
36
+    $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37
+    $ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39 39
 if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40
-	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41
-	$ph['WebUserIcon'] = wrapIcon($icon, 99);
40
+    $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41
+    $ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43 43
 if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44
-	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45
-	$ph['ModulesIcon'] = wrapIcon($icon, 106);
44
+    $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45
+    $ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47 47
 if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48
-	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49
-	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
48
+    $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49
+    $ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51 51
 if($modx->hasPermission('bk_manager')) {
52
-	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53
-	$ph['BackupIcon'] = wrapIcon($icon, 93);
52
+    $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53
+    $ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55 55
 if($modx->hasPermission('help')) {
56
-	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57
-	$ph['HelpIcon'] = wrapIcon($icon, 9);
56
+    $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57
+    $ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 
60 60
 if($modx->hasPermission('new_document')) {
61
-	$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
62
-	$ph['ResourceIcon'] = wrapIcon($icon, 4);
63
-	$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
64
-	$ph['WeblinkIcon'] = wrapIcon($icon, 72);
61
+    $icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
62
+    $ph['ResourceIcon'] = wrapIcon($icon, 4);
63
+    $icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
64
+    $ph['WeblinkIcon'] = wrapIcon($icon, 72);
65 65
 }
66 66
 if($modx->hasPermission('assets_images')) {
67
-	$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
68
-	$ph['ImagesIcon'] = wrapIcon($icon, 72);
67
+    $icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
68
+    $ph['ImagesIcon'] = wrapIcon($icon, 72);
69 69
 }
70 70
 if($modx->hasPermission('assets_files')) {
71
-	$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
72
-	$ph['FilesIcon'] = wrapIcon($icon, 72);
71
+    $icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
72
+    $ph['FilesIcon'] = wrapIcon($icon, 72);
73 73
 }
74 74
 if($modx->hasPermission('change_password')) {
75
-	$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
76
-	$ph['PasswordIcon'] = wrapIcon($icon, 28);
75
+    $icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
76
+    $ph['PasswordIcon'] = wrapIcon($icon, 28);
77 77
 }
78 78
 $icon = '<i class="[&icons_logout_large&]"></i>[%logout%]';
79 79
 $ph['LogoutIcon'] = wrapIcon($icon, 8);
80 80
 
81 81
 // do some config checks
82 82
 if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
83
-	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
84
-	if($config_check_results != $_lang['configcheck_ok']) {
85
-		$ph['config_check_results'] = $config_check_results;
86
-		$ph['config_display'] = 'block';
87
-	} else {
88
-		$ph['config_display'] = 'none';
89
-	}
83
+    include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
84
+    if($config_check_results != $_lang['configcheck_ok']) {
85
+        $ph['config_check_results'] = $config_check_results;
86
+        $ph['config_display'] = 'block';
87
+    } else {
88
+        $ph['config_display'] = 'none';
89
+    }
90 90
 } else {
91
-	$ph['config_display'] = 'none';
91
+    $ph['config_display'] = 'none';
92 92
 }
93 93
 
94 94
 // Check logout-reminder
95 95
 if(isset($_SESSION['show_logout_reminder'])) {
96
-	switch($_SESSION['show_logout_reminder']['type']) {
97
-		case 'logout_reminder':
98
-			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
99
-			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
100
-			break;
101
-	}
102
-	$ph['show_logout_reminder'] = 'block';
103
-	unset($_SESSION['show_logout_reminder']);
96
+    switch($_SESSION['show_logout_reminder']['type']) {
97
+        case 'logout_reminder':
98
+            $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
99
+            $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
100
+            break;
101
+    }
102
+    $ph['show_logout_reminder'] = 'block';
103
+    unset($_SESSION['show_logout_reminder']);
104 104
 } else {
105
-	$ph['show_logout_reminder'] = 'none';
105
+    $ph['show_logout_reminder'] = 'none';
106 106
 }
107 107
 
108 108
 // Check multiple sessions
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
 $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
151 151
 
152 152
 $ph['UserInfo'] = $modx->parseText($tpl, array(
153
-	'username' => $modx->getLoginUserName(),
154
-	'role' => $_SESSION['mgrPermissions']['name'],
155
-	'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time),
156
-	'logincount' => $_SESSION['mgrLogincount'] + 1,
157
-	'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages)
153
+    'username' => $modx->getLoginUserName(),
154
+    'role' => $_SESSION['mgrPermissions']['name'],
155
+    'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time),
156
+    'logincount' => $_SESSION['mgrLogincount'] + 1,
157
+    'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages)
158 158
 ));
159 159
 
160 160
 $from = array();
@@ -163,13 +163,13 @@  discard block
 block discarded – undo
163 163
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
164 164
 
165 165
 if($modx->db->getRecordCount($rs) < 1) {
166
-	$html = '<p>[%no_active_users_found%]</p>';
166
+    $html = '<p>[%no_active_users_found%]</p>';
167 167
 } else {
168
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
169
-	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
170
-	$ph['now'] = strftime('%H:%M:%S', $now);
171
-	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
172
-	$html = '
168
+    include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
169
+    $now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
170
+    $ph['now'] = strftime('%H:%M:%S', $now);
171
+    $timetocheck = ($now - (60 * 20)); //+$server_offset_time;
172
+    $html = '
173 173
 	<div class="card-body">
174 174
 		[%onlineusers_message%] 
175 175
 		<b>[+now+]</b>):
@@ -187,33 +187,33 @@  discard block
 block discarded – undo
187 187
 	</thead>
188 188
 	<tbody>';
189 189
 
190
-	$userList = array();
191
-	$userCount = array();
192
-	// Create userlist with session-count first before output
193
-	while($activeusers = $modx->db->getRow($rs)) {
194
-		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
195
-
196
-		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
197
-		$webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" />&nbsp;' : '';
198
-		$ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip'];
199
-		$currentaction = getAction($activeusers['action'], $activeusers['id']);
200
-		$userList[] = array(
201
-			$idle,
202
-			'',
203
-			$activeusers['username'],
204
-			$webicon,
205
-			abs($activeusers['internalKey']),
206
-			$ip,
207
-			strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
208
-			$currentaction
209
-		);
210
-	}
211
-	foreach($userList as $params) {
212
-		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
213
-		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
214
-	}
215
-
216
-	$html .= '
190
+    $userList = array();
191
+    $userCount = array();
192
+    // Create userlist with session-count first before output
193
+    while($activeusers = $modx->db->getRow($rs)) {
194
+        $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
195
+
196
+        $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
197
+        $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" />&nbsp;' : '';
198
+        $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip'];
199
+        $currentaction = getAction($activeusers['action'], $activeusers['id']);
200
+        $userList[] = array(
201
+            $idle,
202
+            '',
203
+            $activeusers['username'],
204
+            $webicon,
205
+            abs($activeusers['internalKey']),
206
+            $ip,
207
+            strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
208
+            $currentaction
209
+        );
210
+    }
211
+    foreach($userList as $params) {
212
+        $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
213
+        $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
214
+    }
215
+
216
+    $html .= '
217 217
 	</tbody>
218 218
 	</table>
219 219
 </div>
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 // invoke event OnManagerWelcomePrerender
255 255
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
256 256
 if(is_array($evtOut)) {
257
-	$output = implode('', $evtOut);
258
-	$ph['OnManagerWelcomePrerender'] = $output;
257
+    $output = implode('', $evtOut);
258
+    $ph['OnManagerWelcomePrerender'] = $output;
259 259
 }
260 260
 
261 261
 $widgets['welcome'] = array(
262
-	'menuindex' => '10',
263
-	'id' => 'welcome',
264
-	'cols' => 'col-lg-6',
265
-	'icon' => 'fa-home',
266
-	'title' => '[%welcome_title%]',
267
-	'body' => '
262
+    'menuindex' => '10',
263
+    'id' => 'welcome',
264
+    'cols' => 'col-lg-6',
265
+    'icon' => 'fa-home',
266
+    'title' => '[%welcome_title%]',
267
+    'body' => '
268 268
 				<div class="wm_buttons card-body"> 
269 269
 					<!--@IF:[[#hasPermission?key=new_document]]--> 
270 270
 					<span class="wm_button">
@@ -338,25 +338,25 @@  discard block
 block discarded – undo
338 338
 					</table>
339 339
 				</div>
340 340
 		',
341
-	'hide'=>'0'
341
+    'hide'=>'0'
342 342
 );
343 343
 $widgets['onlineinfo'] = array(
344
-	'menuindex' => '20',
345
-	'id' => 'onlineinfo',
346
-	'cols' => 'col-lg-6',
347
-	'icon' => 'fa-user',
348
-	'title' => '[%onlineusers_title%]',
349
-	'body' => '<div class="userstable">[+OnlineInfo+]</div>',
350
-	'hide'=>'0'
344
+    'menuindex' => '20',
345
+    'id' => 'onlineinfo',
346
+    'cols' => 'col-lg-6',
347
+    'icon' => 'fa-user',
348
+    'title' => '[%onlineusers_title%]',
349
+    'body' => '<div class="userstable">[+OnlineInfo+]</div>',
350
+    'hide'=>'0'
351 351
 );
352 352
 $widgets['recentinfo'] = array(
353
-	'menuindex' => '30',
354
-	'id' => 'modxrecent_widget',
355
-	'cols' => 'col-sm-12',
356
-	'icon' => 'fa-pencil-square-o',
357
-	'title' => '[%activity_title%]',
358
-	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
359
-	'hide'=>'0'
353
+    'menuindex' => '30',
354
+    'id' => 'modxrecent_widget',
355
+    'cols' => 'col-sm-12',
356
+    'icon' => 'fa-pencil-square-o',
357
+    'title' => '[%activity_title%]',
358
+    'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
359
+    'hide'=>'0'
360 360
 );
361 361
 if ($modx->config['rss_url_news']) {
362 362
     $widgets['news'] = array(
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 // invoke OnManagerWelcomeHome event
385 385
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
386 386
 if(is_array($sitewidgets)) {
387
-	$newwidgets = array();
387
+    $newwidgets = array();
388 388
     foreach($sitewidgets as $widget){
389 389
         $newwidgets = array_merge($newwidgets, unserialize($widget));
390 390
     }
@@ -392,21 +392,21 @@  discard block
 block discarded – undo
392 392
 }
393 393
 
394 394
 usort($widgets, function ($a, $b) {
395
-	return $a['menuindex'] - $b['menuindex'];
395
+    return $a['menuindex'] - $b['menuindex'];
396 396
 });
397 397
 
398 398
 $tpl = getTplWidget();
399 399
 $output = '';
400 400
 foreach($widgets as $widget) {
401
-	if ($widget['hide'] != '1'){
402
-		$output .= $modx->parseText($tpl, $widget);
403
-	}
401
+    if ($widget['hide'] != '1'){
402
+        $output .= $modx->parseText($tpl, $widget);
403
+    }
404 404
 }
405 405
 $ph['widgets'] = $output;
406 406
 
407 407
 // load template
408 408
 if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
409
-	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
409
+    $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
410 410
 }
411 411
 
412 412
 $target = $modx->config['manager_welcome_tpl'];
@@ -414,27 +414,27 @@  discard block
 block discarded – undo
414 414
 $target = $modx->mergeSettingsContent($target);
415 415
 
416 416
 if(substr($target, 0, 1) === '@') {
417
-	if(substr($target, 0, 6) === '@CHUNK') {
418
-		$content = $modx->getChunk(trim(substr($target, 7)));
419
-	} elseif(substr($target, 0, 5) === '@FILE') {
420
-		$content = file_get_contents(trim(substr($target, 6)));
421
-	} else {
422
-		$content = '';
423
-	}
417
+    if(substr($target, 0, 6) === '@CHUNK') {
418
+        $content = $modx->getChunk(trim(substr($target, 7)));
419
+    } elseif(substr($target, 0, 5) === '@FILE') {
420
+        $content = file_get_contents(trim(substr($target, 6)));
421
+    } else {
422
+        $content = '';
423
+    }
424 424
 } else {
425
-	$chunk = $modx->getChunk($target);
426
-	if($chunk !== false && !empty($chunk)) {
427
-		$content = $chunk;
428
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
429
-		$content = file_get_contents(MODX_BASE_PATH . $target);
430
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
431
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
432
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
433
-	{
434
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
435
-	} else {
436
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
437
-	}
425
+    $chunk = $modx->getChunk($target);
426
+    if($chunk !== false && !empty($chunk)) {
427
+        $content = $chunk;
428
+    } elseif(is_file(MODX_BASE_PATH . $target)) {
429
+        $content = file_get_contents(MODX_BASE_PATH . $target);
430
+    } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
431
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
432
+    } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
433
+    {
434
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
435
+    } else {
436
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
437
+    }
438 438
 }
439 439
 
440 440
 // merge placeholders
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
 $content = $modx->mergeSettingsContent($content);
443 443
 $content = $modx->parseText($content, $ph);
444 444
 if(strpos($content, '[+') !== false) {
445
-	$modx->toPlaceholders($ph);
446
-	$content = $modx->mergePlaceholderContent($content);
445
+    $modx->toPlaceholders($ph);
446
+    $content = $modx->mergePlaceholderContent($content);
447 447
 }
448 448
 $content = $modx->parseDocumentSource($content);
449 449
 $content = $modx->parseText($content, $_lang, '[%', '%]');
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 $content = $modx->cleanUpMODXTags($content); //cleanup
452 452
 
453 453
 if($js = $modx->getRegisteredClientScripts()) {
454
-	$content .= $js;
454
+    $content .= $js;
455 455
 }
456 456
 
457 457
 echo $content;
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
462 462
 //</span>
463 463
 function getTplWidget() { // recent document info
464
-	return '
464
+    return '
465 465
 		<div class="[+cols+]" id="[+id+]">
466 466
 			<div class="card"[+cardAttr+]>
467 467
 				<div class="card-header"[+headAttr+]> <i class="fa [+icon+]"></i> [+title+] </div>
@@ -472,11 +472,11 @@  discard block
 block discarded – undo
472 472
 }
473 473
 
474 474
 function getRecentInfo() { // recent document info
475
-	$modx = evolutionCMS();
475
+    $modx = evolutionCMS();
476 476
 
477
-	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
477
+    $modx->addSnippet('recentInfoList', 'getRecentInfoList');
478 478
 
479
-	$html = '
479
+    $html = '
480 480
 			<div class="table-responsive">
481 481
 				<table class="table data">
482 482
 					<thead>
@@ -494,96 +494,96 @@  discard block
 block discarded – undo
494 494
 				</table>
495 495
 			</div>
496 496
 ';
497
-	return $html;
497
+    return $html;
498 498
 }
499 499
 
500 500
 function getRecentInfoList() {
501
-	$modx = evolutionCMS();
502
-
503
-	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
504
-
505
-	if($modx->db->getRecordCount($rs) < 1) {
506
-		return '<tr><td>[%no_activity_message%]</td></tr>';
507
-	}
508
-
509
-	$tpl = getRecentInfoRowTpl();
510
-
511
-	$btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&amp;id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> ';
512
-	$btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
513
-
514
-	$output = array();
515
-	while($ph = $modx->db->getRow($rs)) {
516
-		$docid = $ph['id'];
517
-		$_ = $modx->getUserInfo($ph['editedby']);
518
-		$ph['username'] = $_['username'];
519
-
520
-		if($ph['deleted'] == 1) {
521
-			$ph['status'] = 'deleted text-danger';
522
-		} elseif($ph['published'] == 0) {
523
-			$ph['status'] = 'unpublished font-italic text-muted';
524
-		} else {
525
-			$ph['status'] = 'published';
526
-		}
527
-
528
-		if($modx->hasPermission('edit_document')) {
529
-			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
530
-		} else {
531
-			$ph['edit_btn'] = '';
532
-		}
533
-
534
-		$preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : '';
535
-		$ph['preview_btn'] = str_replace(array(
536
-			'[+id+]',
537
-			'[+preview_disabled+]'
538
-		), array(
539
-			$docid,
540
-			$preview_disabled
541
-		), $btntpl['preview_btn']);
542
-
543
-		if($modx->hasPermission('delete_document')) {
544
-			if($ph['deleted'] == 0) {
545
-				$delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
546
-			} else {
547
-				$delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
548
-			}
549
-			$ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
550
-		} else {
551
-			$ph['delete_btn'] = '';
552
-		}
553
-
554
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
555
-			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
556
-		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
557
-			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
558
-		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
559
-			$publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
560
-		} else {
561
-			$publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
562
-		}
563
-		$ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
564
-
565
-		$ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
566
-
567
-		if($ph['longtitle'] == '') {
568
-			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
569
-		}
570
-		if($ph['description'] == '') {
571
-			$ph['description'] = '(<i>[%not_set%]</i>)';
572
-		}
573
-		if($ph['introtext'] == '') {
574
-			$ph['introtext'] = '(<i>[%not_set%]</i>)';
575
-		}
576
-		if($ph['alias'] == '') {
577
-			$ph['alias'] = '(<i>[%not_set%]</i>)';
578
-		}
579
-
580
-		$output[] = $modx->parseText($tpl, $ph);
581
-	}
582
-	return implode("\n", $output);
501
+    $modx = evolutionCMS();
502
+
503
+    $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
504
+
505
+    if($modx->db->getRecordCount($rs) < 1) {
506
+        return '<tr><td>[%no_activity_message%]</td></tr>';
507
+    }
508
+
509
+    $tpl = getRecentInfoRowTpl();
510
+
511
+    $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&amp;id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> ';
512
+    $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
513
+
514
+    $output = array();
515
+    while($ph = $modx->db->getRow($rs)) {
516
+        $docid = $ph['id'];
517
+        $_ = $modx->getUserInfo($ph['editedby']);
518
+        $ph['username'] = $_['username'];
519
+
520
+        if($ph['deleted'] == 1) {
521
+            $ph['status'] = 'deleted text-danger';
522
+        } elseif($ph['published'] == 0) {
523
+            $ph['status'] = 'unpublished font-italic text-muted';
524
+        } else {
525
+            $ph['status'] = 'published';
526
+        }
527
+
528
+        if($modx->hasPermission('edit_document')) {
529
+            $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
530
+        } else {
531
+            $ph['edit_btn'] = '';
532
+        }
533
+
534
+        $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : '';
535
+        $ph['preview_btn'] = str_replace(array(
536
+            '[+id+]',
537
+            '[+preview_disabled+]'
538
+        ), array(
539
+            $docid,
540
+            $preview_disabled
541
+        ), $btntpl['preview_btn']);
542
+
543
+        if($modx->hasPermission('delete_document')) {
544
+            if($ph['deleted'] == 0) {
545
+                $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
546
+            } else {
547
+                $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
548
+            }
549
+            $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
550
+        } else {
551
+            $ph['delete_btn'] = '';
552
+        }
553
+
554
+        if($ph['deleted'] == 1 && $ph['published'] == 0) {
555
+            $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
556
+        } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
557
+            $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
558
+        } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
559
+            $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
560
+        } else {
561
+            $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
562
+        }
563
+        $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
564
+
565
+        $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
566
+
567
+        if($ph['longtitle'] == '') {
568
+            $ph['longtitle'] = '(<i>[%not_set%]</i>)';
569
+        }
570
+        if($ph['description'] == '') {
571
+            $ph['description'] = '(<i>[%not_set%]</i>)';
572
+        }
573
+        if($ph['introtext'] == '') {
574
+            $ph['introtext'] = '(<i>[%not_set%]</i>)';
575
+        }
576
+        if($ph['alias'] == '') {
577
+            $ph['alias'] = '(<i>[%not_set%]</i>)';
578
+        }
579
+
580
+        $output[] = $modx->parseText($tpl, $ph);
581
+    }
582
+    return implode("\n", $output);
583 583
 }
584 584
 
585 585
 function getRecentInfoRowTpl() {
586
-	$tpl = '
586
+    $tpl = '
587 587
 						<tr>
588 588
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
589 589
 							<td data-toggle="collapse" data-target=".collapse[+id+]"><a class="[+status+]" title="[%edit_resource%]" href="index.php?a=3&amp;id=[+id+]" target="main">[+pagetitle+]</a></td>
@@ -607,16 +607,16 @@  discard block
 block discarded – undo
607 607
 								</div>
608 608
 							</td>
609 609
 						</tr>';
610
-	return $tpl;
610
+    return $tpl;
611 611
 }
612 612
 
613 613
 // setup icons
614 614
 function wrapIcon($i, $action) {
615
-	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
615
+    return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
616 616
 }
617 617
 
618 618
 function getStartUpScript() {
619
-	$script = '
619
+    $script = '
620 620
         <script type="text/javascript">
621 621
         function hideConfigCheckWarning(key) {
622 622
         	var xhr = new XMLHttpRequest();
@@ -640,5 +640,5 @@  discard block
 block discarded – undo
640 640
 		})(jQuery);        
641 641
         </script>
642 642
 ';
643
-	return $script;
643
+    return $script;
644 644
 }
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
4 4
 }
5 5
 
6 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,62 +16,62 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
20
-	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
19
+if ($modx->hasPermission('messages')) {
20
+	include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
23 23
 
24 24
 	$msg = array();
25 25
 	$msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
26
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : '';
27 27
 	$msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
28
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0';
29 29
 	$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30 30
 	$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31 31
 	$ph['MessageInfo'] = implode("\n", $msg);
32 32
 }
33 33
 
34 34
 // setup icons
35
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
35
+if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36 36
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37 37
 	$ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
39
+if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40 40
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41 41
 	$ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
43
+if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44 44
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45 45
 	$ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47
-if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
47
+if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48 48
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49 49
 	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51
-if($modx->hasPermission('bk_manager')) {
51
+if ($modx->hasPermission('bk_manager')) {
52 52
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53 53
 	$ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55
-if($modx->hasPermission('help')) {
55
+if ($modx->hasPermission('help')) {
56 56
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57 57
 	$ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 
60
-if($modx->hasPermission('new_document')) {
60
+if ($modx->hasPermission('new_document')) {
61 61
 	$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
62 62
 	$ph['ResourceIcon'] = wrapIcon($icon, 4);
63 63
 	$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
64 64
 	$ph['WeblinkIcon'] = wrapIcon($icon, 72);
65 65
 }
66
-if($modx->hasPermission('assets_images')) {
66
+if ($modx->hasPermission('assets_images')) {
67 67
 	$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
68 68
 	$ph['ImagesIcon'] = wrapIcon($icon, 72);
69 69
 }
70
-if($modx->hasPermission('assets_files')) {
70
+if ($modx->hasPermission('assets_files')) {
71 71
 	$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
72 72
 	$ph['FilesIcon'] = wrapIcon($icon, 72);
73 73
 }
74
-if($modx->hasPermission('change_password')) {
74
+if ($modx->hasPermission('change_password')) {
75 75
 	$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
76 76
 	$ph['PasswordIcon'] = wrapIcon($icon, 28);
77 77
 }
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 $ph['LogoutIcon'] = wrapIcon($icon, 8);
80 80
 
81 81
 // do some config checks
82
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
83
-	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
84
-	if($config_check_results != $_lang['configcheck_ok']) {
82
+if (($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
83
+	include_once(MODX_MANAGER_PATH.'includes/config_check.inc.php');
84
+	if ($config_check_results != $_lang['configcheck_ok']) {
85 85
 		$ph['config_check_results'] = $config_check_results;
86 86
 		$ph['config_display'] = 'block';
87 87
 	} else {
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 }
93 93
 
94 94
 // Check logout-reminder
95
-if(isset($_SESSION['show_logout_reminder'])) {
96
-	switch($_SESSION['show_logout_reminder']['type']) {
95
+if (isset($_SESSION['show_logout_reminder'])) {
96
+	switch ($_SESSION['show_logout_reminder']['type']) {
97 97
 		case 'logout_reminder':
98 98
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
99 99
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	</tr>
148 148
 </table>';
149 149
 
150
-$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
150
+$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>';
151 151
 
152 152
 $ph['UserInfo'] = $modx->parseText($tpl, array(
153 153
 	'username' => $modx->getLoginUserName(),
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
163 163
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
164 164
 
165
-if($modx->db->getRecordCount($rs) < 1) {
165
+if ($modx->db->getRecordCount($rs) < 1) {
166 166
 	$html = '<p>[%no_active_users_found%]</p>';
167 167
 } else {
168
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
168
+	include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
169 169
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
170 170
 	$ph['now'] = strftime('%H:%M:%S', $now);
171 171
 	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	$userList = array();
191 191
 	$userCount = array();
192 192
 	// Create userlist with session-count first before output
193
-	while($activeusers = $modx->db->getRow($rs)) {
193
+	while ($activeusers = $modx->db->getRow($rs)) {
194 194
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
195 195
 
196 196
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 			$currentaction
209 209
 		);
210 210
 	}
211
-	foreach($userList as $params) {
211
+	foreach ($userList as $params) {
212 212
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
213
-		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
213
+		$html .= "\n\t\t".vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
214 214
 	}
215 215
 
216 216
 	$html .= '
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 $ph['OnlineInfo'] = $html;
223 223
 
224 224
 // include rss feeds for important forum topics
225
-include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php');
225
+include_once(MODX_MANAGER_PATH.'includes/rss.inc.php');
226 226
 $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content'];
227 227
 $ph['modx_news_content'] = $feedData['modx_news_content'];
228 228
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
 // invoke event OnManagerWelcomePrerender
255 255
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
256
-if(is_array($evtOut)) {
256
+if (is_array($evtOut)) {
257 257
 	$output = implode('', $evtOut);
258 258
 	$ph['OnManagerWelcomePrerender'] = $output;
259 259
 }
@@ -383,57 +383,57 @@  discard block
 block discarded – undo
383 383
 
384 384
 // invoke OnManagerWelcomeHome event
385 385
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
386
-if(is_array($sitewidgets)) {
386
+if (is_array($sitewidgets)) {
387 387
 	$newwidgets = array();
388
-    foreach($sitewidgets as $widget){
388
+    foreach ($sitewidgets as $widget) {
389 389
         $newwidgets = array_merge($newwidgets, unserialize($widget));
390 390
     }
391 391
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
392 392
 }
393 393
 
394
-usort($widgets, function ($a, $b) {
394
+usort($widgets, function($a, $b){
395 395
 	return $a['menuindex'] - $b['menuindex'];
396 396
 });
397 397
 
398 398
 $tpl = getTplWidget();
399 399
 $output = '';
400
-foreach($widgets as $widget) {
401
-	if ($widget['hide'] != '1'){
400
+foreach ($widgets as $widget) {
401
+	if ($widget['hide'] != '1') {
402 402
 		$output .= $modx->parseText($tpl, $widget);
403 403
 	}
404 404
 }
405 405
 $ph['widgets'] = $output;
406 406
 
407 407
 // load template
408
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
409
-	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
408
+if (!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
409
+	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH.'media/style/common/welcome.tpl';
410 410
 }
411 411
 
412 412
 $target = $modx->config['manager_welcome_tpl'];
413 413
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
414 414
 $target = $modx->mergeSettingsContent($target);
415 415
 
416
-if(substr($target, 0, 1) === '@') {
417
-	if(substr($target, 0, 6) === '@CHUNK') {
416
+if (substr($target, 0, 1) === '@') {
417
+	if (substr($target, 0, 6) === '@CHUNK') {
418 418
 		$content = $modx->getChunk(trim(substr($target, 7)));
419
-	} elseif(substr($target, 0, 5) === '@FILE') {
419
+	} elseif (substr($target, 0, 5) === '@FILE') {
420 420
 		$content = file_get_contents(trim(substr($target, 6)));
421 421
 	} else {
422 422
 		$content = '';
423 423
 	}
424 424
 } else {
425 425
 	$chunk = $modx->getChunk($target);
426
-	if($chunk !== false && !empty($chunk)) {
426
+	if ($chunk !== false && !empty($chunk)) {
427 427
 		$content = $chunk;
428
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
429
-		$content = file_get_contents(MODX_BASE_PATH . $target);
430
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
431
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
432
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
428
+	} elseif (is_file(MODX_BASE_PATH.$target)) {
429
+		$content = file_get_contents(MODX_BASE_PATH.$target);
430
+	} elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl')) {
431
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl');
432
+	} elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html')) // ClipperCMS compatible
433 433
 	{
434
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
434
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html');
435 435
 	} else {
436
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
436
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl');
437 437
 	}
438 438
 }
439 439
 
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 $content = $modx->mergeConditionalTagsContent($content);
442 442
 $content = $modx->mergeSettingsContent($content);
443 443
 $content = $modx->parseText($content, $ph);
444
-if(strpos($content, '[+') !== false) {
444
+if (strpos($content, '[+') !== false) {
445 445
 	$modx->toPlaceholders($ph);
446 446
 	$content = $modx->mergePlaceholderContent($content);
447 447
 }
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 $content = $modx->parseText($content, $_style, '[&', '&]');
451 451
 $content = $modx->cleanUpMODXTags($content); //cleanup
452 452
 
453
-if($js = $modx->getRegisteredClientScripts()) {
453
+if ($js = $modx->getRegisteredClientScripts()) {
454 454
 	$content .= $js;
455 455
 }
456 456
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 //	<a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
461 461
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
462 462
 //</span>
463
-function getTplWidget() { // recent document info
463
+function getTplWidget(){ // recent document info
464 464
 	return '
465 465
 		<div class="[+cols+]" id="[+id+]">
466 466
 			<div class="card"[+cardAttr+]>
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 ';
472 472
 }
473 473
 
474
-function getRecentInfo() { // recent document info
474
+function getRecentInfo(){ // recent document info
475 475
 	$modx = evolutionCMS();
476 476
 
477 477
 	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
@@ -497,12 +497,12 @@  discard block
 block discarded – undo
497 497
 	return $html;
498 498
 }
499 499
 
500
-function getRecentInfoList() {
500
+function getRecentInfoList(){
501 501
 	$modx = evolutionCMS();
502 502
 
503 503
 	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
504 504
 
505
-	if($modx->db->getRecordCount($rs) < 1) {
505
+	if ($modx->db->getRecordCount($rs) < 1) {
506 506
 		return '<tr><td>[%no_activity_message%]</td></tr>';
507 507
 	}
508 508
 
@@ -512,20 +512,20 @@  discard block
 block discarded – undo
512 512
 	$btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
513 513
 
514 514
 	$output = array();
515
-	while($ph = $modx->db->getRow($rs)) {
515
+	while ($ph = $modx->db->getRow($rs)) {
516 516
 		$docid = $ph['id'];
517 517
 		$_ = $modx->getUserInfo($ph['editedby']);
518 518
 		$ph['username'] = $_['username'];
519 519
 
520
-		if($ph['deleted'] == 1) {
520
+		if ($ph['deleted'] == 1) {
521 521
 			$ph['status'] = 'deleted text-danger';
522
-		} elseif($ph['published'] == 0) {
522
+		} elseif ($ph['published'] == 0) {
523 523
 			$ph['status'] = 'unpublished font-italic text-muted';
524 524
 		} else {
525 525
 			$ph['status'] = 'published';
526 526
 		}
527 527
 
528
-		if($modx->hasPermission('edit_document')) {
528
+		if ($modx->hasPermission('edit_document')) {
529 529
 			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
530 530
 		} else {
531 531
 			$ph['edit_btn'] = '';
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
 			$preview_disabled
541 541
 		), $btntpl['preview_btn']);
542 542
 
543
-		if($modx->hasPermission('delete_document')) {
544
-			if($ph['deleted'] == 0) {
543
+		if ($modx->hasPermission('delete_document')) {
544
+			if ($ph['deleted'] == 0) {
545 545
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
546 546
 			} else {
547 547
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
@@ -551,11 +551,11 @@  discard block
 block discarded – undo
551 551
 			$ph['delete_btn'] = '';
552 552
 		}
553 553
 
554
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
554
+		if ($ph['deleted'] == 1 && $ph['published'] == 0) {
555 555
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
556
-		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
556
+		} elseif ($ph['deleted'] == 1 && $ph['published'] == 1) {
557 557
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
558
-		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
558
+		} elseif ($ph['deleted'] == 0 && $ph['published'] == 0) {
559 559
 			$publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
560 560
 		} else {
561 561
 			$publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
@@ -564,16 +564,16 @@  discard block
 block discarded – undo
564 564
 
565 565
 		$ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
566 566
 
567
-		if($ph['longtitle'] == '') {
567
+		if ($ph['longtitle'] == '') {
568 568
 			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
569 569
 		}
570
-		if($ph['description'] == '') {
570
+		if ($ph['description'] == '') {
571 571
 			$ph['description'] = '(<i>[%not_set%]</i>)';
572 572
 		}
573
-		if($ph['introtext'] == '') {
573
+		if ($ph['introtext'] == '') {
574 574
 			$ph['introtext'] = '(<i>[%not_set%]</i>)';
575 575
 		}
576
-		if($ph['alias'] == '') {
576
+		if ($ph['alias'] == '') {
577 577
 			$ph['alias'] = '(<i>[%not_set%]</i>)';
578 578
 		}
579 579
 
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 	return implode("\n", $output);
583 583
 }
584 584
 
585
-function getRecentInfoRowTpl() {
585
+function getRecentInfoRowTpl(){
586 586
 	$tpl = '
587 587
 						<tr>
588 588
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
@@ -611,11 +611,11 @@  discard block
 block discarded – undo
611 611
 }
612 612
 
613 613
 // setup icons
614
-function wrapIcon($i, $action) {
614
+function wrapIcon($i, $action){
615 615
 	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
616 616
 }
617 617
 
618
-function getStartUpScript() {
618
+function getStartUpScript(){
619 619
 	$script = '
620 620
         <script type="text/javascript">
621 621
         function hideConfigCheckWarning(key) {
Please login to merge, or discard this patch.
Braces   +81 added lines, -71 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
4 4
 }
5 5
 
6 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
19
+if($modx->hasPermission('messages')) {
20 20
 	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
@@ -32,46 +32,46 @@  discard block
 block discarded – undo
32 32
 }
33 33
 
34 34
 // setup icons
35
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
35
+if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36 36
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37 37
 	$ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
39
+if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40 40
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41 41
 	$ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
43
+if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44 44
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45 45
 	$ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47
-if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
47
+if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48 48
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49 49
 	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51
-if($modx->hasPermission('bk_manager')) {
51
+if($modx->hasPermission('bk_manager')) {
52 52
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53 53
 	$ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55
-if($modx->hasPermission('help')) {
55
+if($modx->hasPermission('help')) {
56 56
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57 57
 	$ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 
60
-if($modx->hasPermission('new_document')) {
60
+if($modx->hasPermission('new_document')) {
61 61
 	$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
62 62
 	$ph['ResourceIcon'] = wrapIcon($icon, 4);
63 63
 	$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
64 64
 	$ph['WeblinkIcon'] = wrapIcon($icon, 72);
65 65
 }
66
-if($modx->hasPermission('assets_images')) {
66
+if($modx->hasPermission('assets_images')) {
67 67
 	$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
68 68
 	$ph['ImagesIcon'] = wrapIcon($icon, 72);
69 69
 }
70
-if($modx->hasPermission('assets_files')) {
70
+if($modx->hasPermission('assets_files')) {
71 71
 	$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
72 72
 	$ph['FilesIcon'] = wrapIcon($icon, 72);
73 73
 }
74
-if($modx->hasPermission('change_password')) {
74
+if($modx->hasPermission('change_password')) {
75 75
 	$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
76 76
 	$ph['PasswordIcon'] = wrapIcon($icon, 28);
77 77
 }
@@ -79,21 +79,21 @@  discard block
 block discarded – undo
79 79
 $ph['LogoutIcon'] = wrapIcon($icon, 8);
80 80
 
81 81
 // do some config checks
82
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
82
+if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
83 83
 	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
84
-	if($config_check_results != $_lang['configcheck_ok']) {
84
+	if($config_check_results != $_lang['configcheck_ok']) {
85 85
 		$ph['config_check_results'] = $config_check_results;
86 86
 		$ph['config_display'] = 'block';
87
-	} else {
87
+	} else {
88 88
 		$ph['config_display'] = 'none';
89 89
 	}
90
-} else {
90
+} else {
91 91
 	$ph['config_display'] = 'none';
92 92
 }
93 93
 
94 94
 // Check logout-reminder
95
-if(isset($_SESSION['show_logout_reminder'])) {
96
-	switch($_SESSION['show_logout_reminder']['type']) {
95
+if(isset($_SESSION['show_logout_reminder'])) {
96
+	switch($_SESSION['show_logout_reminder']['type']) {
97 97
 		case 'logout_reminder':
98 98
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
99 99
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	}
102 102
 	$ph['show_logout_reminder'] = 'block';
103 103
 	unset($_SESSION['show_logout_reminder']);
104
-} else {
104
+} else {
105 105
 	$ph['show_logout_reminder'] = 'none';
106 106
 }
107 107
 
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
163 163
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
164 164
 
165
-if($modx->db->getRecordCount($rs) < 1) {
165
+if($modx->db->getRecordCount($rs) < 1) {
166 166
 	$html = '<p>[%no_active_users_found%]</p>';
167
-} else {
167
+} else {
168 168
 	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
169 169
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
170 170
 	$ph['now'] = strftime('%H:%M:%S', $now);
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	$userList = array();
191 191
 	$userCount = array();
192 192
 	// Create userlist with session-count first before output
193
-	while($activeusers = $modx->db->getRow($rs)) {
193
+	while($activeusers = $modx->db->getRow($rs)) {
194 194
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
195 195
 
196 196
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 			$currentaction
209 209
 		);
210 210
 	}
211
-	foreach($userList as $params) {
211
+	foreach($userList as $params) {
212 212
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
213 213
 		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
214 214
 	}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
 // invoke event OnManagerWelcomePrerender
255 255
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
256
-if(is_array($evtOut)) {
256
+if(is_array($evtOut)) {
257 257
 	$output = implode('', $evtOut);
258 258
 	$ph['OnManagerWelcomePrerender'] = $output;
259 259
 }
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
359 359
 	'hide'=>'0'
360 360
 );
361
-if ($modx->config['rss_url_news']) {
361
+if ($modx->config['rss_url_news']) {
362 362
     $widgets['news'] = array(
363 363
         'menuindex' => '40',
364 364
         'id' => 'news',
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
         'hide'=>'0'
370 370
     );
371 371
 }
372
-if ($modx->config['rss_url_security']) {
372
+if ($modx->config['rss_url_security']) {
373 373
     $widgets['security'] = array(
374 374
         'menuindex' => '50',
375 375
         'id' => 'security',
@@ -383,29 +383,29 @@  discard block
 block discarded – undo
383 383
 
384 384
 // invoke OnManagerWelcomeHome event
385 385
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
386
-if(is_array($sitewidgets)) {
386
+if(is_array($sitewidgets)) {
387 387
 	$newwidgets = array();
388
-    foreach($sitewidgets as $widget){
388
+    foreach($sitewidgets as $widget) {
389 389
         $newwidgets = array_merge($newwidgets, unserialize($widget));
390 390
     }
391 391
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
392 392
 }
393 393
 
394
-usort($widgets, function ($a, $b) {
394
+usort($widgets, function ($a, $b){
395 395
 	return $a['menuindex'] - $b['menuindex'];
396 396
 });
397 397
 
398 398
 $tpl = getTplWidget();
399 399
 $output = '';
400
-foreach($widgets as $widget) {
401
-	if ($widget['hide'] != '1'){
400
+foreach($widgets as $widget) {
401
+	if ($widget['hide'] != '1') {
402 402
 		$output .= $modx->parseText($tpl, $widget);
403 403
 	}
404 404
 }
405 405
 $ph['widgets'] = $output;
406 406
 
407 407
 // load template
408
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
408
+if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
409 409
 	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
410 410
 }
411 411
 
@@ -413,26 +413,28 @@  discard block
 block discarded – undo
413 413
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
414 414
 $target = $modx->mergeSettingsContent($target);
415 415
 
416
-if(substr($target, 0, 1) === '@') {
417
-	if(substr($target, 0, 6) === '@CHUNK') {
416
+if(substr($target, 0, 1) === '@') {
417
+	if(substr($target, 0, 6) === '@CHUNK') {
418 418
 		$content = $modx->getChunk(trim(substr($target, 7)));
419
-	} elseif(substr($target, 0, 5) === '@FILE') {
419
+	} elseif(substr($target, 0, 5) === '@FILE') {
420 420
 		$content = file_get_contents(trim(substr($target, 6)));
421
-	} else {
421
+	} else {
422 422
 		$content = '';
423 423
 	}
424
-} else {
424
+} else {
425 425
 	$chunk = $modx->getChunk($target);
426
-	if($chunk !== false && !empty($chunk)) {
426
+	if($chunk !== false && !empty($chunk)) {
427 427
 		$content = $chunk;
428
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
428
+	} elseif(is_file(MODX_BASE_PATH . $target)) {
429 429
 		$content = file_get_contents(MODX_BASE_PATH . $target);
430
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
430
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
431 431
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
432
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
432
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) {
433
+	    // ClipperCMS compatible
433 434
 	{
434
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
435
-	} else {
435
+		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
436
+	}
437
+	} else {
436 438
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
437 439
 	}
438 440
 }
@@ -441,7 +443,7 @@  discard block
 block discarded – undo
441 443
 $content = $modx->mergeConditionalTagsContent($content);
442 444
 $content = $modx->mergeSettingsContent($content);
443 445
 $content = $modx->parseText($content, $ph);
444
-if(strpos($content, '[+') !== false) {
446
+if(strpos($content, '[+') !== false) {
445 447
 	$modx->toPlaceholders($ph);
446 448
 	$content = $modx->mergePlaceholderContent($content);
447 449
 }
@@ -450,7 +452,7 @@  discard block
 block discarded – undo
450 452
 $content = $modx->parseText($content, $_style, '[&', '&]');
451 453
 $content = $modx->cleanUpMODXTags($content); //cleanup
452 454
 
453
-if($js = $modx->getRegisteredClientScripts()) {
455
+if($js = $modx->getRegisteredClientScripts()) {
454 456
 	$content .= $js;
455 457
 }
456 458
 
@@ -460,7 +462,9 @@  discard block
 block discarded – undo
460 462
 //	<a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
461 463
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
462 464
 //</span>
463
-function getTplWidget() { // recent document info
465
+function getTplWidget()
466
+{
467
+// recent document info
464 468
 	return '
465 469
 		<div class="[+cols+]" id="[+id+]">
466 470
 			<div class="card"[+cardAttr+]>
@@ -471,7 +475,9 @@  discard block
 block discarded – undo
471 475
 ';
472 476
 }
473 477
 
474
-function getRecentInfo() { // recent document info
478
+function getRecentInfo()
479
+{
480
+// recent document info
475 481
 	$modx = evolutionCMS();
476 482
 
477 483
 	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
@@ -497,12 +503,13 @@  discard block
 block discarded – undo
497 503
 	return $html;
498 504
 }
499 505
 
500
-function getRecentInfoList() {
506
+function getRecentInfoList()
507
+{
501 508
 	$modx = evolutionCMS();
502 509
 
503 510
 	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
504 511
 
505
-	if($modx->db->getRecordCount($rs) < 1) {
512
+	if($modx->db->getRecordCount($rs) < 1) {
506 513
 		return '<tr><td>[%no_activity_message%]</td></tr>';
507 514
 	}
508 515
 
@@ -512,22 +519,22 @@  discard block
 block discarded – undo
512 519
 	$btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
513 520
 
514 521
 	$output = array();
515
-	while($ph = $modx->db->getRow($rs)) {
522
+	while($ph = $modx->db->getRow($rs)) {
516 523
 		$docid = $ph['id'];
517 524
 		$_ = $modx->getUserInfo($ph['editedby']);
518 525
 		$ph['username'] = $_['username'];
519 526
 
520
-		if($ph['deleted'] == 1) {
527
+		if($ph['deleted'] == 1) {
521 528
 			$ph['status'] = 'deleted text-danger';
522
-		} elseif($ph['published'] == 0) {
529
+		} elseif($ph['published'] == 0) {
523 530
 			$ph['status'] = 'unpublished font-italic text-muted';
524
-		} else {
531
+		} else {
525 532
 			$ph['status'] = 'published';
526 533
 		}
527 534
 
528
-		if($modx->hasPermission('edit_document')) {
535
+		if($modx->hasPermission('edit_document')) {
529 536
 			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
530
-		} else {
537
+		} else {
531 538
 			$ph['edit_btn'] = '';
532 539
 		}
533 540
 
@@ -540,40 +547,40 @@  discard block
 block discarded – undo
540 547
 			$preview_disabled
541 548
 		), $btntpl['preview_btn']);
542 549
 
543
-		if($modx->hasPermission('delete_document')) {
544
-			if($ph['deleted'] == 0) {
550
+		if($modx->hasPermission('delete_document')) {
551
+			if($ph['deleted'] == 0) {
545 552
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
546
-			} else {
553
+			} else {
547 554
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
548 555
 			}
549 556
 			$ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
550
-		} else {
557
+		} else {
551 558
 			$ph['delete_btn'] = '';
552 559
 		}
553 560
 
554
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
561
+		if($ph['deleted'] == 1 && $ph['published'] == 0) {
555 562
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
556
-		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
563
+		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
557 564
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
558
-		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
565
+		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
559 566
 			$publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
560
-		} else {
567
+		} else {
561 568
 			$publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
562 569
 		}
563 570
 		$ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
564 571
 
565 572
 		$ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
566 573
 
567
-		if($ph['longtitle'] == '') {
574
+		if($ph['longtitle'] == '') {
568 575
 			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
569 576
 		}
570
-		if($ph['description'] == '') {
577
+		if($ph['description'] == '') {
571 578
 			$ph['description'] = '(<i>[%not_set%]</i>)';
572 579
 		}
573
-		if($ph['introtext'] == '') {
580
+		if($ph['introtext'] == '') {
574 581
 			$ph['introtext'] = '(<i>[%not_set%]</i>)';
575 582
 		}
576
-		if($ph['alias'] == '') {
583
+		if($ph['alias'] == '') {
577 584
 			$ph['alias'] = '(<i>[%not_set%]</i>)';
578 585
 		}
579 586
 
@@ -582,7 +589,8 @@  discard block
 block discarded – undo
582 589
 	return implode("\n", $output);
583 590
 }
584 591
 
585
-function getRecentInfoRowTpl() {
592
+function getRecentInfoRowTpl()
593
+{
586 594
 	$tpl = '
587 595
 						<tr>
588 596
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
@@ -611,11 +619,13 @@  discard block
 block discarded – undo
611 619
 }
612 620
 
613 621
 // setup icons
614
-function wrapIcon($i, $action) {
622
+function wrapIcon($i, $action)
623
+{
615 624
 	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
616 625
 }
617 626
 
618
-function getStartUpScript() {
627
+function getStartUpScript()
628
+{
619 629
 	$script = '
620 630
         <script type="text/javascript">
621 631
         function hideConfigCheckWarning(key) {
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab6_filemanager_settings.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
         <?php
114 114
             // invoke OnMiscSettingsRender event
115 115
             $evtOut = $modx->invokeEvent('OnFileManagerSettingsRender');
116
-            if(is_array($evtOut)) echo implode("",$evtOut);
116
+            if (is_array($evtOut)) echo implode("", $evtOut);
117 117
         ?>
118 118
     </td>
119 119
   </tr>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,9 @@
 block discarded – undo
113 113
         <?php
114 114
             // invoke OnMiscSettingsRender event
115 115
             $evtOut = $modx->invokeEvent('OnFileManagerSettingsRender');
116
-            if(is_array($evtOut)) echo implode("",$evtOut);
116
+            if(is_array($evtOut)) {
117
+                echo implode("",$evtOut);
118
+            }
117 119
         ?>
118 120
     </td>
119 121
   </tr>
Please login to merge, or discard this patch.
manager/actions/mutate_user.dynamic.php 4 patches
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 switch($modx->manager->action) {
7
-	case 12:
8
-		if(!$modx->hasPermission('edit_user')) {
9
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
-		}
11
-		break;
12
-	case 11:
13
-		if(!$modx->hasPermission('new_user')) {
14
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
-		}
16
-		break;
17
-	default:
18
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+    case 12:
8
+        if(!$modx->hasPermission('edit_user')) {
9
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
+        }
11
+        break;
12
+    case 11:
13
+        if(!$modx->hasPermission('new_user')) {
14
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+        }
16
+        break;
17
+    default:
18
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21 21
 $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
@@ -23,75 +23,75 @@  discard block
 block discarded – undo
23 23
 // check to see the snippet editor isn't locked
24 24
 $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
25 25
 if($username = $modx->db->getValue($rs)) {
26
-	$modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user"));
26
+    $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user"));
27 27
 }
28 28
 // end check for lock
29 29
 
30 30
 if($modx->manager->action == '12') {
31
-	// get user attribute
32
-	$rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33
-	$userdata = $modx->db->getRow($rs);
34
-	if(!$userdata) {
35
-		$modx->webAlertAndQuit("No user returned!");
36
-	}
37
-
38
-
39
-	// get user settings
40
-	$rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
41
-	$usersettings = array();
42
-	while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
43
-	// manually extract so that user display settings are not overwritten
44
-	foreach($usersettings as $k => $v) {
45
-		if($k != 'manager_language' && $k != 'manager_theme') {
46
-			${$k} = $v;
47
-		}
48
-	}
49
-
50
-	// get user name
51
-	$rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
52
-	$usernamedata = $modx->db->getRow($rs);
53
-	if(!$usernamedata) {
54
-		$modx->webAlertAndQuit("No user returned while getting username!");
55
-	}
56
-	$_SESSION['itemname'] = $usernamedata['username'];
31
+    // get user attribute
32
+    $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33
+    $userdata = $modx->db->getRow($rs);
34
+    if(!$userdata) {
35
+        $modx->webAlertAndQuit("No user returned!");
36
+    }
37
+
38
+
39
+    // get user settings
40
+    $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
41
+    $usersettings = array();
42
+    while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
43
+    // manually extract so that user display settings are not overwritten
44
+    foreach($usersettings as $k => $v) {
45
+        if($k != 'manager_language' && $k != 'manager_theme') {
46
+            ${$k} = $v;
47
+        }
48
+    }
49
+
50
+    // get user name
51
+    $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
52
+    $usernamedata = $modx->db->getRow($rs);
53
+    if(!$usernamedata) {
54
+        $modx->webAlertAndQuit("No user returned while getting username!");
55
+    }
56
+    $_SESSION['itemname'] = $usernamedata['username'];
57 57
 } else {
58
-	$userdata = array();
59
-	$usersettings = array();
60
-	$usernamedata = array();
61
-	$_SESSION['itemname'] = $_lang["new_user"];
58
+    $userdata = array();
59
+    $usersettings = array();
60
+    $usernamedata = array();
61
+    $_SESSION['itemname'] = $_lang["new_user"];
62 62
 }
63 63
 
64 64
 // avoid doubling htmlspecialchars (already encoded in DB)
65 65
 foreach($userdata as $key => $val) {
66
-	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
66
+    $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
67 67
 };
68 68
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
69 69
 
70 70
 // restore saved form
71 71
 $formRestored = false;
72 72
 if($modx->manager->hasFormValues()) {
73
-	$modx->manager->loadFormValues();
74
-	// restore post values
75
-	$userdata = array_merge($userdata, $_POST);
76
-	$userdata['dob'] = $modx->toTimeStamp($userdata['dob']);
77
-	$usernamedata['username'] = $userdata['newusername'];
78
-	$usernamedata['oldusername'] = $_POST['oldusername'];
79
-	$usersettings = array_merge($usersettings, $userdata);
80
-	$usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
81
-	extract($usersettings, EXTR_OVERWRITE);
73
+    $modx->manager->loadFormValues();
74
+    // restore post values
75
+    $userdata = array_merge($userdata, $_POST);
76
+    $userdata['dob'] = $modx->toTimeStamp($userdata['dob']);
77
+    $usernamedata['username'] = $userdata['newusername'];
78
+    $usernamedata['oldusername'] = $_POST['oldusername'];
79
+    $usersettings = array_merge($usersettings, $userdata);
80
+    $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : "";
81
+    extract($usersettings, EXTR_OVERWRITE);
82 82
 }
83 83
 
84 84
 // include the country list language file
85 85
 $_country_lang = array();
86 86
 include_once "lang/country/english_country.inc.php";
87 87
 if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
88
-	include_once "lang/country/" . $manager_language . "_country.inc.php";
88
+    include_once "lang/country/" . $manager_language . "_country.inc.php";
89 89
 }
90 90
 asort($_country_lang);
91 91
 
92 92
 $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block';
93 93
 if($which_browser == 'default') {
94
-	$which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
94
+    $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
95 95
 }
96 96
 ?>
97 97
 <script type="text/javascript">
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
 <form action="index.php?a=32" method="post" name="userform">
202 202
 	<?php
203 203
 
204
-	// invoke OnUserFormPrerender event
205
-	$evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
206
-		"id" => $user
207
-	));
208
-	if(is_array($evtOut)) {
209
-		echo implode("", $evtOut);
210
-	}
211
-	?>
204
+    // invoke OnUserFormPrerender event
205
+    $evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
206
+        "id" => $user
207
+    ));
208
+    if(is_array($evtOut)) {
209
+        echo implode("", $evtOut);
210
+    }
211
+    ?>
212 212
 	<input type="hidden" name="mode" value="<?php echo $modx->manager->action; ?>">
213 213
 	<input type="hidden" name="id" value="<?php echo $user ?>">
214 214
 	<input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" />
@@ -301,21 +301,21 @@  discard block
 block discarded – undo
301 301
 						<td>&nbsp;</td>
302 302
 						<td><?php
303 303
 
304
-							$rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1');
305
-							?>
304
+                            $rs = $modx->db->select('name, id', '[+prefix+]user_roles', ($modx->hasPermission('save_role')) ? '' : 'id != 1');
305
+                            ?>
306 306
 							<select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px">
307 307
 								<?php
308
-								while($row = $modx->db->getRow($rs)) {
309
-									if($modx->manager->action == '11') {
310
-										$selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
311
-									} else {
312
-										$selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
313
-									}
314
-									?>
308
+                                while($row = $modx->db->getRow($rs)) {
309
+                                    if($modx->manager->action == '11') {
310
+                                        $selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
311
+                                    } else {
312
+                                        $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
313
+                                    }
314
+                                    ?>
315 315
 									<option value="<?php echo $row['id']; ?>"<?php echo $selectedtext; ?>><?php echo $row['name']; ?></option>
316 316
 									<?php
317
-								}
318
-								?>
317
+                                }
318
+                                ?>
319 319
 							</select></td>
320 320
 					</tr>
321 321
 					<tr>
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
361 361
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
362 362
 								<?php
363
-								foreach($_country_lang as $key => $country) {
364
-									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
365
-								}
366
-								?>
363
+                                foreach($_country_lang as $key => $country) {
364
+                                    echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
365
+                                }
366
+                                ?>
367 367
 							</select></td>
368 368
 					</tr>
369 369
 					<tr>
@@ -439,21 +439,21 @@  discard block
 block discarded – undo
439 439
 						<td><select name="manager_language" class="inputBox" onChange="documentDirty=true">
440 440
 								<option value=""></option>
441 441
 								<?php
442
-								$activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
443
-								$dir = dir("includes/lang");
444
-								while($file = $dir->read()) {
445
-									if(strpos($file, ".inc.php") > 0) {
446
-										$endpos = strpos($file, ".");
447
-										$languagename = substr($file, 0, $endpos);
448
-										$selectedtext = $languagename == $activelang ? "selected='selected'" : "";
449
-										?>
442
+                                $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
443
+                                $dir = dir("includes/lang");
444
+                                while($file = $dir->read()) {
445
+                                    if(strpos($file, ".inc.php") > 0) {
446
+                                        $endpos = strpos($file, ".");
447
+                                        $languagename = substr($file, 0, $endpos);
448
+                                        $selectedtext = $languagename == $activelang ? "selected='selected'" : "";
449
+                                        ?>
450 450
 										<option value="<?php echo $languagename; ?>" <?php echo $selectedtext; ?>><?php echo ucwords(str_replace("_", " ", $languagename)); ?></option>
451 451
 										<?php
452 452
 
453
-									}
454
-								}
455
-								$dir->close();
456
-								?>
453
+                                    }
454
+                                }
455
+                                $dir->close();
456
+                                ?>
457 457
 							</select></td>
458 458
 					</tr>
459 459
 					<tr>
@@ -528,22 +528,22 @@  discard block
 block discarded – undo
528 528
 						<td><select name="manager_theme" class="inputBox" onChange="documentDirty=true;document.userform.theme_refresher.value = Date.parse(new Date());">
529 529
 								<option value=""></option>
530 530
 								<?php
531
-								$dir = dir("media/style/");
532
-								while($file = $dir->read()) {
533
-									if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
534
-										$themename = $file;
535
-										if($themename === 'common') {
536
-											continue;
537
-										}
538
-										$attr = 'value="' . $themename . '" ';
539
-										if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
540
-											$attr .= 'selected="selected" ';
541
-										}
542
-										echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
543
-									}
544
-								}
545
-								$dir->close();
546
-								?>
531
+                                $dir = dir("media/style/");
532
+                                while($file = $dir->read()) {
533
+                                    if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
534
+                                        $themename = $file;
535
+                                        if($themename === 'common') {
536
+                                            continue;
537
+                                        }
538
+                                        $attr = 'value="' . $themename . '" ';
539
+                                        if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
540
+                                            $attr .= 'selected="selected" ';
541
+                                        }
542
+                                        echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
543
+                                    }
544
+                                }
545
+                                $dir->close();
546
+                                ?>
547 547
 							</select>
548 548
 							<input type="hidden" name="theme_refresher" value=""></td>
549 549
 					</tr>
@@ -579,15 +579,15 @@  discard block
 block discarded – undo
579 579
 						<th><?php echo $_lang["which_browser_title"] ?></th>
580 580
 						<td><select name="which_browser" class="inputBox" onChange="documentDirty=true;">
581 581
 								<?php
582
-								$selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
583
-								echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
584
-								foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
585
-									$dir = str_replace('\\', '/', $dir);
586
-									$browser_name = substr($dir, strrpos($dir, '/') + 1);
587
-									$selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
588
-									echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
589
-								}
590
-								?>
582
+                                $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
583
+                                echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
584
+                                foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
585
+                                    $dir = str_replace('\\', '/', $dir);
586
+                                    $browser_name = substr($dir, strrpos($dir, '/') + 1);
587
+                                    $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
588
+                                    echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
589
+                                }
590
+                                ?>
591 591
 							</select></td>
592 592
 					</tr>
593 593
 					<tr>
@@ -664,17 +664,17 @@  discard block
 block discarded – undo
664 664
 								<option value=""></option>
665 665
 								<?php
666 666
 
667
-								$edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : '';
668
-								// invoke OnRichTextEditorRegister event
669
-								$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
670
-								echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
671
-								if(is_array($evtOut)) {
672
-									for($i = 0; $i < count($evtOut); $i++) {
673
-										$editor = $evtOut[$i];
674
-										echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
675
-									}
676
-								}
677
-								?>
667
+                                $edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : '';
668
+                                // invoke OnRichTextEditorRegister event
669
+                                $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
670
+                                echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
671
+                                if(is_array($evtOut)) {
672
+                                    for($i = 0; $i < count($evtOut); $i++) {
673
+                                        $editor = $evtOut[$i];
674
+                                        echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
675
+                                    }
676
+                                }
677
+                                ?>
678 678
 							</select></td>
679 679
 					</tr>
680 680
 					<tr id='editorRow1' style="display: <?php echo $use_editor == 1 ? $displayStyle : 'none'; ?>">
@@ -707,12 +707,12 @@  discard block
 block discarded – undo
707 707
 					</tr>
708 708
 				</table>
709 709
 				<?php
710
-				// invoke OnInterfaceSettingsRender event
711
-				$evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
712
-				if(is_array($evtOut)) {
713
-					echo implode("", $evtOut);
714
-				}
715
-				?>
710
+                // invoke OnInterfaceSettingsRender event
711
+                $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
712
+                if(is_array($evtOut)) {
713
+                    echo implode("", $evtOut);
714
+                }
715
+                ?>
716 716
 			</div>
717 717
 
718 718
 			<!-- Photo -->
@@ -761,39 +761,39 @@  discard block
 block discarded – undo
761 761
 			</div>
762 762
 			<?php if($use_udperms == 1) {
763 763
 
764
-			$groupsarray = array();
765
-
766
-			if($modx->manager->action == '12') { // only do this bit if the user is being edited
767
-				$rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
768
-				$groupsarray = $modx->db->getColumn('user_group', $rs);
769
-			}
770
-			// retain selected doc groups between post
771
-			if(is_array($_POST['user_groups'])) {
772
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
773
-			}
774
-			?>
764
+            $groupsarray = array();
765
+
766
+            if($modx->manager->action == '12') { // only do this bit if the user is being edited
767
+                $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
768
+                $groupsarray = $modx->db->getColumn('user_group', $rs);
769
+            }
770
+            // retain selected doc groups between post
771
+            if(is_array($_POST['user_groups'])) {
772
+                foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
773
+            }
774
+            ?>
775 775
 			<div class="tab-page" id="tabAccess">
776 776
 				<h2 class="tab"><?php echo $_lang["access_permissions"] ?></h2>
777 777
 				<script type="text/javascript">tpUser.addTabPage(document.getElementById("tabAccess"));</script>
778 778
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
779 779
 				<?php
780
-				$rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
781
-				while($row = $modx->db->getRow($rs)) {
782
-					echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
783
-				}
784
-				}
785
-				?>
780
+                $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
781
+                while($row = $modx->db->getRow($rs)) {
782
+                    echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
783
+                }
784
+                }
785
+                ?>
786 786
 			</div>
787 787
 		</div>
788 788
 	</div>
789 789
 	<input type="submit" name="save" style="display:none">
790 790
 	<?php
791
-	// invoke OnUserFormRender event
792
-	$evtOut = $modx->invokeEvent("OnUserFormRender", array(
793
-		"id" => $user
794
-	));
795
-	if(is_array($evtOut)) {
796
-		echo implode("", $evtOut);
797
-	}
798
-	?>
791
+    // invoke OnUserFormRender event
792
+    $evtOut = $modx->invokeEvent("OnUserFormRender", array(
793
+        "id" => $user
794
+    ));
795
+    if(is_array($evtOut)) {
796
+        echo implode("", $evtOut);
797
+    }
798
+    ?>
799 799
 </form>
Please login to merge, or discard this patch.
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,18 +4,18 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 switch($modx->manager->action) {
7
-	case 12:
8
-		if(!$modx->hasPermission('edit_user')) {
9
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
-		}
11
-		break;
12
-	case 11:
13
-		if(!$modx->hasPermission('new_user')) {
14
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
-		}
16
-		break;
17
-	default:
18
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+	    case 12:
8
+		    if(!$modx->hasPermission('edit_user')) {
9
+			    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
+		    }
11
+		    break;
12
+	    case 11:
13
+		    if(!$modx->hasPermission('new_user')) {
14
+			    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+		    }
16
+		    break;
17
+	    default:
18
+		    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21 21
 $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  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
-switch($modx->manager->action) {
6
+switch ($modx->manager->action) {
7 7
 	case 12:
8
-		if(!$modx->hasPermission('edit_user')) {
8
+		if (!$modx->hasPermission('edit_user')) {
9 9
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10 10
 		}
11 11
 		break;
12 12
 	case 11:
13
-		if(!$modx->hasPermission('new_user')) {
13
+		if (!$modx->hasPermission('new_user')) {
14 14
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15 15
 		}
16 16
 		break;
@@ -18,20 +18,20 @@  discard block
 block discarded – undo
18 18
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$user = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 // check to see the snippet editor isn't locked
24
-$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
25
-if($username = $modx->db->getValue($rs)) {
24
+$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='".$modx->getLoginUserID()."'");
25
+if ($username = $modx->db->getValue($rs)) {
26 26
 	$modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user"));
27 27
 }
28 28
 // end check for lock
29 29
 
30
-if($modx->manager->action == '12') {
30
+if ($modx->manager->action == '12') {
31 31
 	// get user attribute
32 32
 	$rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33 33
 	$userdata = $modx->db->getRow($rs);
34
-	if(!$userdata) {
34
+	if (!$userdata) {
35 35
 		$modx->webAlertAndQuit("No user returned!");
36 36
 	}
37 37
 
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 	// get user settings
40 40
 	$rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
41 41
 	$usersettings = array();
42
-	while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
42
+	while ($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
43 43
 	// manually extract so that user display settings are not overwritten
44
-	foreach($usersettings as $k => $v) {
45
-		if($k != 'manager_language' && $k != 'manager_theme') {
44
+	foreach ($usersettings as $k => $v) {
45
+		if ($k != 'manager_language' && $k != 'manager_theme') {
46 46
 			${$k} = $v;
47 47
 		}
48 48
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	// get user name
51 51
 	$rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
52 52
 	$usernamedata = $modx->db->getRow($rs);
53
-	if(!$usernamedata) {
53
+	if (!$usernamedata) {
54 54
 		$modx->webAlertAndQuit("No user returned while getting username!");
55 55
 	}
56 56
 	$_SESSION['itemname'] = $usernamedata['username'];
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 }
63 63
 
64 64
 // avoid doubling htmlspecialchars (already encoded in DB)
65
-foreach($userdata as $key => $val) {
65
+foreach ($userdata as $key => $val) {
66 66
 	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
67 67
 };
68 68
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
69 69
 
70 70
 // restore saved form
71 71
 $formRestored = false;
72
-if($modx->manager->hasFormValues()) {
72
+if ($modx->manager->hasFormValues()) {
73 73
 	$modx->manager->loadFormValues();
74 74
 	// restore post values
75 75
 	$userdata = array_merge($userdata, $_POST);
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
 // include the country list language file
85 85
 $_country_lang = array();
86 86
 include_once "lang/country/english_country.inc.php";
87
-if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
88
-	include_once "lang/country/" . $manager_language . "_country.inc.php";
87
+if ($manager_language != "english" && file_exists($modx->config['site_manager_path']."includes/lang/country/".$manager_language."_country.inc.php")) {
88
+	include_once "lang/country/".$manager_language."_country.inc.php";
89 89
 }
90 90
 asort($_country_lang);
91 91
 
92 92
 $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block';
93
-if($which_browser == 'default') {
93
+if ($which_browser == 'default') {
94 94
 	$which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
95 95
 }
96 96
 ?>
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 			document.userform.save.click();
183 183
 		},
184 184
 		delete: function() {
185
-			<?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
185
+			<?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
186 186
 			alert("<?php echo $_lang['alert_delete_self']; ?>");
187 187
 			<?php } else { ?>
188 188
 			if(confirm("<?php echo $_lang['confirm_delete_user']; ?>") === true) {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	$evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
206 206
 		"id" => $user
207 207
 	));
208
-	if(is_array($evtOut)) {
208
+	if (is_array($evtOut)) {
209 209
 		echo implode("", $evtOut);
210 210
 	}
211 211
 	?>
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	<input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" />
215 215
 
216 216
 	<h1>
217
-        <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'] . '<small>(' . $usernamedata['id'] . ')</small>' : $_lang['user_title']) ?>
217
+        <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'].'<small>('.$usernamedata['id'].')</small>' : $_lang['user_title']) ?>
218 218
     </h1>
219 219
 
220 220
 	<?php echo $_style['actionbuttons']['dynamic']['user'] ?>
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 				<table border="0" cellspacing="0" cellpadding="3" class="table table--edit table--editUser">
233 233
 					<tr>
234 234
 						<td colspan="3"><span id="blocked" class="warning">
235
-							<?php if($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
235
+							<?php if ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
236 236
 								<?php echo $_lang['user_is_blocked']; ?>
237 237
 							<?php } ?>
238 238
 							</span>
239 239
 							<br /></td>
240 240
 					</tr>
241
-					<?php if(!empty($userdata['id'])) { ?>
241
+					<?php if (!empty($userdata['id'])) { ?>
242 242
 						<tr id="showname" style="display: <?php echo ($modx->manager->action == '12' && (!isset($usernamedata['oldusername']) || $usernamedata['oldusername'] == $usernamedata['username'])) ? $displayStyle : 'none'; ?> ">
243 243
 							<td colspan="3"><i class="<?php echo $_style["icons_user"] ?>"></i>&nbsp;<b><?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?></b> - <span class="comment"><a href="javascript:;" onClick="changeName();return false;"><?php echo $_lang["change_name"]; ?></a></span>
244 244
 								<input type="hidden" name="oldusername" value="<?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?>" />
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 						<td><input type="text" name="newusername" class="inputBox" value="<?php echo $modx->htmlspecialchars($usernamedata['username']); ?>" onChange='documentDirty=true;' maxlength="100" /></td>
252 252
 					</tr>
253 253
 					<tr>
254
-						<th><?php echo $modx->manager->action == '11' ? $_lang['password'] . ":" : $_lang['change_password_new'] . ":"; ?></th>
254
+						<th><?php echo $modx->manager->action == '11' ? $_lang['password'].":" : $_lang['change_password_new'].":"; ?></th>
255 255
 						<td>&nbsp;</td>
256 256
 						<td><input name="newpasswordcheck" type="checkbox" onClick="changestate(document.userform.newpassword);changePasswordState(document.userform.newpassword);"<?php echo $modx->manager->action == "11" ? " checked disabled" : ""; ?>>
257 257
 							<input type="hidden" name="newpassword" value="<?php echo $modx->manager->action == "11" ? 1 : 0; ?>" onChange="documentDirty=true;" />
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 							?>
306 306
 							<select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px">
307 307
 								<?php
308
-								while($row = $modx->db->getRow($rs)) {
309
-									if($modx->manager->action == '11') {
308
+								while ($row = $modx->db->getRow($rs)) {
309
+									if ($modx->manager->action == '11') {
310 310
 										$selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
311 311
 									} else {
312 312
 										$selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
361 361
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
362 362
 								<?php
363
-								foreach($_country_lang as $key => $country) {
364
-									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
363
+								foreach ($_country_lang as $key => $country) {
364
+									echo "<option value=\"$key\"".(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').">$country</option>";
365 365
 								}
366 366
 								?>
367 367
 							</select></td>
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 						<td>&nbsp;</td>
388 388
 						<td><textarea type="text" name="comment" class="inputBox" rows="5" onChange="documentDirty=true;"><?php echo $modx->htmlspecialchars($userdata['comment']); ?></textarea></td>
389 389
 					</tr>
390
-					<?php if($modx->manager->action == '12') { ?>
390
+					<?php if ($modx->manager->action == '12') { ?>
391 391
 						<tr>
392 392
 							<th><?php echo $_lang['user_logincount']; ?>:</th>
393 393
 							<td>&nbsp;</td>
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 						</tr>
425 425
 					<?php } ?>
426 426
 				</table>
427
-				<?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
427
+				<?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
428 428
 					<p><?php echo $_lang['user_edit_self_msg']; ?></p>
429 429
 				<?php } ?>
430 430
 			</div>
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 								<?php
442 442
 								$activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
443 443
 								$dir = dir("includes/lang");
444
-								while($file = $dir->read()) {
445
-									if(strpos($file, ".inc.php") > 0) {
444
+								while ($file = $dir->read()) {
445
+									if (strpos($file, ".inc.php") > 0) {
446 446
 										$endpos = strpos($file, ".");
447 447
 										$languagename = substr($file, 0, $endpos);
448 448
 										$selectedtext = $languagename == $activelang ? "selected='selected'" : "";
@@ -529,17 +529,17 @@  discard block
 block discarded – undo
529 529
 								<option value=""></option>
530 530
 								<?php
531 531
 								$dir = dir("media/style/");
532
-								while($file = $dir->read()) {
533
-									if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
532
+								while ($file = $dir->read()) {
533
+									if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
534 534
 										$themename = $file;
535
-										if($themename === 'common') {
535
+										if ($themename === 'common') {
536 536
 											continue;
537 537
 										}
538
-										$attr = 'value="' . $themename . '" ';
539
-										if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
538
+										$attr = 'value="'.$themename.'" ';
539
+										if (isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
540 540
 											$attr .= 'selected="selected" ';
541 541
 										}
542
-										echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
542
+										echo "\t\t<option ".rtrim($attr).'>'.ucwords(str_replace("_", " ", $themename))."</option>\n";
543 543
 									}
544 544
 								}
545 545
 								$dir->close();
@@ -580,12 +580,12 @@  discard block
 block discarded – undo
580 580
 						<td><select name="which_browser" class="inputBox" onChange="documentDirty=true;">
581 581
 								<?php
582 582
 								$selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
583
-								echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
584
-								foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
583
+								echo '<option value="default"'.$selected.'>'.$_lang['option_default']."</option>\n";
584
+								foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
585 585
 									$dir = str_replace('\\', '/', $dir);
586 586
 									$browser_name = substr($dir, strrpos($dir, '/') + 1);
587 587
 									$selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
588
-									echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
588
+									echo '<option value="'.$browser_name.'"'.$selected.'>'."{$browser_name}</option>\n";
589 589
 								}
590 590
 								?>
591 591
 							</select></td>
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 					</tr>
613 613
 					<tr>
614 614
 						<td>&nbsp;</td>
615
-						<td class='comment'><?php echo $_lang["uploadable_images_message"] . $_lang["user_upload_message"] ?></td>
615
+						<td class='comment'><?php echo $_lang["uploadable_images_message"].$_lang["user_upload_message"] ?></td>
616 616
 					</tr>
617 617
 					<tr>
618 618
 						<th><?php echo $_lang["uploadable_media_title"] ?></th>
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 					</tr>
625 625
 					<tr>
626 626
 						<td>&nbsp;</td>
627
-						<td class='comment'><?php echo $_lang["uploadable_media_message"] . $_lang["user_upload_message"] ?></td>
627
+						<td class='comment'><?php echo $_lang["uploadable_media_message"].$_lang["user_upload_message"] ?></td>
628 628
 					</tr>
629 629
 					<tr>
630 630
 						<th><?php echo $_lang["uploadable_flash_title"] ?></th>
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 					</tr>
637 637
 					<tr>
638 638
 						<td>&nbsp;</td>
639
-						<td class='comment'><?php echo $_lang["uploadable_flash_message"] . $_lang["user_upload_message"] ?></td>
639
+						<td class='comment'><?php echo $_lang["uploadable_flash_message"].$_lang["user_upload_message"] ?></td>
640 640
 					</tr>
641 641
 					<tr>
642 642
 						<th><?php echo $_lang["uploadable_files_title"] ?></th>
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 					</tr>
649 649
 					<tr>
650 650
 						<td>&nbsp;</td>
651
-						<td class='comment'><?php echo $_lang["uploadable_files_message"] . $_lang["user_upload_message"] ?></td>
651
+						<td class='comment'><?php echo $_lang["uploadable_files_message"].$_lang["user_upload_message"] ?></td>
652 652
 					</tr>
653 653
 					<tr class='row2'>
654 654
 						<th><?php echo $_lang["upload_maxsize_title"] ?></th>
@@ -667,11 +667,11 @@  discard block
 block discarded – undo
667 667
 								$edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : '';
668 668
 								// invoke OnRichTextEditorRegister event
669 669
 								$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
670
-								echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
671
-								if(is_array($evtOut)) {
672
-									for($i = 0; $i < count($evtOut); $i++) {
670
+								echo "<option value='none'".($edt == 'none' ? " selected='selected'" : "").">".$_lang["none"]."</option>\n";
671
+								if (is_array($evtOut)) {
672
+									for ($i = 0; $i < count($evtOut); $i++) {
673 673
 										$editor = $evtOut[$i];
674
-										echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
674
+										echo "<option value='$editor'".($edt == $editor ? " selected='selected'" : "").">$editor</option>\n";
675 675
 									}
676 676
 								}
677 677
 								?>
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 				<?php
710 710
 				// invoke OnInterfaceSettingsRender event
711 711
 				$evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
712
-				if(is_array($evtOut)) {
712
+				if (is_array($evtOut)) {
713 713
 					echo implode("", $evtOut);
714 714
 				}
715 715
 				?>
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 					function BrowseServer() {
737 737
 						var w = screen.width * 0.7;
738 738
 						var h = screen.height * 0.7;
739
-						OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h);
739
+						OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h);
740 740
 					}
741 741
 
742 742
 					function SetUrl(url, width, height, alt) {
@@ -759,17 +759,17 @@  discard block
 block discarded – undo
759 759
 					</tr>
760 760
 				</table>
761 761
 			</div>
762
-			<?php if($use_udperms == 1) {
762
+			<?php if ($use_udperms == 1) {
763 763
 
764 764
 			$groupsarray = array();
765 765
 
766
-			if($modx->manager->action == '12') { // only do this bit if the user is being edited
766
+			if ($modx->manager->action == '12') { // only do this bit if the user is being edited
767 767
 				$rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
768 768
 				$groupsarray = $modx->db->getColumn('user_group', $rs);
769 769
 			}
770 770
 			// retain selected doc groups between post
771
-			if(is_array($_POST['user_groups'])) {
772
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
771
+			if (is_array($_POST['user_groups'])) {
772
+				foreach ($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
773 773
 			}
774 774
 			?>
775 775
 			<div class="tab-page" id="tabAccess">
@@ -778,8 +778,8 @@  discard block
 block discarded – undo
778 778
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
779 779
 				<?php
780 780
 				$rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
781
-				while($row = $modx->db->getRow($rs)) {
782
-					echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
781
+				while ($row = $modx->db->getRow($rs)) {
782
+					echo "<label><input type='checkbox' name='user_groups[]' value='".$row['id']."'".(in_array($row['id'], $groupsarray) ? " checked='checked'" : "")." />".$row['name']."</label><br />";
783 783
 				}
784 784
 				}
785 785
 				?>
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 	$evtOut = $modx->invokeEvent("OnUserFormRender", array(
793 793
 		"id" => $user
794 794
 	));
795
-	if(is_array($evtOut)) {
795
+	if (is_array($evtOut)) {
796 796
 		echo implode("", $evtOut);
797 797
 	}
798 798
 	?>
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,9 @@  discard block
 block discarded – undo
39 39
 	// get user settings
40 40
 	$rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
41 41
 	$usersettings = array();
42
-	while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
42
+	while($row = $modx->db->getRow($rs)) {
43
+	    $usersettings[$row['setting_name']] = $row['setting_value'];
44
+	}
43 45
 	// manually extract so that user display settings are not overwritten
44 46
 	foreach($usersettings as $k => $v) {
45 47
 		if($k != 'manager_language' && $k != 'manager_theme') {
@@ -763,13 +765,16 @@  discard block
 block discarded – undo
763 765
 
764 766
 			$groupsarray = array();
765 767
 
766
-			if($modx->manager->action == '12') { // only do this bit if the user is being edited
768
+			if($modx->manager->action == '12') {
769
+// only do this bit if the user is being edited
767 770
 				$rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
768 771
 				$groupsarray = $modx->db->getColumn('user_group', $rs);
769 772
 			}
770 773
 			// retain selected doc groups between post
771 774
 			if(is_array($_POST['user_groups'])) {
772
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
775
+				foreach($_POST['user_groups'] as $n => $v) {
776
+				    $groupsarray[] = $v;
777
+				}
773 778
 			}
774 779
 			?>
775 780
 			<div class="tab-page" id="tabAccess">
Please login to merge, or discard this patch.