@@ -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 | define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
7 | 7 | define('MODX_API_MODE', true); |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | include_once("{$core_path}lang/english.inc.php"); |
19 | 19 | |
20 | 20 | if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
21 | - include_once("{$core_path}lang/{$manager_language}.inc.php"); |
|
21 | + include_once("{$core_path}lang/{$manager_language}.inc.php"); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | // Initialize System Alert Message Queque |
25 | 25 | if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
26 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
26 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
27 | 27 | } |
28 | 28 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
29 | 29 | |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | |
39 | 39 | // invoke OnBeforeManagerLogin event |
40 | 40 | $modx->invokeEvent('OnBeforeManagerLogin', array( |
41 | - 'username' => $username, |
|
42 | - 'userpassword' => $givenPassword, |
|
43 | - 'rememberme' => $rememberme |
|
44 | - )); |
|
41 | + 'username' => $username, |
|
42 | + 'userpassword' => $givenPassword, |
|
43 | + 'rememberme' => $rememberme |
|
44 | + )); |
|
45 | 45 | $fields = 'mu.*, ua.*'; |
46 | 46 | $from = '[+prefix+]manager_users AS mu, [+prefix+]user_attributes AS ua'; |
47 | 47 | $where = "BINARY mu.username='{$username}' and ua.internalKey=mu.id"; |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | $limit = $modx->db->getRecordCount($rs); |
50 | 50 | |
51 | 51 | if($limit == 0 || $limit > 1) { |
52 | - jsAlert($_lang['login_processor_unknown_user']); |
|
53 | - return; |
|
52 | + jsAlert($_lang['login_processor_unknown_user']); |
|
53 | + return; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $row = $modx->db->getRow($rs); |
@@ -71,127 +71,127 @@ discard block |
||
71 | 71 | // get the user settings from the database |
72 | 72 | $rs = $modx->db->select('setting_name, setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_value!=''"); |
73 | 73 | while($row = $modx->db->getRow($rs)) { |
74 | - extract($row); |
|
75 | - ${$setting_name} = $setting_value; |
|
74 | + extract($row); |
|
75 | + ${$setting_name} = $setting_value; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | // blocked due to number of login errors. |
79 | 79 | if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
80 | - @session_destroy(); |
|
81 | - session_unset(); |
|
82 | - if($cip = getenv("HTTP_CLIENT_IP")) { |
|
83 | - $ip = $cip; |
|
84 | - } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
85 | - $ip = $cip; |
|
86 | - } elseif($cip = getenv("REMOTE_ADDR")) { |
|
87 | - $ip = $cip; |
|
88 | - } else { |
|
89 | - $ip = "UNKNOWN"; |
|
90 | - } |
|
91 | - $log = new EvolutionCMS\Legacy\LogHandler(); |
|
92 | - $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
93 | - jsAlert($_lang['login_processor_many_failed_logins']); |
|
94 | - return; |
|
80 | + @session_destroy(); |
|
81 | + session_unset(); |
|
82 | + if($cip = getenv("HTTP_CLIENT_IP")) { |
|
83 | + $ip = $cip; |
|
84 | + } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
85 | + $ip = $cip; |
|
86 | + } elseif($cip = getenv("REMOTE_ADDR")) { |
|
87 | + $ip = $cip; |
|
88 | + } else { |
|
89 | + $ip = "UNKNOWN"; |
|
90 | + } |
|
91 | + $log = new EvolutionCMS\Legacy\LogHandler(); |
|
92 | + $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
93 | + jsAlert($_lang['login_processor_many_failed_logins']); |
|
94 | + return; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | // blocked due to number of login errors, but get to try again |
98 | 98 | if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
99 | - $fields = array(); |
|
100 | - $fields['failedlogincount'] = '0'; |
|
101 | - $fields['blockeduntil'] = time() - 1; |
|
102 | - $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
99 | + $fields = array(); |
|
100 | + $fields['failedlogincount'] = '0'; |
|
101 | + $fields['blockeduntil'] = time() - 1; |
|
102 | + $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | // this user has been blocked by an admin, so no way he's loggin in! |
106 | 106 | if($blocked == '1') { |
107 | - @session_destroy(); |
|
108 | - session_unset(); |
|
109 | - jsAlert($_lang['login_processor_blocked1']); |
|
110 | - return; |
|
107 | + @session_destroy(); |
|
108 | + session_unset(); |
|
109 | + jsAlert($_lang['login_processor_blocked1']); |
|
110 | + return; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | // blockuntil: this user has a block until date |
114 | 114 | if($blockeduntildate > time()) { |
115 | - @session_destroy(); |
|
116 | - session_unset(); |
|
117 | - jsAlert($_lang['login_processor_blocked2']); |
|
118 | - return; |
|
115 | + @session_destroy(); |
|
116 | + session_unset(); |
|
117 | + jsAlert($_lang['login_processor_blocked2']); |
|
118 | + return; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | // blockafter: this user has a block after date |
122 | 122 | if($blockedafterdate > 0 && $blockedafterdate < time()) { |
123 | - @session_destroy(); |
|
124 | - session_unset(); |
|
125 | - jsAlert($_lang['login_processor_blocked3']); |
|
126 | - return; |
|
123 | + @session_destroy(); |
|
124 | + session_unset(); |
|
125 | + jsAlert($_lang['login_processor_blocked3']); |
|
126 | + return; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | // allowed ip |
130 | 130 | if($allowed_ip) { |
131 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
132 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
133 | - jsAlert($_lang['login_processor_remotehost_ip']); |
|
134 | - return; |
|
135 | - } |
|
136 | - } |
|
137 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
138 | - jsAlert($_lang['login_processor_remote_ip']); |
|
139 | - return; |
|
140 | - } |
|
131 | + if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
132 | + if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
133 | + jsAlert($_lang['login_processor_remotehost_ip']); |
|
134 | + return; |
|
135 | + } |
|
136 | + } |
|
137 | + if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
138 | + jsAlert($_lang['login_processor_remote_ip']); |
|
139 | + return; |
|
140 | + } |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | // allowed days |
144 | 144 | if($allowed_days) { |
145 | - $date = getdate(); |
|
146 | - $day = $date['wday'] + 1; |
|
147 | - if(!in_array($day,explode(',',$allowed_days))) { |
|
148 | - jsAlert($_lang['login_processor_date']); |
|
149 | - return; |
|
150 | - } |
|
145 | + $date = getdate(); |
|
146 | + $day = $date['wday'] + 1; |
|
147 | + if(!in_array($day,explode(',',$allowed_days))) { |
|
148 | + jsAlert($_lang['login_processor_date']); |
|
149 | + return; |
|
150 | + } |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | // invoke OnManagerAuthentication event |
154 | 154 | $rt = $modx->invokeEvent('OnManagerAuthentication', array( |
155 | - 'userid' => $internalKey, |
|
156 | - 'username' => $username, |
|
157 | - 'userpassword' => $givenPassword, |
|
158 | - 'savedpassword' => $dbasePassword, |
|
159 | - 'rememberme' => $rememberme |
|
160 | - )); |
|
155 | + 'userid' => $internalKey, |
|
156 | + 'username' => $username, |
|
157 | + 'userpassword' => $givenPassword, |
|
158 | + 'savedpassword' => $dbasePassword, |
|
159 | + 'rememberme' => $rememberme |
|
160 | + )); |
|
161 | 161 | |
162 | 162 | // check if plugin authenticated the user |
163 | 163 | $matchPassword = false; |
164 | 164 | if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
165 | - // check user password - local authentication |
|
166 | - $hashType = $modx->manager->getHashType($dbasePassword); |
|
167 | - if($hashType == 'phpass') { |
|
168 | - $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
|
169 | - } elseif($hashType == 'md5') { |
|
170 | - $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
171 | - } elseif($hashType == 'v1') { |
|
172 | - $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
173 | - } else { |
|
174 | - $matchPassword = false; |
|
175 | - } |
|
165 | + // check user password - local authentication |
|
166 | + $hashType = $modx->manager->getHashType($dbasePassword); |
|
167 | + if($hashType == 'phpass') { |
|
168 | + $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
|
169 | + } elseif($hashType == 'md5') { |
|
170 | + $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
171 | + } elseif($hashType == 'v1') { |
|
172 | + $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
173 | + } else { |
|
174 | + $matchPassword = false; |
|
175 | + } |
|
176 | 176 | } else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
177 | - $matchPassword = true; |
|
177 | + $matchPassword = true; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | if(!$matchPassword) { |
181 | - jsAlert($_lang['login_processor_wrong_password']); |
|
182 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
183 | - return; |
|
181 | + jsAlert($_lang['login_processor_wrong_password']); |
|
182 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
183 | + return; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | if($modx->config['use_captcha'] == 1) { |
187 | - if(!isset ($_SESSION['veriword'])) { |
|
188 | - jsAlert($_lang['login_processor_captcha_config']); |
|
189 | - return; |
|
190 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
191 | - jsAlert($_lang['login_processor_bad_code']); |
|
192 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
193 | - return; |
|
194 | - } |
|
187 | + if(!isset ($_SESSION['veriword'])) { |
|
188 | + jsAlert($_lang['login_processor_captcha_config']); |
|
189 | + return; |
|
190 | + } elseif($_SESSION['veriword'] != $captcha_code) { |
|
191 | + jsAlert($_lang['login_processor_bad_code']); |
|
192 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
193 | + return; |
|
194 | + } |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | $modx->cleanupExpiredLocks(); |
@@ -226,36 +226,36 @@ discard block |
||
226 | 226 | $_SESSION['mgrToken'] = md5($currentsessionid); |
227 | 227 | |
228 | 228 | if($rememberme == '1') { |
229 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
230 | - |
|
231 | - // Set a cookie separate from the session cookie with the username in it. |
|
232 | - // Are we using secure connection? If so, make sure the cookie is secure |
|
233 | - global $https_port; |
|
234 | - |
|
235 | - $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
236 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
237 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
238 | - } else { |
|
239 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
240 | - } |
|
229 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
230 | + |
|
231 | + // Set a cookie separate from the session cookie with the username in it. |
|
232 | + // Are we using secure connection? If so, make sure the cookie is secure |
|
233 | + global $https_port; |
|
234 | + |
|
235 | + $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
236 | + if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
237 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
238 | + } else { |
|
239 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
240 | + } |
|
241 | 241 | } else { |
242 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
242 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
243 | 243 | |
244 | - // Remove the Remember Me cookie |
|
245 | - setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
244 | + // Remove the Remember Me cookie |
|
245 | + setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | // Check if user already has an active session, if not check if user pressed logout end of last session |
249 | 249 | $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
250 | 250 | $activeSession = $modx->db->getValue($rs); |
251 | 251 | if(!$activeSession) { |
252 | - $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
253 | - if($lastHit = $modx->db->getValue($rs)) { |
|
254 | - $_SESSION['show_logout_reminder'] = array( |
|
255 | - 'type' => 'logout_reminder', |
|
256 | - 'lastHit' => $lastHit |
|
257 | - ); |
|
258 | - } |
|
252 | + $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
253 | + if($lastHit = $modx->db->getValue($rs)) { |
|
254 | + $_SESSION['show_logout_reminder'] = array( |
|
255 | + 'type' => 'logout_reminder', |
|
256 | + 'lastHit' => $lastHit |
|
257 | + ); |
|
258 | + } |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | $log = new EvolutionCMS\Legacy\LogHandler(); |
@@ -263,27 +263,27 @@ discard block |
||
263 | 263 | |
264 | 264 | // invoke OnManagerLogin event |
265 | 265 | $modx->invokeEvent('OnManagerLogin', array( |
266 | - 'userid' => $internalKey, |
|
267 | - 'username' => $username, |
|
268 | - 'userpassword' => $givenPassword, |
|
269 | - 'rememberme' => $rememberme |
|
270 | - )); |
|
266 | + 'userid' => $internalKey, |
|
267 | + 'username' => $username, |
|
268 | + 'userpassword' => $givenPassword, |
|
269 | + 'rememberme' => $rememberme |
|
270 | + )); |
|
271 | 271 | |
272 | 272 | // check if we should redirect user to a web page |
273 | 273 | $rs = $modx->db->select('setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_name='manager_login_startup'"); |
274 | 274 | $id = (int)$modx->db->getValue($rs); |
275 | 275 | if($id > 0) { |
276 | - $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
277 | - if($_POST['ajax'] == 1) { |
|
278 | - echo $header; |
|
279 | - } else { |
|
280 | - header($header); |
|
281 | - } |
|
276 | + $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
277 | + if($_POST['ajax'] == 1) { |
|
278 | + echo $header; |
|
279 | + } else { |
|
280 | + header($header); |
|
281 | + } |
|
282 | 282 | } else { |
283 | - $header = 'Location: ' . MODX_MANAGER_URL; |
|
284 | - if($_POST['ajax'] == 1) { |
|
285 | - echo $header; |
|
286 | - } else { |
|
287 | - header($header); |
|
288 | - } |
|
283 | + $header = 'Location: ' . MODX_MANAGER_URL; |
|
284 | + if($_POST['ajax'] == 1) { |
|
285 | + echo $header; |
|
286 | + } else { |
|
287 | + header($header); |
|
288 | + } |
|
289 | 289 | } |
@@ -3,7 +3,7 @@ discard block |
||
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('edit_document')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
@@ -25,68 +25,68 @@ discard block |
||
25 | 25 | // check user has permission to move document to chosen location |
26 | 26 | |
27 | 27 | if ($use_udperms == 1) { |
28 | - if ($oldparent != $newParentID) { |
|
29 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
30 | - $udperms->user = $modx->getLoginUserID(); |
|
31 | - $udperms->document = $newParentID; |
|
32 | - $udperms->role = $_SESSION['mgrRole']; |
|
28 | + if ($oldparent != $newParentID) { |
|
29 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
30 | + $udperms->user = $modx->getLoginUserID(); |
|
31 | + $udperms->document = $newParentID; |
|
32 | + $udperms->role = $_SESSION['mgrRole']; |
|
33 | 33 | |
34 | - if (!$udperms->checkPermissions()) { |
|
35 | - $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
36 | - } |
|
37 | - } |
|
34 | + if (!$udperms->checkPermissions()) { |
|
35 | + $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
36 | + } |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
41 | - "id_document" => $documentID, |
|
42 | - "old_parent" => $oldparent, |
|
43 | - "new_parent" => $newParentID |
|
41 | + "id_document" => $documentID, |
|
42 | + "old_parent" => $oldparent, |
|
43 | + "new_parent" => $newParentID |
|
44 | 44 | )); |
45 | 45 | if (is_array($evtOut) && count($evtOut) > 0){ |
46 | - $newParent = array_pop($evtOut); |
|
47 | - if($newParent == $oldparent) { |
|
48 | - $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
49 | - }else{ |
|
50 | - $newParentID = $newParent; |
|
51 | - } |
|
46 | + $newParent = array_pop($evtOut); |
|
47 | + if($newParent == $oldparent) { |
|
48 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
49 | + }else{ |
|
50 | + $newParentID = $newParent; |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $children = allChildren($documentID); |
55 | 55 | if (!array_search($newParentID, $children)) { |
56 | - $modx->db->update(array( |
|
57 | - 'isfolder' => 1, |
|
58 | - ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
56 | + $modx->db->update(array( |
|
57 | + 'isfolder' => 1, |
|
58 | + ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
59 | 59 | |
60 | - $modx->db->update(array( |
|
61 | - 'parent' => $newParentID, |
|
62 | - 'editedby' => $modx->getLoginUserID(), |
|
63 | - 'editedon' => time(), |
|
64 | - ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
60 | + $modx->db->update(array( |
|
61 | + 'parent' => $newParentID, |
|
62 | + 'editedby' => $modx->getLoginUserID(), |
|
63 | + 'editedon' => time(), |
|
64 | + ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
65 | 65 | |
66 | - // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
67 | - $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
68 | - $limit = $modx->db->getValue($rs); |
|
66 | + // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
67 | + $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
68 | + $limit = $modx->db->getValue($rs); |
|
69 | 69 | |
70 | - if(!$limit>0) { |
|
71 | - $modx->db->update(array( |
|
72 | - 'isfolder' => 0, |
|
73 | - ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
74 | - } |
|
75 | - // Set the item name for logger |
|
76 | - $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
77 | - $_SESSION['itemname'] = $pagetitle; |
|
70 | + if(!$limit>0) { |
|
71 | + $modx->db->update(array( |
|
72 | + 'isfolder' => 0, |
|
73 | + ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
74 | + } |
|
75 | + // Set the item name for logger |
|
76 | + $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
77 | + $_SESSION['itemname'] = $pagetitle; |
|
78 | 78 | |
79 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
80 | - "id_document" => $documentID, |
|
81 | - "old_parent" => $oldparent, |
|
82 | - "new_parent" => $newParentID |
|
83 | - )); |
|
79 | + $modx->invokeEvent("onAfterMoveDocument", array ( |
|
80 | + "id_document" => $documentID, |
|
81 | + "old_parent" => $oldparent, |
|
82 | + "new_parent" => $newParentID |
|
83 | + )); |
|
84 | 84 | |
85 | - // empty cache & sync site |
|
86 | - $modx->clearCache('full'); |
|
85 | + // empty cache & sync site |
|
86 | + $modx->clearCache('full'); |
|
87 | 87 | |
88 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
89 | - header($header); |
|
88 | + $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
89 | + header($header); |
|
90 | 90 | } else { |
91 | - $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
91 | + $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
92 | 92 | } |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('delete_document')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_REQUEST['id'])? (int)$_REQUEST['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 | /************ webber ********/ |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
32 | 32 | |
33 | 33 | if(!$udperms->checkPermissions()) { |
34 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
34 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | // get the timestamp on which the document was deleted. |
38 | 38 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
39 | 39 | $deltime = $modx->db->getValue($rs); |
40 | 40 | if(!$deltime) { |
41 | - $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
41 | + $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $children = array(); |
@@ -46,20 +46,20 @@ discard block |
||
46 | 46 | getChildrenForUnDelete($id); |
47 | 47 | |
48 | 48 | if(count($children)>0) { |
49 | - $modx->db->update( |
|
50 | - array( |
|
51 | - 'deleted' => 0, |
|
52 | - 'deletedby' => 0, |
|
53 | - 'deletedon' => 0, |
|
54 | - ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
49 | + $modx->db->update( |
|
50 | + array( |
|
51 | + 'deleted' => 0, |
|
52 | + 'deletedby' => 0, |
|
53 | + 'deletedon' => 0, |
|
54 | + ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
55 | 55 | } |
56 | 56 | //'undelete' the document. |
57 | 57 | $modx->db->update( |
58 | - array( |
|
59 | - 'deleted' => 0, |
|
60 | - 'deletedby' => 0, |
|
61 | - 'deletedon' => 0, |
|
62 | - ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
58 | + array( |
|
59 | + 'deleted' => 0, |
|
60 | + 'deletedby' => 0, |
|
61 | + 'deletedon' => 0, |
|
62 | + ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
63 | 63 | |
64 | 64 | $modx->invokeEvent("OnDocFormUnDelete", |
65 | 65 | array( |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('save_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $modx->loadExtension('phpass'); |
@@ -45,134 +45,134 @@ discard block |
||
45 | 45 | |
46 | 46 | // verify password |
47 | 47 | if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
48 | - webAlertAndQuit("Password typed is mismatched", 12); |
|
48 | + webAlertAndQuit("Password typed is mismatched", 12); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // verify email |
52 | 52 | if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
53 | - webAlertAndQuit("E-mail address doesn't seem to be valid!", 12); |
|
53 | + webAlertAndQuit("E-mail address doesn't seem to be valid!", 12); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // verify admin security |
57 | 57 | if($_SESSION['mgrRole'] != 1) { |
58 | - // Check to see if user tried to spoof a "1" (admin) role |
|
59 | - if(!$modx->hasPermission('save_role')) { |
|
60 | - webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12); |
|
61 | - } |
|
62 | - // Verify that the user being edited wasn't an admin and the user ID got spoofed |
|
63 | - $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1"); |
|
64 | - $limit = $modx->db->getValue($rs); |
|
65 | - if($limit > 0) { |
|
66 | - webAlertAndQuit("You cannot alter an administrative user.", 12); |
|
67 | - } |
|
58 | + // Check to see if user tried to spoof a "1" (admin) role |
|
59 | + if(!$modx->hasPermission('save_role')) { |
|
60 | + webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12); |
|
61 | + } |
|
62 | + // Verify that the user being edited wasn't an admin and the user ID got spoofed |
|
63 | + $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1"); |
|
64 | + $limit = $modx->db->getValue($rs); |
|
65 | + if($limit > 0) { |
|
66 | + webAlertAndQuit("You cannot alter an administrative user.", 12); |
|
67 | + } |
|
68 | 68 | |
69 | 69 | } |
70 | 70 | |
71 | 71 | switch($input['mode']) { |
72 | - case '11' : // new user |
|
73 | - // check if this user name already exist |
|
74 | - $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername))); |
|
75 | - $limit = $modx->db->getValue($rs); |
|
76 | - if($limit > 0) { |
|
77 | - webAlertAndQuit("User name is already in use!", 12); |
|
78 | - } |
|
79 | - |
|
80 | - // check if the email address already exist |
|
81 | - $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id)); |
|
82 | - $limit = $modx->db->getValue($rs); |
|
83 | - if($limit > 0) { |
|
84 | - webAlertAndQuit("Email is already in use!", 12); |
|
85 | - } |
|
86 | - |
|
87 | - // generate a new password for this user |
|
88 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
89 | - if(strlen($specifiedpassword) < 6) { |
|
90 | - webAlertAndQuit("Password is too short!", 12); |
|
91 | - } else { |
|
92 | - $newpassword = $specifiedpassword; |
|
93 | - } |
|
94 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
95 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
96 | - } elseif($passwordgenmethod == 'g') { |
|
97 | - $newpassword = generate_password(8); |
|
98 | - } else { |
|
99 | - webAlertAndQuit("No password generation method specified!", 12); |
|
100 | - } |
|
101 | - |
|
102 | - // invoke OnBeforeUserFormSave event |
|
103 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
104 | - "mode" => "new", |
|
105 | - )); |
|
106 | - |
|
107 | - // create the user account |
|
108 | - $internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users); |
|
109 | - |
|
110 | - $field = array(); |
|
111 | - $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
112 | - $modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
113 | - |
|
114 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
115 | - $field = $modx->db->escape($field); |
|
116 | - $modx->db->insert($field, $tbl_user_attributes); |
|
117 | - |
|
118 | - // Save user settings |
|
72 | + case '11' : // new user |
|
73 | + // check if this user name already exist |
|
74 | + $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername))); |
|
75 | + $limit = $modx->db->getValue($rs); |
|
76 | + if($limit > 0) { |
|
77 | + webAlertAndQuit("User name is already in use!", 12); |
|
78 | + } |
|
79 | + |
|
80 | + // check if the email address already exist |
|
81 | + $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id)); |
|
82 | + $limit = $modx->db->getValue($rs); |
|
83 | + if($limit > 0) { |
|
84 | + webAlertAndQuit("Email is already in use!", 12); |
|
85 | + } |
|
86 | + |
|
87 | + // generate a new password for this user |
|
88 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
89 | + if(strlen($specifiedpassword) < 6) { |
|
90 | + webAlertAndQuit("Password is too short!", 12); |
|
91 | + } else { |
|
92 | + $newpassword = $specifiedpassword; |
|
93 | + } |
|
94 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
95 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
96 | + } elseif($passwordgenmethod == 'g') { |
|
97 | + $newpassword = generate_password(8); |
|
98 | + } else { |
|
99 | + webAlertAndQuit("No password generation method specified!", 12); |
|
100 | + } |
|
101 | + |
|
102 | + // invoke OnBeforeUserFormSave event |
|
103 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
104 | + "mode" => "new", |
|
105 | + )); |
|
106 | + |
|
107 | + // create the user account |
|
108 | + $internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users); |
|
109 | + |
|
110 | + $field = array(); |
|
111 | + $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
112 | + $modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
113 | + |
|
114 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
115 | + $field = $modx->db->escape($field); |
|
116 | + $modx->db->insert($field, $tbl_user_attributes); |
|
117 | + |
|
118 | + // Save user settings |
|
119 | 119 | saveManagerUserSettings($internalKey); |
120 | 120 | |
121 | - // invoke OnManagerSaveUser event |
|
122 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
123 | - "mode" => "new", |
|
124 | - "userid" => $internalKey, |
|
125 | - "username" => $newusername, |
|
126 | - "userpassword" => $newpassword, |
|
127 | - "useremail" => $email, |
|
128 | - "userfullname" => $fullname, |
|
129 | - "userroleid" => $role |
|
130 | - )); |
|
131 | - |
|
132 | - // invoke OnUserFormSave event |
|
133 | - $modx->invokeEvent("OnUserFormSave", array( |
|
134 | - "mode" => "new", |
|
135 | - "id" => $internalKey |
|
136 | - )); |
|
137 | - |
|
138 | - // Set the item name for logger |
|
139 | - $_SESSION['itemname'] = $newusername; |
|
140 | - |
|
141 | - /*******************************************************************************/ |
|
142 | - // put the user in the user_groups he/ she should be in |
|
143 | - // first, check that up_perms are switched on! |
|
144 | - if($use_udperms == 1) { |
|
145 | - if(!empty($user_groups)) { |
|
146 | - for($i = 0; $i < count($user_groups); $i++) { |
|
147 | - $f = array(); |
|
148 | - $f['user_group'] = (int)$user_groups[$i]; |
|
149 | - $f['member'] = $internalKey; |
|
150 | - $modx->db->insert($f, $tbl_member_groups); |
|
151 | - } |
|
152 | - } |
|
153 | - } |
|
154 | - // end of user_groups stuff! |
|
155 | - |
|
156 | - if($passwordnotifymethod == 'e') { |
|
121 | + // invoke OnManagerSaveUser event |
|
122 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
123 | + "mode" => "new", |
|
124 | + "userid" => $internalKey, |
|
125 | + "username" => $newusername, |
|
126 | + "userpassword" => $newpassword, |
|
127 | + "useremail" => $email, |
|
128 | + "userfullname" => $fullname, |
|
129 | + "userroleid" => $role |
|
130 | + )); |
|
131 | + |
|
132 | + // invoke OnUserFormSave event |
|
133 | + $modx->invokeEvent("OnUserFormSave", array( |
|
134 | + "mode" => "new", |
|
135 | + "id" => $internalKey |
|
136 | + )); |
|
137 | + |
|
138 | + // Set the item name for logger |
|
139 | + $_SESSION['itemname'] = $newusername; |
|
140 | + |
|
141 | + /*******************************************************************************/ |
|
142 | + // put the user in the user_groups he/ she should be in |
|
143 | + // first, check that up_perms are switched on! |
|
144 | + if($use_udperms == 1) { |
|
145 | + if(!empty($user_groups)) { |
|
146 | + for($i = 0; $i < count($user_groups); $i++) { |
|
147 | + $f = array(); |
|
148 | + $f['user_group'] = (int)$user_groups[$i]; |
|
149 | + $f['member'] = $internalKey; |
|
150 | + $modx->db->insert($f, $tbl_member_groups); |
|
151 | + } |
|
152 | + } |
|
153 | + } |
|
154 | + // end of user_groups stuff! |
|
155 | + |
|
156 | + if($passwordnotifymethod == 'e') { |
|
157 | 157 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
158 | - if($input['stay'] != '') { |
|
159 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
160 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | - header($header); |
|
162 | - } else { |
|
163 | - $header = "Location: index.php?a=75&r=2"; |
|
164 | - header($header); |
|
165 | - } |
|
166 | - } else { |
|
167 | - if($input['stay'] != '') { |
|
168 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
169 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
170 | - } else { |
|
171 | - $stayUrl = "index.php?a=75&r=2"; |
|
172 | - } |
|
173 | - |
|
174 | - include_once "header.inc.php"; |
|
175 | - ?> |
|
158 | + if($input['stay'] != '') { |
|
159 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
160 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | + header($header); |
|
162 | + } else { |
|
163 | + $header = "Location: index.php?a=75&r=2"; |
|
164 | + header($header); |
|
165 | + } |
|
166 | + } else { |
|
167 | + if($input['stay'] != '') { |
|
168 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
169 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
170 | + } else { |
|
171 | + $stayUrl = "index.php?a=75&r=2"; |
|
172 | + } |
|
173 | + |
|
174 | + include_once "header.inc.php"; |
|
175 | + ?> |
|
176 | 176 | |
177 | 177 | <h1><?php echo $_lang['user_title']; ?></h1> |
178 | 178 | |
@@ -194,125 +194,125 @@ discard block |
||
194 | 194 | </div> |
195 | 195 | <?php |
196 | 196 | |
197 | - include_once "footer.inc.php"; |
|
198 | - } |
|
199 | - break; |
|
200 | - case '12' : // edit user |
|
201 | - // generate a new password for this user |
|
202 | - if($genpassword == 1) { |
|
203 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
204 | - if(strlen($specifiedpassword) < 6) { |
|
205 | - webAlertAndQuit("Password is too short!", 12); |
|
206 | - } else { |
|
207 | - $newpassword = $specifiedpassword; |
|
208 | - } |
|
209 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
210 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
211 | - } elseif($passwordgenmethod == 'g') { |
|
212 | - $newpassword = generate_password(8); |
|
213 | - } else { |
|
214 | - webAlertAndQuit("No password generation method specified!", 12); |
|
215 | - } |
|
216 | - } |
|
217 | - if($passwordnotifymethod == 'e') { |
|
197 | + include_once "footer.inc.php"; |
|
198 | + } |
|
199 | + break; |
|
200 | + case '12' : // edit user |
|
201 | + // generate a new password for this user |
|
202 | + if($genpassword == 1) { |
|
203 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
204 | + if(strlen($specifiedpassword) < 6) { |
|
205 | + webAlertAndQuit("Password is too short!", 12); |
|
206 | + } else { |
|
207 | + $newpassword = $specifiedpassword; |
|
208 | + } |
|
209 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
210 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
211 | + } elseif($passwordgenmethod == 'g') { |
|
212 | + $newpassword = generate_password(8); |
|
213 | + } else { |
|
214 | + webAlertAndQuit("No password generation method specified!", 12); |
|
215 | + } |
|
216 | + } |
|
217 | + if($passwordnotifymethod == 'e') { |
|
218 | 218 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
219 | - } |
|
220 | - |
|
221 | - // check if the username already exist |
|
222 | - $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id)); |
|
223 | - $limit = $modx->db->getValue($rs); |
|
224 | - if($limit > 0) { |
|
225 | - webAlertAndQuit("User name is already in use!", 12); |
|
226 | - } |
|
227 | - |
|
228 | - // check if the email address already exists |
|
229 | - $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id)); |
|
230 | - $limit = $modx->db->getValue($rs); |
|
231 | - if($limit > 0) { |
|
232 | - webAlertAndQuit("Email is already in use!", 12); |
|
233 | - } |
|
234 | - |
|
235 | - // invoke OnBeforeUserFormSave event |
|
236 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
237 | - "mode" => "upd", |
|
238 | - "id" => $id |
|
239 | - )); |
|
240 | - |
|
241 | - // update user name and password |
|
242 | - $field = array(); |
|
243 | - $field['username'] = $modx->db->escape($newusername); |
|
244 | - if($genpassword == 1) { |
|
245 | - $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
246 | - } |
|
247 | - $modx->db->update($field, $tbl_manager_users, "id='{$id}'"); |
|
248 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
249 | - $field = $modx->db->escape($field); |
|
250 | - $modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
251 | - |
|
252 | - // Save user settings |
|
219 | + } |
|
220 | + |
|
221 | + // check if the username already exist |
|
222 | + $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id)); |
|
223 | + $limit = $modx->db->getValue($rs); |
|
224 | + if($limit > 0) { |
|
225 | + webAlertAndQuit("User name is already in use!", 12); |
|
226 | + } |
|
227 | + |
|
228 | + // check if the email address already exists |
|
229 | + $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id)); |
|
230 | + $limit = $modx->db->getValue($rs); |
|
231 | + if($limit > 0) { |
|
232 | + webAlertAndQuit("Email is already in use!", 12); |
|
233 | + } |
|
234 | + |
|
235 | + // invoke OnBeforeUserFormSave event |
|
236 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
237 | + "mode" => "upd", |
|
238 | + "id" => $id |
|
239 | + )); |
|
240 | + |
|
241 | + // update user name and password |
|
242 | + $field = array(); |
|
243 | + $field['username'] = $modx->db->escape($newusername); |
|
244 | + if($genpassword == 1) { |
|
245 | + $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
246 | + } |
|
247 | + $modx->db->update($field, $tbl_manager_users, "id='{$id}'"); |
|
248 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
249 | + $field = $modx->db->escape($field); |
|
250 | + $modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
251 | + |
|
252 | + // Save user settings |
|
253 | 253 | saveManagerUserSettings($id); |
254 | 254 | |
255 | - // Set the item name for logger |
|
256 | - $_SESSION['itemname'] = $newusername; |
|
257 | - |
|
258 | - // invoke OnManagerSaveUser event |
|
259 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
260 | - "mode" => "upd", |
|
261 | - "userid" => $id, |
|
262 | - "username" => $newusername, |
|
263 | - "userpassword" => $newpassword, |
|
264 | - "useremail" => $email, |
|
265 | - "userfullname" => $fullname, |
|
266 | - "userroleid" => $role, |
|
267 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
268 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
269 | - )); |
|
270 | - |
|
271 | - // invoke OnManagerChangePassword event |
|
272 | - if($genpassword == 1) { |
|
273 | - $modx->invokeEvent("OnManagerChangePassword", array( |
|
274 | - "userid" => $id, |
|
275 | - "username" => $newusername, |
|
276 | - "userpassword" => $newpassword |
|
277 | - )); |
|
278 | - } |
|
279 | - |
|
280 | - // invoke OnUserFormSave event |
|
281 | - $modx->invokeEvent("OnUserFormSave", array( |
|
282 | - "mode" => "upd", |
|
283 | - "id" => $id |
|
284 | - )); |
|
285 | - |
|
286 | - /*******************************************************************************/ |
|
287 | - // put the user in the user_groups he/ she should be in |
|
288 | - // first, check that up_perms are switched on! |
|
289 | - if($use_udperms == 1) { |
|
290 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
291 | - $modx->db->delete($tbl_member_groups, "member='{$id}'"); |
|
292 | - if(!empty($user_groups)) { |
|
293 | - for($i = 0; $i < count($user_groups); $i++) { |
|
294 | - $field = array(); |
|
295 | - $field['user_group'] = (int)$user_groups[$i]; |
|
296 | - $field['member'] = $id; |
|
297 | - $modx->db->insert($field, $tbl_member_groups); |
|
298 | - } |
|
299 | - } |
|
300 | - } |
|
301 | - // end of user_groups stuff! |
|
302 | - /*******************************************************************************/ |
|
303 | - if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
304 | - $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
305 | - } |
|
306 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
307 | - if($input['stay'] != '') { |
|
308 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
309 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
310 | - } else { |
|
311 | - $stayUrl = "index.php?a=75&r=2"; |
|
312 | - } |
|
313 | - |
|
314 | - include_once "header.inc.php"; |
|
315 | - ?> |
|
255 | + // Set the item name for logger |
|
256 | + $_SESSION['itemname'] = $newusername; |
|
257 | + |
|
258 | + // invoke OnManagerSaveUser event |
|
259 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
260 | + "mode" => "upd", |
|
261 | + "userid" => $id, |
|
262 | + "username" => $newusername, |
|
263 | + "userpassword" => $newpassword, |
|
264 | + "useremail" => $email, |
|
265 | + "userfullname" => $fullname, |
|
266 | + "userroleid" => $role, |
|
267 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
268 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
269 | + )); |
|
270 | + |
|
271 | + // invoke OnManagerChangePassword event |
|
272 | + if($genpassword == 1) { |
|
273 | + $modx->invokeEvent("OnManagerChangePassword", array( |
|
274 | + "userid" => $id, |
|
275 | + "username" => $newusername, |
|
276 | + "userpassword" => $newpassword |
|
277 | + )); |
|
278 | + } |
|
279 | + |
|
280 | + // invoke OnUserFormSave event |
|
281 | + $modx->invokeEvent("OnUserFormSave", array( |
|
282 | + "mode" => "upd", |
|
283 | + "id" => $id |
|
284 | + )); |
|
285 | + |
|
286 | + /*******************************************************************************/ |
|
287 | + // put the user in the user_groups he/ she should be in |
|
288 | + // first, check that up_perms are switched on! |
|
289 | + if($use_udperms == 1) { |
|
290 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
291 | + $modx->db->delete($tbl_member_groups, "member='{$id}'"); |
|
292 | + if(!empty($user_groups)) { |
|
293 | + for($i = 0; $i < count($user_groups); $i++) { |
|
294 | + $field = array(); |
|
295 | + $field['user_group'] = (int)$user_groups[$i]; |
|
296 | + $field['member'] = $id; |
|
297 | + $modx->db->insert($field, $tbl_member_groups); |
|
298 | + } |
|
299 | + } |
|
300 | + } |
|
301 | + // end of user_groups stuff! |
|
302 | + /*******************************************************************************/ |
|
303 | + if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
304 | + $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
305 | + } |
|
306 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
307 | + if($input['stay'] != '') { |
|
308 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
309 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
310 | + } else { |
|
311 | + $stayUrl = "index.php?a=75&r=2"; |
|
312 | + } |
|
313 | + |
|
314 | + include_once "header.inc.php"; |
|
315 | + ?> |
|
316 | 316 | |
317 | 317 | <h1><?php echo $_lang['user_title']; ?></h1> |
318 | 318 | |
@@ -332,18 +332,18 @@ discard block |
||
332 | 332 | </div> |
333 | 333 | <?php |
334 | 334 | |
335 | - include_once "footer.inc.php"; |
|
336 | - } else { |
|
337 | - if($input['stay'] != '') { |
|
338 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
339 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
340 | - header($header); |
|
341 | - } else { |
|
342 | - $header = "Location: index.php?a=75&r=2"; |
|
343 | - header($header); |
|
344 | - } |
|
345 | - } |
|
346 | - break; |
|
347 | - default: |
|
348 | - webAlertAndQuit("No operation set in request.", 12); |
|
335 | + include_once "footer.inc.php"; |
|
336 | + } else { |
|
337 | + if($input['stay'] != '') { |
|
338 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
339 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
340 | + header($header); |
|
341 | + } else { |
|
342 | + $header = "Location: index.php?a=75&r=2"; |
|
343 | + header($header); |
|
344 | + } |
|
345 | + } |
|
346 | + break; |
|
347 | + default: |
|
348 | + webAlertAndQuit("No operation set in request.", 12); |
|
349 | 349 | } |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('save_web_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $tbl_web_users = $modx->getFullTableName('web_users'); |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | |
13 | 13 | $input = $_POST; |
14 | 14 | foreach($input as $k => $v) { |
15 | - if($k !== 'comment') { |
|
16 | - $v = $modx->htmlspecialchars($v, ENT_NOQUOTES); |
|
17 | - } |
|
18 | - $input[$k] = $v; |
|
15 | + if($k !== 'comment') { |
|
16 | + $v = $modx->htmlspecialchars($v, ENT_NOQUOTES); |
|
17 | + } |
|
18 | + $input[$k] = $v; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = (int)$input['id']; |
@@ -51,82 +51,82 @@ discard block |
||
51 | 51 | |
52 | 52 | // verify password |
53 | 53 | if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
54 | - webAlertAndQuit("Password typed is mismatched", 88); |
|
54 | + webAlertAndQuit("Password typed is mismatched", 88); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // verify email |
58 | 58 | if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
59 | - webAlertAndQuit("E-mail address doesn't seem to be valid!", 88); |
|
59 | + webAlertAndQuit("E-mail address doesn't seem to be valid!", 88); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | switch($input['mode']) { |
63 | - case '87' : // new user |
|
64 | - // check if this user name already exist |
|
65 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
66 | - $limit = $modx->db->getValue($rs); |
|
67 | - if($limit > 0) { |
|
68 | - webAlertAndQuit("User name is already in use!", 88); |
|
69 | - } |
|
70 | - |
|
71 | - // check if the email address already exist |
|
72 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
73 | - $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
74 | - $limit = $modx->db->getValue($rs); |
|
75 | - if($limit > 0) { |
|
76 | - webAlertAndQuit("Email is already in use!", 88); |
|
77 | - } |
|
78 | - } |
|
79 | - |
|
80 | - // generate a new password for this user |
|
81 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | - if(strlen($specifiedpassword) < 6) { |
|
83 | - webAlertAndQuit("Password is too short!", 88); |
|
84 | - } else { |
|
85 | - $newpassword = $specifiedpassword; |
|
86 | - } |
|
87 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
88 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
89 | - } elseif($passwordgenmethod == 'g') { |
|
90 | - $newpassword = generate_password(8); |
|
91 | - } else { |
|
92 | - webAlertAndQuit("No password generation method specified!", 88); |
|
93 | - } |
|
94 | - |
|
95 | - // invoke OnBeforeWUsrFormSave event |
|
96 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
97 | - "mode" => "new", |
|
98 | - )); |
|
99 | - |
|
100 | - // create the user account |
|
101 | - $field = array(); |
|
102 | - $field['username'] = $esc_newusername; |
|
103 | - $field['password'] = md5($newpassword); |
|
104 | - $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
105 | - |
|
106 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
107 | - $field = $modx->db->escape($field); |
|
108 | - $modx->db->insert($field, $tbl_web_user_attributes); |
|
109 | - |
|
110 | - // Save User Settings |
|
63 | + case '87' : // new user |
|
64 | + // check if this user name already exist |
|
65 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
66 | + $limit = $modx->db->getValue($rs); |
|
67 | + if($limit > 0) { |
|
68 | + webAlertAndQuit("User name is already in use!", 88); |
|
69 | + } |
|
70 | + |
|
71 | + // check if the email address already exist |
|
72 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
73 | + $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
74 | + $limit = $modx->db->getValue($rs); |
|
75 | + if($limit > 0) { |
|
76 | + webAlertAndQuit("Email is already in use!", 88); |
|
77 | + } |
|
78 | + } |
|
79 | + |
|
80 | + // generate a new password for this user |
|
81 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | + if(strlen($specifiedpassword) < 6) { |
|
83 | + webAlertAndQuit("Password is too short!", 88); |
|
84 | + } else { |
|
85 | + $newpassword = $specifiedpassword; |
|
86 | + } |
|
87 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
88 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
89 | + } elseif($passwordgenmethod == 'g') { |
|
90 | + $newpassword = generate_password(8); |
|
91 | + } else { |
|
92 | + webAlertAndQuit("No password generation method specified!", 88); |
|
93 | + } |
|
94 | + |
|
95 | + // invoke OnBeforeWUsrFormSave event |
|
96 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
97 | + "mode" => "new", |
|
98 | + )); |
|
99 | + |
|
100 | + // create the user account |
|
101 | + $field = array(); |
|
102 | + $field['username'] = $esc_newusername; |
|
103 | + $field['password'] = md5($newpassword); |
|
104 | + $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
105 | + |
|
106 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
107 | + $field = $modx->db->escape($field); |
|
108 | + $modx->db->insert($field, $tbl_web_user_attributes); |
|
109 | + |
|
110 | + // Save User Settings |
|
111 | 111 | saveWebUserSettings($internalKey); |
112 | 112 | |
113 | - // Set the item name for logger |
|
114 | - $_SESSION['itemname'] = $newusername; |
|
115 | - |
|
116 | - /*******************************************************************************/ |
|
117 | - // put the user in the user_groups he/ she should be in |
|
118 | - // first, check that up_perms are switched on! |
|
119 | - if($use_udperms == 1) { |
|
120 | - if(!empty($user_groups)) { |
|
121 | - for($i = 0; $i < count($user_groups); $i++) { |
|
122 | - $f = array(); |
|
123 | - $f['webgroup'] = (int)$user_groups[$i]; |
|
124 | - $f['webuser'] = $internalKey; |
|
125 | - $modx->db->insert($f, $tbl_web_groups); |
|
126 | - } |
|
127 | - } |
|
128 | - } |
|
129 | - // end of user_groups stuff! |
|
113 | + // Set the item name for logger |
|
114 | + $_SESSION['itemname'] = $newusername; |
|
115 | + |
|
116 | + /*******************************************************************************/ |
|
117 | + // put the user in the user_groups he/ she should be in |
|
118 | + // first, check that up_perms are switched on! |
|
119 | + if($use_udperms == 1) { |
|
120 | + if(!empty($user_groups)) { |
|
121 | + for($i = 0; $i < count($user_groups); $i++) { |
|
122 | + $f = array(); |
|
123 | + $f['webgroup'] = (int)$user_groups[$i]; |
|
124 | + $f['webuser'] = $internalKey; |
|
125 | + $modx->db->insert($f, $tbl_web_groups); |
|
126 | + } |
|
127 | + } |
|
128 | + } |
|
129 | + // end of user_groups stuff! |
|
130 | 130 | |
131 | 131 | // invoke OnWebSaveUser event |
132 | 132 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -144,26 +144,26 @@ discard block |
||
144 | 144 | "id" => $internalKey |
145 | 145 | )); |
146 | 146 | |
147 | - if($passwordnotifymethod == 'e') { |
|
147 | + if($passwordnotifymethod == 'e') { |
|
148 | 148 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
149 | - if($input['stay'] != '') { |
|
150 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | - header($header); |
|
153 | - } else { |
|
154 | - $header = "Location: index.php?a=99&r=2"; |
|
155 | - header($header); |
|
156 | - } |
|
157 | - } else { |
|
158 | - if($input['stay'] != '') { |
|
159 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | - } else { |
|
162 | - $stayUrl = "index.php?a=99&r=2"; |
|
163 | - } |
|
164 | - |
|
165 | - include_once "header.inc.php"; |
|
166 | - ?> |
|
149 | + if($input['stay'] != '') { |
|
150 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
151 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | + header($header); |
|
153 | + } else { |
|
154 | + $header = "Location: index.php?a=99&r=2"; |
|
155 | + header($header); |
|
156 | + } |
|
157 | + } else { |
|
158 | + if($input['stay'] != '') { |
|
159 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
160 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | + } else { |
|
162 | + $stayUrl = "index.php?a=99&r=2"; |
|
163 | + } |
|
164 | + |
|
165 | + include_once "header.inc.php"; |
|
166 | + ?> |
|
167 | 167 | |
168 | 168 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
169 | 169 | |
@@ -185,86 +185,86 @@ discard block |
||
185 | 185 | </div> |
186 | 186 | <?php |
187 | 187 | |
188 | - include_once "footer.inc.php"; |
|
189 | - } |
|
190 | - break; |
|
191 | - case '88' : // edit user |
|
192 | - // generate a new password for this user |
|
193 | - if($genpassword == 1) { |
|
194 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | - if(strlen($specifiedpassword) < 6) { |
|
196 | - webAlertAndQuit("Password is too short!", 88); |
|
197 | - } else { |
|
198 | - $newpassword = $specifiedpassword; |
|
199 | - } |
|
200 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
202 | - } elseif($passwordgenmethod == 'g') { |
|
203 | - $newpassword = generate_password(8); |
|
204 | - } else { |
|
205 | - webAlertAndQuit("No password generation method specified!", 88); |
|
206 | - } |
|
207 | - } |
|
208 | - if($passwordnotifymethod == 'e') { |
|
188 | + include_once "footer.inc.php"; |
|
189 | + } |
|
190 | + break; |
|
191 | + case '88' : // edit user |
|
192 | + // generate a new password for this user |
|
193 | + if($genpassword == 1) { |
|
194 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | + if(strlen($specifiedpassword) < 6) { |
|
196 | + webAlertAndQuit("Password is too short!", 88); |
|
197 | + } else { |
|
198 | + $newpassword = $specifiedpassword; |
|
199 | + } |
|
200 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
202 | + } elseif($passwordgenmethod == 'g') { |
|
203 | + $newpassword = generate_password(8); |
|
204 | + } else { |
|
205 | + webAlertAndQuit("No password generation method specified!", 88); |
|
206 | + } |
|
207 | + } |
|
208 | + if($passwordnotifymethod == 'e') { |
|
209 | 209 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
210 | - } |
|
211 | - |
|
212 | - // check if the username already exist |
|
213 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
214 | - $limit = $modx->db->getValue($rs); |
|
215 | - if($limit > 0) { |
|
216 | - webAlertAndQuit("User name is already in use!", 88); |
|
217 | - } |
|
218 | - |
|
219 | - // check if the email address already exists |
|
220 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
221 | - $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
222 | - $limit = $modx->db->getValue($rs); |
|
223 | - if($limit > 0) { |
|
224 | - webAlertAndQuit("Email is already in use!", 88); |
|
225 | - } |
|
226 | - } |
|
227 | - |
|
228 | - // invoke OnBeforeWUsrFormSave event |
|
229 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
230 | - "mode" => "upd", |
|
231 | - "id" => $id |
|
232 | - )); |
|
233 | - |
|
234 | - // update user name and password |
|
235 | - $field = array(); |
|
236 | - $field['username'] = $esc_newusername; |
|
237 | - if($genpassword == 1) { |
|
238 | - $field['password'] = md5($newpassword); |
|
239 | - } |
|
240 | - $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
241 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
242 | - $field = $modx->db->escape($field); |
|
243 | - $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
244 | - |
|
245 | - // Save User Settings |
|
210 | + } |
|
211 | + |
|
212 | + // check if the username already exist |
|
213 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
214 | + $limit = $modx->db->getValue($rs); |
|
215 | + if($limit > 0) { |
|
216 | + webAlertAndQuit("User name is already in use!", 88); |
|
217 | + } |
|
218 | + |
|
219 | + // check if the email address already exists |
|
220 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
221 | + $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
222 | + $limit = $modx->db->getValue($rs); |
|
223 | + if($limit > 0) { |
|
224 | + webAlertAndQuit("Email is already in use!", 88); |
|
225 | + } |
|
226 | + } |
|
227 | + |
|
228 | + // invoke OnBeforeWUsrFormSave event |
|
229 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
230 | + "mode" => "upd", |
|
231 | + "id" => $id |
|
232 | + )); |
|
233 | + |
|
234 | + // update user name and password |
|
235 | + $field = array(); |
|
236 | + $field['username'] = $esc_newusername; |
|
237 | + if($genpassword == 1) { |
|
238 | + $field['password'] = md5($newpassword); |
|
239 | + } |
|
240 | + $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
241 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
242 | + $field = $modx->db->escape($field); |
|
243 | + $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
244 | + |
|
245 | + // Save User Settings |
|
246 | 246 | saveWebUserSettings($id); |
247 | 247 | |
248 | - // Set the item name for logger |
|
249 | - $_SESSION['itemname'] = $newusername; |
|
250 | - |
|
251 | - /*******************************************************************************/ |
|
252 | - // put the user in the user_groups he/ she should be in |
|
253 | - // first, check that up_perms are switched on! |
|
254 | - if($use_udperms == 1) { |
|
255 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
256 | - $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
257 | - if(!empty($user_groups)) { |
|
258 | - for($i = 0; $i < count($user_groups); $i++) { |
|
259 | - $field = array(); |
|
260 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
261 | - $field['webuser'] = $id; |
|
262 | - $modx->db->insert($field, $tbl_web_groups); |
|
263 | - } |
|
264 | - } |
|
265 | - } |
|
266 | - // end of user_groups stuff! |
|
267 | - /*******************************************************************************/ |
|
248 | + // Set the item name for logger |
|
249 | + $_SESSION['itemname'] = $newusername; |
|
250 | + |
|
251 | + /*******************************************************************************/ |
|
252 | + // put the user in the user_groups he/ she should be in |
|
253 | + // first, check that up_perms are switched on! |
|
254 | + if($use_udperms == 1) { |
|
255 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
256 | + $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
257 | + if(!empty($user_groups)) { |
|
258 | + for($i = 0; $i < count($user_groups); $i++) { |
|
259 | + $field = array(); |
|
260 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
261 | + $field['webuser'] = $id; |
|
262 | + $modx->db->insert($field, $tbl_web_groups); |
|
263 | + } |
|
264 | + } |
|
265 | + } |
|
266 | + // end of user_groups stuff! |
|
267 | + /*******************************************************************************/ |
|
268 | 268 | |
269 | 269 | // invoke OnWebSaveUser event |
270 | 270 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -293,16 +293,16 @@ discard block |
||
293 | 293 | "id" => $id |
294 | 294 | )); |
295 | 295 | |
296 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | - if($input['stay'] != '') { |
|
298 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
299 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
300 | - } else { |
|
301 | - $stayUrl = "index.php?a=99&r=2"; |
|
302 | - } |
|
296 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | + if($input['stay'] != '') { |
|
298 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
299 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
300 | + } else { |
|
301 | + $stayUrl = "index.php?a=99&r=2"; |
|
302 | + } |
|
303 | 303 | |
304 | - include_once "header.inc.php"; |
|
305 | - ?> |
|
304 | + include_once "header.inc.php"; |
|
305 | + ?> |
|
306 | 306 | |
307 | 307 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
308 | 308 | |
@@ -322,18 +322,18 @@ discard block |
||
322 | 322 | </div> |
323 | 323 | <?php |
324 | 324 | |
325 | - include_once "footer.inc.php"; |
|
326 | - } else { |
|
327 | - if($input['stay'] != '') { |
|
328 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
329 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
330 | - header($header); |
|
331 | - } else { |
|
332 | - $header = "Location: index.php?a=99&r=2"; |
|
333 | - header($header); |
|
334 | - } |
|
335 | - } |
|
336 | - break; |
|
337 | - default : |
|
338 | - webAlertAndQuit("No operation set in request.", 88); |
|
325 | + include_once "footer.inc.php"; |
|
326 | + } else { |
|
327 | + if($input['stay'] != '') { |
|
328 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
329 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
330 | + header($header); |
|
331 | + } else { |
|
332 | + $header = "Location: index.php?a=99&r=2"; |
|
333 | + header($header); |
|
334 | + } |
|
335 | + } |
|
336 | + break; |
|
337 | + default : |
|
338 | + webAlertAndQuit("No operation set in request.", 88); |
|
339 | 339 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /********************/ |
@@ -12,29 +12,29 @@ discard block |
||
12 | 12 | |
13 | 13 | // check permissions |
14 | 14 | switch($modx->manager->action) { |
15 | - case 27: |
|
16 | - if(!$modx->hasPermission('edit_document')) { |
|
17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | - } |
|
19 | - break; |
|
20 | - case 85: |
|
21 | - case 72: |
|
22 | - case 4: |
|
23 | - if(!$modx->hasPermission('new_document')) { |
|
24 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | - // check user has permissions for parent |
|
27 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
28 | - $udperms->user = $modx->getLoginUserID(); |
|
29 | - $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
30 | - $udperms->role = $_SESSION['mgrRole']; |
|
31 | - if(!$udperms->checkPermissions()) { |
|
32 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
33 | - } |
|
34 | - } |
|
35 | - break; |
|
36 | - default: |
|
37 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + case 27: |
|
16 | + if(!$modx->hasPermission('edit_document')) { |
|
17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | + } |
|
19 | + break; |
|
20 | + case 85: |
|
21 | + case 72: |
|
22 | + case 4: |
|
23 | + if(!$modx->hasPermission('new_document')) { |
|
24 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
25 | + } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | + // check user has permissions for parent |
|
27 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
28 | + $udperms->user = $modx->getLoginUserID(); |
|
29 | + $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
30 | + $udperms->role = $_SESSION['mgrRole']; |
|
31 | + if(!$udperms->checkPermissions()) { |
|
32 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
33 | + } |
|
34 | + } |
|
35 | + break; |
|
36 | + default: |
|
37 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -53,21 +53,21 @@ discard block |
||
53 | 53 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
54 | 54 | |
55 | 55 | if($modx->manager->action == 27) { |
56 | - //editing an existing document |
|
57 | - // check permissions on the document |
|
58 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
59 | - $udperms->user = $modx->getLoginUserID(); |
|
60 | - $udperms->document = $id; |
|
61 | - $udperms->role = $_SESSION['mgrRole']; |
|
62 | - |
|
63 | - if(!$udperms->checkPermissions()) { |
|
64 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
65 | - } |
|
56 | + //editing an existing document |
|
57 | + // check permissions on the document |
|
58 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
59 | + $udperms->user = $modx->getLoginUserID(); |
|
60 | + $udperms->document = $id; |
|
61 | + $udperms->role = $_SESSION['mgrRole']; |
|
62 | + |
|
63 | + if(!$udperms->checkPermissions()) { |
|
64 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // check to see if resource isn't locked |
69 | 69 | if($lockedEl = $modx->elementIsLocked(7, $id)) { |
70 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
70 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
71 | 71 | } |
72 | 72 | // end check for lock |
73 | 73 | |
@@ -76,74 +76,74 @@ discard block |
||
76 | 76 | |
77 | 77 | // get document groups for current user |
78 | 78 | if($_SESSION['mgrDocgroups']) { |
79 | - $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
79 | + $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | if(!empty ($id)) { |
83 | - $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
84 | - if($docgrp) { |
|
85 | - $access .= " OR dg.document_group IN ({$docgrp})"; |
|
86 | - } |
|
87 | - $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
88 | - $content = array(); |
|
89 | - $content = $modx->db->getRow($rs); |
|
90 | - $modx->documentObject = &$content; |
|
91 | - if(!$content) { |
|
92 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
93 | - } |
|
94 | - $_SESSION['itemname'] = $content['pagetitle']; |
|
83 | + $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
84 | + if($docgrp) { |
|
85 | + $access .= " OR dg.document_group IN ({$docgrp})"; |
|
86 | + } |
|
87 | + $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
88 | + $content = array(); |
|
89 | + $content = $modx->db->getRow($rs); |
|
90 | + $modx->documentObject = &$content; |
|
91 | + if(!$content) { |
|
92 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
93 | + } |
|
94 | + $_SESSION['itemname'] = $content['pagetitle']; |
|
95 | 95 | } else { |
96 | - $content = array(); |
|
96 | + $content = array(); |
|
97 | 97 | |
98 | - if(isset($_REQUEST['newtemplate'])) { |
|
99 | - $content['template'] = $_REQUEST['newtemplate']; |
|
100 | - } else { |
|
101 | - $content['template'] = getDefaultTemplate(); |
|
102 | - } |
|
98 | + if(isset($_REQUEST['newtemplate'])) { |
|
99 | + $content['template'] = $_REQUEST['newtemplate']; |
|
100 | + } else { |
|
101 | + $content['template'] = getDefaultTemplate(); |
|
102 | + } |
|
103 | 103 | |
104 | - $_SESSION['itemname'] = $_lang["new_resource"]; |
|
104 | + $_SESSION['itemname'] = $_lang["new_resource"]; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // restore saved form |
108 | 108 | $formRestored = $modx->manager->loadFormValues(); |
109 | 109 | if(isset($_REQUEST['newtemplate'])) { |
110 | - $formRestored = true; |
|
110 | + $formRestored = true; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | // retain form values if template was changed |
114 | 114 | // edited to convert pub_date and unpub_date |
115 | 115 | // sottwell 02-09-2006 |
116 | 116 | if($formRestored == true) { |
117 | - $content = array_merge($content, $_POST); |
|
118 | - $content['content'] = $_POST['ta']; |
|
119 | - if(empty ($content['pub_date'])) { |
|
120 | - unset ($content['pub_date']); |
|
121 | - } else { |
|
122 | - $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
123 | - } |
|
124 | - if(empty ($content['unpub_date'])) { |
|
125 | - unset ($content['unpub_date']); |
|
126 | - } else { |
|
127 | - $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
128 | - } |
|
117 | + $content = array_merge($content, $_POST); |
|
118 | + $content['content'] = $_POST['ta']; |
|
119 | + if(empty ($content['pub_date'])) { |
|
120 | + unset ($content['pub_date']); |
|
121 | + } else { |
|
122 | + $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
123 | + } |
|
124 | + if(empty ($content['unpub_date'])) { |
|
125 | + unset ($content['unpub_date']); |
|
126 | + } else { |
|
127 | + $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
128 | + } |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // increase menu index if this is a new document |
132 | 132 | if(!isset ($_REQUEST['id'])) { |
133 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
134 | - $modx->config['auto_menuindex'] = 1; |
|
135 | - } |
|
136 | - if($modx->config['auto_menuindex']) { |
|
137 | - $pid = (int)$_REQUEST['pid']; |
|
138 | - $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
139 | - $content['menuindex'] = $modx->db->getValue($rs); |
|
140 | - } else { |
|
141 | - $content['menuindex'] = 0; |
|
142 | - } |
|
133 | + if(!isset ($modx->config['auto_menuindex'])) { |
|
134 | + $modx->config['auto_menuindex'] = 1; |
|
135 | + } |
|
136 | + if($modx->config['auto_menuindex']) { |
|
137 | + $pid = (int)$_REQUEST['pid']; |
|
138 | + $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
139 | + $content['menuindex'] = $modx->db->getValue($rs); |
|
140 | + } else { |
|
141 | + $content['menuindex'] = 0; |
|
142 | + } |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | if(isset ($_POST['which_editor'])) { |
146 | - $modx->config['which_editor'] = $_POST['which_editor']; |
|
146 | + $modx->config['which_editor'] = $_POST['which_editor']; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | // Add lock-element JS-Script |
@@ -543,23 +543,23 @@ discard block |
||
543 | 543 | |
544 | 544 | <form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;"> |
545 | 545 | <?php |
546 | - // invoke OnDocFormPrerender event |
|
547 | - $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
548 | - 'id' => $id, |
|
549 | - 'template' => $content['template'] |
|
550 | - )); |
|
551 | - |
|
552 | - if(is_array($evtOut)) { |
|
553 | - echo implode('', $evtOut); |
|
554 | - } |
|
555 | - |
|
556 | - /*************************/ |
|
557 | - $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
558 | - $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
559 | - $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
560 | - /*************************/ |
|
561 | - |
|
562 | - ?> |
|
546 | + // invoke OnDocFormPrerender event |
|
547 | + $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
548 | + 'id' => $id, |
|
549 | + 'template' => $content['template'] |
|
550 | + )); |
|
551 | + |
|
552 | + if(is_array($evtOut)) { |
|
553 | + echo implode('', $evtOut); |
|
554 | + } |
|
555 | + |
|
556 | + /*************************/ |
|
557 | + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
558 | + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
559 | + $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
560 | + /*************************/ |
|
561 | + |
|
562 | + ?> |
|
563 | 563 | <input type="hidden" name="a" value="5" /> |
564 | 564 | <input type="hidden" name="id" value="<?= $content['id'] ?>" /> |
565 | 565 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>" /> |
@@ -574,54 +574,54 @@ discard block |
||
574 | 574 | |
575 | 575 | <h1> |
576 | 576 | <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
577 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
578 | - } else { |
|
579 | - if ($modx->manager->action == '4') { |
|
577 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
578 | + } else { |
|
579 | + if ($modx->manager->action == '4') { |
|
580 | 580 | echo $_lang['add_resource']; |
581 | 581 | } else if ($modx->manager->action == '72') { |
582 | 582 | echo $_lang['add_weblink']; |
583 | 583 | } else { |
584 | 584 | echo $_lang['create_resource_title']; |
585 | 585 | } |
586 | - } ?> |
|
586 | + } ?> |
|
587 | 587 | </h1> |
588 | 588 | |
589 | 589 | <?= $_style['actionbuttons']['dynamic']['document'] ?> |
590 | 590 | |
591 | 591 | <?php |
592 | - // breadcrumbs |
|
593 | - if($modx->config['use_breadcrumbs']) { |
|
594 | - $temp = array(); |
|
595 | - $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
596 | - |
|
597 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
598 | - $bID = (int) $_REQUEST['id']; |
|
599 | - $temp = $modx->getParentIds($bID); |
|
600 | - } else if(isset($_REQUEST['pid'])) { |
|
601 | - $bID = (int) $_REQUEST['pid']; |
|
602 | - $temp = $modx->getParentIds($bID); |
|
603 | - array_unshift($temp, $bID); |
|
604 | - } |
|
605 | - |
|
606 | - if($temp) { |
|
607 | - $parents = implode(',', $temp); |
|
608 | - |
|
609 | - if(!empty($parents)) { |
|
610 | - $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
611 | - $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
612 | - while($row = $modx->db->getRow($rs)) { |
|
613 | - $out .= '<li class="breadcrumbs__li"> |
|
592 | + // breadcrumbs |
|
593 | + if($modx->config['use_breadcrumbs']) { |
|
594 | + $temp = array(); |
|
595 | + $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
596 | + |
|
597 | + if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
598 | + $bID = (int) $_REQUEST['id']; |
|
599 | + $temp = $modx->getParentIds($bID); |
|
600 | + } else if(isset($_REQUEST['pid'])) { |
|
601 | + $bID = (int) $_REQUEST['pid']; |
|
602 | + $temp = $modx->getParentIds($bID); |
|
603 | + array_unshift($temp, $bID); |
|
604 | + } |
|
605 | + |
|
606 | + if($temp) { |
|
607 | + $parents = implode(',', $temp); |
|
608 | + |
|
609 | + if(!empty($parents)) { |
|
610 | + $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
611 | + $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
612 | + while($row = $modx->db->getRow($rs)) { |
|
613 | + $out .= '<li class="breadcrumbs__li"> |
|
614 | 614 | <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
615 | 615 | <span class="breadcrumbs__sep">></span> |
616 | 616 | </li>'; |
617 | - } |
|
618 | - } |
|
619 | - } |
|
617 | + } |
|
618 | + } |
|
619 | + } |
|
620 | 620 | |
621 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
622 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
623 | - } |
|
624 | - ?> |
|
621 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
622 | + echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
623 | + } |
|
624 | + ?> |
|
625 | 625 | |
626 | 626 | <!-- start main wrapper --> |
627 | 627 | <div class="sectionBody"> |
@@ -633,13 +633,13 @@ discard block |
||
633 | 633 | |
634 | 634 | <!-- General --> |
635 | 635 | <?php |
636 | - $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
637 | - 'id' => $id |
|
638 | - )); |
|
639 | - if(is_array($evtOut)) { |
|
640 | - echo implode('', $evtOut); |
|
641 | - } else { |
|
642 | - ?> |
|
636 | + $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
637 | + 'id' => $id |
|
638 | + )); |
|
639 | + if(is_array($evtOut)) { |
|
640 | + echo implode('', $evtOut); |
|
641 | + } else { |
|
642 | + ?> |
|
643 | 643 | <div class="tab-page" id="tabGeneral"> |
644 | 644 | <h2 class="tab"><?= $_lang['settings_general'] ?></h2> |
645 | 645 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script> |
@@ -724,36 +724,36 @@ discard block |
||
724 | 724 | <select id="template" name="template" class="inputBox" onchange="templateWarning();"> |
725 | 725 | <option value="0">(blank)</option> |
726 | 726 | <?php |
727 | - $field = "t.templatename, t.selectable, t.id, c.category"; |
|
728 | - $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
729 | - $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
730 | - $currentCategory = ''; |
|
731 | - while($row = $modx->db->getRow($rs)) { |
|
732 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
733 | - continue; |
|
734 | - }; |
|
735 | - // Skip if not selectable but show if selected! |
|
736 | - $thisCategory = $row['category']; |
|
737 | - if($thisCategory == null) { |
|
738 | - $thisCategory = $_lang["no_category"]; |
|
739 | - } |
|
740 | - if($thisCategory != $currentCategory) { |
|
741 | - if($closeOptGroup) { |
|
742 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
743 | - } |
|
744 | - echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
745 | - $closeOptGroup = true; |
|
746 | - } |
|
727 | + $field = "t.templatename, t.selectable, t.id, c.category"; |
|
728 | + $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
729 | + $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
730 | + $currentCategory = ''; |
|
731 | + while($row = $modx->db->getRow($rs)) { |
|
732 | + if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
733 | + continue; |
|
734 | + }; |
|
735 | + // Skip if not selectable but show if selected! |
|
736 | + $thisCategory = $row['category']; |
|
737 | + if($thisCategory == null) { |
|
738 | + $thisCategory = $_lang["no_category"]; |
|
739 | + } |
|
740 | + if($thisCategory != $currentCategory) { |
|
741 | + if($closeOptGroup) { |
|
742 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
743 | + } |
|
744 | + echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
745 | + $closeOptGroup = true; |
|
746 | + } |
|
747 | 747 | |
748 | - $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
748 | + $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
749 | 749 | |
750 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
751 | - $currentCategory = $thisCategory; |
|
752 | - } |
|
753 | - if($thisCategory != '') { |
|
754 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
755 | - } |
|
756 | - ?> |
|
750 | + echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
751 | + $currentCategory = $thisCategory; |
|
752 | + } |
|
753 | + if($thisCategory != '') { |
|
754 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
755 | + } |
|
756 | + ?> |
|
757 | 757 | </select> |
758 | 758 | </td> |
759 | 759 | </tr> |
@@ -793,37 +793,37 @@ discard block |
||
793 | 793 | </td> |
794 | 794 | <td valign="top"> |
795 | 795 | <?php |
796 | - $parentlookup = false; |
|
797 | - if(isset ($_REQUEST['id'])) { |
|
798 | - if($content['parent'] == 0) { |
|
799 | - $parentname = $site_name; |
|
800 | - } else { |
|
801 | - $parentlookup = $content['parent']; |
|
802 | - } |
|
803 | - } elseif(isset ($_REQUEST['pid'])) { |
|
804 | - if($_REQUEST['pid'] == 0) { |
|
805 | - $parentname = $site_name; |
|
806 | - } else { |
|
807 | - $parentlookup = $_REQUEST['pid']; |
|
808 | - } |
|
809 | - } elseif(isset($_POST['parent'])) { |
|
810 | - if($_POST['parent'] == 0) { |
|
811 | - $parentname = $site_name; |
|
812 | - } else { |
|
813 | - $parentlookup = $_POST['parent']; |
|
814 | - } |
|
815 | - } else { |
|
816 | - $parentname = $site_name; |
|
817 | - $content['parent'] = 0; |
|
818 | - } |
|
819 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
820 | - $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
821 | - $parentname = $modx->db->getValue($rs); |
|
822 | - if(!$parentname) { |
|
823 | - $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
824 | - } |
|
825 | - } |
|
826 | - ?> |
|
796 | + $parentlookup = false; |
|
797 | + if(isset ($_REQUEST['id'])) { |
|
798 | + if($content['parent'] == 0) { |
|
799 | + $parentname = $site_name; |
|
800 | + } else { |
|
801 | + $parentlookup = $content['parent']; |
|
802 | + } |
|
803 | + } elseif(isset ($_REQUEST['pid'])) { |
|
804 | + if($_REQUEST['pid'] == 0) { |
|
805 | + $parentname = $site_name; |
|
806 | + } else { |
|
807 | + $parentlookup = $_REQUEST['pid']; |
|
808 | + } |
|
809 | + } elseif(isset($_POST['parent'])) { |
|
810 | + if($_POST['parent'] == 0) { |
|
811 | + $parentname = $site_name; |
|
812 | + } else { |
|
813 | + $parentlookup = $_POST['parent']; |
|
814 | + } |
|
815 | + } else { |
|
816 | + $parentname = $site_name; |
|
817 | + $content['parent'] = 0; |
|
818 | + } |
|
819 | + if($parentlookup !== false && is_numeric($parentlookup)) { |
|
820 | + $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
821 | + $parentname = $modx->db->getValue($rs); |
|
822 | + if(!$parentname) { |
|
823 | + $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
824 | + } |
|
825 | + } |
|
826 | + ?> |
|
827 | 827 | <i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i> |
828 | 828 | <b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $parentname ?>)</span></b> |
829 | 829 | <input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" /> |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | </tr> |
832 | 832 | <tr></tr> |
833 | 833 | <?php |
834 | - /* |
|
834 | + /* |
|
835 | 835 | if($content['type'] == 'reference' || $modx->manager->action == '72') { |
836 | 836 | ?> |
837 | 837 | <tr> |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | </tr> |
860 | 860 | <?php |
861 | 861 | }*/ |
862 | - ?> |
|
862 | + ?> |
|
863 | 863 | |
864 | 864 | <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
865 | 865 | <tr> |
@@ -872,36 +872,36 @@ discard block |
||
872 | 872 | <select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();"> |
873 | 873 | <option value="none"><?= $_lang['none'] ?></option> |
874 | 874 | <?php |
875 | - // invoke OnRichTextEditorRegister event |
|
876 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
877 | - if(is_array($evtOut)) { |
|
878 | - for($i = 0; $i < count($evtOut); $i++) { |
|
879 | - $editor = $evtOut[$i]; |
|
880 | - echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
881 | - } |
|
882 | - } |
|
883 | - ?> |
|
875 | + // invoke OnRichTextEditorRegister event |
|
876 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
877 | + if(is_array($evtOut)) { |
|
878 | + for($i = 0; $i < count($evtOut); $i++) { |
|
879 | + $editor = $evtOut[$i]; |
|
880 | + echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
881 | + } |
|
882 | + } |
|
883 | + ?> |
|
884 | 884 | </select> |
885 | 885 | </label> |
886 | 886 | </div> |
887 | 887 | <div id="content_body"> |
888 | 888 | <?php |
889 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
890 | - $htmlContent = $content['content']; |
|
891 | - ?> |
|
889 | + if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
890 | + $htmlContent = $content['content']; |
|
891 | + ?> |
|
892 | 892 | <div class="section-editor clearfix"> |
893 | 893 | <textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->htmlspecialchars($htmlContent) ?></textarea> |
894 | 894 | </div> |
895 | 895 | <?php |
896 | - // Richtext-[*content*] |
|
897 | - $richtexteditorIds = array(); |
|
898 | - $richtexteditorOptions = array(); |
|
899 | - $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
900 | - $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
901 | - } else { |
|
902 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
903 | - } |
|
904 | - ?> |
|
896 | + // Richtext-[*content*] |
|
897 | + $richtexteditorIds = array(); |
|
898 | + $richtexteditorOptions = array(); |
|
899 | + $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
900 | + $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
901 | + } else { |
|
902 | + echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
903 | + } |
|
904 | + ?> |
|
905 | 905 | </div> |
906 | 906 | </td> |
907 | 907 | </tr> |
@@ -1207,8 +1207,8 @@ discard block |
||
1207 | 1207 | |
1208 | 1208 | <?php |
1209 | 1209 | |
1210 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1211 | - ?> |
|
1210 | + if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1211 | + ?> |
|
1212 | 1212 | <tr> |
1213 | 1213 | <td> |
1214 | 1214 | <span class="warning"><?= $_lang['resource_type'] ?></span> |
@@ -1230,15 +1230,15 @@ discard block |
||
1230 | 1230 | <td> |
1231 | 1231 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1232 | 1232 | <?php |
1233 | - if(!$content['contentType']) { |
|
1234 | - $content['contentType'] = 'text/html'; |
|
1235 | - } |
|
1236 | - $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1237 | - $ct = explode(",", $custom_contenttype); |
|
1238 | - for($i = 0; $i < count($ct); $i++) { |
|
1239 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1240 | - } |
|
1241 | - ?> |
|
1233 | + if(!$content['contentType']) { |
|
1234 | + $content['contentType'] = 'text/html'; |
|
1235 | + } |
|
1236 | + $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1237 | + $ct = explode(",", $custom_contenttype); |
|
1238 | + for($i = 0; $i < count($ct); $i++) { |
|
1239 | + echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1240 | + } |
|
1241 | + ?> |
|
1242 | 1242 | </select> |
1243 | 1243 | </td> |
1244 | 1244 | </tr> |
@@ -1261,23 +1261,23 @@ discard block |
||
1261 | 1261 | </td> |
1262 | 1262 | </tr> |
1263 | 1263 | <?php |
1264 | - } else { |
|
1265 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1266 | - // non-admin managers creating or editing a document resource |
|
1267 | - ?> |
|
1264 | + } else { |
|
1265 | + if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1266 | + // non-admin managers creating or editing a document resource |
|
1267 | + ?> |
|
1268 | 1268 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
1269 | 1269 | <input type="hidden" name="type" value="document" /> |
1270 | 1270 | <input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" /> |
1271 | 1271 | <?php |
1272 | - } else { |
|
1273 | - // non-admin managers creating or editing a reference (weblink) resource |
|
1274 | - ?> |
|
1272 | + } else { |
|
1273 | + // non-admin managers creating or editing a reference (weblink) resource |
|
1274 | + ?> |
|
1275 | 1275 | <input type="hidden" name="type" value="reference" /> |
1276 | 1276 | <input type="hidden" name="contentType" value="text/html" /> |
1277 | 1277 | <?php |
1278 | - } |
|
1279 | - }//if mgrRole |
|
1280 | - ?> |
|
1278 | + } |
|
1279 | + }//if mgrRole |
|
1280 | + ?> |
|
1281 | 1281 | |
1282 | 1282 | <tr> |
1283 | 1283 | <td> |
@@ -1360,112 +1360,112 @@ discard block |
||
1360 | 1360 | ?> |
1361 | 1361 | |
1362 | 1362 | <?php |
1363 | - /******************************* |
|
1363 | + /******************************* |
|
1364 | 1364 | * Document Access Permissions */ |
1365 | - if($use_udperms == 1) { |
|
1366 | - $groupsarray = array(); |
|
1367 | - $sql = ''; |
|
1368 | - |
|
1369 | - $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1370 | - if($documentId > 0) { |
|
1371 | - // Load up, the permissions from the parent (if new document) or existing document |
|
1372 | - $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1373 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1374 | - |
|
1375 | - // Load up the current permissions and names |
|
1376 | - $vs = array( |
|
1377 | - $tbl_document_group_names, |
|
1378 | - $tbl_document_groups, |
|
1379 | - $documentId |
|
1380 | - ); |
|
1381 | - $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1382 | - $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1383 | - } else { |
|
1384 | - // Just load up the names, we're starting clean |
|
1385 | - $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1386 | - } |
|
1387 | - |
|
1388 | - // retain selected doc groups between post |
|
1389 | - if(isset($_POST['docgroups'])) { |
|
1390 | - $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1391 | - } |
|
1365 | + if($use_udperms == 1) { |
|
1366 | + $groupsarray = array(); |
|
1367 | + $sql = ''; |
|
1368 | + |
|
1369 | + $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1370 | + if($documentId > 0) { |
|
1371 | + // Load up, the permissions from the parent (if new document) or existing document |
|
1372 | + $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1373 | + while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1374 | + |
|
1375 | + // Load up the current permissions and names |
|
1376 | + $vs = array( |
|
1377 | + $tbl_document_group_names, |
|
1378 | + $tbl_document_groups, |
|
1379 | + $documentId |
|
1380 | + ); |
|
1381 | + $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1382 | + $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1383 | + } else { |
|
1384 | + // Just load up the names, we're starting clean |
|
1385 | + $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1386 | + } |
|
1387 | + |
|
1388 | + // retain selected doc groups between post |
|
1389 | + if(isset($_POST['docgroups'])) { |
|
1390 | + $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1391 | + } |
|
1392 | + |
|
1393 | + $isManager = $modx->hasPermission('access_permissions'); |
|
1394 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1395 | + |
|
1396 | + // Setup Basic attributes for each Input box |
|
1397 | + $inputAttributes = array( |
|
1398 | + 'type' => 'checkbox', |
|
1399 | + 'class' => 'checkbox', |
|
1400 | + 'name' => 'docgroups[]', |
|
1401 | + 'onclick' => 'makePublic(false);', |
|
1402 | + ); |
|
1403 | + $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1404 | + $permissions_yes = 0; // count permissions the current mgr user has |
|
1405 | + $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1406 | + |
|
1407 | + // Loop through the permissions list |
|
1408 | + while($row = $modx->db->getRow($rs)) { |
|
1409 | + |
|
1410 | + // Create an inputValue pair (group ID and group link (if it exists)) |
|
1411 | + $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1412 | + $inputId = 'group-' . $row['id']; |
|
1413 | + |
|
1414 | + $checked = in_array($inputValue, $groupsarray); |
|
1415 | + if($checked) { |
|
1416 | + $notPublic = true; |
|
1417 | + } // Mark as private access (either web or manager) |
|
1418 | + |
|
1419 | + // Skip the access permission if the user doesn't have access... |
|
1420 | + if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1421 | + continue; |
|
1422 | + } |
|
1392 | 1423 | |
1393 | - $isManager = $modx->hasPermission('access_permissions'); |
|
1394 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1395 | - |
|
1396 | - // Setup Basic attributes for each Input box |
|
1397 | - $inputAttributes = array( |
|
1398 | - 'type' => 'checkbox', |
|
1399 | - 'class' => 'checkbox', |
|
1400 | - 'name' => 'docgroups[]', |
|
1401 | - 'onclick' => 'makePublic(false);', |
|
1402 | - ); |
|
1403 | - $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1404 | - $permissions_yes = 0; // count permissions the current mgr user has |
|
1405 | - $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1406 | - |
|
1407 | - // Loop through the permissions list |
|
1408 | - while($row = $modx->db->getRow($rs)) { |
|
1409 | - |
|
1410 | - // Create an inputValue pair (group ID and group link (if it exists)) |
|
1411 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1412 | - $inputId = 'group-' . $row['id']; |
|
1413 | - |
|
1414 | - $checked = in_array($inputValue, $groupsarray); |
|
1415 | - if($checked) { |
|
1416 | - $notPublic = true; |
|
1417 | - } // Mark as private access (either web or manager) |
|
1418 | - |
|
1419 | - // Skip the access permission if the user doesn't have access... |
|
1420 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1421 | - continue; |
|
1422 | - } |
|
1423 | - |
|
1424 | - // Setup attributes for this Input box |
|
1425 | - $inputAttributes['id'] = $inputId; |
|
1426 | - $inputAttributes['value'] = $inputValue; |
|
1427 | - if($checked) { |
|
1428 | - $inputAttributes['checked'] = 'checked'; |
|
1429 | - } else { |
|
1430 | - unset($inputAttributes['checked']); |
|
1431 | - } |
|
1432 | - |
|
1433 | - // Create attribute string list |
|
1434 | - $inputString = array(); |
|
1435 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1436 | - |
|
1437 | - // Make the <input> HTML |
|
1438 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1439 | - |
|
1440 | - // does user have this permission? |
|
1441 | - $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1442 | - $vs = array( |
|
1443 | - $row['id'], |
|
1444 | - $_SESSION['mgrInternalKey'] |
|
1445 | - ); |
|
1446 | - $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1447 | - $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
1448 | - $count = $modx->db->getValue($rsp); |
|
1449 | - if($count > 0) { |
|
1450 | - ++$permissions_yes; |
|
1451 | - } else { |
|
1452 | - ++$permissions_no; |
|
1453 | - } |
|
1454 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1455 | - } |
|
1456 | - // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1457 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1458 | - $permissions = array(); |
|
1459 | - } |
|
1424 | + // Setup attributes for this Input box |
|
1425 | + $inputAttributes['id'] = $inputId; |
|
1426 | + $inputAttributes['value'] = $inputValue; |
|
1427 | + if($checked) { |
|
1428 | + $inputAttributes['checked'] = 'checked'; |
|
1429 | + } else { |
|
1430 | + unset($inputAttributes['checked']); |
|
1431 | + } |
|
1460 | 1432 | |
1461 | - // See if the Access Permissions section is worth displaying... |
|
1462 | - if(!empty($permissions)) { |
|
1463 | - // Add the "All Document Groups" item if we have rights in both contexts |
|
1464 | - if($isManager && $isWeb) { |
|
1465 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1466 | - } |
|
1467 | - // Output the permissions list... |
|
1468 | - ?> |
|
1433 | + // Create attribute string list |
|
1434 | + $inputString = array(); |
|
1435 | + foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1436 | + |
|
1437 | + // Make the <input> HTML |
|
1438 | + $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1439 | + |
|
1440 | + // does user have this permission? |
|
1441 | + $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1442 | + $vs = array( |
|
1443 | + $row['id'], |
|
1444 | + $_SESSION['mgrInternalKey'] |
|
1445 | + ); |
|
1446 | + $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1447 | + $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
1448 | + $count = $modx->db->getValue($rsp); |
|
1449 | + if($count > 0) { |
|
1450 | + ++$permissions_yes; |
|
1451 | + } else { |
|
1452 | + ++$permissions_no; |
|
1453 | + } |
|
1454 | + $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1455 | + } |
|
1456 | + // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1457 | + if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1458 | + $permissions = array(); |
|
1459 | + } |
|
1460 | + |
|
1461 | + // See if the Access Permissions section is worth displaying... |
|
1462 | + if(!empty($permissions)) { |
|
1463 | + // Add the "All Document Groups" item if we have rights in both contexts |
|
1464 | + if($isManager && $isWeb) { |
|
1465 | + array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1466 | + } |
|
1467 | + // Output the permissions list... |
|
1468 | + ?> |
|
1469 | 1469 | <!-- Access Permissions --> |
1470 | 1470 | <div class="tab-page" id="tabAccess"> |
1471 | 1471 | <h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2> |
@@ -1499,31 +1499,31 @@ discard block |
||
1499 | 1499 | </ul> |
1500 | 1500 | </div><!--div class="tab-page" id="tabAccess"--> |
1501 | 1501 | <?php |
1502 | - } // !empty($permissions) |
|
1503 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1504 | - ?> |
|
1502 | + } // !empty($permissions) |
|
1503 | + elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1504 | + ?> |
|
1505 | 1505 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1506 | 1506 | <?php |
1507 | 1507 | |
1508 | - } |
|
1509 | - } |
|
1510 | - /* End Document Access Permissions * |
|
1508 | + } |
|
1509 | + } |
|
1510 | + /* End Document Access Permissions * |
|
1511 | 1511 | ***********************************/ |
1512 | - ?> |
|
1512 | + ?> |
|
1513 | 1513 | |
1514 | 1514 | <input type="submit" name="save" style="display:none" /> |
1515 | 1515 | <?php |
1516 | 1516 | |
1517 | - // invoke OnDocFormRender event |
|
1518 | - $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1519 | - 'id' => $id, |
|
1520 | - 'template' => $content['template'] |
|
1521 | - )); |
|
1517 | + // invoke OnDocFormRender event |
|
1518 | + $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1519 | + 'id' => $id, |
|
1520 | + 'template' => $content['template'] |
|
1521 | + )); |
|
1522 | 1522 | |
1523 | - if(is_array($evtOut)) { |
|
1524 | - echo implode('', $evtOut); |
|
1525 | - } |
|
1526 | - ?> |
|
1523 | + if(is_array($evtOut)) { |
|
1524 | + echo implode('', $evtOut); |
|
1525 | + } |
|
1526 | + ?> |
|
1527 | 1527 | </div><!--div class="tab-pane" id="documentPane"--> |
1528 | 1528 | </div><!--div class="sectionBody"--> |
1529 | 1529 | </fieldset> |
@@ -1534,17 +1534,17 @@ discard block |
||
1534 | 1534 | </script> |
1535 | 1535 | <?php |
1536 | 1536 | if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
1537 | - if(is_array($richtexteditorIds)) { |
|
1538 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1539 | - // invoke OnRichTextEditorInit event |
|
1540 | - $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1541 | - 'editor' => $editor, |
|
1542 | - 'elements' => $elements, |
|
1543 | - 'options' => $richtexteditorOptions[$editor] |
|
1544 | - )); |
|
1545 | - if(is_array($evtOut)) { |
|
1546 | - echo implode('', $evtOut); |
|
1547 | - } |
|
1548 | - } |
|
1549 | - } |
|
1537 | + if(is_array($richtexteditorIds)) { |
|
1538 | + foreach($richtexteditorIds as $editor => $elements) { |
|
1539 | + // invoke OnRichTextEditorInit event |
|
1540 | + $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1541 | + 'editor' => $editor, |
|
1542 | + 'elements' => $elements, |
|
1543 | + 'options' => $richtexteditorOptions[$editor] |
|
1544 | + )); |
|
1545 | + if(is_array($evtOut)) { |
|
1546 | + echo implode('', $evtOut); |
|
1547 | + } |
|
1548 | + } |
|
1549 | + } |
|
1550 | 1550 | } |
@@ -1,20 +1,20 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | switch($modx->manager->action) { |
6 | - case 107: |
|
7 | - if(!$modx->hasPermission('new_module')) { |
|
8 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | - } |
|
10 | - break; |
|
11 | - case 108: |
|
12 | - if(!$modx->hasPermission('edit_module')) { |
|
13 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
14 | - } |
|
15 | - break; |
|
16 | - default: |
|
17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + case 107: |
|
7 | + if(!$modx->hasPermission('new_module')) { |
|
8 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | + } |
|
10 | + break; |
|
11 | + case 108: |
|
12 | + if(!$modx->hasPermission('edit_module')) { |
|
13 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
14 | + } |
|
15 | + break; |
|
16 | + default: |
|
17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | 18 | } |
19 | 19 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
20 | 20 | // Get table names (alphabetical) |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | // check to see the module editor isn't locked |
34 | 34 | if($lockedEl = $modx->elementIsLocked(6, $id)) { |
35 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
|
35 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
|
36 | 36 | } |
37 | 37 | // end check for lock |
38 | 38 | |
@@ -40,22 +40,22 @@ discard block |
||
40 | 40 | $modx->lockElement(6, $id); |
41 | 41 | |
42 | 42 | if(isset($_GET['id'])) { |
43 | - $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'"); |
|
44 | - $content = $modx->db->getRow($rs); |
|
45 | - if(!$content) { |
|
46 | - $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
47 | - } |
|
48 | - $content['properties'] = str_replace("&", "&", $content['properties']); |
|
49 | - $_SESSION['itemname'] = $content['name']; |
|
50 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
51 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
52 | - } |
|
43 | + $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'"); |
|
44 | + $content = $modx->db->getRow($rs); |
|
45 | + if(!$content) { |
|
46 | + $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
47 | + } |
|
48 | + $content['properties'] = str_replace("&", "&", $content['properties']); |
|
49 | + $_SESSION['itemname'] = $content['name']; |
|
50 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
51 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
52 | + } |
|
53 | 53 | } else { |
54 | - $_SESSION['itemname'] = $_lang["new_module"]; |
|
55 | - $content['wrap'] = '1'; |
|
54 | + $_SESSION['itemname'] = $_lang["new_module"]; |
|
55 | + $content['wrap'] = '1'; |
|
56 | 56 | } |
57 | 57 | if($modx->manager->hasFormValues()) { |
58 | - $modx->manager->loadFormValues(); |
|
58 | + $modx->manager->loadFormValues(); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // Add lock-element JS-Script |
@@ -426,18 +426,18 @@ discard block |
||
426 | 426 | |
427 | 427 | <form name="mutate" id="mutate" class="module" method="post" action="index.php?a=109"> |
428 | 428 | <?php |
429 | - // invoke OnModFormPrerender event |
|
430 | - $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
|
431 | - if(is_array($evtOut)) { |
|
432 | - echo implode('', $evtOut); |
|
433 | - } |
|
434 | - |
|
435 | - // Prepare internal params & info-tab via parseDocBlock |
|
436 | - $modulecode = isset($content['modulecode']) ? $modx->db->escape($content['modulecode']) : ''; |
|
437 | - $docBlock = $modx->parseDocBlockFromString($modulecode); |
|
438 | - $docBlockList = $modx->convertDocBlockIntoList($docBlock); |
|
439 | - $internal = array(); |
|
440 | - ?> |
|
429 | + // invoke OnModFormPrerender event |
|
430 | + $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
|
431 | + if(is_array($evtOut)) { |
|
432 | + echo implode('', $evtOut); |
|
433 | + } |
|
434 | + |
|
435 | + // Prepare internal params & info-tab via parseDocBlock |
|
436 | + $modulecode = isset($content['modulecode']) ? $modx->db->escape($content['modulecode']) : ''; |
|
437 | + $docBlock = $modx->parseDocBlockFromString($modulecode); |
|
438 | + $docBlockList = $modx->convertDocBlockIntoList($docBlock); |
|
439 | + $internal = array(); |
|
440 | + ?> |
|
441 | 441 | <input type="hidden" name="id" value="<?= $content['id'] ?>"> |
442 | 442 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
443 | 443 | |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
491 | 491 | <option> </option> |
492 | 492 | <?php |
493 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
494 | - foreach(getCategories() as $n => $v) { |
|
495 | - echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
496 | - } |
|
497 | - ?> |
|
493 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
494 | + foreach(getCategories() as $n => $v) { |
|
495 | + echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
496 | + } |
|
497 | + ?> |
|
498 | 498 | </select> |
499 | 499 | </div> |
500 | 500 | </div> |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | <i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang['manage_depends'] ?></a> |
602 | 602 | </div> |
603 | 603 | <?php |
604 | - $ds = $modx->db->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name, |
|
604 | + $ds = $modx->db->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name, |
|
605 | 605 | CASE smd.type |
606 | 606 | WHEN 10 THEN 'Chunk' |
607 | 607 | WHEN 20 THEN 'Document' |
@@ -617,17 +617,17 @@ discard block |
||
617 | 617 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = 50 |
618 | 618 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = 60", "smd.module='{$id}'", 'smd.type,name'); |
619 | 619 | |
620 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
621 | - $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
622 | - $grd->noRecordMsg = $_lang['no_records_found']; |
|
623 | - $grd->cssClass = 'grid'; |
|
624 | - $grd->columnHeaderClass = 'gridHeader'; |
|
625 | - $grd->itemClass = 'gridItem'; |
|
626 | - $grd->altItemClass = 'gridAltItem'; |
|
627 | - $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
628 | - $grd->fields = "name,type"; |
|
629 | - echo $grd->render(); |
|
630 | - ?> |
|
620 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
621 | + $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
622 | + $grd->noRecordMsg = $_lang['no_records_found']; |
|
623 | + $grd->cssClass = 'grid'; |
|
624 | + $grd->columnHeaderClass = 'gridHeader'; |
|
625 | + $grd->itemClass = 'gridItem'; |
|
626 | + $grd->altItemClass = 'gridAltItem'; |
|
627 | + $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
628 | + $grd->fields = "name,type"; |
|
629 | + echo $grd->render(); |
|
630 | + ?> |
|
631 | 631 | </div> |
632 | 632 | </div> |
633 | 633 | <?php endif; ?> |
@@ -639,12 +639,12 @@ discard block |
||
639 | 639 | <div class="container container-body"> |
640 | 640 | <?php if($use_udperms == 1) : ?> |
641 | 641 | <?php |
642 | - // fetch user access permissions for the module |
|
643 | - $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
|
644 | - $groupsarray = $modx->db->getColumn('usergroup', $rs); |
|
642 | + // fetch user access permissions for the module |
|
643 | + $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
|
644 | + $groupsarray = $modx->db->getColumn('usergroup', $rs); |
|
645 | 645 | |
646 | - if($modx->hasPermission('access_permissions')) { |
|
647 | - ?> |
|
646 | + if($modx->hasPermission('access_permissions')) { |
|
647 | + ?> |
|
648 | 648 | <!-- User Group Access Permissions --> |
649 | 649 | <script type="text/javascript"> |
650 | 650 | function makePublic(b) { |
@@ -668,28 +668,28 @@ discard block |
||
668 | 668 | </script> |
669 | 669 | <p><?= $_lang['module_group_access_msg'] ?></p> |
670 | 670 | <?php |
671 | - } |
|
672 | - $chk = ''; |
|
673 | - $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name'); |
|
674 | - while($row = $modx->db->getRow($rs)) { |
|
675 | - $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
|
676 | - $checked = in_array($row['id'], $groupsarray); |
|
677 | - if($modx->hasPermission('access_permissions')) { |
|
678 | - if($checked) { |
|
679 | - $notPublic = true; |
|
680 | - } |
|
681 | - $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
682 | - } else { |
|
683 | - if($checked) { |
|
684 | - $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
685 | - } |
|
686 | - } |
|
687 | - } |
|
688 | - if($modx->hasPermission('access_permissions')) { |
|
689 | - $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
690 | - } |
|
691 | - echo $chks; |
|
692 | - ?> |
|
671 | + } |
|
672 | + $chk = ''; |
|
673 | + $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name'); |
|
674 | + while($row = $modx->db->getRow($rs)) { |
|
675 | + $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
|
676 | + $checked = in_array($row['id'], $groupsarray); |
|
677 | + if($modx->hasPermission('access_permissions')) { |
|
678 | + if($checked) { |
|
679 | + $notPublic = true; |
|
680 | + } |
|
681 | + $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
682 | + } else { |
|
683 | + if($checked) { |
|
684 | + $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
685 | + } |
|
686 | + } |
|
687 | + } |
|
688 | + if($modx->hasPermission('access_permissions')) { |
|
689 | + $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
690 | + } |
|
691 | + echo $chks; |
|
692 | + ?> |
|
693 | 693 | <?php endif; ?> |
694 | 694 | </div> |
695 | 695 | </div> |
@@ -705,11 +705,11 @@ discard block |
||
705 | 705 | |
706 | 706 | <input type="submit" name="save" style="display:none;"> |
707 | 707 | <?php |
708 | - // invoke OnModFormRender event |
|
709 | - $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
|
710 | - if(is_array($evtOut)) { |
|
711 | - echo implode('', $evtOut); |
|
712 | - } |
|
713 | - ?> |
|
708 | + // invoke OnModFormRender event |
|
709 | + $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
|
710 | + if(is_array($evtOut)) { |
|
711 | + echo implode('', $evtOut); |
|
712 | + } |
|
713 | + ?> |
|
714 | 714 | </form> |
715 | 715 | <script type="text/javascript">setTimeout('showParameters();', 10);</script> |
@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | $logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">'; |
6 | 6 | $downloadLinks = array( |
7 | - 0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'), |
|
8 | - 1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | - 2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | - 3=>array('title'=>$_lang["extras"],'link'=>array( |
|
11 | - 'http://extras.evolution-cms.com/', |
|
12 | - 'https://github.com/extras-evolution' |
|
13 | - )), |
|
7 | + 0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'), |
|
8 | + 1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | + 2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | + 3=>array('title'=>$_lang["extras"],'link'=>array( |
|
11 | + 'http://extras.evolution-cms.com/', |
|
12 | + 'https://github.com/extras-evolution' |
|
13 | + )), |
|
14 | 14 | ); |
15 | 15 | |
16 | 16 | $translationLinks = array( |
17 | - 0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | - 1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
17 | + 0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | + 1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('settings')) { |
6 | - $modx->webAlertAndQuit($_lang['error_no_privileges']); |
|
6 | + $modx->webAlertAndQuit($_lang['error_no_privileges']); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // check to see the edit settings page isn't locked |
10 | 10 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=17 AND internalKey!='" . $modx->getLoginUserID() . "'"); |
11 | 11 | if($username = $modx->db->getValue($rs)) { |
12 | - $modx->webAlertAndQuit(sprintf($_lang['lock_settings_msg'], $username)); |
|
12 | + $modx->webAlertAndQuit(sprintf($_lang['lock_settings_msg'], $username)); |
|
13 | 13 | } |
14 | 14 | // end check for lock |
15 | 15 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | include_once(MODX_MANAGER_PATH . 'includes/default_config.php'); |
20 | 20 | $rs = $modx->db->select('setting_name, setting_value', '[+prefix+]system_settings'); |
21 | 21 | while($row = $modx->db->getRow($rs)) { |
22 | - $settings[$row['setting_name']] = $row['setting_value']; |
|
22 | + $settings[$row['setting_name']] = $row['setting_value']; |
|
23 | 23 | } |
24 | 24 | $settings['filemanager_path'] = preg_replace('@^' . preg_quote(MODX_BASE_PATH) . '@', '[(base_path)]', $settings['filemanager_path']); |
25 | 25 | $settings['rb_base_dir'] = preg_replace('@^' . preg_quote(MODX_BASE_PATH) . '@', '[(base_path)]', $settings['rb_base_dir']); |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | $lang_keys = array(); |
31 | 31 | $dir = dir('includes/lang'); |
32 | 32 | while($file = $dir->read()) { |
33 | - if(strpos($file, '.inc.php') > 0) { |
|
34 | - $endpos = strpos($file, '.'); |
|
35 | - $languagename = substr($file, 0, $endpos); |
|
36 | - $lang_keys[$languagename] = get_lang_keys($file); |
|
37 | - } |
|
33 | + if(strpos($file, '.inc.php') > 0) { |
|
34 | + $endpos = strpos($file, '.'); |
|
35 | + $languagename = substr($file, 0, $endpos); |
|
36 | + $lang_keys[$languagename] = get_lang_keys($file); |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | $dir->close(); |
40 | 40 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | </script> |
77 | 77 | |
78 | 78 | <?php |
79 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab1_site_settings.inc.php'); |
|
80 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab2_furl_settings.inc.php'); |
|
81 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab3_user_settings.inc.php'); |
|
82 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab4_manager_settings.inc.php'); |
|
83 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab5_security_settings.inc.php'); |
|
84 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab6_filemanager_settings.inc.php'); |
|
85 | - include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab7_filebrowser_settings.inc.php'); |
|
86 | - ?> |
|
79 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab1_site_settings.inc.php'); |
|
80 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab2_furl_settings.inc.php'); |
|
81 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab3_user_settings.inc.php'); |
|
82 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab4_manager_settings.inc.php'); |
|
83 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab5_security_settings.inc.php'); |
|
84 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab6_filemanager_settings.inc.php'); |
|
85 | + include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab7_filebrowser_settings.inc.php'); |
|
86 | + ?> |
|
87 | 87 | </div> |
88 | 88 | </div> |
89 | 89 | </form> |
@@ -130,5 +130,5 @@ discard block |
||
130 | 130 | </script> |
131 | 131 | <?php |
132 | 132 | if(is_numeric($_GET['tab'])) { |
133 | - echo '<script type="text/javascript">tpSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>'; |
|
133 | + echo '<script type="text/javascript">tpSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>'; |
|
134 | 134 | } |