Completed
Push — develop ( cb7ecf...5e631f )
by Dmytro
17s
created
manager/includes/categories.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     $newCat = $modx->getDatabase()->escape($newCat);
35 35
     $cats = $modx->getDatabase()->select('id', $modx->getFullTableName('categories'), "category='{$newCat}'");
36 36
     if ($cat = $modx->getDatabase()->getValue($cats)) {
37
-        return (int)$cat;
37
+        return (int) $cat;
38 38
     }
39 39
 
40 40
     return 0;
Please login to merge, or discard this patch.
manager/includes/accesscontrol.inc.php 1 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 . 'captcha.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.'captcha.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->getDatabase()->query($sql);
232 232
     }
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_moduser.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-$userid = (int)$value;
2
+$userid = (int) $value;
3 3
 if (!isset($modx->getModifiers()->cache['ui'][$userid])) {
4 4
     if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid));
5 5
     else             $user = $modx->getUserInfo($userid);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 $userid = (int)$value;
3 3
 if (!isset($modx->getModifiers()->cache['ui'][$userid])) {
4
-    if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid));
5
-    else             $user = $modx->getUserInfo($userid);
4
+    if ($userid < 0) {
5
+        $user = $modx->getWebUserInfo(abs($userid));
6
+    } else {
7
+        $user = $modx->getUserInfo($userid);
8
+    }
6 9
     $modx->getModifiers()->cache['ui'][$userid] = $user;
