@@ -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_web_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Set the item name for logger |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeWUsrFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeWUsrFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the user. |
25 | 25 | $modx->db->delete($modx->getFullTableName('web_users'), "id='{$id}'"); |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | |
33 | 33 | // invoke OnWebDeleteUser event |
34 | 34 | $modx->invokeEvent("OnWebDeleteUser", |
35 | - array( |
|
36 | - "userid" => $id, |
|
37 | - "username" => $username |
|
38 | - )); |
|
35 | + array( |
|
36 | + "userid" => $id, |
|
37 | + "username" => $username |
|
38 | + )); |
|
39 | 39 | |
40 | 40 | // invoke OnWUsrFormDelete event |
41 | 41 | $modx->invokeEvent("OnWUsrFormDelete", |
42 | - array( |
|
43 | - "id" => $id |
|
44 | - )); |
|
42 | + array( |
|
43 | + "id" => $id |
|
44 | + )); |
|
45 | 45 | |
46 | 46 | $header="Location: index.php?a=99"; |
47 | 47 | header($header); |
@@ -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"); |
|
48 | + webAlertAndQuit("Password typed is mismatched"); |
|
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!"); |
|
53 | + webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
|
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!"); |
|
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."); |
|
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!"); |
|
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."); |
|
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!"); |
|
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!"); |
|
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!"); |
|
91 | - } else { |
|
92 | - $newpassword = $specifiedpassword; |
|
93 | - } |
|
94 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
95 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
96 | - } elseif($passwordgenmethod == 'g') { |
|
97 | - $newpassword = generate_password(8); |
|
98 | - } else { |
|
99 | - webAlertAndQuit("No password generation method specified!"); |
|
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 | - saveUserSettings($internalKey); |
|
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'] = intval($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 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
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 | - ?> |
|
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!"); |
|
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!"); |
|
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!"); |
|
91 | + } else { |
|
92 | + $newpassword = $specifiedpassword; |
|
93 | + } |
|
94 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
95 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
96 | + } elseif($passwordgenmethod == 'g') { |
|
97 | + $newpassword = generate_password(8); |
|
98 | + } else { |
|
99 | + webAlertAndQuit("No password generation method specified!"); |
|
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 | + saveUserSettings($internalKey); |
|
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'] = intval($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 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
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!"); |
|
206 | - } else { |
|
207 | - $newpassword = $specifiedpassword; |
|
208 | - } |
|
209 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
210 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
211 | - } elseif($passwordgenmethod == 'g') { |
|
212 | - $newpassword = generate_password(8); |
|
213 | - } else { |
|
214 | - webAlertAndQuit("No password generation method specified!"); |
|
215 | - } |
|
216 | - } |
|
217 | - if($passwordnotifymethod == 'e') { |
|
218 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
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!"); |
|
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!"); |
|
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 | - saveUserSettings($id); |
|
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'] = intval($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 | - ?> |
|
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!"); |
|
206 | + } else { |
|
207 | + $newpassword = $specifiedpassword; |
|
208 | + } |
|
209 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
210 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
211 | + } elseif($passwordgenmethod == 'g') { |
|
212 | + $newpassword = generate_password(8); |
|
213 | + } else { |
|
214 | + webAlertAndQuit("No password generation method specified!"); |
|
215 | + } |
|
216 | + } |
|
217 | + if($passwordnotifymethod == 'e') { |
|
218 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
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!"); |
|
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!"); |
|
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 | + saveUserSettings($id); |
|
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'] = intval($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,151 +332,151 @@ 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."); |
|
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."); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | // Send an email to the user |
352 | 352 | function sendMailMessage($email, $uid, $pwd, $ufn) { |
353 | - global $modx, $_lang, $signupemail_message; |
|
354 | - global $emailsubject, $emailsender; |
|
355 | - global $site_name; |
|
356 | - $manager_url = MODX_MANAGER_URL; |
|
357 | - $message = sprintf($signupemail_message, $uid, $pwd); // use old method |
|
358 | - // replace placeholders |
|
359 | - $message = str_replace("[+uid+]", $uid, $message); |
|
360 | - $message = str_replace("[+pwd+]", $pwd, $message); |
|
361 | - $message = str_replace("[+ufn+]", $ufn, $message); |
|
362 | - $message = str_replace("[+sname+]", $site_name, $message); |
|
363 | - $message = str_replace("[+saddr+]", $emailsender, $message); |
|
364 | - $message = str_replace("[+semail+]", $emailsender, $message); |
|
365 | - $message = str_replace("[+surl+]", $manager_url, $message); |
|
366 | - |
|
367 | - $param = array(); |
|
368 | - $param['from'] = "{$site_name}<{$emailsender}>"; |
|
369 | - $param['subject'] = $emailsubject; |
|
370 | - $param['body'] = $message; |
|
371 | - $param['to'] = $email; |
|
372 | - $param['type'] = 'text'; |
|
373 | - $rs = $modx->sendmail($param); |
|
374 | - if(!$rs) { |
|
375 | - $modx->manager->saveFormValues(); |
|
376 | - $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
|
377 | - } |
|
353 | + global $modx, $_lang, $signupemail_message; |
|
354 | + global $emailsubject, $emailsender; |
|
355 | + global $site_name; |
|
356 | + $manager_url = MODX_MANAGER_URL; |
|
357 | + $message = sprintf($signupemail_message, $uid, $pwd); // use old method |
|
358 | + // replace placeholders |
|
359 | + $message = str_replace("[+uid+]", $uid, $message); |
|
360 | + $message = str_replace("[+pwd+]", $pwd, $message); |
|
361 | + $message = str_replace("[+ufn+]", $ufn, $message); |
|
362 | + $message = str_replace("[+sname+]", $site_name, $message); |
|
363 | + $message = str_replace("[+saddr+]", $emailsender, $message); |
|
364 | + $message = str_replace("[+semail+]", $emailsender, $message); |
|
365 | + $message = str_replace("[+surl+]", $manager_url, $message); |
|
366 | + |
|
367 | + $param = array(); |
|
368 | + $param['from'] = "{$site_name}<{$emailsender}>"; |
|
369 | + $param['subject'] = $emailsubject; |
|
370 | + $param['body'] = $message; |
|
371 | + $param['to'] = $email; |
|
372 | + $param['type'] = 'text'; |
|
373 | + $rs = $modx->sendmail($param); |
|
374 | + if(!$rs) { |
|
375 | + $modx->manager->saveFormValues(); |
|
376 | + $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
|
377 | + } |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | // Save User Settings |
381 | 381 | function saveUserSettings($id) { |
382 | - global $modx; |
|
383 | - $tbl_user_settings = $modx->getFullTableName('user_settings'); |
|
384 | - |
|
385 | - $ignore = array( |
|
386 | - 'id', |
|
387 | - 'oldusername', |
|
388 | - 'oldemail', |
|
389 | - 'newusername', |
|
390 | - 'fullname', |
|
391 | - 'newpassword', |
|
392 | - 'newpasswordcheck', |
|
393 | - 'passwordgenmethod', |
|
394 | - 'passwordnotifymethod', |
|
395 | - 'specifiedpassword', |
|
396 | - 'confirmpassword', |
|
397 | - 'email', |
|
398 | - 'phone', |
|
399 | - 'mobilephone', |
|
400 | - 'fax', |
|
401 | - 'dob', |
|
402 | - 'country', |
|
403 | - 'street', |
|
404 | - 'city', |
|
405 | - 'state', |
|
406 | - 'zip', |
|
407 | - 'gender', |
|
408 | - 'photo', |
|
409 | - 'comment', |
|
410 | - 'role', |
|
411 | - 'failedlogincount', |
|
412 | - 'blocked', |
|
413 | - 'blockeduntil', |
|
414 | - 'blockedafter', |
|
415 | - 'user_groups', |
|
416 | - 'mode', |
|
417 | - 'blockedmode', |
|
418 | - 'stay', |
|
419 | - 'save', |
|
420 | - 'theme_refresher' |
|
421 | - ); |
|
422 | - |
|
423 | - // determine which settings can be saved blank (based on 'default_{settingname}' POST checkbox values) |
|
424 | - $defaults = array( |
|
425 | - 'upload_images', |
|
426 | - 'upload_media', |
|
427 | - 'upload_flash', |
|
428 | - 'upload_files' |
|
429 | - ); |
|
430 | - |
|
431 | - // get user setting field names |
|
432 | - $settings = array(); |
|
433 | - foreach($_POST as $n => $v) { |
|
434 | - if(in_array($n, $ignore) || (!in_array($n, $defaults) && is_scalar($v) && trim($v) == '') || (!in_array($n, $defaults) && is_array($v) && empty($v))) { |
|
435 | - continue; |
|
436 | - } // ignore blacklist and empties |
|
437 | - $settings[$n] = $v; // this value should be saved |
|
438 | - } |
|
439 | - |
|
440 | - foreach($defaults as $k) { |
|
441 | - if(isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') { |
|
442 | - unset($settings[$k]); |
|
443 | - } |
|
444 | - unset($settings['default_' . $k]); |
|
445 | - } |
|
446 | - |
|
447 | - $modx->db->delete($tbl_user_settings, "user='{$id}'"); |
|
448 | - |
|
449 | - foreach($settings as $n => $vl) { |
|
450 | - if(is_array($vl)) { |
|
451 | - $vl = implode(",", $vl); |
|
452 | - } |
|
453 | - if($vl != '') { |
|
454 | - $f = array(); |
|
455 | - $f['user'] = $id; |
|
456 | - $f['setting_name'] = $n; |
|
457 | - $f['setting_value'] = $vl; |
|
458 | - $f = $modx->db->escape($f); |
|
459 | - $modx->db->insert($f, $tbl_user_settings); |
|
460 | - } |
|
461 | - } |
|
382 | + global $modx; |
|
383 | + $tbl_user_settings = $modx->getFullTableName('user_settings'); |
|
384 | + |
|
385 | + $ignore = array( |
|
386 | + 'id', |
|
387 | + 'oldusername', |
|
388 | + 'oldemail', |
|
389 | + 'newusername', |
|
390 | + 'fullname', |
|
391 | + 'newpassword', |
|
392 | + 'newpasswordcheck', |
|
393 | + 'passwordgenmethod', |
|
394 | + 'passwordnotifymethod', |
|
395 | + 'specifiedpassword', |
|
396 | + 'confirmpassword', |
|
397 | + 'email', |
|
398 | + 'phone', |
|
399 | + 'mobilephone', |
|
400 | + 'fax', |
|
401 | + 'dob', |
|
402 | + 'country', |
|
403 | + 'street', |
|
404 | + 'city', |
|
405 | + 'state', |
|
406 | + 'zip', |
|
407 | + 'gender', |
|
408 | + 'photo', |
|
409 | + 'comment', |
|
410 | + 'role', |
|
411 | + 'failedlogincount', |
|
412 | + 'blocked', |
|
413 | + 'blockeduntil', |
|
414 | + 'blockedafter', |
|
415 | + 'user_groups', |
|
416 | + 'mode', |
|
417 | + 'blockedmode', |
|
418 | + 'stay', |
|
419 | + 'save', |
|
420 | + 'theme_refresher' |
|
421 | + ); |
|
422 | + |
|
423 | + // determine which settings can be saved blank (based on 'default_{settingname}' POST checkbox values) |
|
424 | + $defaults = array( |
|
425 | + 'upload_images', |
|
426 | + 'upload_media', |
|
427 | + 'upload_flash', |
|
428 | + 'upload_files' |
|
429 | + ); |
|
430 | + |
|
431 | + // get user setting field names |
|
432 | + $settings = array(); |
|
433 | + foreach($_POST as $n => $v) { |
|
434 | + if(in_array($n, $ignore) || (!in_array($n, $defaults) && is_scalar($v) && trim($v) == '') || (!in_array($n, $defaults) && is_array($v) && empty($v))) { |
|
435 | + continue; |
|
436 | + } // ignore blacklist and empties |
|
437 | + $settings[$n] = $v; // this value should be saved |
|
438 | + } |
|
439 | + |
|
440 | + foreach($defaults as $k) { |
|
441 | + if(isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') { |
|
442 | + unset($settings[$k]); |
|
443 | + } |
|
444 | + unset($settings['default_' . $k]); |
|
445 | + } |
|
446 | + |
|
447 | + $modx->db->delete($tbl_user_settings, "user='{$id}'"); |
|
448 | + |
|
449 | + foreach($settings as $n => $vl) { |
|
450 | + if(is_array($vl)) { |
|
451 | + $vl = implode(",", $vl); |
|
452 | + } |
|
453 | + if($vl != '') { |
|
454 | + $f = array(); |
|
455 | + $f['user'] = $id; |
|
456 | + $f['setting_name'] = $n; |
|
457 | + $f['setting_value'] = $vl; |
|
458 | + $f = $modx->db->escape($f); |
|
459 | + $modx->db->insert($f, $tbl_user_settings); |
|
460 | + } |
|
461 | + } |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | // Web alert - sends an alert to web browser |
465 | 465 | function webAlertAndQuit($msg) { |
466 | - global $id, $modx; |
|
467 | - $mode = $_POST['mode']; |
|
468 | - $modx->manager->saveFormValues($mode); |
|
469 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '12' ? "&id={$id}" : '')); |
|
466 | + global $id, $modx; |
|
467 | + $mode = $_POST['mode']; |
|
468 | + $modx->manager->saveFormValues($mode); |
|
469 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '12' ? "&id={$id}" : '')); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | // Generate password |
473 | 473 | function generate_password($length = 10) { |
474 | - $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
|
475 | - $ps_len = strlen($allowable_characters); |
|
476 | - mt_srand((double) microtime() * 1000000); |
|
477 | - $pass = ""; |
|
478 | - for($i = 0; $i < $length; $i++) { |
|
479 | - $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
|
480 | - } |
|
481 | - return $pass; |
|
474 | + $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
|
475 | + $ps_len = strlen($allowable_characters); |
|
476 | + mt_srand((double) microtime() * 1000000); |
|
477 | + $pass = ""; |
|
478 | + for($i = 0; $i < $length; $i++) { |
|
479 | + $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
|
480 | + } |
|
481 | + return $pass; |
|
482 | 482 | } |
@@ -1,135 +1,135 @@ |
||
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_role')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | extract($_POST); |
10 | 10 | |
11 | 11 | if($name == '' || !isset ($name)) { |
12 | - $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}" . ($mode = 35 ? "&id={$id}" : "")); |
|
12 | + $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}" . ($mode = 35 ? "&id={$id}" : "")); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | // setup fields |
16 | 16 | $fields = array( |
17 | - 'name' => $name, |
|
18 | - 'description' => $description, |
|
19 | - 'frames' => $frames, |
|
20 | - 'home' => $home, |
|
21 | - 'view_document' => $view_document, |
|
22 | - 'new_document' => $new_document, |
|
23 | - 'save_document' => $save_document, |
|
24 | - 'publish_document' => $publish_document, |
|
25 | - 'delete_document' => $delete_document, |
|
26 | - 'empty_trash' => $empty_trash, |
|
27 | - 'action_ok' => $action_ok, |
|
28 | - 'logout' => $logout, |
|
29 | - 'help' => $help, |
|
30 | - 'messages' => $messages, |
|
31 | - 'new_user' => $new_user, |
|
32 | - 'edit_user' => $edit_user, |
|
33 | - 'logs' => $logs, |
|
34 | - 'edit_parser' => (isset ($edit_parser)) ? $edit_parser : '0', |
|
35 | - 'save_parser' => (isset ($save_parser)) ? $save_parser : '0', |
|
36 | - 'edit_template' => $edit_template, |
|
37 | - 'settings' => $settings, |
|
38 | - 'credits' => $credits, |
|
39 | - 'new_template' => $new_template, |
|
40 | - 'save_template' => $save_template, |
|
41 | - 'delete_template' => $delete_template, |
|
42 | - 'edit_snippet' => $edit_snippet, |
|
43 | - 'new_snippet' => $new_snippet, |
|
44 | - 'save_snippet' => $save_snippet, |
|
45 | - 'delete_snippet' => $delete_snippet, |
|
46 | - 'edit_chunk' => $edit_chunk, |
|
47 | - 'new_chunk' => $new_chunk, |
|
48 | - 'save_chunk' => $save_chunk, |
|
49 | - 'delete_chunk' => $delete_chunk, |
|
50 | - 'empty_cache' => $empty_cache, |
|
51 | - 'edit_document' => $edit_document, |
|
52 | - 'change_password' => $change_password, |
|
53 | - 'error_dialog' => $error_dialog, |
|
54 | - 'about' => $about, |
|
55 | - 'file_manager' => $file_manager, |
|
56 | - 'assets_files' => $assets_files, |
|
57 | - 'assets_images' => $assets_images, |
|
58 | - 'save_user' => $save_user, |
|
59 | - 'delete_user' => $delete_user, |
|
60 | - 'save_password' => $save_password, |
|
61 | - 'edit_role' => $edit_role, |
|
62 | - 'save_role' => $save_role, |
|
63 | - 'delete_role' => $delete_role, |
|
64 | - 'new_role' => $new_role, |
|
65 | - 'access_permissions' => $access_permissions, |
|
66 | - 'bk_manager' => $bk_manager, |
|
67 | - 'new_plugin' => $new_plugin, |
|
68 | - 'edit_plugin' => $edit_plugin, |
|
69 | - 'save_plugin' => $save_plugin, |
|
70 | - 'delete_plugin' => $delete_plugin, |
|
71 | - 'new_module' => $new_module, |
|
72 | - 'edit_module' => $edit_module, |
|
73 | - 'save_module' => $save_module, |
|
74 | - 'delete_module' => $delete_module, |
|
75 | - 'exec_module' => $exec_module, |
|
76 | - 'view_eventlog' => $view_eventlog, |
|
77 | - 'delete_eventlog' => $delete_eventlog, |
|
78 | - 'new_web_user' => $new_web_user, |
|
79 | - 'edit_web_user' => $edit_web_user, |
|
80 | - 'save_web_user' => $save_web_user, |
|
81 | - 'delete_web_user' => $delete_web_user, |
|
82 | - 'web_access_permissions' => $web_access_permissions, |
|
83 | - 'view_unpublished' => $view_unpublished, |
|
84 | - 'import_static' => $import_static, |
|
85 | - 'export_static' => $export_static, |
|
86 | - 'remove_locks' => $remove_locks, |
|
87 | - 'display_locks' => $display_locks, |
|
88 | - 'change_resourcetype' => $change_resourcetype, |
|
89 | - 'category_manager' => $category_manager |
|
17 | + 'name' => $name, |
|
18 | + 'description' => $description, |
|
19 | + 'frames' => $frames, |
|
20 | + 'home' => $home, |
|
21 | + 'view_document' => $view_document, |
|
22 | + 'new_document' => $new_document, |
|
23 | + 'save_document' => $save_document, |
|
24 | + 'publish_document' => $publish_document, |
|
25 | + 'delete_document' => $delete_document, |
|
26 | + 'empty_trash' => $empty_trash, |
|
27 | + 'action_ok' => $action_ok, |
|
28 | + 'logout' => $logout, |
|
29 | + 'help' => $help, |
|
30 | + 'messages' => $messages, |
|
31 | + 'new_user' => $new_user, |
|
32 | + 'edit_user' => $edit_user, |
|
33 | + 'logs' => $logs, |
|
34 | + 'edit_parser' => (isset ($edit_parser)) ? $edit_parser : '0', |
|
35 | + 'save_parser' => (isset ($save_parser)) ? $save_parser : '0', |
|
36 | + 'edit_template' => $edit_template, |
|
37 | + 'settings' => $settings, |
|
38 | + 'credits' => $credits, |
|
39 | + 'new_template' => $new_template, |
|
40 | + 'save_template' => $save_template, |
|
41 | + 'delete_template' => $delete_template, |
|
42 | + 'edit_snippet' => $edit_snippet, |
|
43 | + 'new_snippet' => $new_snippet, |
|
44 | + 'save_snippet' => $save_snippet, |
|
45 | + 'delete_snippet' => $delete_snippet, |
|
46 | + 'edit_chunk' => $edit_chunk, |
|
47 | + 'new_chunk' => $new_chunk, |
|
48 | + 'save_chunk' => $save_chunk, |
|
49 | + 'delete_chunk' => $delete_chunk, |
|
50 | + 'empty_cache' => $empty_cache, |
|
51 | + 'edit_document' => $edit_document, |
|
52 | + 'change_password' => $change_password, |
|
53 | + 'error_dialog' => $error_dialog, |
|
54 | + 'about' => $about, |
|
55 | + 'file_manager' => $file_manager, |
|
56 | + 'assets_files' => $assets_files, |
|
57 | + 'assets_images' => $assets_images, |
|
58 | + 'save_user' => $save_user, |
|
59 | + 'delete_user' => $delete_user, |
|
60 | + 'save_password' => $save_password, |
|
61 | + 'edit_role' => $edit_role, |
|
62 | + 'save_role' => $save_role, |
|
63 | + 'delete_role' => $delete_role, |
|
64 | + 'new_role' => $new_role, |
|
65 | + 'access_permissions' => $access_permissions, |
|
66 | + 'bk_manager' => $bk_manager, |
|
67 | + 'new_plugin' => $new_plugin, |
|
68 | + 'edit_plugin' => $edit_plugin, |
|
69 | + 'save_plugin' => $save_plugin, |
|
70 | + 'delete_plugin' => $delete_plugin, |
|
71 | + 'new_module' => $new_module, |
|
72 | + 'edit_module' => $edit_module, |
|
73 | + 'save_module' => $save_module, |
|
74 | + 'delete_module' => $delete_module, |
|
75 | + 'exec_module' => $exec_module, |
|
76 | + 'view_eventlog' => $view_eventlog, |
|
77 | + 'delete_eventlog' => $delete_eventlog, |
|
78 | + 'new_web_user' => $new_web_user, |
|
79 | + 'edit_web_user' => $edit_web_user, |
|
80 | + 'save_web_user' => $save_web_user, |
|
81 | + 'delete_web_user' => $delete_web_user, |
|
82 | + 'web_access_permissions' => $web_access_permissions, |
|
83 | + 'view_unpublished' => $view_unpublished, |
|
84 | + 'import_static' => $import_static, |
|
85 | + 'export_static' => $export_static, |
|
86 | + 'remove_locks' => $remove_locks, |
|
87 | + 'display_locks' => $display_locks, |
|
88 | + 'change_resourcetype' => $change_resourcetype, |
|
89 | + 'category_manager' => $category_manager |
|
90 | 90 | ); |
91 | 91 | |
92 | 92 | $fields = $modx->db->escape($fields); |
93 | 93 | |
94 | 94 | switch($_POST['mode']) { |
95 | - case '38' : |
|
96 | - $tbl = $modx->getFullTableName("user_roles"); |
|
95 | + case '38' : |
|
96 | + $tbl = $modx->getFullTableName("user_roles"); |
|
97 | 97 | |
98 | - // disallow duplicate names for role |
|
99 | - $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
|
100 | - if($modx->db->getValue($rs) > 0) { |
|
101 | - $modx->manager->saveFormValues(38); |
|
102 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
|
103 | - } |
|
98 | + // disallow duplicate names for role |
|
99 | + $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
|
100 | + if($modx->db->getValue($rs) > 0) { |
|
101 | + $modx->manager->saveFormValues(38); |
|
102 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
|
103 | + } |
|
104 | 104 | |
105 | - $modx->db->insert($fields, $tbl); |
|
105 | + $modx->db->insert($fields, $tbl); |
|
106 | 106 | |
107 | - // Set the item name for logger |
|
108 | - $_SESSION['itemname'] = $_POST['name']; |
|
107 | + // Set the item name for logger |
|
108 | + $_SESSION['itemname'] = $_POST['name']; |
|
109 | 109 | |
110 | - $header = "Location: index.php?a=86&r=2"; |
|
111 | - header($header); |
|
112 | - break; |
|
113 | - case '35' : |
|
114 | - $tbl = $modx->getFullTableName("user_roles"); |
|
110 | + $header = "Location: index.php?a=86&r=2"; |
|
111 | + header($header); |
|
112 | + break; |
|
113 | + case '35' : |
|
114 | + $tbl = $modx->getFullTableName("user_roles"); |
|
115 | 115 | |
116 | - // disallow duplicate names for role |
|
117 | - $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
|
118 | - if($modx->db->getValue($rs) > 0) { |
|
119 | - $modx->manager->saveFormValues(35); |
|
120 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
|
121 | - } |
|
116 | + // disallow duplicate names for role |
|
117 | + $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
|
118 | + if($modx->db->getValue($rs) > 0) { |
|
119 | + $modx->manager->saveFormValues(35); |
|
120 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
|
121 | + } |
|
122 | 122 | |
123 | - $modx->db->update($fields, $tbl, "id='{$id}'"); |
|
123 | + $modx->db->update($fields, $tbl, "id='{$id}'"); |
|
124 | 124 | |
125 | - // Set the item name for logger |
|
126 | - $_SESSION['itemname'] = $_POST['name']; |
|
125 | + // Set the item name for logger |
|
126 | + $_SESSION['itemname'] = $_POST['name']; |
|
127 | 127 | |
128 | - $header = "Location: index.php?a=86&r=2"; |
|
129 | - header($header); |
|
130 | - break; |
|
131 | - default : |
|
132 | - $modx->webAlertAndQuit("No operation set in request."); |
|
128 | + $header = "Location: index.php?a=86&r=2"; |
|
129 | + header($header); |
|
130 | + break; |
|
131 | + default : |
|
132 | + $modx->webAlertAndQuit("No operation set in request."); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | $modx->unlockElement(8, $id); |
@@ -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('new_snippet')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate Snippet |
21 | 21 | $newid = $modx->db->insert( |
22 | - array( |
|
23 | - 'name'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'snippet'=>'', |
|
26 | - 'properties'=>'', |
|
27 | - 'category'=>'', |
|
28 | - ), $modx->getFullTableName('site_snippets'), // Insert into |
|
29 | - "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'name'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'snippet'=>'', |
|
26 | + 'properties'=>'', |
|
27 | + 'category'=>'', |
|
28 | + ), $modx->getFullTableName('site_snippets'), // Insert into |
|
29 | + "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from |
|
30 | 30 | |
31 | 31 | // Set the item name for logger |
32 | 32 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_snippets'), "id='{$newid}'")); |
@@ -4,8 +4,8 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | if(!$modx->hasPermission('delete_plugin')) { |
7 | - $e->setError(3); |
|
8 | - $e->dumpError(); |
|
7 | + $e->setError(3); |
|
8 | + $e->dumpError(); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | $tbl_site_plugins = $modx->getFullTablename('site_plugins'); |
@@ -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('save_document')||!$modx->hasPermission('publish_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'])? intval($_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 ********/ |
@@ -33,20 +33,20 @@ discard block |
||
33 | 33 | $udperms->role = $_SESSION['mgrRole']; |
34 | 34 | |
35 | 35 | if(!$udperms->checkPermissions()) { |
36 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
36 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // update the document |
40 | 40 | $modx->db->update( |
41 | - array( |
|
42 | - 'published' => 0, |
|
43 | - 'pub_date' => 0, |
|
44 | - 'unpub_date' => 0, |
|
45 | - 'editedby' => $modx->getLoginUserID(), |
|
46 | - 'editedon' => time(), |
|
47 | - 'publishedby' => 0, |
|
48 | - 'publishedon' => 0, |
|
49 | - ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
41 | + array( |
|
42 | + 'published' => 0, |
|
43 | + 'pub_date' => 0, |
|
44 | + 'unpub_date' => 0, |
|
45 | + 'editedby' => $modx->getLoginUserID(), |
|
46 | + 'editedon' => time(), |
|
47 | + 'publishedby' => 0, |
|
48 | + 'publishedon' => 0, |
|
49 | + ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
50 | 50 | |
51 | 51 | // invoke OnDocUnPublished event |
52 | 52 | $modx->invokeEvent("OnDocUnPublished",array("docid"=>$id)); |
@@ -1,22 +1,22 @@ 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('delete_template')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
10 | 10 | if($id == 0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // delete the template, but first check it doesn't have any documents using it |
15 | 15 | $rs = $modx->db->select('id, pagetitle,introtext', $modx->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->db->getRecordCount($rs); |
17 | 17 | if($limit > 0) { |
18 | - include "header.inc.php"; |
|
19 | - ?> |
|
18 | + include "header.inc.php"; |
|
19 | + ?> |
|
20 | 20 | |
21 | 21 | <h1><?php echo $_lang['manage_templates']; ?></h1> |
22 | 22 | |
@@ -28,20 +28,20 @@ discard block |
||
28 | 28 | <p>Documents using this template:</p> |
29 | 29 | <ul> |
30 | 30 | <?php |
31 | - while($row = $modx->db->getRow($rs)) { |
|
32 | - echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
33 | - } |
|
34 | - ?> |
|
31 | + while($row = $modx->db->getRow($rs)) { |
|
32 | + echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
33 | + } |
|
34 | + ?> |
|
35 | 35 | </ul> |
36 | 36 | </div> |
37 | 37 | </div> |
38 | 38 | <?php |
39 | - include_once "footer.inc.php"; |
|
40 | - exit; |
|
39 | + include_once "footer.inc.php"; |
|
40 | + exit; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if($id == $default_template) { |
44 | - $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
|
44 | + $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set the item name for logger |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | |
51 | 51 | // invoke OnBeforeTempFormDelete event |
52 | 52 | $modx->invokeEvent("OnBeforeTempFormDelete", array( |
53 | - "id" => $id |
|
54 | - )); |
|
53 | + "id" => $id |
|
54 | + )); |
|
55 | 55 | |
56 | 56 | // delete the document. |
57 | 57 | $modx->db->delete($modx->getFullTableName('site_templates'), "id='{$id}'"); |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | // invoke OnTempFormDelete event |
62 | 62 | $modx->invokeEvent("OnTempFormDelete", array( |
63 | - "id" => $id |
|
64 | - )); |
|
63 | + "id" => $id |
|
64 | + )); |
|
65 | 65 | |
66 | 66 | // empty cache |
67 | 67 | $modx->clearCache('full'); |
@@ -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_snippet')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Set the item name for logger |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeSnipFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeSnipFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the snippet. |
25 | 25 | $modx->db->delete($modx->getFullTableName('site_snippets'), "id='{$id}'"); |
26 | 26 | |
27 | 27 | // invoke OnSnipFormDelete event |
28 | 28 | $modx->invokeEvent("OnSnipFormDelete", |
29 | - array( |
|
30 | - "id" => $id |
|
31 | - )); |
|
29 | + array( |
|
30 | + "id" => $id |
|
31 | + )); |
|
32 | 32 | |
33 | 33 | // empty cache |
34 | 34 | $modx->clearCache('full'); |
@@ -3,22 +3,22 @@ |
||
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_role')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | if($id==1){ |
15 | - $modx->webAlertAndQuit("The role you are trying to delete is the admin role. This role cannot be deleted!"); |
|
15 | + $modx->webAlertAndQuit("The role you are trying to delete is the admin role. This role cannot be deleted!"); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('user_attributes'), "role='{$id}'"); |
19 | 19 | $count=$modx->db->getValue($rs); |
20 | 20 | if($count>0){ |
21 | - $modx->webAlertAndQuit("There are users with this role. It can't be deleted."); |
|
21 | + $modx->webAlertAndQuit("There are users with this role. It can't be deleted."); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | // Set the item name for logger |