@@ -19,46 +19,46 @@ discard block |
||
19 | 19 | |
20 | 20 | public static $cnt; |
21 | 21 | |
22 | - public function __construct($id = '', $width = 120, $visible = false) { |
|
22 | + public function __construct($id = '', $width = 120, $visible = false){ |
|
23 | 23 | self::$cnt++; |
24 | 24 | $this->html = ""; |
25 | 25 | $this->visible = $visible ? $visible : false; |
26 | - $this->width = is_numeric($width) ? (int)$width : 120; |
|
27 | - $this->id = $id ? $id : "cntxMnu" . self::$cnt; // set id |
|
26 | + $this->width = is_numeric($width) ? (int) $width : 120; |
|
27 | + $this->id = $id ? $id : "cntxMnu".self::$cnt; // set id |
|
28 | 28 | } |
29 | 29 | |
30 | - public function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
30 | + public function addItem($text, $action = "", $img = "", $disabled = 0){ |
|
31 | 31 | global $base_url, $_style; |
32 | - if($disabled) { |
|
32 | + if ($disabled) { |
|
33 | 33 | return; |
34 | 34 | } |
35 | - if(!$img) { |
|
36 | - $img = $base_url . $_style['tx']; |
|
35 | + if (!$img) { |
|
36 | + $img = $base_url.$_style['tx']; |
|
37 | 37 | } |
38 | - if(substr($action, 0, 3) == "js:") { |
|
38 | + if (substr($action, 0, 3) == "js:") { |
|
39 | 39 | $action = substr($action, 3); |
40 | - } else if(substr($action, 0, 3) == "hl:") { |
|
41 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
40 | + } else if (substr($action, 0, 3) == "hl:") { |
|
41 | + $action = "window.location.href='".substr($action, 3)."'"; |
|
42 | 42 | } else { |
43 | - $action = "window.location.href='" . $action . "'"; |
|
43 | + $action = "window.location.href='".$action."'"; |
|
44 | 44 | } |
45 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
46 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
47 | - if(substr($img, 0, 5) == 'fa fa') { |
|
48 | - $img = '<i class="' . $img . '"></i>'; |
|
49 | - } else if(substr($img, 0, 1) != '<') { |
|
50 | - $img = '<img src="' . $img . '" />'; |
|
45 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('".$this->id."');\""; |
|
46 | + $this->html .= "<div class='".($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem")."' $action>"; |
|
47 | + if (substr($img, 0, 5) == 'fa fa') { |
|
48 | + $img = '<i class="'.$img.'"></i>'; |
|
49 | + } else if (substr($img, 0, 1) != '<') { |
|
50 | + $img = '<img src="'.$img.'" />'; |
|
51 | 51 | } |
52 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
52 | + $this->html .= $img.' '.$text.'</div>'; |
|
53 | 53 | } |
54 | 54 | |
55 | - public function addSeparator() { |
|
55 | + public function addSeparator(){ |
|
56 | 56 | $this->html .= " |
57 | 57 | <div class='cntxMnuSeparator'></div> |
58 | 58 | "; |
59 | 59 | } |
60 | 60 | |
61 | - public function render() { |
|
61 | + public function render(){ |
|
62 | 62 | $ContextMenuScript = <<<BLOCK |
63 | 63 | <script> |
64 | 64 | function getCntxMenu(id) { |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | </script> |
72 | 72 | BLOCK; |
73 | 73 | |
74 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
74 | + $html = $ContextMenuScript."<div id='".$this->id."' class='contextMenu' style='width:".$this->width."px; visibility:".($this->visible ? 'visible' : 'hidden')."'>".$this->html."</div>"; |
|
75 | 75 | $ContextMenuScript = ""; // reset css |
76 | 76 | return $html; |
77 | 77 | } |
78 | 78 | |
79 | - public function getClientScriptObject() { |
|
80 | - return "getCntxMenu('" . $this->id . "')"; |
|
79 | + public function getClientScriptObject(){ |
|
80 | + return "getCntxMenu('".$this->id."')"; |
|
81 | 81 | } |
82 | 82 | } |
@@ -2,7 +2,8 @@ discard block |
||
2 | 2 | |
3 | 3 | use EvolutionCMS\Interfaces\ContextMenuInterface; |
4 | 4 | |
5 | -class ContextMenu implements ContextMenuInterface{ |
|
5 | +class ContextMenu implements ContextMenuInterface |
|
6 | +{ |
|
6 | 7 | public $id; |
7 | 8 | /** |
8 | 9 | * @var string |
@@ -19,7 +20,8 @@ discard block |
||
19 | 20 | |
20 | 21 | public static $cnt; |
21 | 22 | |
22 | - public function __construct($id = '', $width = 120, $visible = false) { |
|
23 | + public function __construct($id = '', $width = 120, $visible = false) |
|
24 | + { |
|
23 | 25 | self::$cnt++; |
24 | 26 | $this->html = ""; |
25 | 27 | $this->visible = $visible ? $visible : false; |
@@ -27,7 +29,8 @@ discard block |
||
27 | 29 | $this->id = $id ? $id : "cntxMnu" . self::$cnt; // set id |
28 | 30 | } |
29 | 31 | |
30 | - public function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
32 | + public function addItem($text, $action = "", $img = "", $disabled = 0) |
|
33 | + { |
|
31 | 34 | global $base_url, $_style; |
32 | 35 | if($disabled) { |
33 | 36 | return; |
@@ -52,13 +55,15 @@ discard block |
||
52 | 55 | $this->html .= $img . ' ' . $text . '</div>'; |
53 | 56 | } |
54 | 57 | |
55 | - public function addSeparator() { |
|
58 | + public function addSeparator() |
|
59 | + { |
|
56 | 60 | $this->html .= " |
57 | 61 | <div class='cntxMnuSeparator'></div> |
58 | 62 | "; |
59 | 63 | } |
60 | 64 | |
61 | - public function render() { |
|
65 | + public function render() |
|
66 | + { |
|
62 | 67 | $ContextMenuScript = <<<BLOCK |
63 | 68 | <script> |
64 | 69 | function getCntxMenu(id) { |
@@ -76,7 +81,8 @@ discard block |
||
76 | 81 | return $html; |
77 | 82 | } |
78 | 83 | |
79 | - public function getClientScriptObject() { |
|
84 | + public function getClientScriptObject() |
|
85 | + { |
|
80 | 86 | return "getCntxMenu('" . $this->id . "')"; |
81 | 87 | } |
82 | 88 | } |
@@ -69,7 +69,7 @@ |
||
69 | 69 | cm.style.visibility = 'hidden'; |
70 | 70 | } |
71 | 71 | </script> |
72 | -BLOCK; |
|
72 | +block; |
|
73 | 73 | |
74 | 74 | $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
75 | 75 | $ContextMenuScript = ""; // reset css |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
7 | 7 | } |
8 | 8 | |
9 | -require_once(dirname(__FILE__) . '/protect.inc.php'); |
|
9 | +require_once(dirname(__FILE__).'/protect.inc.php'); |
|
10 | 10 | |
11 | 11 | $action = preg_replace('/[^A-Za-z0-9_\-\.\/]/', '', $_POST['action']); |
12 | 12 | $lang = preg_replace('/[^A-Za-z0-9_\s\+\-\.\/]/', '', $_POST['lang']); |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | |
24 | 24 | switch (true) { |
25 | 25 | case ($action == 'get' && preg_match('/^[A-z0-9_-]+$/', |
26 | - $lang) && file_exists(dirname(__FILE__) . '/lang/' . $lang . '.inc.php')): { |
|
27 | - include(dirname(__FILE__) . '/lang/' . $lang . '.inc.php'); |
|
26 | + $lang) && file_exists(dirname(__FILE__).'/lang/'.$lang.'.inc.php')): { |
|
27 | + include(dirname(__FILE__).'/lang/'.$lang.'.inc.php'); |
|
28 | 28 | $str = isset($key, $_lang, $_lang[$key]) ? $_lang[$key] : ""; |
29 | 29 | break; |
30 | 30 | } |
31 | 31 | case ($action == 'setsetting' && !empty($key) && !empty($value)): { |
32 | - $sql = "REPLACE INTO " . $modx->getFullTableName("system_settings") . " (setting_name, setting_value) VALUES('{$key}', '{$value}');"; |
|
32 | + $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) VALUES('{$key}', '{$value}');"; |
|
33 | 33 | $str = "true"; |
34 | 34 | $modx->getDatabase()->query($sql); |
35 | 35 | $emptyCache = true; |
@@ -34,7 +34,7 @@ |
||
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; |
@@ -18,13 +18,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -1,5 +1,5 @@ |
||
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); |
@@ -1,8 +1,11 @@ |
||
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]; |
@@ -1,43 +1,43 @@ |
||
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",' '),' ',$content); |
|
14 | -if(preg_match('/\s+/',$content)) |
|
15 | - $content = preg_replace('/\s+/',' ',$content); |
|
13 | +$content = str_replace(array("\r\n", "\r", "\n", "\t", ' '), ' ', $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; |
@@ -1,9 +1,11 @@ discard block |
||
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 |
||
11 | 13 | $content = strip_tags($content); |
12 | 14 | |
13 | 15 | $content = str_replace(array("\r\n","\r","\n","\t",' '),' ',$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 |
||
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; |
@@ -2,22 +2,22 @@ |
||
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 |
@@ -5,11 +5,14 @@ discard block |
||
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 |
||
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; |
@@ -1,21 +1,21 @@ |
||
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 />"; |
@@ -36,7 +36,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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']; |
@@ -380,10 +380,12 @@ |
||
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 |