7 10
 } else {
8 11
     $user = $modx->getModifiers()->cache['ui'][$userid];
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_summary.inc.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,43 +1,43 @@
 block discarded – undo
1 1
 <?php
2
-if(strpos($opt,',')) list($limit,$delim) = explode(',', $opt);
3
-elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';}
4
-else {$limit=124;$delim='';}
2
+if (strpos($opt, ',')) list($limit, $delim) = explode(',', $opt);
3
+elseif (preg_match('/^[1-9][0-9]*$/', $opt)) {$limit = $opt; $delim = ''; }
4
+else {$limit = 124; $delim = ''; }
5 5
 
6
-if($delim==='') $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.';
7
-$limit = (int)$limit;
6
+if ($delim === '') $delim = $modx->config['manager_language'] === 'japanese-utf8' ? '。' : '.';
7
+$limit = (int) $limit;
8 8
 
9 9
 $content = $modx->getModifiers()->parseDocumentSource($value);
10 10
 
11 11
 $content = strip_tags($content);
12 12
 
13
-$content = str_replace(array("\r\n","\r","\n","\t",'&nbsp;'),' ',$content);
14
-if(preg_match('/\s+/',$content))
15
-    $content = preg_replace('/\s+/',' ',$content);
13
+$content = str_replace(array("\r\n", "\r", "\n", "\t", '&nbsp;'), ' ', $content);
14
+if (preg_match('/\s+/', $content))
15
+    $content = preg_replace('/\s+/', ' ', $content);
16 16
 $content = trim($content);
17 17
 
18 18
 $pos = $modx->getModifiers()->strpos($content, $delim);
19 19
 
20
-if($pos!==false && $pos<$limit) {
20
+if ($pos !== false && $pos < $limit) {
21 21
     $_ = explode($delim, $content);
22 22
     $text = '';
23
-    foreach($_ as $v) {
24
-        if($limit <= $modx->getModifiers()->strlen($text.$v.$delim)) break;
23
+    foreach ($_ as $v) {
24
+        if ($limit <= $modx->getModifiers()->strlen($text.$v.$delim)) break;
25 25
         $text .= $v.$delim;
26 26
     }
27
-    if($text) $content = $text;
27
+    if ($text) $content = $text;
28 28
 }
29 29
 
30
-if($limit<$modx->getModifiers()->strlen($content) && strpos($content,' ')!==false) {
30
+if ($limit < $modx->getModifiers()->strlen($content) && strpos($content, ' ') !== false) {
31 31
     $_ = explode(' ', $content);
32 32
     $text = '';
33
-    foreach($_ as $v) {
34
-        if($limit <= $modx->getModifiers()->strlen($text.$v.' ')) break;
35
-        $text .= $v . ' ';
33
+    foreach ($_ as $v) {
34
+        if ($limit <= $modx->getModifiers()->strlen($text.$v.' ')) break;
35
+        $text .= $v.' ';
36 36
     }
37
-    if($text!=='') $content = $text;
37
+    if ($text !== '') $content = $text;
38 38
 }
39 39
 
40
-if($limit < $modx->getModifiers()->strlen($content)) $content = $modx->getModifiers()->substr($content, 0, $limit);
41
-if($modx->getModifiers()->substr($content,-1)==$delim) $content = rtrim($content,$delim) . $delim;
40
+if ($limit < $modx->getModifiers()->strlen($content)) $content = $modx->getModifiers()->substr($content, 0, $limit);
41
+if ($modx->getModifiers()->substr($content, -1) == $delim) $content = rtrim($content, $delim).$delim;
42 42
 
43 43
 return $content;
Please login to merge, or discard this patch.
Braces   +28 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,9 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(strpos($opt,',')) list($limit,$delim) = explode(',', $opt);
3
-elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';}
4
-else {$limit=124;$delim='';}
2
+if(strpos($opt,',')) {
3
+    list($limit,$delim) = explode(',', $opt);
4
+} elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} else {$limit=124;$delim='';}
5 5
 
6
-if($delim==='') $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.';
6
+if($delim==='') {
7
+    $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.';
8
+}
7 9
 $limit = (int)$limit;
8 10
 
9 11
 $content = $modx->getModifiers()->parseDocumentSource($value);
@@ -11,8 +13,9 @@  discard block
 block discarded – undo
11 13
 $content = strip_tags($content);
12 14
 
13 15
 $content = str_replace(array("\r\n","\r","\n","\t",'&nbsp;'),' ',$content);
14
-if(preg_match('/\s+/',$content))
16
+if(preg_match('/\s+/',$content)) {
15 17
     $content = preg_replace('/\s+/',' ',$content);
18
+}
16 19
 $content = trim($content);
17 20
 
18 21
 $pos = $modx->getModifiers()->strpos($content, $delim);
@@ -21,23 +24,35 @@  discard block
 block discarded – undo
21 24
     $_ = explode($delim, $content);
22 25
     $text = '';
23 26
     foreach($_ as $v) {
24
-        if($limit <= $modx->getModifiers()->strlen($text.$v.$delim)) break;
27
+        if($limit <= $modx->getModifiers()->strlen($text.$v.$delim)) {
28
+            break;
29
+        }
25 30
         $text .= $v.$delim;
26 31
     }
27
-    if($text) $content = $text;
28
-}
32
+    if($text) {
33
+        $content = $text;
34
+    }
35
+    }
29 36
 
30 37
 if($limit<$modx->getModifiers()->strlen($content) && strpos($content,' ')!==false) {
31 38
     $_ = explode(' ', $content);
32 39
     $text = '';
33 40
     foreach($_ as $v) {
34
-        if($limit <= $modx->getModifiers()->strlen($text.$v.' ')) break;
41
+        if($limit <= $modx->getModifiers()->strlen($text.$v.' ')) {
42
+            break;
43
+        }
35 44
         $text .= $v . ' ';
36 45
     }
37
-    if($text!=='') $content = $text;
38
-}
46
+    if($text!=='') {
47
+        $content = $text;
48
+    }
49
+    }
39 50
 
40
-if($limit < $modx->getModifiers()->strlen($content)) $content = $modx->getModifiers()->substr($content, 0, $limit);
41
-if($modx->getModifiers()->substr($content,-1)==$delim) $content = rtrim($content,$delim) . $delim;
51
+if($limit < $modx->getModifiers()->strlen($content)) {
52
+    $content = $modx->getModifiers()->substr($content, 0, $limit);
53
+}
54
+if($modx->getModifiers()->substr($content,-1)==$delim) {
55
+    $content = rtrim($content,$delim) . $delim;
56
+}
42 57
 
43 58
 return $content;
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_memberof.inc.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,22 +2,22 @@
 block discarded – undo
2 2
 $userID = abs($modx->getLoginUserID('web'));
3 3
 $modx->qs_hash = md5($modx->qs_hash."^{$userID}^");
4 4
 
5
-$groupNames = ($this->strlen($opt) > 0 ) ? explode(',',$opt) : array();
5
+$groupNames = ($this->strlen($opt) > 0) ? explode(',', $opt) : array();
6 6
 
7 7
 // if $groupNames is not an array return false
8
-if(!is_array($groupNames)) return 0;
8
+if (!is_array($groupNames)) return 0;
9 9
 
10 10
 // Creates an array with all webgroups the user id is in
11 11
 if (isset($modx->getModifiers()->cache['mo'][$userID])) $grpNames = $modx->getModifiers()->cache['mo'][$userID];
12 12
 else {
13
-    $from = sprintf("[+prefix+]webgroup_names wgn INNER JOIN [+prefix+]web_groups wg ON wg.webgroup=wgn.id AND wg.webuser='%s'",$userID);
14
-    $rs = $modx->getDatabase()->select('wgn.name',$from);
15
-    $modx->getModifiers()->cache['mo'][$userID] = $grpNames = $modx->getDatabase()->getColumn('name',$rs);
13
+    $from = sprintf("[+prefix+]webgroup_names wgn INNER JOIN [+prefix+]web_groups wg ON wg.webgroup=wgn.id AND wg.webuser='%s'", $userID);
14
+    $rs = $modx->getDatabase()->select('wgn.name', $from);
15
+    $modx->getModifiers()->cache['mo'][$userID] = $grpNames = $modx->getDatabase()->getColumn('name', $rs);
16 16
 }
17 17
 
18 18
 // Check if a supplied group matches a webgroup from the array we just created
19
-foreach($groupNames as $k=>$v) {
20
-    if(in_array(trim($v),$grpNames)) return 1;
19
+foreach ($groupNames as $k=>$v) {
20
+    if (in_array(trim($v), $grpNames)) return 1;
21 21
 }
22 22
 
23 23
 // If we get here the above logic did not find a match, so return false
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,11 +5,14 @@  discard block
 block discarded – undo
5 5
 $groupNames = ($this->strlen($opt) > 0 ) ? explode(',',$opt) : array();
6 6
 
7 7
 // if $groupNames is not an array return false
8
-if(!is_array($groupNames)) return 0;
8
+if(!is_array($groupNames)) {
9
+    return 0;
10
+}
9 11
 
10 12
 // Creates an array with all webgroups the user id is in
11
-if (isset($modx->getModifiers()->cache['mo'][$userID])) $grpNames = $modx->getModifiers()->cache['mo'][$userID];
12
-else {
13
+if (isset($modx->getModifiers()->cache['mo'][$userID])) {
14
+    $grpNames = $modx->getModifiers()->cache['mo'][$userID];
15
+} else {
13 16
     $from = sprintf("[+prefix+]webgroup_names wgn INNER JOIN [+prefix+]web_groups wg ON wg.webgroup=wgn.id AND wg.webuser='%s'",$userID);
14 17
     $rs = $modx->getDatabase()->select('wgn.name',$from);
15 18
     $modx->getModifiers()->cache['mo'][$userID] = $grpNames = $modx->getDatabase()->getColumn('name',$rs);
@@ -17,8 +20,10 @@  discard block
 block discarded – undo
17 20
 
18 21
 // Check if a supplied group matches a webgroup from the array we just created
19 22
 foreach($groupNames as $k=>$v) {
20
-    if(in_array(trim($v),$grpNames)) return 1;
21
-}
23
+    if(in_array(trim($v),$grpNames)) {
24
+        return 1;
25
+    }
26
+    }
22 27
 
23 28
 // If we get here the above logic did not find a match, so return false
24 29
 return 0;
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_addbreak.inc.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 $text = $modx->getModifiers()->parseDocumentSource($value);
3
-$text = str_replace(array("\r\n","\r"),"\n",$text);
3
+$text = str_replace(array("\r\n", "\r"), "\n", $text);
4 4
 
5 5
 $blockElms  = 'br,table,tbody,tr,td,th,thead,tfoot,caption,colgroup,div';
6 6
 $blockElms .= ',dl,dd,dt,ul,ol,li,pre,select,option,form,map,area,blockquote';
7 7
 $blockElms .= ',address,math,style,input,p,h1,h2,h3,h4,h5,h6,hr,object,param,embed';
8 8
 $blockElms .= ',noframes,noscript,section,article,aside,hgroup,footer,address,code';
9 9
 $blockElms = explode(',', $blockElms);
10
-$lines = explode("\n",$text);
10
+$lines = explode("\n", $text);
11 11
 $c = count($lines);
12
-foreach($lines as $i=>$line)
12
+foreach ($lines as $i=>$line)
13 13
 {
14 14
     $line = rtrim($line);
15
-    if($i===$c-1) break;
16
-    foreach($blockElms as $block)
15
+    if ($i === $c - 1) break;
16
+    foreach ($blockElms as $block)
17 17
     {
18
-        if(preg_match("@</?{$block}" . '[^>]*>$@',$line))
18
+        if (preg_match("@</?{$block}".'[^>]*>$@', $line))
19 19
             continue 2;
20 20
     }
21 21
     $lines[$i] = "{$line}<br />";
Please login to merge, or discard this patch.
manager/includes/functions/processors.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     }
37 37
 }
38 38
 
39
-if(!function_exists('duplicateDocument')) {
39
+if (!function_exists('duplicateDocument')) {
40 40
     /**
41 41
      * @param int $docid
42 42
      * @param null|int $parent
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
             $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('pagetitle', $modx->getFullTableName('site_content'),
91 91
                 "pagetitle LIKE '{$pagetitle} Duplicate%'"));
92 92
             if ($count >= 1) {
93
-                $count = ' ' . ($count + 1);
93
+                $count = ' '.($count + 1);
94 94
             } else {
95 95
                 $count = '';
96 96
             }
97 97
 
98
-            $content['pagetitle'] = $_lang['duplicated_el_suffix'] . $count . ' ' . $content['pagetitle'];
98
+            $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle'];
99 99
             $content['alias'] = null;
100 100
         } elseif ($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) {
101 101
             $content['alias'] = null;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     }
154 154
 }
155 155
 
156
-if(!function_exists('duplicateTVs')) {
156
+if (!function_exists('duplicateTVs')) {
157 157
     /**
158 158
      * Duplicate Document TVs
159 159
      *
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 
167 167
         $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues');
168 168
 
169
-        $newid = (int)$newid;
170
-        $oldid = (int)$oldid;
169
+        $newid = (int) $newid;
170
+        $oldid = (int) $oldid;
171 171
 
172 172
         $modx->getDatabase()->insert(
173 173
             array('contentid' => '', 'tmplvarid' => '', 'value' => ''), $tbltvc, // Insert into
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     }
177 177
 }
178 178
 
179
-if(!function_exists('duplicateAccess')) {
179
+if (!function_exists('duplicateAccess')) {
180 180
     /**
181 181
      * Duplicate Document Access Permissions
182 182
      *
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 
190 190
         $tbldg = $modx->getFullTableName('document_groups');
191 191
 
192
-        $newid = (int)$newid;
193
-        $oldid = (int)$oldid;
192
+        $newid = (int) $newid;
193
+        $oldid = (int) $oldid;
194 194
 
195 195
         $modx->getDatabase()->insert(
196 196
             array('document' => '', 'document_group' => ''), $tbldg, // Insert into
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     }
200 200
 }
201 201
 
202
-if(!function_exists('evalModule')) {
202
+if (!function_exists('evalModule')) {
203 203
     /**
204 204
      * evalModule
205 205
      *
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
             }
236 236
             if ($modx->config['error_reporting'] === '99' || 2 < $error_level) {
237 237
                 $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'],
238
-                    $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg);
238
+                    $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg);
239 239
                 $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>");
240 240
             }
241 241
         }
242 242
         unset($modx->event->params);
243 243
 
244
-        return $mod . $msg;
244
+        return $mod.$msg;
245 245
     }
246 246
 }
247 247
 
248
-if(!function_exists('allChildren')) {
248
+if (!function_exists('allChildren')) {
249 249
     /**
250 250
      * @param int $currDocID
251 251
      * @return array
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     }
266 266
 }
267 267
 
268
-if(!function_exists('jsAlert')) {
268
+if (!function_exists('jsAlert')) {
269 269
     /**
270 270
      * show javascript alert
271 271
      *
@@ -275,14 +275,14 @@  discard block
 block discarded – undo
275 275
     {
276 276
         $modx = evolutionCMS();
277 277
         if ($_POST['ajax'] != 1) {
278
-            echo "<script>window.setTimeout(\"alert('" . addslashes($modx->getDatabase()->escape($msg)) . "')\",10);history.go(-1)</script>";
278
+            echo "<script>window.setTimeout(\"alert('".addslashes($modx->getDatabase()->escape($msg))."')\",10);history.go(-1)</script>";
279 279
         } else {
280
-            echo $msg . "\n";
280
+            echo $msg."\n";
281 281
         }
282 282
     }
283 283
 }
284 284
 
285
-if(!function_exists('login')) {
285
+if (!function_exists('login')) {
286 286
     /**
287 287
      * @param string $username
288 288
      * @param string $givenPassword
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     }
298 298
 }
299 299
 
300
-if(!function_exists('loginV1')) {
300
+if (!function_exists('loginV1')) {
301 301
     /**
302 302
      * @param int $internalKey
303 303
      * @param string $givenPassword
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
     }
331 331
 }
332 332
 
333
-if(!function_exists('loginMD5')) {
333
+if (!function_exists('loginMD5')) {
334 334
     /**
335 335
      * @param int $internalKey
336 336
      * @param string $givenPassword
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
     }
352 352
 }
353 353
 
354
-if(!function_exists('updateNewHash')) {
354
+if (!function_exists('updateNewHash')) {
355 355
     /**
356 356
      * @param string $username
357 357
      * @param string $password
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
     }
367 367
 }
368 368
 
369
-if(!function_exists('incrementFailedLoginCount')) {
369
+if (!function_exists('incrementFailedLoginCount')) {
370 370
     /**
371 371
      * @param int $internalKey
372 372
      * @param int $failedlogins
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
         if ($failedlogins < $failed_allowed) {
391 391
             //sleep to help prevent brute force attacks
392
-            $sleep = (int)$failedlogins / 2;
392
+            $sleep = (int) $failedlogins / 2;
393 393
             if ($sleep > 5) {
394 394
                 $sleep = 5;
395 395
             }
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
     }
403 403
 }
404 404
 
405
-if(!function_exists('saveUserGroupAccessPermissons')) {
405
+if (!function_exists('saveUserGroupAccessPermissons')) {
406 406
     /**
407 407
      * saves module user group access
408 408
      */
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
     }
434 434
 }
435 435
 
436
-if(!function_exists('saveEventListeners')) {
436
+if (!function_exists('saveEventListeners')) {
437 437
 # Save Plugin Event Listeners
438 438
     function saveEventListeners($id, $sysevents, $mode)
439 439
     {
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
     }
487 487
 }
488 488
 
489
-if(!function_exists('getEventIdByName')) {
489
+if (!function_exists('getEventIdByName')) {
490 490
     /**
491 491
      * @param string $name
492 492
      * @return string|int
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
     }
510 510
 }
511 511
 
512
-if(!function_exists('saveTemplateAccess')) {
512
+if (!function_exists('saveTemplateAccess')) {
513 513
     /**
514 514
      * @param int $id
515 515
      */
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
     }
549 549
 }
550 550
 
551
-if(!function_exists('saveTemplateVarAccess')) {
551
+if (!function_exists('saveTemplateVarAccess')) {
552 552
     /**
553 553
      * @return void
554 554
      */
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
     }
588 588
 }
589 589
 
590
-if(!function_exists('saveDocumentAccessPermissons')) {
590
+if (!function_exists('saveDocumentAccessPermissons')) {
591 591
     function saveDocumentAccessPermissons()
592 592
     {
593 593
         global $id, $newid;
@@ -756,10 +756,10 @@  discard block
 block discarded – undo
756 756
         }
757 757
 
758 758
         foreach ($defaults as $k) {
759
-            if (isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') {
759
+            if (isset($settings['default_'.$k]) && $settings['default_'.$k] == '1') {
760 760
                 unset($settings[$k]);
761 761
             }
762
-            unset($settings['default_' . $k]);
762
+            unset($settings['default_'.$k]);
763 763
         }
764 764
 
765 765
         $modx->getDatabase()->delete($tbl_user_settings, "user='{$id}'");
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
         global $id, $modx;
792 792
         $mode = $_POST['mode'];
793 793
         $modx->getManagerApi()->saveFormValues($mode);
794
-        $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode === $action ? "&id={$id}" : ''));
794
+        $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode === $action ? "&id={$id}" : ''));
795 795
     }
796 796
 }
