@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.'); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('save_plugin')) { |
6 | 6 | $modx->webAlertAndQuit($_lang['error_no_privileges']); |
7 | 7 | } |
8 | 8 | |
9 | -$id = (int)$_POST['id']; |
|
9 | +$id = (int) $_POST['id']; |
|
10 | 10 | $name = $modx->getDatabase()->escape(trim($_POST['name'])); |
11 | 11 | $description = $modx->getDatabase()->escape($_POST['description']); |
12 | 12 | $locked = isset($_POST['locked']) && $_POST['locked'] == 'on' ? '1' : '0'; |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | |
21 | 21 | //Kyle Jaebker - added category support |
22 | 22 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
23 | - $categoryid = (int)$_POST['categoryid']; |
|
23 | + $categoryid = (int) $_POST['categoryid']; |
|
24 | 24 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
25 | 25 | $categoryid = 0; |
26 | 26 | } else { |
27 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
27 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
28 | 28 | $categoryid = getCategory($_POST['newcategory']); |
29 | 29 | } |
30 | 30 | |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid; |
41 | 41 | |
42 | 42 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
43 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
43 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
44 | 44 | if ($version) { |
45 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
45 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
46 | 46 | } |
47 | 47 | if (isset($parsed['modx_category'])) { |
48 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
48 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
49 | 49 | $categoryid = getCategory($parsed['modx_category']); |
50 | 50 | } |
51 | 51 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | // finished emptying cache - redirect |
104 | 104 | if ($_POST['stay'] != '') { |
105 | 105 | $a = ($_POST['stay'] == '2') ? "102&id=$newid" : '101'; |
106 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
106 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
107 | 107 | header($header); |
108 | 108 | } else { |
109 | 109 | $header = 'Location: index.php?a=76&r=2'; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | // finished emptying cache - redirect |
159 | 159 | if ($_POST['stay'] != '') { |
160 | 160 | $a = ($_POST['stay'] == '2') ? "102&id=$id" : '101'; |
161 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
161 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
162 | 162 | header($header); |
163 | 163 | } else { |
164 | 164 | $modx->unlockElement(5, $id); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | $msg = ''; |
39 | -$pth = dirname(__DIR__, 2) . '/install/'; |
|
39 | +$pth = dirname(__DIR__, 2).'/install/'; |
|
40 | 40 | $pth = str_replace('\\', '/', $pth); |
41 | 41 | |
42 | 42 | if (isset($_GET['rminstall'])) { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | } |
49 | 49 | if ($msg) { |
50 | - echo "<script>alert('" . addslashes($msg) . "');</script>"; |
|
50 | + echo "<script>alert('".addslashes($msg)."');</script>"; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | echo "<script>window.location='../index.php?a=2';</script>"; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if (! isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
3 | - header('HTTP/1.0 404 Not Found'); |
|
4 | - exit('error'); |
|
3 | + header('HTTP/1.0 404 Not Found'); |
|
4 | + exit('error'); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | // Initialize System Alert Message Queque |
35 | 35 | if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
36 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
36 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
37 | 37 | } |
38 | 38 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
39 | 39 | |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | |
52 | 52 | // invoke OnBeforeManagerLogin event |
53 | 53 | $modx->invokeEvent('OnBeforeManagerLogin', array( |
54 | - 'username' => $username, |
|
55 | - 'userpassword' => $givenPassword, |
|
56 | - 'rememberme' => $rememberme |
|
57 | - )); |
|
54 | + 'username' => $username, |
|
55 | + 'userpassword' => $givenPassword, |
|
56 | + 'rememberme' => $rememberme |
|
57 | + )); |
|
58 | 58 | $fields = 'mu.*, ua.*'; |
59 | 59 | $from = $modx->getDatabase()->getFullTableName('manager_users') . ' AS mu, ' . |
60 | 60 | $modx->getDatabase()->getFullTableName('user_attributes') . ' AS ua'; |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | $limit = $modx->getDatabase()->getRecordCount($rs); |
64 | 64 | |
65 | 65 | if($limit == 0 || $limit > 1) { |
66 | - jsAlert($_lang['login_processor_unknown_user']); |
|
67 | - return; |
|
66 | + jsAlert($_lang['login_processor_unknown_user']); |
|
67 | + return; |
|
68 | 68 | } |
69 | 69 | $row = $modx->getDatabase()->getRow($rs); |
70 | 70 | |
@@ -88,36 +88,36 @@ discard block |
||
88 | 88 | "user='{$internalKey}' AND setting_value!=''" |
89 | 89 | ); |
90 | 90 | while($row = $modx->getDatabase()->getRow($rs)) { |
91 | - extract($row); |
|
92 | - ${$setting_name} = $setting_value; |
|
91 | + extract($row); |
|
92 | + ${$setting_name} = $setting_value; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // blocked due to number of login errors. |
96 | 96 | if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
97 | - @session_destroy(); |
|
98 | - session_unset(); |
|
99 | - if($cip = getenv("HTTP_CLIENT_IP")) { |
|
100 | - $ip = $cip; |
|
101 | - } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
102 | - $ip = $cip; |
|
103 | - } elseif($cip = getenv("REMOTE_ADDR")) { |
|
104 | - $ip = $cip; |
|
105 | - } else { |
|
106 | - $ip = "UNKNOWN"; |
|
107 | - } |
|
108 | - $log = new EvolutionCMS\Legacy\LogHandler(); |
|
109 | - $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
110 | - jsAlert($_lang['login_processor_many_failed_logins']); |
|
111 | - return; |
|
97 | + @session_destroy(); |
|
98 | + session_unset(); |
|
99 | + if($cip = getenv("HTTP_CLIENT_IP")) { |
|
100 | + $ip = $cip; |
|
101 | + } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
102 | + $ip = $cip; |
|
103 | + } elseif($cip = getenv("REMOTE_ADDR")) { |
|
104 | + $ip = $cip; |
|
105 | + } else { |
|
106 | + $ip = "UNKNOWN"; |
|
107 | + } |
|
108 | + $log = new EvolutionCMS\Legacy\LogHandler(); |
|
109 | + $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
110 | + jsAlert($_lang['login_processor_many_failed_logins']); |
|
111 | + return; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | // blocked due to number of login errors, but get to try again |
115 | 115 | if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
116 | - $fields = array(); |
|
117 | - $fields['failedlogincount'] = '0'; |
|
118 | - $fields['blockeduntil'] = time() - 1; |
|
119 | - $modx->getDatabase()->update( |
|
120 | - $fields, |
|
116 | + $fields = array(); |
|
117 | + $fields['failedlogincount'] = '0'; |
|
118 | + $fields['blockeduntil'] = time() - 1; |
|
119 | + $modx->getDatabase()->update( |
|
120 | + $fields, |
|
121 | 121 | $modx->getDatabase()->getFullTableName('user_attributes'), |
122 | 122 | "internalKey='{$internalKey}'" |
123 | 123 | ); |
@@ -125,94 +125,94 @@ discard block |
||
125 | 125 | |
126 | 126 | // this user has been blocked by an admin, so no way he's loggin in! |
127 | 127 | if($blocked == '1') { |
128 | - @session_destroy(); |
|
129 | - session_unset(); |
|
130 | - jsAlert($_lang['login_processor_blocked1']); |
|
131 | - return; |
|
128 | + @session_destroy(); |
|
129 | + session_unset(); |
|
130 | + jsAlert($_lang['login_processor_blocked1']); |
|
131 | + return; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | // blockuntil: this user has a block until date |
135 | 135 | if($blockeduntildate > time()) { |
136 | - @session_destroy(); |
|
137 | - session_unset(); |
|
138 | - jsAlert($_lang['login_processor_blocked2']); |
|
139 | - return; |
|
136 | + @session_destroy(); |
|
137 | + session_unset(); |
|
138 | + jsAlert($_lang['login_processor_blocked2']); |
|
139 | + return; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | // blockafter: this user has a block after date |
143 | 143 | if($blockedafterdate > 0 && $blockedafterdate < time()) { |
144 | - @session_destroy(); |
|
145 | - session_unset(); |
|
146 | - jsAlert($_lang['login_processor_blocked3']); |
|
147 | - return; |
|
144 | + @session_destroy(); |
|
145 | + session_unset(); |
|
146 | + jsAlert($_lang['login_processor_blocked3']); |
|
147 | + return; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | // allowed ip |
151 | 151 | if(!empty($allowed_ip)) { |
152 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
153 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
154 | - jsAlert($_lang['login_processor_remotehost_ip']); |
|
155 | - return; |
|
156 | - } |
|
157 | - } |
|
158 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
159 | - jsAlert($_lang['login_processor_remote_ip']); |
|
160 | - return; |
|
161 | - } |
|
152 | + if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
153 | + if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
154 | + jsAlert($_lang['login_processor_remotehost_ip']); |
|
155 | + return; |
|
156 | + } |
|
157 | + } |
|
158 | + if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
159 | + jsAlert($_lang['login_processor_remote_ip']); |
|
160 | + return; |
|
161 | + } |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // allowed days |
165 | 165 | if(!empty($allowed_days)) { |
166 | - $date = getdate(); |
|
167 | - $day = $date['wday'] + 1; |
|
168 | - if(!in_array($day,explode(',',$allowed_days))) { |
|
169 | - jsAlert($_lang['login_processor_date']); |
|
170 | - return; |
|
171 | - } |
|
166 | + $date = getdate(); |
|
167 | + $day = $date['wday'] + 1; |
|
168 | + if(!in_array($day,explode(',',$allowed_days))) { |
|
169 | + jsAlert($_lang['login_processor_date']); |
|
170 | + return; |
|
171 | + } |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | // invoke OnManagerAuthentication event |
175 | 175 | $rt = $modx->invokeEvent('OnManagerAuthentication', array( |
176 | - 'userid' => $internalKey, |
|
177 | - 'username' => $username, |
|
178 | - 'userpassword' => $givenPassword, |
|
179 | - 'savedpassword' => $dbasePassword, |
|
180 | - 'rememberme' => $rememberme |
|
181 | - )); |
|
176 | + 'userid' => $internalKey, |
|
177 | + 'username' => $username, |
|
178 | + 'userpassword' => $givenPassword, |
|
179 | + 'savedpassword' => $dbasePassword, |
|
180 | + 'rememberme' => $rememberme |
|
181 | + )); |
|
182 | 182 | |
183 | 183 | // check if plugin authenticated the user |
184 | 184 | $matchPassword = false; |
185 | 185 | if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
186 | - // check user password - local authentication |
|
187 | - $hashType = $modx->getManagerApi()->getHashType($dbasePassword); |
|
188 | - if($hashType == 'phpass') { |
|
189 | - $matchPassword = login($username, $requestPassword, $dbasePassword); |
|
190 | - } elseif($hashType == 'md5') { |
|
191 | - $matchPassword = loginMD5($internalKey, $requestPassword, $dbasePassword, $username); |
|
192 | - } elseif($hashType == 'v1') { |
|
193 | - $matchPassword = loginV1($internalKey, $requestPassword, $dbasePassword, $username); |
|
194 | - } else { |
|
195 | - $matchPassword = false; |
|
196 | - } |
|
186 | + // check user password - local authentication |
|
187 | + $hashType = $modx->getManagerApi()->getHashType($dbasePassword); |
|
188 | + if($hashType == 'phpass') { |
|
189 | + $matchPassword = login($username, $requestPassword, $dbasePassword); |
|
190 | + } elseif($hashType == 'md5') { |
|
191 | + $matchPassword = loginMD5($internalKey, $requestPassword, $dbasePassword, $username); |
|
192 | + } elseif($hashType == 'v1') { |
|
193 | + $matchPassword = loginV1($internalKey, $requestPassword, $dbasePassword, $username); |
|
194 | + } else { |
|
195 | + $matchPassword = false; |
|
196 | + } |
|
197 | 197 | } else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
198 | - $matchPassword = true; |
|
198 | + $matchPassword = true; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | if(!$matchPassword) { |
202 | - jsAlert($_lang['login_processor_wrong_password']); |
|
203 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes ?? 10); |
|
204 | - return; |
|
202 | + jsAlert($_lang['login_processor_wrong_password']); |
|
203 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes ?? 10); |
|
204 | + return; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | if($modx->config['use_captcha'] == 1) { |
208 | - if(!isset ($_SESSION['veriword'])) { |
|
209 | - jsAlert($_lang['login_processor_captcha_config']); |
|
210 | - return; |
|
211 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
212 | - jsAlert($_lang['login_processor_bad_code']); |
|
213 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes ?? 10); |
|
214 | - return; |
|
215 | - } |
|
208 | + if(!isset ($_SESSION['veriword'])) { |
|
209 | + jsAlert($_lang['login_processor_captcha_config']); |
|
210 | + return; |
|
211 | + } elseif($_SESSION['veriword'] != $captcha_code) { |
|
212 | + jsAlert($_lang['login_processor_bad_code']); |
|
213 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes ?? 10); |
|
214 | + return; |
|
215 | + } |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | $modx->cleanupExpiredLocks(); |
@@ -251,36 +251,36 @@ discard block |
||
251 | 251 | $_SESSION['mgrToken'] = md5($currentsessionid); |
252 | 252 | |
253 | 253 | if($rememberme == '1') { |
254 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
255 | - |
|
256 | - // Set a cookie separate from the session cookie with the username in it. |
|
257 | - // Are we using secure connection? If so, make sure the cookie is secure |
|
258 | - global $https_port; |
|
259 | - |
|
260 | - $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
261 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
262 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
263 | - } else { |
|
264 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
265 | - } |
|
254 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
255 | + |
|
256 | + // Set a cookie separate from the session cookie with the username in it. |
|
257 | + // Are we using secure connection? If so, make sure the cookie is secure |
|
258 | + global $https_port; |
|
259 | + |
|
260 | + $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
261 | + if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
262 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
263 | + } else { |
|
264 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
265 | + } |
|
266 | 266 | } else { |
267 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
267 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
268 | 268 | |
269 | - // Remove the Remember Me cookie |
|
270 | - setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
269 | + // Remove the Remember Me cookie |
|
270 | + setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | // Check if user already has an active session, if not check if user pressed logout end of last session |
274 | 274 | $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
275 | 275 | $activeSession = $modx->getDatabase()->getValue($rs); |
276 | 276 | if(!$activeSession) { |
277 | - $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
278 | - if($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
279 | - $_SESSION['show_logout_reminder'] = array( |
|
280 | - 'type' => 'logout_reminder', |
|
281 | - 'lastHit' => $lastHit |
|
282 | - ); |
|
283 | - } |
|
277 | + $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
278 | + if($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
279 | + $_SESSION['show_logout_reminder'] = array( |
|
280 | + 'type' => 'logout_reminder', |
|
281 | + 'lastHit' => $lastHit |
|
282 | + ); |
|
283 | + } |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | $log = new EvolutionCMS\Legacy\LogHandler(); |
@@ -288,11 +288,11 @@ discard block |
||
288 | 288 | |
289 | 289 | // invoke OnManagerLogin event |
290 | 290 | $modx->invokeEvent('OnManagerLogin', array( |
291 | - 'userid' => $internalKey, |
|
292 | - 'username' => $username, |
|
293 | - 'userpassword' => $givenPassword, |
|
294 | - 'rememberme' => $rememberme |
|
295 | - )); |
|
291 | + 'userid' => $internalKey, |
|
292 | + 'username' => $username, |
|
293 | + 'userpassword' => $givenPassword, |
|
294 | + 'rememberme' => $rememberme |
|
295 | + )); |
|
296 | 296 | |
297 | 297 | // check if we should redirect user to a web page |
298 | 298 | $rs = $modx->getDatabase()->select( |
@@ -303,17 +303,17 @@ discard block |
||
303 | 303 | $id = (int)$modx->getDatabase()->getValue($rs); |
304 | 304 | $ajax = (int)get_by_key($_POST, 'ajax', 0, 'is_scalar'); |
305 | 305 | if($id > 0) { |
306 | - $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
307 | - if($ajax === 1) { |
|
308 | - echo $header; |
|
309 | - } else { |
|
310 | - header($header); |
|
311 | - } |
|
306 | + $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
307 | + if($ajax === 1) { |
|
308 | + echo $header; |
|
309 | + } else { |
|
310 | + header($header); |
|
311 | + } |
|
312 | 312 | } else { |
313 | - $header = 'Location: ' . MODX_MANAGER_URL; |
|
314 | - if($ajax === 1) { |
|
315 | - echo $header; |
|
316 | - } else { |
|
317 | - header($header); |
|
318 | - } |
|
313 | + $header = 'Location: ' . MODX_MANAGER_URL; |
|
314 | + if($ajax === 1) { |
|
315 | + echo $header; |
|
316 | + } else { |
|
317 | + header($header); |
|
318 | + } |
|
319 | 319 | } |
@@ -1,23 +1,23 @@ discard block |
||
1 | 1 | <?php |
2 | -if (! isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
2 | +if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
3 | 3 | header('HTTP/1.0 404 Not Found'); |
4 | 4 | exit('error'); |
5 | 5 | } |
6 | 6 | |
7 | -define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
|
7 | +define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
|
8 | 8 | define('MODX_API_MODE', true); |
9 | 9 | |
10 | -if (file_exists(dirname(__DIR__) . '/config.php')) { |
|
11 | - $config = require dirname(__DIR__) . '/config.php'; |
|
12 | -} elseif (file_exists(dirname(__DIR__, 2) . '/config.php')) { |
|
13 | - $config = require dirname(__DIR__, 2) . '/config.php'; |
|
10 | +if (file_exists(dirname(__DIR__).'/config.php')) { |
|
11 | + $config = require dirname(__DIR__).'/config.php'; |
|
12 | +} elseif (file_exists(dirname(__DIR__, 2).'/config.php')) { |
|
13 | + $config = require dirname(__DIR__, 2).'/config.php'; |
|
14 | 14 | } else { |
15 | 15 | $config = [ |
16 | 16 | 'root' => dirname(__DIR__, 2) |
17 | 17 | ]; |
18 | 18 | } |
19 | -if (!empty($config['root']) && file_exists($config['root']. '/index.php')) { |
|
20 | - require_once $config['root'] . '/index.php'; |
|
19 | +if (!empty($config['root']) && file_exists($config['root'].'/index.php')) { |
|
20 | + require_once $config['root'].'/index.php'; |
|
21 | 21 | } else { |
22 | 22 | echo "<h3>Unable to load configuration settings</h3>"; |
23 | 23 | echo "Please run the EVO <a href='../install'>install utility</a>"; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $_lang = ManagerTheme::getLexicon(); |
33 | 33 | |
34 | 34 | // Initialize System Alert Message Queque |
35 | -if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
35 | +if (!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
36 | 36 | $_SESSION['SystemAlertMsgQueque'] = array(); |
37 | 37 | } |
38 | 38 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | 'rememberme' => $rememberme |
57 | 57 | )); |
58 | 58 | $fields = 'mu.*, ua.*'; |
59 | -$from = $modx->getDatabase()->getFullTableName('manager_users') . ' AS mu, ' . |
|
60 | - $modx->getDatabase()->getFullTableName('user_attributes') . ' AS ua'; |
|
59 | +$from = $modx->getDatabase()->getFullTableName('manager_users').' AS mu, '. |
|
60 | + $modx->getDatabase()->getFullTableName('user_attributes').' AS ua'; |
|
61 | 61 | $where = "BINARY mu.username='{$username}' and ua.internalKey=mu.id"; |
62 | 62 | $rs = $modx->getDatabase()->select($fields, $from, $where); |
63 | 63 | $limit = $modx->getDatabase()->getRecordCount($rs); |
64 | 64 | |
65 | -if($limit == 0 || $limit > 1) { |
|
65 | +if ($limit == 0 || $limit > 1) { |
|
66 | 66 | jsAlert($_lang['login_processor_unknown_user']); |
67 | 67 | return; |
68 | 68 | } |
@@ -87,32 +87,32 @@ discard block |
||
87 | 87 | $modx->getDatabase()->getFullTableName('user_settings'), |
88 | 88 | "user='{$internalKey}' AND setting_value!=''" |
89 | 89 | ); |
90 | -while($row = $modx->getDatabase()->getRow($rs)) { |
|
90 | +while ($row = $modx->getDatabase()->getRow($rs)) { |
|
91 | 91 | extract($row); |
92 | 92 | ${$setting_name} = $setting_value; |
93 | 93 | } |
94 | 94 | |
95 | 95 | // blocked due to number of login errors. |
96 | -if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
|
96 | +if ($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
|
97 | 97 | @session_destroy(); |
98 | 98 | session_unset(); |
99 | - if($cip = getenv("HTTP_CLIENT_IP")) { |
|
99 | + if ($cip = getenv("HTTP_CLIENT_IP")) { |
|
100 | 100 | $ip = $cip; |
101 | - } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
101 | + } elseif ($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
102 | 102 | $ip = $cip; |
103 | - } elseif($cip = getenv("REMOTE_ADDR")) { |
|
103 | + } elseif ($cip = getenv("REMOTE_ADDR")) { |
|
104 | 104 | $ip = $cip; |
105 | 105 | } else { |
106 | 106 | $ip = "UNKNOWN"; |
107 | 107 | } |
108 | 108 | $log = new EvolutionCMS\Legacy\LogHandler(); |
109 | - $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
109 | + $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: ".$ip); |
|
110 | 110 | jsAlert($_lang['login_processor_many_failed_logins']); |
111 | 111 | return; |
112 | 112 | } |
113 | 113 | |
114 | 114 | // blocked due to number of login errors, but get to try again |
115 | -if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
|
115 | +if ($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
|
116 | 116 | $fields = array(); |
117 | 117 | $fields['failedlogincount'] = '0'; |
118 | 118 | $fields['blockeduntil'] = time() - 1; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | // this user has been blocked by an admin, so no way he's loggin in! |
127 | -if($blocked == '1') { |
|
127 | +if ($blocked == '1') { |
|
128 | 128 | @session_destroy(); |
129 | 129 | session_unset(); |
130 | 130 | jsAlert($_lang['login_processor_blocked1']); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | // blockuntil: this user has a block until date |
135 | -if($blockeduntildate > time()) { |
|
135 | +if ($blockeduntildate > time()) { |
|
136 | 136 | @session_destroy(); |
137 | 137 | session_unset(); |
138 | 138 | jsAlert($_lang['login_processor_blocked2']); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | // blockafter: this user has a block after date |
143 | -if($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
143 | +if ($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
144 | 144 | @session_destroy(); |
145 | 145 | session_unset(); |
146 | 146 | jsAlert($_lang['login_processor_blocked3']); |
@@ -148,24 +148,24 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | // allowed ip |
151 | -if(!empty($allowed_ip)) { |
|
152 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
153 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
151 | +if (!empty($allowed_ip)) { |
|
152 | + if (($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
153 | + if (gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
154 | 154 | jsAlert($_lang['login_processor_remotehost_ip']); |
155 | 155 | return; |
156 | 156 | } |
157 | 157 | } |
158 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
158 | + if (!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
159 | 159 | jsAlert($_lang['login_processor_remote_ip']); |
160 | 160 | return; |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | // allowed days |
165 | -if(!empty($allowed_days)) { |
|
165 | +if (!empty($allowed_days)) { |
|
166 | 166 | $date = getdate(); |
167 | 167 | $day = $date['wday'] + 1; |
168 | - if(!in_array($day,explode(',',$allowed_days))) { |
|
168 | + if (!in_array($day, explode(',', $allowed_days))) { |
|
169 | 169 | jsAlert($_lang['login_processor_date']); |
170 | 170 | return; |
171 | 171 | } |
@@ -182,33 +182,33 @@ discard block |
||
182 | 182 | |
183 | 183 | // check if plugin authenticated the user |
184 | 184 | $matchPassword = false; |
185 | -if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
185 | +if (!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
186 | 186 | // check user password - local authentication |
187 | 187 | $hashType = $modx->getManagerApi()->getHashType($dbasePassword); |
188 | - if($hashType == 'phpass') { |
|
188 | + if ($hashType == 'phpass') { |
|
189 | 189 | $matchPassword = login($username, $requestPassword, $dbasePassword); |
190 | - } elseif($hashType == 'md5') { |
|
190 | + } elseif ($hashType == 'md5') { |
|
191 | 191 | $matchPassword = loginMD5($internalKey, $requestPassword, $dbasePassword, $username); |
192 | - } elseif($hashType == 'v1') { |
|
192 | + } elseif ($hashType == 'v1') { |
|
193 | 193 | $matchPassword = loginV1($internalKey, $requestPassword, $dbasePassword, $username); |
194 | 194 | } else { |
195 | 195 | $matchPassword = false; |
196 | 196 | } |
197 | -} else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
197 | +} else if ($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
198 | 198 | $matchPassword = true; |
199 | 199 | } |
200 | 200 | |
201 | -if(!$matchPassword) { |
|
201 | +if (!$matchPassword) { |
|
202 | 202 | jsAlert($_lang['login_processor_wrong_password']); |
203 | 203 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes ?? 10); |
204 | 204 | return; |
205 | 205 | } |
206 | 206 | |
207 | -if($modx->config['use_captcha'] == 1) { |
|
208 | - if(!isset ($_SESSION['veriword'])) { |
|
207 | +if ($modx->config['use_captcha'] == 1) { |
|
208 | + if (!isset ($_SESSION['veriword'])) { |
|
209 | 209 | jsAlert($_lang['login_processor_captcha_config']); |
210 | 210 | return; |
211 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
211 | + } elseif ($_SESSION['veriword'] != $captcha_code) { |
|
212 | 212 | jsAlert($_lang['login_processor_bad_code']); |
213 | 213 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes ?? 10); |
214 | 214 | return; |
@@ -237,28 +237,28 @@ discard block |
||
237 | 237 | |
238 | 238 | // successful login so reset fail count and update key values |
239 | 239 | $modx->getDatabase()->update( |
240 | - 'failedlogincount=0, ' . 'logincount=logincount+1, ' . 'lastlogin=thislogin, ' . 'thislogin=' . time() . ', ' . "sessionid='{$currentsessionid}'", |
|
240 | + 'failedlogincount=0, '.'logincount=logincount+1, '.'lastlogin=thislogin, '.'thislogin='.time().', '."sessionid='{$currentsessionid}'", |
|
241 | 241 | $modx->getDatabase()->getFullTableName('user_attributes'), |
242 | 242 | "internalKey='{$internalKey}'" |
243 | 243 | ); |
244 | 244 | |
245 | 245 | // get user's document groups |
246 | 246 | $i = 0; |
247 | -$rs = $modx->getDatabase()->select('uga.documentgroup', $modx->getDatabase()->getFullTableName('member_groups') . ' ug |
|
248 | - INNER JOIN ' . $modx->getDatabase()->getFullTableName('membergroup_access') . ' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'"); |
|
247 | +$rs = $modx->getDatabase()->select('uga.documentgroup', $modx->getDatabase()->getFullTableName('member_groups').' ug |
|
248 | + INNER JOIN ' . $modx->getDatabase()->getFullTableName('membergroup_access').' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'"); |
|
249 | 249 | $_SESSION['mgrDocgroups'] = $modx->getDatabase()->getColumn('documentgroup', $rs); |
250 | 250 | |
251 | 251 | $_SESSION['mgrToken'] = md5($currentsessionid); |
252 | 252 | |
253 | -if($rememberme == '1') { |
|
254 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
253 | +if ($rememberme == '1') { |
|
254 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = (int) $modx->config['session.cookie.lifetime']; |
|
255 | 255 | |
256 | 256 | // Set a cookie separate from the session cookie with the username in it. |
257 | 257 | // Are we using secure connection? If so, make sure the cookie is secure |
258 | 258 | global $https_port; |
259 | 259 | |
260 | 260 | $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
261 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
261 | + if (version_compare(PHP_VERSION, '5.2', '<')) { |
|
262 | 262 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
263 | 263 | } else { |
264 | 264 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
@@ -273,9 +273,9 @@ discard block |
||
273 | 273 | // Check if user already has an active session, if not check if user pressed logout end of last session |
274 | 274 | $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
275 | 275 | $activeSession = $modx->getDatabase()->getValue($rs); |
276 | -if(!$activeSession) { |
|
276 | +if (!$activeSession) { |
|
277 | 277 | $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
278 | - if($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
278 | + if ($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
279 | 279 | $_SESSION['show_logout_reminder'] = array( |
280 | 280 | 'type' => 'logout_reminder', |
281 | 281 | 'lastHit' => $lastHit |
@@ -300,18 +300,18 @@ discard block |
||
300 | 300 | $modx->getDatabase()->getFullTableName('user_settings'), |
301 | 301 | "user='{$internalKey}' AND setting_name='manager_login_startup'" |
302 | 302 | ); |
303 | -$id = (int)$modx->getDatabase()->getValue($rs); |
|
304 | -$ajax = (int)get_by_key($_POST, 'ajax', 0, 'is_scalar'); |
|
305 | -if($id > 0) { |
|
306 | - $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
307 | - if($ajax === 1) { |
|
303 | +$id = (int) $modx->getDatabase()->getValue($rs); |
|
304 | +$ajax = (int) get_by_key($_POST, 'ajax', 0, 'is_scalar'); |
|
305 | +if ($id > 0) { |
|
306 | + $header = 'Location: '.$modx->makeUrl($id, '', '', 'full'); |
|
307 | + if ($ajax === 1) { |
|
308 | 308 | echo $header; |
309 | 309 | } else { |
310 | 310 | header($header); |
311 | 311 | } |
312 | 312 | } else { |
313 | - $header = 'Location: ' . MODX_MANAGER_URL; |
|
314 | - if($ajax === 1) { |
|
313 | + $header = 'Location: '.MODX_MANAGER_URL; |
|
314 | + if ($ajax === 1) { |
|
315 | 315 | echo $header; |
316 | 316 | } else { |
317 | 317 | header($header); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (! isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
2 | +if (! isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
3 | 3 | header('HTTP/1.0 404 Not Found'); |
4 | 4 | exit('error'); |
5 | 5 | } |
@@ -7,18 +7,18 @@ discard block |
||
7 | 7 | define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
8 | 8 | define('MODX_API_MODE', true); |
9 | 9 | |
10 | -if (file_exists(dirname(__DIR__) . '/config.php')) { |
|
10 | +if (file_exists(dirname(__DIR__) . '/config.php')) { |
|
11 | 11 | $config = require dirname(__DIR__) . '/config.php'; |
12 | -} elseif (file_exists(dirname(__DIR__, 2) . '/config.php')) { |
|
12 | +} elseif (file_exists(dirname(__DIR__, 2) . '/config.php')) { |
|
13 | 13 | $config = require dirname(__DIR__, 2) . '/config.php'; |
14 | -} else { |
|
14 | +} else { |
|
15 | 15 | $config = [ |
16 | 16 | 'root' => dirname(__DIR__, 2) |
17 | 17 | ]; |
18 | 18 | } |
19 | -if (!empty($config['root']) && file_exists($config['root']. '/index.php')) { |
|
19 | +if (!empty($config['root']) && file_exists($config['root']. '/index.php')) { |
|
20 | 20 | require_once $config['root'] . '/index.php'; |
21 | -} else { |
|
21 | +} else { |
|
22 | 22 | echo "<h3>Unable to load configuration settings</h3>"; |
23 | 23 | echo "Please run the EVO <a href='../install'>install utility</a>"; |
24 | 24 | exit; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $_lang = ManagerTheme::getLexicon(); |
33 | 33 | |
34 | 34 | // Initialize System Alert Message Queque |
35 | -if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
35 | +if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
36 | 36 | $_SESSION['SystemAlertMsgQueque'] = array(); |
37 | 37 | } |
38 | 38 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $rs = $modx->getDatabase()->select($fields, $from, $where); |
63 | 63 | $limit = $modx->getDatabase()->getRecordCount($rs); |
64 | 64 | |
65 | -if($limit == 0 || $limit > 1) { |
|
65 | +if($limit == 0 || $limit > 1) { |
|
66 | 66 | jsAlert($_lang['login_processor_unknown_user']); |
67 | 67 | return; |
68 | 68 | } |
@@ -87,22 +87,22 @@ discard block |
||
87 | 87 | $modx->getDatabase()->getFullTableName('user_settings'), |
88 | 88 | "user='{$internalKey}' AND setting_value!=''" |
89 | 89 | ); |
90 | -while($row = $modx->getDatabase()->getRow($rs)) { |
|
90 | +while($row = $modx->getDatabase()->getRow($rs)) { |
|
91 | 91 | extract($row); |
92 | 92 | ${$setting_name} = $setting_value; |
93 | 93 | } |
94 | 94 | |
95 | 95 | // blocked due to number of login errors. |
96 | -if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
|
96 | +if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
|
97 | 97 | @session_destroy(); |
98 | 98 | session_unset(); |
99 | - if($cip = getenv("HTTP_CLIENT_IP")) { |
|
99 | + if($cip = getenv("HTTP_CLIENT_IP")) { |
|
100 | 100 | $ip = $cip; |
101 | - } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
101 | + } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
102 | 102 | $ip = $cip; |
103 | - } elseif($cip = getenv("REMOTE_ADDR")) { |
|
103 | + } elseif($cip = getenv("REMOTE_ADDR")) { |
|
104 | 104 | $ip = $cip; |
105 | - } else { |
|
105 | + } else { |
|
106 | 106 | $ip = "UNKNOWN"; |
107 | 107 | } |
108 | 108 | $log = new EvolutionCMS\Legacy\LogHandler(); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | // blocked due to number of login errors, but get to try again |
115 | -if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
|
115 | +if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
|
116 | 116 | $fields = array(); |
117 | 117 | $fields['failedlogincount'] = '0'; |
118 | 118 | $fields['blockeduntil'] = time() - 1; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | // this user has been blocked by an admin, so no way he's loggin in! |
127 | -if($blocked == '1') { |
|
127 | +if($blocked == '1') { |
|
128 | 128 | @session_destroy(); |
129 | 129 | session_unset(); |
130 | 130 | jsAlert($_lang['login_processor_blocked1']); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | // blockuntil: this user has a block until date |
135 | -if($blockeduntildate > time()) { |
|
135 | +if($blockeduntildate > time()) { |
|
136 | 136 | @session_destroy(); |
137 | 137 | session_unset(); |
138 | 138 | jsAlert($_lang['login_processor_blocked2']); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | // blockafter: this user has a block after date |
143 | -if($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
143 | +if($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
144 | 144 | @session_destroy(); |
145 | 145 | session_unset(); |
146 | 146 | jsAlert($_lang['login_processor_blocked3']); |
@@ -148,24 +148,24 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | // allowed ip |
151 | -if(!empty($allowed_ip)) { |
|
152 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
153 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
151 | +if(!empty($allowed_ip)) { |
|
152 | + if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
153 | + if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
154 | 154 | jsAlert($_lang['login_processor_remotehost_ip']); |
155 | 155 | return; |
156 | 156 | } |
157 | 157 | } |
158 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
158 | + if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
159 | 159 | jsAlert($_lang['login_processor_remote_ip']); |
160 | 160 | return; |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | // allowed days |
165 | -if(!empty($allowed_days)) { |
|
165 | +if(!empty($allowed_days)) { |
|
166 | 166 | $date = getdate(); |
167 | 167 | $day = $date['wday'] + 1; |
168 | - if(!in_array($day,explode(',',$allowed_days))) { |
|
168 | + if(!in_array($day,explode(',',$allowed_days))) { |
|
169 | 169 | jsAlert($_lang['login_processor_date']); |
170 | 170 | return; |
171 | 171 | } |
@@ -182,33 +182,33 @@ discard block |
||
182 | 182 | |
183 | 183 | // check if plugin authenticated the user |
184 | 184 | $matchPassword = false; |
185 | -if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
185 | +if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
186 | 186 | // check user password - local authentication |
187 | 187 | $hashType = $modx->getManagerApi()->getHashType($dbasePassword); |
188 | - if($hashType == 'phpass') { |
|
188 | + if($hashType == 'phpass') { |
|
189 | 189 | $matchPassword = login($username, $requestPassword, $dbasePassword); |
190 | - } elseif($hashType == 'md5') { |
|
190 | + } elseif($hashType == 'md5') { |
|
191 | 191 | $matchPassword = loginMD5($internalKey, $requestPassword, $dbasePassword, $username); |
192 | - } elseif($hashType == 'v1') { |
|
192 | + } elseif($hashType == 'v1') { |
|
193 | 193 | $matchPassword = loginV1($internalKey, $requestPassword, $dbasePassword, $username); |
194 | - } else { |
|
194 | + } else { |
|
195 | 195 | $matchPassword = false; |
196 | 196 | } |
197 | -} else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
197 | +} else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
198 | 198 | $matchPassword = true; |
199 | 199 | } |
200 | 200 | |
201 | -if(!$matchPassword) { |
|
201 | +if(!$matchPassword) { |
|
202 | 202 | jsAlert($_lang['login_processor_wrong_password']); |
203 | 203 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes ?? 10); |
204 | 204 | return; |
205 | 205 | } |
206 | 206 | |
207 | -if($modx->config['use_captcha'] == 1) { |
|
208 | - if(!isset ($_SESSION['veriword'])) { |
|
207 | +if($modx->config['use_captcha'] == 1) { |
|
208 | + if(!isset ($_SESSION['veriword'])) { |
|
209 | 209 | jsAlert($_lang['login_processor_captcha_config']); |
210 | 210 | return; |
211 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
211 | + } elseif($_SESSION['veriword'] != $captcha_code) { |
|
212 | 212 | jsAlert($_lang['login_processor_bad_code']); |
213 | 213 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes ?? 10); |
214 | 214 | return; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | $_SESSION['mgrToken'] = md5($currentsessionid); |
252 | 252 | |
253 | -if($rememberme == '1') { |
|
253 | +if($rememberme == '1') { |
|
254 | 254 | $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
255 | 255 | |
256 | 256 | // Set a cookie separate from the session cookie with the username in it. |
@@ -258,12 +258,12 @@ discard block |
||
258 | 258 | global $https_port; |
259 | 259 | |
260 | 260 | $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
261 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
261 | + if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
262 | 262 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
263 | - } else { |
|
263 | + } else { |
|
264 | 264 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
265 | 265 | } |
266 | -} else { |
|
266 | +} else { |
|
267 | 267 | $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
268 | 268 | |
269 | 269 | // Remove the Remember Me cookie |
@@ -273,9 +273,9 @@ discard block |
||
273 | 273 | // Check if user already has an active session, if not check if user pressed logout end of last session |
274 | 274 | $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
275 | 275 | $activeSession = $modx->getDatabase()->getValue($rs); |
276 | -if(!$activeSession) { |
|
276 | +if(!$activeSession) { |
|
277 | 277 | $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
278 | - if($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
278 | + if($lastHit = $modx->getDatabase()->getValue($rs)) { |
|
279 | 279 | $_SESSION['show_logout_reminder'] = array( |
280 | 280 | 'type' => 'logout_reminder', |
281 | 281 | 'lastHit' => $lastHit |
@@ -302,18 +302,18 @@ discard block |
||
302 | 302 | ); |
303 | 303 | $id = (int)$modx->getDatabase()->getValue($rs); |
304 | 304 | $ajax = (int)get_by_key($_POST, 'ajax', 0, 'is_scalar'); |
305 | -if($id > 0) { |
|
305 | +if($id > 0) { |
|
306 | 306 | $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
307 | - if($ajax === 1) { |
|
307 | + if($ajax === 1) { |
|
308 | 308 | echo $header; |
309 | - } else { |
|
309 | + } else { |
|
310 | 310 | header($header); |
311 | 311 | } |
312 | -} else { |
|
312 | +} else { |
|
313 | 313 | $header = 'Location: ' . MODX_MANAGER_URL; |
314 | - if($ajax === 1) { |
|
314 | + if($ajax === 1) { |
|
315 | 315 | echo $header; |
316 | - } else { |
|
316 | + } else { |
|
317 | 317 | header($header); |
318 | 318 | } |
319 | 319 | } |
@@ -261,7 +261,7 @@ |
||
261 | 261 | if(version_compare(PHP_VERSION, '5.2', '<')) { |
262 | 262 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
263 | 263 | } else { |
264 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
264 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, null, $secure, true); |
|
265 | 265 | } |
266 | 266 | } else { |
267 | 267 | $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
@@ -65,89 +65,89 @@ |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | switch ($_POST['mode']) { |
68 | - case '23': // Save new snippet |
|
69 | - |
|
70 | - // invoke OnBeforeSnipFormSave event |
|
71 | - $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
72 | - "mode" => "new", |
|
73 | - "id" => $id |
|
74 | - )); |
|
75 | - |
|
76 | - // disallow duplicate names for new snippets |
|
77 | - if (EvolutionCMS\Models\SiteSnippet::where('name','=',$name)->first()) { |
|
78 | - $modx->getManagerApi()->saveFormValues(23); |
|
79 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=23"); |
|
80 | - } |
|
81 | - |
|
82 | - //do stuff to save the new doc |
|
83 | - $newid = EvolutionCMS\Models\SiteSnippet::create(compact('name', 'description','snippet','moduleguid','locked','properties','category','disabled','createdon','editedon'))->getKey(); |
|
84 | - |
|
85 | - // invoke OnSnipFormSave event |
|
86 | - $modx->invokeEvent("OnSnipFormSave", array( |
|
87 | - "mode" => "new", |
|
88 | - "id" => $newid |
|
89 | - )); |
|
90 | - |
|
91 | - // Set the item name for logger |
|
92 | - $_SESSION['itemname'] = $name; |
|
93 | - |
|
94 | - // empty cache |
|
95 | - $modx->clearCache('full'); |
|
96 | - |
|
97 | - // finished emptying cache - redirect |
|
98 | - if ($_POST['stay'] != '') { |
|
99 | - $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23"; |
|
100 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
101 | - header($header); |
|
102 | - } else { |
|
103 | - $header = "Location: index.php?a=76&r=2"; |
|
104 | - header($header); |
|
105 | - } |
|
106 | - break; |
|
107 | - case '22': // Save existing snippet |
|
108 | - // invoke OnBeforeSnipFormSave event |
|
109 | - $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
110 | - "mode" => "upd", |
|
111 | - "id" => $id |
|
112 | - )); |
|
113 | - |
|
114 | - // disallow duplicate names for snippets |
|
115 | - if (EvolutionCMS\Models\SiteSnippet::where('id','!=',$id)->where('name','=',$name)->first()) { |
|
116 | - $modx->getManagerApi()->saveFormValues(22); |
|
117 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=22&id={$id}"); |
|
118 | - } |
|
119 | - |
|
120 | - //do stuff to save the edited doc |
|
121 | - $siteSnippet= EvolutionCMS\Models\SiteSnippet::find($id); |
|
122 | - |
|
123 | - $siteSnippet->update(compact('name', 'description','snippet','moduleguid','locked','properties','category','disabled','editedon')); |
|
124 | - |
|
125 | - // invoke OnSnipFormSave event |
|
126 | - $modx->invokeEvent("OnSnipFormSave", array( |
|
127 | - "mode" => "upd", |
|
128 | - "id" => $id |
|
129 | - )); |
|
130 | - |
|
131 | - // Set the item name for logger |
|
132 | - $_SESSION['itemname'] = $name; |
|
133 | - |
|
134 | - // empty cache |
|
135 | - $modx->clearCache('full'); |
|
136 | - |
|
137 | - if (isset($_POST['runsnippet'])) { |
|
138 | - run_snippet($snippet); |
|
139 | - } |
|
140 | - // finished emptying cache - redirect |
|
141 | - if ($_POST['stay'] != '') { |
|
142 | - $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23"; |
|
143 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
144 | - header($header); |
|
145 | - } else { |
|
146 | - $modx->unlockElement(4, $id); |
|
147 | - $header = "Location: index.php?a=76&r=2"; |
|
148 | - header($header); |
|
149 | - } |
|
150 | - break; |
|
151 | - default: |
|
152 | - $modx->webAlertAndQuit("No operation set in request."); |
|
68 | + case '23': // Save new snippet |
|
69 | + |
|
70 | + // invoke OnBeforeSnipFormSave event |
|
71 | + $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
72 | + "mode" => "new", |
|
73 | + "id" => $id |
|
74 | + )); |
|
75 | + |
|
76 | + // disallow duplicate names for new snippets |
|
77 | + if (EvolutionCMS\Models\SiteSnippet::where('name','=',$name)->first()) { |
|
78 | + $modx->getManagerApi()->saveFormValues(23); |
|
79 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=23"); |
|
80 | + } |
|
81 | + |
|
82 | + //do stuff to save the new doc |
|
83 | + $newid = EvolutionCMS\Models\SiteSnippet::create(compact('name', 'description','snippet','moduleguid','locked','properties','category','disabled','createdon','editedon'))->getKey(); |
|
84 | + |
|
85 | + // invoke OnSnipFormSave event |
|
86 | + $modx->invokeEvent("OnSnipFormSave", array( |
|
87 | + "mode" => "new", |
|
88 | + "id" => $newid |
|
89 | + )); |
|
90 | + |
|
91 | + // Set the item name for logger |
|
92 | + $_SESSION['itemname'] = $name; |
|
93 | + |
|
94 | + // empty cache |
|
95 | + $modx->clearCache('full'); |
|
96 | + |
|
97 | + // finished emptying cache - redirect |
|
98 | + if ($_POST['stay'] != '') { |
|
99 | + $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23"; |
|
100 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
101 | + header($header); |
|
102 | + } else { |
|
103 | + $header = "Location: index.php?a=76&r=2"; |
|
104 | + header($header); |
|
105 | + } |
|
106 | + break; |
|
107 | + case '22': // Save existing snippet |
|
108 | + // invoke OnBeforeSnipFormSave event |
|
109 | + $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
110 | + "mode" => "upd", |
|
111 | + "id" => $id |
|
112 | + )); |
|
113 | + |
|
114 | + // disallow duplicate names for snippets |
|
115 | + if (EvolutionCMS\Models\SiteSnippet::where('id','!=',$id)->where('name','=',$name)->first()) { |
|
116 | + $modx->getManagerApi()->saveFormValues(22); |
|
117 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=22&id={$id}"); |
|
118 | + } |
|
119 | + |
|
120 | + //do stuff to save the edited doc |
|
121 | + $siteSnippet= EvolutionCMS\Models\SiteSnippet::find($id); |
|
122 | + |
|
123 | + $siteSnippet->update(compact('name', 'description','snippet','moduleguid','locked','properties','category','disabled','editedon')); |
|
124 | + |
|
125 | + // invoke OnSnipFormSave event |
|
126 | + $modx->invokeEvent("OnSnipFormSave", array( |
|
127 | + "mode" => "upd", |
|
128 | + "id" => $id |
|
129 | + )); |
|
130 | + |
|
131 | + // Set the item name for logger |
|
132 | + $_SESSION['itemname'] = $name; |
|
133 | + |
|
134 | + // empty cache |
|
135 | + $modx->clearCache('full'); |
|
136 | + |
|
137 | + if (isset($_POST['runsnippet'])) { |
|
138 | + run_snippet($snippet); |
|
139 | + } |
|
140 | + // finished emptying cache - redirect |
|
141 | + if ($_POST['stay'] != '') { |
|
142 | + $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23"; |
|
143 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
144 | + header($header); |
|
145 | + } else { |
|
146 | + $modx->unlockElement(4, $id); |
|
147 | + $header = "Location: index.php?a=76&r=2"; |
|
148 | + header($header); |
|
149 | + } |
|
150 | + break; |
|
151 | + default: |
|
152 | + $modx->webAlertAndQuit("No operation set in request."); |
|
153 | 153 | } |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('save_snippet')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = (int)$_POST['id']; |
|
9 | +$id = (int) $_POST['id']; |
|
10 | 10 | $snippet = trim($_POST['post']); |
11 | 11 | $name = trim($_POST['name']); |
12 | 12 | $description = $_POST['description']; |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | |
33 | 33 | //Kyle Jaebker - added category support |
34 | 34 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
35 | - $category = (int)$_POST['categoryid']; |
|
35 | + $category = (int) $_POST['categoryid']; |
|
36 | 36 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
37 | 37 | $category = 0; |
38 | 38 | } else { |
39 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
39 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
40 | 40 | $category = checkCategory($_POST['newcategory']); |
41 | 41 | if (!$category) { |
42 | 42 | $category = newCategory($_POST['newcategory']); |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid; |
55 | 55 | |
56 | 56 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
57 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
57 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
58 | 58 | if ($version) { |
59 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
59 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
60 | 60 | } |
61 | 61 | if (isset($parsed['modx_category'])) { |
62 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
62 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
63 | 63 | $category = getCategory($parsed['modx_category']); |
64 | 64 | } |
65 | 65 | } |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | )); |
75 | 75 | |
76 | 76 | // disallow duplicate names for new snippets |
77 | - if (EvolutionCMS\Models\SiteSnippet::where('name','=',$name)->first()) { |
|
77 | + if (EvolutionCMS\Models\SiteSnippet::where('name', '=', $name)->first()) { |
|
78 | 78 | $modx->getManagerApi()->saveFormValues(23); |
79 | 79 | $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=23"); |
80 | 80 | } |
81 | 81 | |
82 | 82 | //do stuff to save the new doc |
83 | - $newid = EvolutionCMS\Models\SiteSnippet::create(compact('name', 'description','snippet','moduleguid','locked','properties','category','disabled','createdon','editedon'))->getKey(); |
|
83 | + $newid = EvolutionCMS\Models\SiteSnippet::create(compact('name', 'description', 'snippet', 'moduleguid', 'locked', 'properties', 'category', 'disabled', 'createdon', 'editedon'))->getKey(); |
|
84 | 84 | |
85 | 85 | // invoke OnSnipFormSave event |
86 | 86 | $modx->invokeEvent("OnSnipFormSave", array( |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | // finished emptying cache - redirect |
98 | 98 | if ($_POST['stay'] != '') { |
99 | 99 | $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23"; |
100 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
100 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
101 | 101 | header($header); |
102 | 102 | } else { |
103 | 103 | $header = "Location: index.php?a=76&r=2"; |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | )); |
113 | 113 | |
114 | 114 | // disallow duplicate names for snippets |
115 | - if (EvolutionCMS\Models\SiteSnippet::where('id','!=',$id)->where('name','=',$name)->first()) { |
|
115 | + if (EvolutionCMS\Models\SiteSnippet::where('id', '!=', $id)->where('name', '=', $name)->first()) { |
|
116 | 116 | $modx->getManagerApi()->saveFormValues(22); |
117 | 117 | $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=22&id={$id}"); |
118 | 118 | } |
119 | 119 | |
120 | 120 | //do stuff to save the edited doc |
121 | - $siteSnippet= EvolutionCMS\Models\SiteSnippet::find($id); |
|
121 | + $siteSnippet = EvolutionCMS\Models\SiteSnippet::find($id); |
|
122 | 122 | |
123 | - $siteSnippet->update(compact('name', 'description','snippet','moduleguid','locked','properties','category','disabled','editedon')); |
|
123 | + $siteSnippet->update(compact('name', 'description', 'snippet', 'moduleguid', 'locked', 'properties', 'category', 'disabled', 'editedon')); |
|
124 | 124 | |
125 | 125 | // invoke OnSnipFormSave event |
126 | 126 | $modx->invokeEvent("OnSnipFormSave", array( |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | // finished emptying cache - redirect |
141 | 141 | if ($_POST['stay'] != '') { |
142 | 142 | $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23"; |
143 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
143 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
144 | 144 | header($header); |
145 | 145 | } else { |
146 | 146 | $modx->unlockElement(4, $id); |
@@ -3,12 +3,12 @@ |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('new_snippet')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('new_snippet')) { |
|
5 | +if (!$modx->hasPermission('new_snippet')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | $snippet = EvolutionCMS\Models\SiteSnippet::findOrFail($id); |
16 | 16 | $name = $snippet ->name; |
17 | 17 | $count = EvolutionCMS\Models\SiteSnippet::where('name', 'like', $name.' '.$_lang['duplicated_el_suffix'].'%')->count(); |
18 | -if($count>=1) $count = ' '.($count+1); |
|
18 | +if ($count >= 1) $count = ' '.($count + 1); |
|
19 | 19 | else $count = ''; |
20 | 20 | |
21 | 21 | // duplicate Snippet |
@@ -27,5 +27,5 @@ discard block |
||
27 | 27 | $_SESSION['itemname'] = $newSnippet->name; |
28 | 28 | |
29 | 29 | // finish duplicating - redirect to new snippet |
30 | -$header="Location: index.php?r=2&a=22&id=".$newSnippet->getKey(); |
|
30 | +$header = "Location: index.php?r=2&a=22&id=".$newSnippet->getKey(); |
|
31 | 31 | header($header); |
@@ -15,8 +15,11 @@ |
||
15 | 15 | $snippet = EvolutionCMS\Models\SiteSnippet::findOrFail($id); |
16 | 16 | $name = $snippet ->name; |
17 | 17 | $count = EvolutionCMS\Models\SiteSnippet::where('name', 'like', $name.' '.$_lang['duplicated_el_suffix'].'%')->count(); |
18 | -if($count>=1) $count = ' '.($count+1); |
|
19 | -else $count = ''; |
|
18 | +if($count>=1) { |
|
19 | + $count = ' '.($count+1); |
|
20 | +} else { |
|
21 | + $count = ''; |
|
22 | +} |
|
20 | 23 | |
21 | 24 | // duplicate Snippet |
22 | 25 | $newSnippet = $snippet->replicate(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('file_manager')) { |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | $newToken = makeToken(); |
10 | 10 | |
11 | 11 | // settings |
12 | -$theme_image_path = MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/'; |
|
12 | +$theme_image_path = MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/'; |
|
13 | 13 | $excludes = array( |
14 | 14 | '.', |
15 | 15 | '..', |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | '.git', |
18 | 18 | '.idea' |
19 | 19 | ); |
20 | -$alias_suffix = (!empty($friendly_url_suffix)) ? ',' . ltrim($friendly_url_suffix, '.') : ''; |
|
21 | -$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix); |
|
22 | -$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix); |
|
20 | +$alias_suffix = (!empty($friendly_url_suffix)) ? ','.ltrim($friendly_url_suffix, '.') : ''; |
|
21 | +$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix); |
|
22 | +$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix); |
|
23 | 23 | $viewablefiles = explode(',', 'jpg,gif,png,ico'); |
24 | 24 | |
25 | 25 | $editablefiles = add_dot($editablefiles); |
@@ -32,31 +32,31 @@ discard block |
||
32 | 32 | { |
33 | 33 | */ |
34 | 34 | $protected_path[] = MODX_MANAGER_PATH; |
35 | -$protected_path[] = MODX_BASE_PATH . 'temp/backup'; |
|
36 | -$protected_path[] = MODX_BASE_PATH . 'assets/backup'; |
|
35 | +$protected_path[] = MODX_BASE_PATH.'temp/backup'; |
|
36 | +$protected_path[] = MODX_BASE_PATH.'assets/backup'; |
|
37 | 37 | |
38 | 38 | if (!$modx->hasPermission('save_plugin')) { |
39 | - $protected_path[] = MODX_BASE_PATH . 'assets/plugins'; |
|
39 | + $protected_path[] = MODX_BASE_PATH.'assets/plugins'; |
|
40 | 40 | } |
41 | 41 | if (!$modx->hasPermission('save_snippet')) { |
42 | - $protected_path[] = MODX_BASE_PATH . 'assets/snippets'; |
|
42 | + $protected_path[] = MODX_BASE_PATH.'assets/snippets'; |
|
43 | 43 | } |
44 | 44 | if (!$modx->hasPermission('save_template')) { |
45 | - $protected_path[] = MODX_BASE_PATH . 'assets/templates'; |
|
45 | + $protected_path[] = MODX_BASE_PATH.'assets/templates'; |
|
46 | 46 | } |
47 | 47 | if (!$modx->hasPermission('save_module')) { |
48 | - $protected_path[] = MODX_BASE_PATH . 'assets/modules'; |
|
48 | + $protected_path[] = MODX_BASE_PATH.'assets/modules'; |
|
49 | 49 | } |
50 | 50 | if (!$modx->hasPermission('empty_cache')) { |
51 | - $protected_path[] = MODX_BASE_PATH . 'assets/cache'; |
|
51 | + $protected_path[] = MODX_BASE_PATH.'assets/cache'; |
|
52 | 52 | } |
53 | 53 | if (!$modx->hasPermission('import_static')) { |
54 | - $protected_path[] = MODX_BASE_PATH . 'temp/import'; |
|
55 | - $protected_path[] = MODX_BASE_PATH . 'assets/import'; |
|
54 | + $protected_path[] = MODX_BASE_PATH.'temp/import'; |
|
55 | + $protected_path[] = MODX_BASE_PATH.'assets/import'; |
|
56 | 56 | } |
57 | 57 | if (!$modx->hasPermission('export_static')) { |
58 | - $protected_path[] = MODX_BASE_PATH . 'temp/export'; |
|
59 | - $protected_path[] = MODX_BASE_PATH . 'assets/export'; |
|
58 | + $protected_path[] = MODX_BASE_PATH.'temp/export'; |
|
59 | + $protected_path[] = MODX_BASE_PATH.'assets/export'; |
|
60 | 60 | } |
61 | 61 | /* |
62 | 62 | } |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | $rw = realpath('../'); |
99 | 99 | $webstart_path = str_replace('\\', '/', str_replace($rw, '', $rf)); |
100 | 100 | if (substr($webstart_path, 0, 1) == '/') { |
101 | - $webstart_path = '..' . $webstart_path; |
|
101 | + $webstart_path = '..'.$webstart_path; |
|
102 | 102 | } else { |
103 | - $webstart_path = '../' . $webstart_path; |
|
103 | + $webstart_path = '../'.$webstart_path; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | ?> |
107 | 107 | <script type="text/javascript"> |
108 | 108 | |
109 | - var current_path = '<?= $startpath;?>'; |
|
109 | + var current_path = '<?= $startpath; ?>'; |
|
110 | 110 | |
111 | 111 | function viewfile (url) |
112 | 112 | { |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | function unzipFile (file) |
143 | 143 | { |
144 | 144 | if (confirmUnzip()) { |
145 | - window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken;?>"; |
|
145 | + window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken; ?>"; |
|
146 | 146 | return false; |
147 | 147 | } |
148 | 148 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | function deleteFolder (folder, status) |
165 | 165 | { |
166 | 166 | if (confirmDeleteFolder(status)) { |
167 | - window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken;?>"; |
|
167 | + window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken; ?>"; |
|
168 | 168 | return false; |
169 | 169 | } |
170 | 170 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | function deleteFile (file) |
173 | 173 | { |
174 | 174 | if (confirmDelete()) { |
175 | - window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken;?>"; |
|
175 | + window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken; ?>"; |
|
176 | 176 | return false; |
177 | 177 | } |
178 | 178 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | { |
182 | 182 | var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
183 | 183 | if (newFilename !== null && newFilename !== file) { |
184 | - window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
184 | + window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | { |
190 | 190 | var newDirname = prompt("<?= $_lang["files_dynamic_new_folder_name"] ?>", dir); |
191 | 191 | if (newDirname !== null && newDirname !== dir) { |
192 | - window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken;?>"; |
|
192 | + window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken; ?>"; |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
199 | 199 | if (newFilename !== null && newFilename !== file) { |
200 | - window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
200 | + window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | <?php endif ?> |
217 | 217 | <?php |
218 | 218 | if (isset($_GET['mode']) && $_GET['mode'] !== 'drill') { |
219 | - $href = 'a=31&path=' . urlencode($_REQUEST['path']); |
|
219 | + $href = 'a=31&path='.urlencode($_REQUEST['path']); |
|
220 | 220 | } else { |
221 | 221 | $href = 'a=2'; |
222 | 222 | } |
@@ -226,12 +226,12 @@ discard block |
||
226 | 226 | $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFolderName(this);"><i class="[+image+]"></i><span>[+subject+]</span></a>'; |
227 | 227 | $ph['image'] = $_style['files_folder-open']; |
228 | 228 | $ph['subject'] = $_lang['add_folder']; |
229 | - $ph['href'] = 'index.php?a=31&mode=newfolder&path=' . urlencode($startpath) . '&name='; |
|
229 | + $ph['href'] = 'index.php?a=31&mode=newfolder&path='.urlencode($startpath).'&name='; |
|
230 | 230 | $_ = parsePlaceholder($tpl, $ph); |
231 | 231 | |
232 | - $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>' . $_lang['files.dynamic.php1'] . '</span></a>'; |
|
232 | + $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>'.$_lang['files.dynamic.php1'].'</span></a>'; |
|
233 | 233 | $ph['image'] = $_style['files_page_html']; |
234 | - $ph['href'] = 'index.php?a=31&mode=newfile&path=' . urlencode($startpath) . '&name='; |
|
234 | + $ph['href'] = 'index.php?a=31&mode=newfile&path='.urlencode($startpath).'&name='; |
|
235 | 235 | $_ .= parsePlaceholder($tpl, $ph); |
236 | 236 | echo $_; |
237 | 237 | } |
@@ -261,12 +261,12 @@ discard block |
||
261 | 261 | $ph = array(); |
262 | 262 | $ph['style_path'] = $theme_image_path; |
263 | 263 | // To Top Level with folder icon to the left |
264 | - if ($startpath == $filemanager_path || $startpath . '/' == $filemanager_path) { |
|
265 | - $ph['image'] = '' . $_style['files_top'] . ''; |
|
264 | + if ($startpath == $filemanager_path || $startpath.'/' == $filemanager_path) { |
|
265 | + $ph['image'] = ''.$_style['files_top'].''; |
|
266 | 266 | $ph['subject'] = '<span>Top</span>'; |
267 | 267 | } else { |
268 | - $ph['image'] = '' . $_style['files_top'] . ''; |
|
269 | - $ph['subject'] = '<a href="index.php?a=31&mode=drill&path=' . $filemanager_path . '">Top</a>/'; |
|
268 | + $ph['image'] = ''.$_style['files_top'].''; |
|
269 | + $ph['subject'] = '<a href="index.php?a=31&mode=drill&path='.$filemanager_path.'">Top</a>/'; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | echo parsePlaceholder($tpl, $ph); |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | if (empty($v)) { |
284 | 284 | continue; |
285 | 285 | } |
286 | - $path .= rtrim($v, '/') . '/'; |
|
286 | + $path .= rtrim($v, '/').'/'; |
|
287 | 287 | if (1 < $count) { |
288 | - $href = 'index.php?a=31&mode=drill&path=' . urlencode($filemanager_path . $path); |
|
289 | - $pieces[$i] = '<a href="' . $href . '">' . trim($v, '/') . '</a>'; |
|
288 | + $href = 'index.php?a=31&mode=drill&path='.urlencode($filemanager_path.$path); |
|
289 | + $pieces[$i] = '<a href="'.$href.'">'.trim($v, '/').'</a>'; |
|
290 | 290 | } else { |
291 | - $pieces[$i] = '<span>' . trim($v, '/') . '</span>'; |
|
291 | + $pieces[$i] = '<span>'.trim($v, '/').'</span>'; |
|
292 | 292 | } |
293 | 293 | $count--; |
294 | 294 | } |
@@ -301,16 +301,16 @@ discard block |
||
301 | 301 | </div> |
302 | 302 | <?php |
303 | 303 | // check to see user isn't trying to move below the document_root |
304 | - if (substr(strtolower(str_replace('//', '/', $startpath . "/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path . '/'))) { |
|
304 | + if (substr(strtolower(str_replace('//', '/', $startpath."/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path.'/'))) { |
|
305 | 305 | $modx->webAlertAndQuit($_lang["files_access_denied"]); |
306 | 306 | } |
307 | 307 | |
308 | 308 | // Unzip .zip files - by Raymond |
309 | 309 | if ($enablefileunzip && get_by_key($_REQUEST, 'mode') == 'unzip' && is_writable($startpath)) { |
310 | - if (!$err = unzip(realpath("{$startpath}/" . $_REQUEST['file']), realpath($startpath))) { |
|
311 | - echo '<span class="warning"><b>' . $_lang['file_unzip_fail'] . ($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '') . '</b></span><br /><br />'; |
|
310 | + if (!$err = unzip(realpath("{$startpath}/".$_REQUEST['file']), realpath($startpath))) { |
|
311 | + echo '<span class="warning"><b>'.$_lang['file_unzip_fail'].($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '').'</b></span><br /><br />'; |
|
312 | 312 | } else { |
313 | - echo '<span class="success"><b>' . $_lang['file_unzip'] . '</b></span><br /><br />'; |
|
313 | + echo '<span class="success"><b>'.$_lang['file_unzip'].'</b></span><br /><br />'; |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | // End Unzip - Raymond |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | if (get_by_key($_REQUEST, 'mode') == 'deletefolder') { |
323 | 323 | $folder = $_REQUEST['folderpath']; |
324 | 324 | if (!$token_check || !@rrmdir($folder)) { |
325 | - echo '<span class="warning"><b>' . $_lang['file_folder_not_deleted'] . '</b></span><br /><br />'; |
|
325 | + echo '<span class="warning"><b>'.$_lang['file_folder_not_deleted'].'</b></span><br /><br />'; |
|
326 | 326 | } else { |
327 | - echo '<span class="success"><b>' . $_lang['file_folder_deleted'] . '</b></span><br /><br />'; |
|
327 | + echo '<span class="success"><b>'.$_lang['file_folder_deleted'].'</b></span><br /><br />'; |
|
328 | 328 | } |
329 | 329 | } |
330 | 330 | |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | if (!mkdirs("{$startpath}/{$foldername}", 0777)) { |
336 | 336 | echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
337 | 337 | } else { |
338 | - if (!@chmod($startpath . '/' . $foldername, $newfolderaccessmode)) { |
|
339 | - echo '<span class="warning"><b>' . $_lang['file_folder_chmod_error'] . '</b></span><br /><br />'; |
|
338 | + if (!@chmod($startpath.'/'.$foldername, $newfolderaccessmode)) { |
|
339 | + echo '<span class="warning"><b>'.$_lang['file_folder_chmod_error'].'</b></span><br /><br />'; |
|
340 | 340 | } else { |
341 | - echo '<span class="success"><b>' . $_lang['file_folder_created'] . '</b></span><br /><br />'; |
|
341 | + echo '<span class="success"><b>'.$_lang['file_folder_created'].'</b></span><br /><br />'; |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | umask($old_umask); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $filename = $modx->getDatabase()->escape($filename); |
351 | 351 | |
352 | 352 | if (!checkExtension($filename)) { |
353 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
353 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
354 | 354 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $filename) !== 0) { |
355 | 355 | echo $_lang['files.dynamic.php3']; |
356 | 356 | } else { |
@@ -372,11 +372,11 @@ discard block |
||
372 | 372 | $newFilename = $modx->getDatabase()->escape($newFilename); |
373 | 373 | |
374 | 374 | if (!checkExtension($newFilename)) { |
375 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
375 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
376 | 376 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
377 | 377 | echo $_lang['files.dynamic.php3']; |
378 | 378 | } else { |
379 | - if (!copy($filename, MODX_BASE_PATH . $newFilename)) { |
|
379 | + if (!copy($filename, MODX_BASE_PATH.$newFilename)) { |
|
380 | 380 | echo $_lang['files.dynamic.php5']; |
381 | 381 | } |
382 | 382 | umask($old_umask); |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | // Rename folder here |
386 | 386 | if (get_by_key($_REQUEST, 'mode') == 'renameFolder') { |
387 | 387 | $old_umask = umask(0); |
388 | - $dirname = $_REQUEST['path'] . '/' . $_REQUEST['dirname']; |
|
388 | + $dirname = $_REQUEST['path'].'/'.$_REQUEST['dirname']; |
|
389 | 389 | $dirname = $modx->getDatabase()->escape($dirname); |
390 | 390 | $newDirname = str_replace(array( |
391 | 391 | '..\\', |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | |
398 | 398 | if (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newDirname) !== 0) { |
399 | 399 | echo $_lang['files.dynamic.php3']; |
400 | - } else if (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) { |
|
400 | + } else if (!rename($dirname, $_REQUEST['path'].'/'.$newDirname)) { |
|
401 | 401 | echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
402 | 402 | } |
403 | 403 | umask($old_umask); |
@@ -417,11 +417,11 @@ discard block |
||
417 | 417 | $newFilename = $modx->getDatabase()->escape($newFilename); |
418 | 418 | |
419 | 419 | if (!checkExtension($newFilename)) { |
420 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
420 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
421 | 421 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
422 | 422 | echo $_lang['files.dynamic.php3']; |
423 | 423 | } else { |
424 | - if (!rename($filename, $path . '/' . $newFilename)) { |
|
424 | + if (!rename($filename, $path.'/'.$newFilename)) { |
|
425 | 425 | echo $_lang['files.dynamic.php5']; |
426 | 426 | } |
427 | 427 | umask($old_umask); |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | extract(ls($startpath, compact('len', 'webstart_path', 'editablefiles', 'enablefileunzip', 'inlineviewablefiles', 'uploadablefiles', 'enablefiledownload', 'viewablefiles', 'protected_path', 'excludes')), EXTR_OVERWRITE); |
451 | 451 | echo "\n\n\n"; |
452 | 452 | if ($folders == 0 && $files == 0) { |
453 | - echo '<tr><td colspan="4"><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> ' . $_lang['files_directory_is_empty'] . ' </span></td></tr>'; |
|
453 | + echo '<tr><td colspan="4"><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> '.$_lang['files_directory_is_empty'].' </span></td></tr>'; |
|
454 | 454 | } |
455 | 455 | ?> |
456 | 456 | </table> |
@@ -459,10 +459,10 @@ discard block |
||
459 | 459 | <div class="container"> |
460 | 460 | <p> |
461 | 461 | <?php |
462 | - echo $_lang['files_directories'] . ': <b>' . $folders . '</b> '; |
|
463 | - echo $_lang['files_files'] . ': <b>' . $files . '</b> '; |
|
464 | - echo $_lang['files_data'] . ': <b><span dir="ltr">' . nicesize($filesizes) . '</span></b> '; |
|
465 | - echo $_lang['files_dirwritable'] . ' <b>' . (is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no']) . '.</b>' |
|
462 | + echo $_lang['files_directories'].': <b>'.$folders.'</b> '; |
|
463 | + echo $_lang['files_files'].': <b>'.$files.'</b> '; |
|
464 | + echo $_lang['files_data'].': <b><span dir="ltr">'.nicesize($filesizes).'</span></b> '; |
|
465 | + echo $_lang['files_dirwritable'].' <b>'.(is_writable($startpath) == 1 ? $_lang['yes'].'.' : $_lang['no']).'.</b>' |
|
466 | 466 | ?> |
467 | 467 | </p> |
468 | 468 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | </form> |
488 | 488 | <?php |
489 | 489 | } else { |
490 | - echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>"; |
|
490 | + echo "<p>".$_lang['files_upload_inhibited_msg']."</p>"; |
|
491 | 491 | } |
492 | 492 | ?> |
493 | 493 | <div id="imageviewer"></div> |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | ?> |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | ?> |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | ?> |