797 797
 
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
         global $deltime;
808 808
 
809 809
         $rs = $modx->getDatabase()->select('id', $modx->getFullTableName('site_content'),
810
-            "parent='" . (int)$parent . "' AND deleted=1 AND deletedon='" . (int)$deltime . "'");
810
+            "parent='".(int) $parent."' AND deleted=1 AND deletedon='".(int) $deltime."'");
811 811
         // the document has children documents, we'll need to delete those too
812 812
         while ($row = $modx->getDatabase()->getRow($rs)) {
813 813
             $children[] = $row['id'];
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -380,10 +380,12 @@
 block discarded – undo
380 380
         $failedlogins += 1;
381 381
 
382 382
         $fields = array('failedlogincount' => $failedlogins);
383
-        if ($failedlogins >= $failed_allowed) //block user for too many fail attempts
383
+        if ($failedlogins >= $failed_allowed) {
384
+            //block user for too many fail attempts
384 385
         {
385 386
             $fields['blockeduntil'] = time() + ($blocked_minutes * 60);
386 387
         }
388
+        }
387 389
 
388 390
         $modx->getDatabase()->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'");
389 391
 
Please login to merge, or discard this patch.
manager/includes/functions/actions/import.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists('run')) {
2
+if (!function_exists('run')) {
3 3
     /**
4 4
      * @return string
5 5
      */
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
             $modx->getDatabase()->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1");
29 29
         }
30 30
 
31
-        $parent = (int)$_POST['parent'];
31
+        $parent = (int) $_POST['parent'];
32 32
 
33
-        if (is_dir(MODX_BASE_PATH . 'temp/import')) {
34
-            $filedir = MODX_BASE_PATH . 'temp/import/';
35
-        } elseif (is_dir(MODX_BASE_PATH . 'assets/import')) {
36
-            $filedir = MODX_BASE_PATH . 'assets/import/';
33
+        if (is_dir(MODX_BASE_PATH.'temp/import')) {
34
+            $filedir = MODX_BASE_PATH.'temp/import/';
35
+        } elseif (is_dir(MODX_BASE_PATH.'assets/import')) {
36
+            $filedir = MODX_BASE_PATH.'assets/import/';
37 37
         } else {
38 38
             $filedir = '';
39 39
         }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $files = pop_index($files);
45 45
 
46 46
         // no. of files to import
47
-        $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound);
47
+        $output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound);
48 48
 
49 49
         // import files
50 50
         if (0 < count($files)) {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $mtime = $mtime[1] + $mtime[0];
58 58
         $importend = $mtime;
59 59
         $totaltime = ($importend - $importstart);
60
-        $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3));
60
+        $output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3));
61 61
 
62 62
         if ($_POST['convert_link'] == 'on') {
63 63
             convertLink();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     }
68 68
 }
69 69
 
70
-if(!function_exists('importFiles')) {
70
+if (!function_exists('importFiles')) {
71 71
     /**
72 72
      * @param int $parent
73 73
      * @param string $filedir
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             if (is_array($value)) {
99 99
                 // create folder
100 100
                 $alias = $id;
101
-                printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias);
101
+                printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias);
102 102
                 $field = array();
103 103
                 $field['type'] = 'document';
104 104
                 $field['contentType'] = 'text/html';
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                              'index.html',
118 118
                              'index.htm'
119 119
                          ) as $filename) {
120
-                    $filepath = $filedir . $alias . '/' . $filename;
120
+                    $filepath = $filedir.$alias.'/'.$filename;
121 121
                     if ($find === false && file_exists($filepath)) {
122 122
                         $file = getFileContent($filepath);
123 123
                         list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
                         $newid = $modx->getDatabase()->insert($field, $tbl_site_content);
133 133
                         if ($newid) {
134 134
                             $find = true;
135
-                            echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
136
-                            importFiles($newid, $filedir . $alias . '/', $value, 'sub');
135
+                            echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
136
+                            importFiles($newid, $filedir.$alias.'/', $value, 'sub');
137 137
                         } else {
138
-                            echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->getDatabase()->getLastError();
138
+                            echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->getDatabase()->getLastError();
139 139
                             exit;
140 140
                         }
141 141
                     }
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
                     $newid = $modx->getDatabase()->insert($field, $tbl_site_content);
151 151
                     if ($newid) {
152 152
                         $find = true;
153
-                        echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
154
-                        importFiles($newid, $filedir . $alias . '/', $value, 'sub');
153
+                        echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
154
+                        importFiles($newid, $filedir.$alias.'/', $value, 'sub');
155 155
                     } else {
156
-                        echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->getDatabase()->getLastError();
156
+                        echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->getDatabase()->getLastError();
157 157
                         exit;
158 158
                     }
159 159
                 }
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
                 $fparts = explode('.', $value);
167 167
                 $alias = $fparts[0];
168 168
                 $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : "";
169
-                printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename);
169
+                printf("<span>".$_lang['import_site_importing_document']."</span>", $filename);
170 170
 
171 171
                 if (!in_array($ext, $allowedfiles)) {
172
-                    echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n";
172
+                    echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n";
173 173
                 } else {
174
-                    $filepath = $filedir . $filename;
174
+                    $filepath = $filedir.$filename;
175 175
                     $file = getFileContent($filepath);
176 176
                     list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
177 177
 
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
                     $field['menuindex'] = ($alias == 'index') ? 0 : 2;
198 198
                     $newid = $modx->getDatabase()->insert($field, $tbl_site_content);
199 199
                     if ($newid) {
200
-                        echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
200
+                        echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
201 201
                     } else {
202
-                        echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->getDatabase()->getLastError();
202
+                        echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->getDatabase()->getLastError();
203 203
                         exit;
204 204
                     }
205 205
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     }
219 219
 }
220 220
 
221
-if(!function_exists('getFiles')) {
221
+if (!function_exists('getFiles')) {
222 222
     /**
223 223
      * @param string $directory
224 224
      * @param array $listing
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
             foreach ($files as $file) {
235 235
                 if ($file == '.' || $file == '..') {
236 236
                     continue;
237
-                } elseif ($h = @opendir($directory . $file . "/")) {
237
+                } elseif ($h = @opendir($directory.$file."/")) {
238 238
                     closedir($h);
239 239
                     $count = -1;
240
-                    $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1);
240
+                    $listing[$file] = getFiles($directory.$file."/", array(), $count + 1);
241 241
                 } elseif (strpos($file, '.htm') !== false) {
242 242
                     $listing[$dummy] = $file;
243 243
                     $dummy = $dummy + 1;
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
                 }
246 246
             }
247 247
         } else {
248
-            echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>";
248
+            echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>";
249 249
         }
250 250
 
251 251
         return ($listing);
252 252
     }
253 253
 }
254 254
 
255
-if(!function_exists('getFileContent')) {
255
+if (!function_exists('getFileContent')) {
256 256
     /**
257 257
      * @param string $filepath
258 258
      * @return bool|string
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
         global $_lang;
263 263
         // get the file
264 264
         if (!$buffer = file_get_contents($filepath)) {
265
-            echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>";
265
+            echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>";
266 266
         } else {
267 267
             return $buffer;
268 268
         }
269 269
     }
270 270
 }
271 271
 
272
-if(!function_exists('pop_index')) {
272
+if (!function_exists('pop_index')) {
273 273
     /**
274 274
      * @param array $array
275 275
      * @return array
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     }
295 295
 }
296 296
 
297
-if(!function_exists('treatContent')) {
297
+if (!function_exists('treatContent')) {
298 298
     /**
299 299
      * @param string $src
300 300
      * @param string $filename
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         } else {
330 330
             $content = $src;
331 331
             $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i';
332
-            $r = '$1' . $modx->config['modx_charset'] . '$2';
332
+            $r = '$1'.$modx->config['modx_charset'].'$2';
333 333
             $content = preg_replace($s, $r, $content);
334 334
             $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content);
335 335
         }
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     }
346 346
 }
347 347
 
348
-if(!function_exists('convertLink')) {
348
+if (!function_exists('convertLink')) {
349 349
     /**
350 350
      * @return void
351 351
      */
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                     list($href, $v) = explode('"', $v, 2);
369 369
                     $_ = $href;
370 370
                     if (strpos($_, $modx->config['site_url']) !== false) {
371
-                        $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_);
371
+                        $_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_);
372 372
                     }
373 373
                     if ($_[0] === '/') {
374 374
                         $_ = substr($_, 1);
@@ -395,15 +395,15 @@  discard block
 block discarded – undo
395 395
                     if (strpos($_, '/') !== false) {
396 396
                         $_ = substr($_, strrpos($_, '/'));
397 397
                     }
398
-                    $_ = $dir . str_replace('.html', '', $_);
398
+                    $_ = $dir.str_replace('.html', '', $_);
399 399
                     if (!isset($target[$_])) {
400 400
                         $target[$_] = $modx->getIdFromAlias($_);
401 401
                     }
402 402
                     $target[$_] = trim($target[$_]);
403 403
                     if (!empty($target[$_])) {
404
-                        $href = '[~' . $target[$_] . '~]';
404
+                        $href = '[~'.$target[$_].'~]';
405 405
                     }
406
-                    $array[$c] = '<a href="' . $href . '"' . $v;
406
+                    $array[$c] = '<a href="'.$href.'"'.$v;
407 407
                 }
408 408
                 $c++;
409 409
             }
Please login to merge, or discard this patch.
manager/includes/functions/nodes.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!function_exists('makeHTML')) {
3
+if (!function_exists('makeHTML')) {
4 4
     /**
5 5
      * @param int $indent
6 6
      * @param int $parent
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
             case 'publishedon':
38 38
             case 'pub_date':
39 39
             case 'unpub_date':
40
-                $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'],
41
-                    'sc.' . $_SESSION['tree_sortby']);
40
+                $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'],
41
+                    'sc.'.$_SESSION['tree_sortby']);
42 42
                 break;
43 43
             default:
44
-                $sortby = 'sc.' . $_SESSION['tree_sortby'];
44
+                $sortby = 'sc.'.$_SESSION['tree_sortby'];
45 45
         };
46 46
 
47
-        $orderby = $modx->getDatabase()->escape($sortby . ' ' . $_SESSION['tree_sortdir']);
47
+        $orderby = $modx->getDatabase()->escape($sortby.' '.$_SESSION['tree_sortdir']);
48 48
 
49 49
         // Folder sorting gets special setup ;) Add menuindex and pagetitle
50 50
         if ($_SESSION['tree_sortby'] == 'isfolder') {
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
             $_SESSION['mgrDocgroups']) : '';
60 60
         $showProtected = false;
61 61
         if (isset ($modx->config['tree_show_protected'])) {
62
-            $showProtected = (boolean)$modx->config['tree_show_protected'];
62
+            $showProtected = (boolean) $modx->config['tree_show_protected'];
63 63
         }
64
-        $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0';
64
+        $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0';
65 65
         if ($showProtected == false) {
66
-            $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
66
+            $access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
67 67
         } else {
68 68
             $access = '';
69 69
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             }
101 101
 
102 102
             $weblinkDisplay = $row['type'] == 'reference' ? sprintf('&nbsp;%s', $_style['tree_linkgo']) : '';
103
-            $pageIdDisplay = '<small>(' . ($modx_textdir ? '&rlm;' : '') . $row['id'] . ')</small>';
103
+            $pageIdDisplay = '<small>('.($modx_textdir ? '&rlm;' : '').$row['id'].')</small>';
104 104
 
105 105
             // Prepare displaying user-locks
106 106
             $lockedByUser = '';
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                         'element_type' => $_lang["lock_element_type_7"],
112 112
                         'lasthit_df'   => $rowLock['lasthit_df']
113 113
                     ));
114
-                    $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>';
114
+                    $lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>';
115 115
                 } else {
116 116
                     $title = $modx->parseText($_lang["lock_element_locked_by"], array(
117 117
                         'element_type' => $_lang["lock_element_type_7"],
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
                         'lasthit_df'   => $rowLock['lasthit_df']
120 120
                     ));
121 121
                     if ($modx->hasPermission('remove_locks')) {
122
-                        $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
122
+                        $lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
123 123
                     } else {
124
-                        $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
124
+                        $lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
125 125
                     }
126 126
                 }
127 127
             }
@@ -130,22 +130,22 @@  discard block
 block discarded – undo
130 130
 
131 131
             $title = '';
132 132
             if (isDateNode($nodeNameSource)) {
133
-                $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]';
133
+                $title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]';
134 134
             }
135
-            $title .= $_lang['id'] . ': ' . $row['id'];
136
-            $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle'];
137
-            $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex'];
138
-            $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-');
139
-            $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename'];
140
-            $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']);
141
-            $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']);
142
-            $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']);
143
-            $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
144
-            $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
145
-            $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
146
-            $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
135
+            $title .= $_lang['id'].': '.$row['id'];
136
+            $title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle'];
137
+            $title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex'];
138
+            $title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-');
139
+            $title .= '[+lf+]'.$_lang['template'].': '.$row['templatename'];
140
+            $title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']);
141
+            $title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']);
142
+            $title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']);
143
+            $title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
144
+            $title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
145
+            $title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
146
+            $title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
147 147
             $title = $modx->getPhpCompat()->htmlspecialchars($title);
148
-            $title = str_replace('[+lf+]', ' &#13;', $title);   // replace line-breaks with empty space as fall-back
148
+            $title = str_replace('[+lf+]', ' &#13;', $title); // replace line-breaks with empty space as fall-back
149 149
 
150 150
             $data = array(
151 151
                 'id'               => $row['id'],
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                 }
230 230
 
231 231
                 if ($ph['contextmenu']) {
232
-                    $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
232
+                    $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
233 233
                 }
234 234
 
235 235
                 if ($_SESSION['tree_show_only_folders']) {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                         }
288 288
 
289 289
                         if ($ph['contextmenu']) {
290
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
290
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
291 291
                         }
292 292
 
293 293
                         $node .= $modx->parseText($tpl, $ph);
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
                         }
326 326
 
327 327
                         if ($ph['contextmenu']) {
328
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
328
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
329 329
                         }
330 330
 
331 331
                         $node .= $modx->parseText($tpl, $ph);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                         }
377 377
 
378 378
                         if ($ph['contextmenu']) {
379
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
379
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
380 380
                         }
381 381
 
382 382
                         $node .= $modx->parseText($tpl, $ph);
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
                         }
419 419
 
420 420
                         if ($ph['contextmenu']) {
421
-                            $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
421
+                            $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
422 422
                         }
423 423
 
424 424
                         $node .= $modx->parseText($tpl, $ph);
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
     }
445 445
 }
446 446
 
447
-if(!function_exists('getIconInfo')) {
447
+if (!function_exists('getIconInfo')) {
448 448
     /**
449 449
      * @param array $_style
450 450
      * @return array
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     }
479 479
 }
480 480
 
481
-if(!function_exists('getNodeTitle')) {
481
+if (!function_exists('getNodeTitle')) {
482 482
     /**
483 483
      * @param string $nodeNameSource
484 484
      * @param array $row
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
                         $nodetitle .= $modx->config['friendly_url_suffix'];
500 500
                     }
501 501
                 }
502
-                $nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle;
502
+                $nodetitle = $modx->config['friendly_url_prefix'].$nodetitle;
503 503
                 break;
504 504
             case 'pagetitle':
505 505
                 $nodetitle = $row['pagetitle'];
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
     }
534 534
 }
535 535
 
536
-if(!function_exists('isDateNode')) {
536
+if (!function_exists('isDateNode')) {
537 537
     /**
538 538
      * @param string $nodeNameSource
539 539
      * @return bool
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
     }
554 554
 }
555 555
 
556
-if(!function_exists('checkIsFolder')) {
556
+if (!function_exists('checkIsFolder')) {
557 557
     /**
558 558
      * @param int $parent
559 559
      * @param int $isfolder
@@ -563,11 +563,11 @@  discard block
 block discarded – undo
563 563
     {
564 564
         $modx = evolutionCMS();
565 565
 
566
-        return (int)$modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' '));
566
+        return (int) $modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM '.$modx->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' '));
567 567
     }
568 568
 }
569 569
 
570
-if(!function_exists('_htmlentities')) {
570
+if (!function_exists('_htmlentities')) {
571 571
     /**
572 572
      * @param mixed $array
573 573
      * @return string
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
     }
584 584
 }
585 585
 
586
-if(!function_exists('getTplSingleNode')) {
586
+if (!function_exists('getTplSingleNode')) {
587 587
     /**
588 588
      * @return string
589 589
      */
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
     }
614 614
 }
615 615
 
616
-if(!function_exists('getTplFolderNode')) {
616
+if (!function_exists('getTplFolderNode')) {
617 617
     /**
618 618
      * @return string
619 619
      */
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
         title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a><div>';
655 655
     }
656 656
 }
657
-if(!function_exists('getTplFolderNodeNotChildren')) {
657
+if (!function_exists('getTplFolderNodeNotChildren')) {
658 658
     /**
659 659
      * @return string
660 660
      */
Please login to merge, or discard this patch.