@@ -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 | } |
@@ -60,110 +60,110 @@ discard block |
||
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 |
|
111 | - saveWebUserSettings($internalKey); |
|
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! |
|
130 | - |
|
131 | - // invoke OnWebSaveUser event |
|
132 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
133 | - "mode" => "new", |
|
134 | - "userid" => $internalKey, |
|
135 | - "username" => $newusername, |
|
136 | - "userpassword" => $newpassword, |
|
137 | - "useremail" => $email, |
|
138 | - "userfullname" => $fullname |
|
139 | - )); |
|
140 | - |
|
141 | - // invoke OnWUsrFormSave event |
|
142 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
143 | - "mode" => "new", |
|
144 | - "id" => $internalKey |
|
145 | - )); |
|
146 | - |
|
147 | - if($passwordnotifymethod == 'e') { |
|
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 | - ?> |
|
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 | + saveWebUserSettings($internalKey); |
|
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! |
|
130 | + |
|
131 | + // invoke OnWebSaveUser event |
|
132 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
133 | + "mode" => "new", |
|
134 | + "userid" => $internalKey, |
|
135 | + "username" => $newusername, |
|
136 | + "userpassword" => $newpassword, |
|
137 | + "useremail" => $email, |
|
138 | + "userfullname" => $fullname |
|
139 | + )); |
|
140 | + |
|
141 | + // invoke OnWUsrFormSave event |
|
142 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
143 | + "mode" => "new", |
|
144 | + "id" => $internalKey |
|
145 | + )); |
|
146 | + |
|
147 | + if($passwordnotifymethod == 'e') { |
|
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 | + ?> |
|
167 | 167 | |
168 | 168 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
169 | 169 | |
@@ -185,124 +185,124 @@ 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') { |
|
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 |
|
246 | - saveWebUserSettings($id); |
|
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 | - /*******************************************************************************/ |
|
268 | - |
|
269 | - // invoke OnWebSaveUser event |
|
270 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
271 | - "mode" => "upd", |
|
272 | - "userid" => $id, |
|
273 | - "username" => $newusername, |
|
274 | - "userpassword" => $newpassword, |
|
275 | - "useremail" => $email, |
|
276 | - "userfullname" => $fullname, |
|
277 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
278 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
279 | - )); |
|
280 | - |
|
281 | - // invoke OnWebChangePassword event |
|
282 | - if($genpassword == 1) { |
|
283 | - $modx->invokeEvent("OnWebChangePassword", array( |
|
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 | + 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 |
|
246 | + saveWebUserSettings($id); |
|
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 | + /*******************************************************************************/ |
|
268 | + |
|
269 | + // invoke OnWebSaveUser event |
|
270 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
271 | + "mode" => "upd", |
|
284 | 272 | "userid" => $id, |
285 | 273 | "username" => $newusername, |
286 | - "userpassword" => $newpassword |
|
274 | + "userpassword" => $newpassword, |
|
275 | + "useremail" => $email, |
|
276 | + "userfullname" => $fullname, |
|
277 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
278 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
287 | 279 | )); |
288 | - } |
|
289 | 280 | |
290 | - // invoke OnWUsrFormSave event |
|
291 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
292 | - "mode" => "upd", |
|
293 | - "id" => $id |
|
294 | - )); |
|
281 | + // invoke OnWebChangePassword event |
|
282 | + if($genpassword == 1) { |
|
283 | + $modx->invokeEvent("OnWebChangePassword", array( |
|
284 | + "userid" => $id, |
|
285 | + "username" => $newusername, |
|
286 | + "userpassword" => $newpassword |
|
287 | + )); |
|
288 | + } |
|
289 | + |
|
290 | + // invoke OnWUsrFormSave event |
|
291 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
292 | + "mode" => "upd", |
|
293 | + "id" => $id |
|
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,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('save_web_user')) { |
|
5 | +if (!$modx->hasPermission('save_web_user')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | $tbl_web_groups = $modx->getFullTableName('web_groups'); |
12 | 12 | |
13 | 13 | $input = $_POST; |
14 | -foreach($input as $k => $v) { |
|
15 | - if($k !== 'comment') { |
|
14 | +foreach ($input as $k => $v) { |
|
15 | + if ($k !== 'comment') { |
|
16 | 16 | $v = $modx->htmlspecialchars($v, ENT_NOQUOTES); |
17 | 17 | } |
18 | 18 | $input[$k] = $v; |
19 | 19 | } |
20 | 20 | |
21 | -$id = (int)$input['id']; |
|
21 | +$id = (int) $input['id']; |
|
22 | 22 | $oldusername = $input['oldusername']; |
23 | 23 | $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User"; |
24 | 24 | $esc_newusername = $modx->db->escape($newusername); |
@@ -50,21 +50,21 @@ discard block |
||
50 | 50 | $user_groups = $input['user_groups']; |
51 | 51 | |
52 | 52 | // verify password |
53 | -if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
53 | +if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
54 | 54 | webAlertAndQuit("Password typed is mismatched", 88); |
55 | 55 | } |
56 | 56 | |
57 | 57 | // verify email |
58 | -if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
58 | +if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
59 | 59 | webAlertAndQuit("E-mail address doesn't seem to be valid!", 88); |
60 | 60 | } |
61 | 61 | |
62 | -switch($input['mode']) { |
|
62 | +switch ($input['mode']) { |
|
63 | 63 | case '87' : // new user |
64 | 64 | // check if this user name already exist |
65 | 65 | $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
66 | 66 | $limit = $modx->db->getValue($rs); |
67 | - if($limit > 0) { |
|
67 | + if ($limit > 0) { |
|
68 | 68 | webAlertAndQuit("User name is already in use!", 88); |
69 | 69 | } |
70 | 70 | |
@@ -72,21 +72,21 @@ discard block |
||
72 | 72 | if ($modx->config['allow_multiple_emails'] != 1) { |
73 | 73 | $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
74 | 74 | $limit = $modx->db->getValue($rs); |
75 | - if($limit > 0) { |
|
75 | + if ($limit > 0) { |
|
76 | 76 | webAlertAndQuit("Email is already in use!", 88); |
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
80 | 80 | // generate a new password for this user |
81 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | - if(strlen($specifiedpassword) < 6) { |
|
81 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | + if (strlen($specifiedpassword) < 6) { |
|
83 | 83 | webAlertAndQuit("Password is too short!", 88); |
84 | 84 | } else { |
85 | 85 | $newpassword = $specifiedpassword; |
86 | 86 | } |
87 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
87 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
88 | 88 | webAlertAndQuit("You didn't specify a password for this user!", 88); |
89 | - } elseif($passwordgenmethod == 'g') { |
|
89 | + } elseif ($passwordgenmethod == 'g') { |
|
90 | 90 | $newpassword = generate_password(8); |
91 | 91 | } else { |
92 | 92 | webAlertAndQuit("No password generation method specified!", 88); |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | /*******************************************************************************/ |
117 | 117 | // put the user in the user_groups he/ she should be in |
118 | 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++) { |
|
119 | + if ($use_udperms == 1) { |
|
120 | + if (!empty($user_groups)) { |
|
121 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
122 | 122 | $f = array(); |
123 | - $f['webgroup'] = (int)$user_groups[$i]; |
|
123 | + $f['webgroup'] = (int) $user_groups[$i]; |
|
124 | 124 | $f['webuser'] = $internalKey; |
125 | 125 | $modx->db->insert($f, $tbl_web_groups); |
126 | 126 | } |
@@ -144,20 +144,20 @@ 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'] != '') { |
|
149 | + if ($input['stay'] != '') { |
|
150 | 150 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
151 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
152 | 152 | header($header); |
153 | 153 | } else { |
154 | 154 | $header = "Location: index.php?a=99&r=2"; |
155 | 155 | header($header); |
156 | 156 | } |
157 | 157 | } else { |
158 | - if($input['stay'] != '') { |
|
158 | + if ($input['stay'] != '') { |
|
159 | 159 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
160 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
161 | 161 | } else { |
162 | 162 | $stayUrl = "index.php?a=99&r=2"; |
163 | 163 | } |
@@ -190,29 +190,29 @@ discard block |
||
190 | 190 | break; |
191 | 191 | case '88' : // edit user |
192 | 192 | // generate a new password for this user |
193 | - if($genpassword == 1) { |
|
194 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | - if(strlen($specifiedpassword) < 6) { |
|
193 | + if ($genpassword == 1) { |
|
194 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | + if (strlen($specifiedpassword) < 6) { |
|
196 | 196 | webAlertAndQuit("Password is too short!", 88); |
197 | 197 | } else { |
198 | 198 | $newpassword = $specifiedpassword; |
199 | 199 | } |
200 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
200 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | 201 | webAlertAndQuit("You didn't specify a password for this user!", 88); |
202 | - } elseif($passwordgenmethod == 'g') { |
|
202 | + } elseif ($passwordgenmethod == 'g') { |
|
203 | 203 | $newpassword = generate_password(8); |
204 | 204 | } else { |
205 | 205 | webAlertAndQuit("No password generation method specified!", 88); |
206 | 206 | } |
207 | 207 | } |
208 | - if($passwordnotifymethod == 'e') { |
|
208 | + if ($passwordnotifymethod == 'e') { |
|
209 | 209 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
210 | 210 | } |
211 | 211 | |
212 | 212 | // check if the username already exist |
213 | 213 | $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
214 | 214 | $limit = $modx->db->getValue($rs); |
215 | - if($limit > 0) { |
|
215 | + if ($limit > 0) { |
|
216 | 216 | webAlertAndQuit("User name is already in use!", 88); |
217 | 217 | } |
218 | 218 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | if ($modx->config['allow_multiple_emails'] != 1) { |
221 | 221 | $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
222 | 222 | $limit = $modx->db->getValue($rs); |
223 | - if($limit > 0) { |
|
223 | + if ($limit > 0) { |
|
224 | 224 | webAlertAndQuit("Email is already in use!", 88); |
225 | 225 | } |
226 | 226 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | // update user name and password |
235 | 235 | $field = array(); |
236 | 236 | $field['username'] = $esc_newusername; |
237 | - if($genpassword == 1) { |
|
237 | + if ($genpassword == 1) { |
|
238 | 238 | $field['password'] = md5($newpassword); |
239 | 239 | } |
240 | 240 | $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
@@ -251,13 +251,13 @@ discard block |
||
251 | 251 | /*******************************************************************************/ |
252 | 252 | // put the user in the user_groups he/ she should be in |
253 | 253 | // first, check that up_perms are switched on! |
254 | - if($use_udperms == 1) { |
|
254 | + if ($use_udperms == 1) { |
|
255 | 255 | // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
256 | 256 | $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
257 | - if(!empty($user_groups)) { |
|
258 | - for($i = 0; $i < count($user_groups); $i++) { |
|
257 | + if (!empty($user_groups)) { |
|
258 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
259 | 259 | $field = array(); |
260 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
260 | + $field['webgroup'] = (int) $user_groups[$i]; |
|
261 | 261 | $field['webuser'] = $id; |
262 | 262 | $modx->db->insert($field, $tbl_web_groups); |
263 | 263 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | )); |
280 | 280 | |
281 | 281 | // invoke OnWebChangePassword event |
282 | - if($genpassword == 1) { |
|
282 | + if ($genpassword == 1) { |
|
283 | 283 | $modx->invokeEvent("OnWebChangePassword", array( |
284 | 284 | "userid" => $id, |
285 | 285 | "username" => $newusername, |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | "id" => $id |
294 | 294 | )); |
295 | 295 | |
296 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | - if($input['stay'] != '') { |
|
296 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | + if ($input['stay'] != '') { |
|
298 | 298 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
299 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
299 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
300 | 300 | } else { |
301 | 301 | $stayUrl = "index.php?a=99&r=2"; |
302 | 302 | } |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | |
325 | 325 | include_once "footer.inc.php"; |
326 | 326 | } else { |
327 | - if($input['stay'] != '') { |
|
327 | + if ($input['stay'] != '') { |
|
328 | 328 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
329 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
329 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
330 | 330 | header($header); |
331 | 331 | } else { |
332 | 332 | $header = "Location: index.php?a=99&r=2"; |
@@ -1,25 +1,25 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('delete_document')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if ($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | /*******ищем родителя чтобы к нему вернуться********/ |
15 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
15 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
17 | 17 | |
18 | 18 | /************ а заодно и путь возврата (сам путь внизу файла) **********/ |
19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
22 | -$add_path=$sd.$sb.$pg; |
|
19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
22 | +$add_path = $sd.$sb.$pg; |
|
23 | 23 | |
24 | 24 | /*****************************/ |
25 | 25 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | "children"=>$children |
46 | 46 | )); |
47 | 47 | |
48 | -if (count($children)>0) { |
|
48 | +if (count($children) > 0) { |
|
49 | 49 | $modx->db->update( |
50 | 50 | array( |
51 | 51 | 'deleted' => 1, |
@@ -54,19 +54,19 @@ discard block |
||
54 | 54 | ), $modx->getFullTableName('site_content'), "id IN (".implode(", ", $children).")"); |
55 | 55 | } |
56 | 56 | |
57 | -if ($site_start==$id) { |
|
57 | +if ($site_start == $id) { |
|
58 | 58 | $modx->webAlertAndQuit("Document is 'Site start' and cannot be deleted!"); |
59 | 59 | } |
60 | 60 | |
61 | -if ($site_unavailable_page==$id) { |
|
61 | +if ($site_unavailable_page == $id) { |
|
62 | 62 | $modx->webAlertAndQuit("Document is used as the 'Site unavailable page' and cannot be deleted!"); |
63 | 63 | } |
64 | 64 | |
65 | -if ($error_page==$id) { |
|
65 | +if ($error_page == $id) { |
|
66 | 66 | $modx->webAlertAndQuit("Document is used as the 'Site error page' and cannot be deleted!"); |
67 | 67 | } |
68 | 68 | |
69 | -if ($unauthorized_page==$id) { |
|
69 | +if ($unauthorized_page == $id) { |
|
70 | 70 | $modx->webAlertAndQuit("Document is used as the 'Site unauthorized page' and cannot be deleted!"); |
71 | 71 | } |
72 | 72 | |
@@ -92,5 +92,5 @@ discard block |
||
92 | 92 | $modx->clearCache('full'); |
93 | 93 | |
94 | 94 | // finished emptying cache - redirect |
95 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
95 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
96 | 96 | header($header); |
@@ -59,123 +59,123 @@ |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | switch ($_POST['mode']) { |
62 | - case '107': |
|
63 | - // invoke OnBeforeModFormSave event |
|
64 | - $modx->invokeEvent("OnBeforeModFormSave", array( |
|
65 | - "mode" => "new", |
|
66 | - "id" => $id |
|
67 | - )); |
|
68 | - |
|
69 | - // disallow duplicate names for new modules |
|
70 | - $rs = $modx->db->select('count(id)', $modx->getFullTableName('site_modules'), "name='{$name}'"); |
|
71 | - $count = $modx->db->getValue($rs); |
|
72 | - if ($count > 0) { |
|
73 | - $modx->manager->saveFormValues(107); |
|
74 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=107"); |
|
75 | - } |
|
76 | - |
|
77 | - // save the new module |
|
78 | - $newid = $modx->db->insert(array( |
|
79 | - 'name' => $name, |
|
80 | - 'description' => $description, |
|
81 | - 'disabled' => $disabled, |
|
82 | - 'wrap' => $wrap, |
|
83 | - 'locked' => $locked, |
|
84 | - 'icon' => $icon, |
|
85 | - 'resourcefile' => $resourcefile, |
|
86 | - 'enable_resource' => $enable_resource, |
|
87 | - 'category' => $categoryid, |
|
88 | - 'enable_sharedparams' => $enable_sharedparams, |
|
89 | - 'guid' => $guid, |
|
90 | - 'modulecode' => $modulecode, |
|
91 | - 'properties' => $properties, |
|
92 | - 'createdon' => $currentdate, |
|
93 | - 'editedon' => $currentdate |
|
94 | - ), $modx->getFullTableName('site_modules')); |
|
95 | - |
|
96 | - // save user group access permissions |
|
97 | - saveUserGroupAccessPermissons(); |
|
98 | - |
|
99 | - // invoke OnModFormSave event |
|
100 | - $modx->invokeEvent("OnModFormSave", array( |
|
101 | - "mode" => "new", |
|
102 | - "id" => $newid |
|
103 | - )); |
|
104 | - |
|
105 | - // Set the item name for logger |
|
106 | - $_SESSION['itemname'] = $name; |
|
107 | - |
|
108 | - // empty cache |
|
109 | - $modx->clearCache('full'); |
|
110 | - |
|
111 | - // finished emptying cache - redirect |
|
112 | - if ($_POST['stay'] != '') { |
|
113 | - $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
|
114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
115 | - header($header); |
|
116 | - } else { |
|
117 | - $header = "Location: index.php?a=106&r=2"; |
|
118 | - header($header); |
|
119 | - } |
|
120 | - break; |
|
121 | - case '108': |
|
122 | - // invoke OnBeforeModFormSave event |
|
123 | - $modx->invokeEvent("OnBeforeModFormSave", array( |
|
124 | - "mode" => "upd", |
|
125 | - "id" => $id |
|
126 | - )); |
|
127 | - |
|
128 | - // disallow duplicate names for new modules |
|
129 | - $rs = $modx->db->select('count(id)', $modx->getFullTableName('site_modules'), "name='{$name}' AND id!='{$id}'"); |
|
130 | - if ($modx->db->getValue($rs) > 0) { |
|
131 | - $modx->manager->saveFormValues(108); |
|
132 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=108&id={$id}"); |
|
133 | - } |
|
134 | - |
|
135 | - // save the edited module |
|
136 | - $modx->db->update(array( |
|
137 | - 'name' => $name, |
|
138 | - 'description' => $description, |
|
139 | - 'icon' => $icon, |
|
140 | - 'enable_resource' => $enable_resource, |
|
141 | - 'resourcefile' => $resourcefile, |
|
142 | - 'disabled' => $disabled, |
|
143 | - 'wrap' => $wrap, |
|
144 | - 'locked' => $locked, |
|
145 | - 'category' => $categoryid, |
|
146 | - 'enable_sharedparams' => $enable_sharedparams, |
|
147 | - 'guid' => $guid, |
|
148 | - 'modulecode' => $modulecode, |
|
149 | - 'properties' => $properties, |
|
150 | - 'editedon' => $currentdate |
|
151 | - ), $modx->getFullTableName('site_modules'), "id='{$id}'"); |
|
152 | - |
|
153 | - // save user group access permissions |
|
154 | - saveUserGroupAccessPermissons(); |
|
155 | - |
|
156 | - // invoke OnModFormSave event |
|
157 | - $modx->invokeEvent("OnModFormSave", array( |
|
158 | - "mode" => "upd", |
|
159 | - "id" => $id |
|
160 | - )); |
|
161 | - |
|
162 | - // Set the item name for logger |
|
163 | - $_SESSION['itemname'] = $name; |
|
164 | - |
|
165 | - // empty cache |
|
166 | - $modx->clearCache('full'); |
|
167 | - |
|
168 | - // finished emptying cache - redirect |
|
169 | - if ($_POST['stay'] != '') { |
|
170 | - $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
|
171 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
172 | - header($header); |
|
173 | - } else { |
|
174 | - $modx->unlockElement(6, $id); |
|
175 | - $header = "Location: index.php?a=106&r=2"; |
|
176 | - header($header); |
|
177 | - } |
|
178 | - break; |
|
179 | - default: |
|
180 | - $modx->webAlertAndQuit("No operation set in request."); |
|
62 | + case '107': |
|
63 | + // invoke OnBeforeModFormSave event |
|
64 | + $modx->invokeEvent("OnBeforeModFormSave", array( |
|
65 | + "mode" => "new", |
|
66 | + "id" => $id |
|
67 | + )); |
|
68 | + |
|
69 | + // disallow duplicate names for new modules |
|
70 | + $rs = $modx->db->select('count(id)', $modx->getFullTableName('site_modules'), "name='{$name}'"); |
|
71 | + $count = $modx->db->getValue($rs); |
|
72 | + if ($count > 0) { |
|
73 | + $modx->manager->saveFormValues(107); |
|
74 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=107"); |
|
75 | + } |
|
76 | + |
|
77 | + // save the new module |
|
78 | + $newid = $modx->db->insert(array( |
|
79 | + 'name' => $name, |
|
80 | + 'description' => $description, |
|
81 | + 'disabled' => $disabled, |
|
82 | + 'wrap' => $wrap, |
|
83 | + 'locked' => $locked, |
|
84 | + 'icon' => $icon, |
|
85 | + 'resourcefile' => $resourcefile, |
|
86 | + 'enable_resource' => $enable_resource, |
|
87 | + 'category' => $categoryid, |
|
88 | + 'enable_sharedparams' => $enable_sharedparams, |
|
89 | + 'guid' => $guid, |
|
90 | + 'modulecode' => $modulecode, |
|
91 | + 'properties' => $properties, |
|
92 | + 'createdon' => $currentdate, |
|
93 | + 'editedon' => $currentdate |
|
94 | + ), $modx->getFullTableName('site_modules')); |
|
95 | + |
|
96 | + // save user group access permissions |
|
97 | + saveUserGroupAccessPermissons(); |
|
98 | + |
|
99 | + // invoke OnModFormSave event |
|
100 | + $modx->invokeEvent("OnModFormSave", array( |
|
101 | + "mode" => "new", |
|
102 | + "id" => $newid |
|
103 | + )); |
|
104 | + |
|
105 | + // Set the item name for logger |
|
106 | + $_SESSION['itemname'] = $name; |
|
107 | + |
|
108 | + // empty cache |
|
109 | + $modx->clearCache('full'); |
|
110 | + |
|
111 | + // finished emptying cache - redirect |
|
112 | + if ($_POST['stay'] != '') { |
|
113 | + $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
|
114 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
115 | + header($header); |
|
116 | + } else { |
|
117 | + $header = "Location: index.php?a=106&r=2"; |
|
118 | + header($header); |
|
119 | + } |
|
120 | + break; |
|
121 | + case '108': |
|
122 | + // invoke OnBeforeModFormSave event |
|
123 | + $modx->invokeEvent("OnBeforeModFormSave", array( |
|
124 | + "mode" => "upd", |
|
125 | + "id" => $id |
|
126 | + )); |
|
127 | + |
|
128 | + // disallow duplicate names for new modules |
|
129 | + $rs = $modx->db->select('count(id)', $modx->getFullTableName('site_modules'), "name='{$name}' AND id!='{$id}'"); |
|
130 | + if ($modx->db->getValue($rs) > 0) { |
|
131 | + $modx->manager->saveFormValues(108); |
|
132 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=108&id={$id}"); |
|
133 | + } |
|
134 | + |
|
135 | + // save the edited module |
|
136 | + $modx->db->update(array( |
|
137 | + 'name' => $name, |
|
138 | + 'description' => $description, |
|
139 | + 'icon' => $icon, |
|
140 | + 'enable_resource' => $enable_resource, |
|
141 | + 'resourcefile' => $resourcefile, |
|
142 | + 'disabled' => $disabled, |
|
143 | + 'wrap' => $wrap, |
|
144 | + 'locked' => $locked, |
|
145 | + 'category' => $categoryid, |
|
146 | + 'enable_sharedparams' => $enable_sharedparams, |
|
147 | + 'guid' => $guid, |
|
148 | + 'modulecode' => $modulecode, |
|
149 | + 'properties' => $properties, |
|
150 | + 'editedon' => $currentdate |
|
151 | + ), $modx->getFullTableName('site_modules'), "id='{$id}'"); |
|
152 | + |
|
153 | + // save user group access permissions |
|
154 | + saveUserGroupAccessPermissons(); |
|
155 | + |
|
156 | + // invoke OnModFormSave event |
|
157 | + $modx->invokeEvent("OnModFormSave", array( |
|
158 | + "mode" => "upd", |
|
159 | + "id" => $id |
|
160 | + )); |
|
161 | + |
|
162 | + // Set the item name for logger |
|
163 | + $_SESSION['itemname'] = $name; |
|
164 | + |
|
165 | + // empty cache |
|
166 | + $modx->clearCache('full'); |
|
167 | + |
|
168 | + // finished emptying cache - redirect |
|
169 | + if ($_POST['stay'] != '') { |
|
170 | + $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
|
171 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
172 | + header($header); |
|
173 | + } else { |
|
174 | + $modx->unlockElement(6, $id); |
|
175 | + $header = "Location: index.php?a=106&r=2"; |
|
176 | + header($header); |
|
177 | + } |
|
178 | + break; |
|
179 | + default: |
|
180 | + $modx->webAlertAndQuit("No operation set in request."); |
|
181 | 181 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | exit(); |
4 | 4 | } |
5 | 5 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | <?php |
42 | 42 | $rs = $modx->db->select('*', $modx->getFullTableName('site_templates')); |
43 | 43 | $option[] = '<option value="">No selected</option>'; |
44 | - $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int)$_REQUEST['templateid'] : ''; |
|
44 | + $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int) $_REQUEST['templateid'] : ''; |
|
45 | 45 | $selected = $templateid === 0 ? ' selected="selected"' : ''; |
46 | - $option[] = '<option value="0"' . $selected . '>(blank)</option>'; |
|
46 | + $option[] = '<option value="0"'.$selected.'>(blank)</option>'; |
|
47 | 47 | while ($row = $modx->db->getRow($rs)) { |
48 | 48 | $templatename = htmlspecialchars($row['templatename'], ENT_QUOTES, $modx->config['modx_charset']); |
49 | 49 | $selected = $row['id'] == $templateid ? ' selected="selected"' : ''; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $searchfields = htmlentities(trim($_POST['searchfields']), ENT_QUOTES, $modx_manager_charset); |
87 | 87 | $searchlongtitle = $modx->db->escape(trim($_REQUEST['searchfields'])); |
88 | 88 | $search_alias = $modx->db->escape(trim($_REQUEST['searchfields'])); |
89 | - $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int)$_REQUEST['templateid'] : ''; |
|
89 | + $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int) $_REQUEST['templateid'] : ''; |
|
90 | 90 | $searchcontent = $modx->db->escape($_REQUEST['content']); |
91 | 91 | |
92 | 92 | $fields = 'DISTINCT sc.id, contenttype, pagetitle, longtitle, description, introtext, menutitle, deleted, published, isfolder, type'; |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | $friendly_url_suffix = $modx->config['friendly_url_suffix']; |
101 | 101 | $base_url = $modx->config['base_url']; |
102 | 102 | $site_url = $modx->config['site_url']; |
103 | - $url = preg_replace('@' . $friendly_url_suffix . '$@', '', $url); |
|
103 | + $url = preg_replace('@'.$friendly_url_suffix.'$@', '', $url); |
|
104 | 104 | if ($url[0] === '/') { |
105 | - $url = preg_replace('@^' . $base_url . '@', '', $url); |
|
105 | + $url = preg_replace('@^'.$base_url.'@', '', $url); |
|
106 | 106 | } |
107 | 107 | if (substr($url, 0, 4) === 'http') { |
108 | - $url = preg_replace('@^' . $site_url . '@', '', $url); |
|
108 | + $url = preg_replace('@^'.$site_url.'@', '', $url); |
|
109 | 109 | } |
110 | 110 | $idFromAlias = $modx->getIdFromAlias($url); |
111 | 111 | } |
@@ -118,18 +118,18 @@ discard block |
||
118 | 118 | $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
119 | 119 | $articul_result = $modx->db->query($articul_query); |
120 | 120 | $articul_id_array = $modx->db->makeArray($articul_result); |
121 | - if(count($articul_id_array)>0){ |
|
121 | + if (count($articul_id_array) > 0) { |
|
122 | 122 | $articul_id = ''; |
123 | 123 | $i = 1; |
124 | - foreach( $articul_id_array as $articul ) { |
|
125 | - $articul_id.=$articul['contentid']; |
|
126 | - if($i !== count($articul_id_array)){ |
|
127 | - $articul_id.=','; |
|
124 | + foreach ($articul_id_array as $articul) { |
|
125 | + $articul_id .= $articul['contentid']; |
|
126 | + if ($i !== count($articul_id_array)) { |
|
127 | + $articul_id .= ','; |
|
128 | 128 | } |
129 | 129 | $i++; |
130 | 130 | } |
131 | 131 | $articul_id_query = " OR sc.id IN ({$articul_id})"; |
132 | - }else{ |
|
132 | + } else { |
|
133 | 133 | $articul_id_query = ''; |
134 | 134 | } |
135 | 135 | /*end search by TV*/ |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if (ctype_digit($searchfields)) { |
138 | 138 | $sqladd .= "sc.id='{$searchfields}'"; |
139 | 139 | if (strlen($searchfields) > 3) { |
140 | - $sqladd .= $articul_id_query;//search by TV |
|
140 | + $sqladd .= $articul_id_query; //search by TV |
|
141 | 141 | $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'"; |
142 | 142 | } |
143 | 143 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'"; |
158 | 158 | $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'"; |
159 | 159 | $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'"; |
160 | - $sqladd .= $articul_id_query;//search by TV |
|
160 | + $sqladd .= $articul_id_query; //search by TV |
|
161 | 161 | $sqladd .= ")"; |
162 | 162 | } |
163 | 163 | } else if ($idFromAlias) { |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
182 | 182 | $mgrRole = (isset ($_SESSION['mgrRole']) && $_SESSION['mgrRole'] == 1) ? 1 : 0; |
183 | 183 | $docgrp_cond = $docgrp ? " OR dg.document_group IN ({$docgrp})" : ''; |
184 | - $fields .= ', MAX(IF(1=' . $mgrRole . ' OR sc.privatemgr=0' . $docgrp_cond . ',1,0)) AS hasAccess'; |
|
185 | - $sqladd = '(' . $sqladd . ") AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
184 | + $fields .= ', MAX(IF(1='.$mgrRole.' OR sc.privatemgr=0'.$docgrp_cond.',1,0)) AS hasAccess'; |
|
185 | + $sqladd = '('.$sqladd.") AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | if ($sqladd) { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $where = $sqladd; |
193 | 193 | |
194 | 194 | if ($where) { |
195 | - $rs = $modx->db->select($fields, $tbl_site_content . ' AS sc LEFT JOIN ' . $tbldg . ' AS dg ON dg.document=sc.id', $where, 'sc.id'); |
|
195 | + $rs = $modx->db->select($fields, $tbl_site_content.' AS sc LEFT JOIN '.$tbldg.' AS dg ON dg.document=sc.id', $where, 'sc.id'); |
|
196 | 196 | $limit = $modx->db->getRecordCount($rs); |
197 | 197 | } else { |
198 | 198 | $limit = 0; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | if ($limit < 1) { |
212 | 212 | echo $_lang['search_empty']; |
213 | 213 | } else { |
214 | - printf('<p>' . $_lang['search_results_returned_msg'] . '</p>', $limit); |
|
214 | + printf('<p>'.$_lang['search_results_returned_msg'].'</p>', $limit); |
|
215 | 215 | ?> |
216 | 216 | <script type="text/javascript" src="media/script/tablesort.js"></script> |
217 | 217 | <table class="grid sortabletable sortable-onload-2 rowstyle-even" id="table-1"> |
@@ -271,14 +271,14 @@ discard block |
||
271 | 271 | if (function_exists('mb_strlen') && function_exists('mb_substr')) { |
272 | 272 | ?> |
273 | 273 | <td<?= $tdClass ?>> |
274 | - <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset) . "..." : $row['pagetitle'] ?></a> |
|
274 | + <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset)."..." : $row['pagetitle'] ?></a> |
|
275 | 275 | </td> |
276 | - <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset) . "..." : $row['description'] ?></td> |
|
276 | + <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset)."..." : $row['description'] ?></td> |
|
277 | 277 | <?php |
278 | 278 | } else { |
279 | 279 | ?> |
280 | - <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20) . '...' : $row['pagetitle'] ?></td> |
|
281 | - <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35) . '...' : $row['description'] ?></td> |
|
280 | + <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20).'...' : $row['pagetitle'] ?></td> |
|
281 | + <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35).'...' : $row['description'] ?></td> |
|
282 | 282 | <?php |
283 | 283 | } |
284 | 284 | ?> |
@@ -298,115 +298,115 @@ discard block |
||
298 | 298 | if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
299 | 299 | $docscounts = $modx->db->getRecordCount($rs); |
300 | 300 | if ($docscounts > 0) { |
301 | - $output .= '<li><b><i class="fa fa-sitemap"></i> ' . $_lang["manage_documents"] . ' (' . $docscounts . ')</b></li>'; |
|
301 | + $output .= '<li><b><i class="fa fa-sitemap"></i> '.$_lang["manage_documents"].' ('.$docscounts.')</b></li>'; |
|
302 | 302 | while ($row = $modx->db->getRow($rs)) { |
303 | - $output .= '<li' . addClassForItemList('', !$row['published'], $row['deleted']) . '><a href="index.php?a=27&id=' . $row['id'] . '" id="content_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['pagetitle'] . ' <small>(' . $row['id'] . ')</small>', $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
303 | + $output .= '<li'.addClassForItemList('', !$row['published'], $row['deleted']).'><a href="index.php?a=27&id='.$row['id'].'" id="content_'.$row['id'].'" target="main">'.highlightingCoincidence($row['pagetitle'].' <small>('.$row['id'].')</small>', $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | } |
307 | 307 | |
308 | 308 | //templates |
309 | 309 | if ($modx->hasPermission('edit_template')) { |
310 | - $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%" . $searchfields . "%' |
|
311 | - OR `templatename` like '%" . $searchfields . "%' |
|
312 | - OR `description` like '%" . $searchfields . "%' |
|
313 | - OR `content` like '%" . $searchfields . "%'"); |
|
310 | + $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%".$searchfields."%' |
|
311 | + OR `templatename` like '%" . $searchfields."%' |
|
312 | + OR `description` like '%" . $searchfields."%' |
|
313 | + OR `content` like '%" . $searchfields."%'"); |
|
314 | 314 | $templatecounts = $modx->db->getRecordCount($rs); |
315 | 315 | if ($templatecounts > 0) { |
316 | - $output .= '<li><b><i class="fa fa-newspaper-o"></i> ' . $_lang["manage_templates"] . ' (' . $templatecounts . ')</b></li>'; |
|
316 | + $output .= '<li><b><i class="fa fa-newspaper-o"></i> '.$_lang["manage_templates"].' ('.$templatecounts.')</b></li>'; |
|
317 | 317 | while ($row = $modx->db->getRow($rs)) { |
318 | - $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=16&id=' . $row['id'] . '" id="templates_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
318 | + $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=16&id='.$row['id'].'" id="templates_'.$row['id'].'" target="main">'.highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | 323 | //tvs |
324 | 324 | if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
325 | - $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%" . $searchfields . "%' |
|
326 | - OR `name` like '%" . $searchfields . "%' |
|
327 | - OR `description` like '%" . $searchfields . "%' |
|
328 | - OR `type` like '%" . $searchfields . "%' |
|
329 | - OR `elements` like '%" . $searchfields . "%' |
|
330 | - OR `display` like '%" . $searchfields . "%' |
|
331 | - OR `display_params` like '%" . $searchfields . "%' |
|
332 | - OR `default_text` like '%" . $searchfields . "%'"); |
|
325 | + $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%".$searchfields."%' |
|
326 | + OR `name` like '%" . $searchfields."%' |
|
327 | + OR `description` like '%" . $searchfields."%' |
|
328 | + OR `type` like '%" . $searchfields."%' |
|
329 | + OR `elements` like '%" . $searchfields."%' |
|
330 | + OR `display` like '%" . $searchfields."%' |
|
331 | + OR `display_params` like '%" . $searchfields."%' |
|
332 | + OR `default_text` like '%" . $searchfields."%'"); |
|
333 | 333 | $tvscounts = $modx->db->getRecordCount($rs); |
334 | 334 | if ($tvscounts > 0) { |
335 | - $output .= '<li><b><i class="fa fa-list-alt"></i> ' . $_lang["settings_templvars"] . ' (' . $tvscounts . ')</b></li>'; |
|
335 | + $output .= '<li><b><i class="fa fa-list-alt"></i> '.$_lang["settings_templvars"].' ('.$tvscounts.')</b></li>'; |
|
336 | 336 | while ($row = $modx->db->getRow($rs)) { |
337 | - $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=301&id=' . $row['id'] . '" id="tmplvars_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
337 | + $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=301&id='.$row['id'].'" id="tmplvars_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | } |
341 | 341 | |
342 | 342 | //Chunks |
343 | 343 | if ($modx->hasPermission('edit_chunk')) { |
344 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%" . $searchfields . "%' |
|
345 | - OR `name` like '%" . $searchfields . "%' |
|
346 | - OR `description` like '%" . $searchfields . "%' |
|
347 | - OR `snippet` like '%" . $searchfields . "%'"); |
|
344 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%".$searchfields."%' |
|
345 | + OR `name` like '%" . $searchfields."%' |
|
346 | + OR `description` like '%" . $searchfields."%' |
|
347 | + OR `snippet` like '%" . $searchfields."%'"); |
|
348 | 348 | $chunkscounts = $modx->db->getRecordCount($rs); |
349 | 349 | if ($chunkscounts > 0) { |
350 | - $output .= '<li><b><i class="fa fa-th-large"></i> ' . $_lang["manage_htmlsnippets"] . ' (' . $chunkscounts . ')</b></li>'; |
|
350 | + $output .= '<li><b><i class="fa fa-th-large"></i> '.$_lang["manage_htmlsnippets"].' ('.$chunkscounts.')</b></li>'; |
|
351 | 351 | while ($row = $modx->db->getRow($rs)) { |
352 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=78&id=' . $row['id'] . '" id="htmlsnippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
352 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=78&id='.$row['id'].'" id="htmlsnippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | } |
356 | 356 | |
357 | 357 | //Snippets |
358 | 358 | if ($modx->hasPermission('edit_snippet')) { |
359 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%" . $searchfields . "%' |
|
360 | - OR `name` like '%" . $searchfields . "%' |
|
361 | - OR `description` like '%" . $searchfields . "%' |
|
362 | - OR `snippet` like '%" . $searchfields . "%' |
|
363 | - OR `properties` like '%" . $searchfields . "%' |
|
364 | - OR `moduleguid` like '%" . $searchfields . "%'"); |
|
359 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%".$searchfields."%' |
|
360 | + OR `name` like '%" . $searchfields."%' |
|
361 | + OR `description` like '%" . $searchfields."%' |
|
362 | + OR `snippet` like '%" . $searchfields."%' |
|
363 | + OR `properties` like '%" . $searchfields."%' |
|
364 | + OR `moduleguid` like '%" . $searchfields."%'"); |
|
365 | 365 | $snippetscounts = $modx->db->getRecordCount($rs); |
366 | 366 | if ($snippetscounts > 0) { |
367 | - $output .= '<li><b><i class="fa fa-code"></i> ' . $_lang["manage_snippets"] . ' (' . $snippetscounts . ')</b></li>'; |
|
367 | + $output .= '<li><b><i class="fa fa-code"></i> '.$_lang["manage_snippets"].' ('.$snippetscounts.')</b></li>'; |
|
368 | 368 | while ($row = $modx->db->getRow($rs)) { |
369 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=22&id=' . $row['id'] . '" id="snippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
369 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=22&id='.$row['id'].'" id="snippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | 374 | //plugins |
375 | 375 | if ($modx->hasPermission('edit_plugin')) { |
376 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%" . $searchfields . "%' |
|
377 | - OR `name` like '%" . $searchfields . "%' |
|
378 | - OR `description` like '%" . $searchfields . "%' |
|
379 | - OR `plugincode` like '%" . $searchfields . "%' |
|
380 | - OR `properties` like '%" . $searchfields . "%' |
|
381 | - OR `moduleguid` like '%" . $searchfields . "%'"); |
|
376 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%".$searchfields."%' |
|
377 | + OR `name` like '%" . $searchfields."%' |
|
378 | + OR `description` like '%" . $searchfields."%' |
|
379 | + OR `plugincode` like '%" . $searchfields."%' |
|
380 | + OR `properties` like '%" . $searchfields."%' |
|
381 | + OR `moduleguid` like '%" . $searchfields."%'"); |
|
382 | 382 | $pluginscounts = $modx->db->getRecordCount($rs); |
383 | 383 | if ($pluginscounts > 0) { |
384 | - $output .= '<li><b><i class="fa fa-plug"></i> ' . $_lang["manage_plugins"] . ' (' . $pluginscounts . ')</b></li>'; |
|
384 | + $output .= '<li><b><i class="fa fa-plug"></i> '.$_lang["manage_plugins"].' ('.$pluginscounts.')</b></li>'; |
|
385 | 385 | while ($row = $modx->db->getRow($rs)) { |
386 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=102&id=' . $row['id'] . '" id="plugins_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
386 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=102&id='.$row['id'].'" id="plugins_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
387 | 387 | } |
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | 391 | //modules |
392 | 392 | if ($modx->hasPermission('edit_module')) { |
393 | - $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%" . $searchfields . "%' |
|
394 | - OR `name` like '%" . $searchfields . "%' |
|
395 | - OR `description` like '%" . $searchfields . "%' |
|
396 | - OR `modulecode` like '%" . $searchfields . "%' |
|
397 | - OR `properties` like '%" . $searchfields . "%' |
|
398 | - OR `guid` like '%" . $searchfields . "%' |
|
399 | - OR `resourcefile` like '%" . $searchfields . "%'"); |
|
393 | + $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%".$searchfields."%' |
|
394 | + OR `name` like '%" . $searchfields."%' |
|
395 | + OR `description` like '%" . $searchfields."%' |
|
396 | + OR `modulecode` like '%" . $searchfields."%' |
|
397 | + OR `properties` like '%" . $searchfields."%' |
|
398 | + OR `guid` like '%" . $searchfields."%' |
|
399 | + OR `resourcefile` like '%" . $searchfields."%'"); |
|
400 | 400 | $modulescounts = $modx->db->getRecordCount($rs); |
401 | 401 | if ($modulescounts > 0) { |
402 | - $output .= '<li><b><i class="fa fa-cogs"></i> ' . $_lang["modules"] . ' (' . $modulescounts . ')</b></li>'; |
|
402 | + $output .= '<li><b><i class="fa fa-cogs"></i> '.$_lang["modules"].' ('.$modulescounts.')</b></li>'; |
|
403 | 403 | while ($row = $modx->db->getRow($rs)) { |
404 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=108&id=' . $row['id'] . '" id="modules_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>'; |
|
404 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=108&id='.$row['id'].'" id="modules_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>'; |
|
405 | 405 | } |
406 | 406 | } |
407 | 407 | } |
408 | 408 | |
409 | - echo $output ? '<div class="ajaxSearchResults"><ul>' . $output . '</ul></div>' : '1'; |
|
409 | + echo $output ? '<div class="ajaxSearchResults"><ul>'.$output.'</ul></div>' : '1'; |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | ?> |
@@ -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> |
@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -switch($modx->manager->action) { |
|
5 | +switch ($modx->manager->action) { |
|
6 | 6 | case 107: |
7 | - if(!$modx->hasPermission('new_module')) { |
|
7 | + if (!$modx->hasPermission('new_module')) { |
|
8 | 8 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
9 | 9 | } |
10 | 10 | break; |
11 | 11 | case 108: |
12 | - if(!$modx->hasPermission('edit_module')) { |
|
12 | + if (!$modx->hasPermission('edit_module')) { |
|
13 | 13 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
14 | 14 | } |
15 | 15 | break; |
16 | 16 | default: |
17 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
18 | 18 | } |
19 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
19 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
20 | 20 | // Get table names (alphabetical) |
21 | 21 | $tbl_membergroup_names = $modx->getFullTableName('membergroup_names'); |
22 | 22 | $tbl_site_content = $modx->getFullTableName('site_content'); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | // check to see the module editor isn't locked |
34 | -if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
34 | +if ($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
35 | 35 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
36 | 36 | } |
37 | 37 | // end check for lock |
@@ -39,29 +39,29 @@ discard block |
||
39 | 39 | // Lock snippet for other users to edit |
40 | 40 | $modx->lockElement(6, $id); |
41 | 41 | |
42 | -if(isset($_GET['id'])) { |
|
42 | +if (isset($_GET['id'])) { |
|
43 | 43 | $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'"); |
44 | 44 | $content = $modx->db->getRow($rs); |
45 | - if(!$content) { |
|
45 | + if (!$content) { |
|
46 | 46 | $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
47 | 47 | } |
48 | 48 | $content['properties'] = str_replace("&", "&", $content['properties']); |
49 | 49 | $_SESSION['itemname'] = $content['name']; |
50 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
50 | + if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
51 | 51 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
52 | 52 | } |
53 | 53 | } else { |
54 | 54 | $_SESSION['itemname'] = $_lang["new_module"]; |
55 | 55 | $content['wrap'] = '1'; |
56 | 56 | } |
57 | -if($modx->manager->hasFormValues()) { |
|
57 | +if ($modx->manager->hasFormValues()) { |
|
58 | 58 | $modx->manager->loadFormValues(); |
59 | 59 | } |
60 | 60 | |
61 | 61 | // Add lock-element JS-Script |
62 | 62 | $lockElementId = $id; |
63 | 63 | $lockElementType = 6; |
64 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
64 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
65 | 65 | ?> |
66 | 66 | <script type="text/javascript"> |
67 | 67 | function loadDependencies() { |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | function BrowseServer() { |
409 | 409 | var w = screen.width * 0.7; |
410 | 410 | var h = screen.height * 0.7; |
411 | - OpenServerBrowser("<?= MODX_MANAGER_URL;?>media/browser/<?= $which_browser;?>/browser.php?Type=images", w, h); |
|
411 | + OpenServerBrowser("<?= MODX_MANAGER_URL; ?>media/browser/<?= $which_browser; ?>/browser.php?Type=images", w, h); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | function SetUrl(url, width, height, alt) { |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | <?php |
429 | 429 | // invoke OnModFormPrerender event |
430 | 430 | $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
431 | - if(is_array($evtOut)) { |
|
431 | + if (is_array($evtOut)) { |
|
432 | 432 | echo implode('', $evtOut); |
433 | 433 | } |
434 | 434 | |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
443 | 443 | |
444 | 444 | <h1> |
445 | - <i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i> |
|
445 | + <i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i> |
|
446 | 446 | </h1> |
447 | 447 | |
448 | 448 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -467,8 +467,8 @@ discard block |
||
467 | 467 | <div class="col-md-9 col-lg-10"> |
468 | 468 | <div class="form-control-name clearfix"> |
469 | 469 | <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
470 | - <?php if($modx->hasPermission('save_role')): ?> |
|
471 | - <label class="custom-control" title="<?= $_lang['lock_module'] . "\n" . $_lang['lock_module_msg'] ?>" tooltip> |
|
470 | + <?php if ($modx->hasPermission('save_role')): ?> |
|
471 | + <label class="custom-control" title="<?= $_lang['lock_module']."\n".$_lang['lock_module_msg'] ?>" tooltip> |
|
472 | 472 | <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
473 | 473 | <i class="fa fa-lock"></i> |
474 | 474 | </label> |
@@ -490,9 +490,9 @@ 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"; |
|
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 | 496 | } |
497 | 497 | ?> |
498 | 498 | </select> |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | <div class="form-group"> |
525 | 525 | <div class="form-row"> |
526 | 526 | <label for="disabled"><input name="disabled" id="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> |
527 | - <?= ($content['disabled'] == 1 ? '<span class="text-danger">' . $_lang['module_disabled'] . '</span>' : $_lang['module_disabled']) ?></label> |
|
527 | + <?= ($content['disabled'] == 1 ? '<span class="text-danger">'.$_lang['module_disabled'].'</span>' : $_lang['module_disabled']) ?></label> |
|
528 | 528 | </div> |
529 | 529 | <div class="form-row"> |
530 | 530 | <label for="parse_docblock"> |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | </div> |
590 | 590 | <!-- HTML text editor end --> |
591 | 591 | </div> |
592 | - <?php if($modx->manager->action == '108'): ?> |
|
592 | + <?php if ($modx->manager->action == '108'): ?> |
|
593 | 593 | <!-- Dependencies --> |
594 | 594 | <div class="tab-page" id="tabDepend"> |
595 | 595 | <h2 class="tab"><?= $_lang['settings_dependencies'] ?></h2> |
@@ -617,14 +617,14 @@ 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"; |
|
620 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
621 | 621 | $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
622 | 622 | $grd->noRecordMsg = $_lang['no_records_found']; |
623 | 623 | $grd->cssClass = 'grid'; |
624 | 624 | $grd->columnHeaderClass = 'gridHeader'; |
625 | 625 | $grd->itemClass = 'gridItem'; |
626 | 626 | $grd->altItemClass = 'gridAltItem'; |
627 | - $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
627 | + $grd->columns = $_lang['element_name']." ,".$_lang['type']; |
|
628 | 628 | $grd->fields = "name,type"; |
629 | 629 | echo $grd->render(); |
630 | 630 | ?> |
@@ -637,13 +637,13 @@ discard block |
||
637 | 637 | <h2 class="tab"><?= $_lang['access_permissions'] ?></h2> |
638 | 638 | <script type="text/javascript">tp.addTabPage(document.getElementById("tabPermissions"));</script> |
639 | 639 | <div class="container container-body"> |
640 | - <?php if($use_udperms == 1) : ?> |
|
640 | + <?php if ($use_udperms == 1) : ?> |
|
641 | 641 | <?php |
642 | 642 | // fetch user access permissions for the module |
643 | 643 | $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
644 | 644 | $groupsarray = $modx->db->getColumn('usergroup', $rs); |
645 | 645 | |
646 | - if($modx->hasPermission('access_permissions')) { |
|
646 | + if ($modx->hasPermission('access_permissions')) { |
|
647 | 647 | ?> |
648 | 648 | <!-- User Group Access Permissions --> |
649 | 649 | <script type="text/javascript"> |
@@ -671,22 +671,22 @@ discard block |
||
671 | 671 | } |
672 | 672 | $chk = ''; |
673 | 673 | $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name'); |
674 | - while($row = $modx->db->getRow($rs)) { |
|
674 | + while ($row = $modx->db->getRow($rs)) { |
|
675 | 675 | $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
676 | 676 | $checked = in_array($row['id'], $groupsarray); |
677 | - if($modx->hasPermission('access_permissions')) { |
|
678 | - if($checked) { |
|
677 | + if ($modx->hasPermission('access_permissions')) { |
|
678 | + if ($checked) { |
|
679 | 679 | $notPublic = true; |
680 | 680 | } |
681 | - $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
681 | + $chks .= '<label><input type="checkbox" name="usrgroups[]" value="'.$row['id'].'"'.($checked ? ' checked="checked"' : '').' onclick="makePublic(false)" /> '.$row['name']."</label><br />\n"; |
|
682 | 682 | } else { |
683 | - if($checked) { |
|
684 | - $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
683 | + if ($checked) { |
|
684 | + $chks = '<input type="hidden" name="usrgroups[]" value="'.$row['id'].'" />'."\n".$chks; |
|
685 | 685 | } |
686 | 686 | } |
687 | 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; |
|
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 | 690 | } |
691 | 691 | echo $chks; |
692 | 692 | ?> |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | <?php |
708 | 708 | // invoke OnModFormRender event |
709 | 709 | $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
710 | - if(is_array($evtOut)) { |
|
710 | + if (is_array($evtOut)) { |
|
711 | 711 | echo implode('', $evtOut); |
712 | 712 | } |
713 | 713 | ?> |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -switch($modx->manager->action) { |
|
5 | +switch($modx->manager->action) { |
|
6 | 6 | case 107: |
7 | - if(!$modx->hasPermission('new_module')) { |
|
7 | + if(!$modx->hasPermission('new_module')) { |
|
8 | 8 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
9 | 9 | } |
10 | 10 | break; |
11 | 11 | case 108: |
12 | - if(!$modx->hasPermission('edit_module')) { |
|
12 | + if(!$modx->hasPermission('edit_module')) { |
|
13 | 13 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
14 | 14 | } |
15 | 15 | break; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | // check to see the module editor isn't locked |
34 | -if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
34 | +if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
35 | 35 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
36 | 36 | } |
37 | 37 | // end check for lock |
@@ -39,22 +39,22 @@ discard block |
||
39 | 39 | // Lock snippet for other users to edit |
40 | 40 | $modx->lockElement(6, $id); |
41 | 41 | |
42 | -if(isset($_GET['id'])) { |
|
42 | +if(isset($_GET['id'])) { |
|
43 | 43 | $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'"); |
44 | 44 | $content = $modx->db->getRow($rs); |
45 | - if(!$content) { |
|
45 | + if(!$content) { |
|
46 | 46 | $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
47 | 47 | } |
48 | 48 | $content['properties'] = str_replace("&", "&", $content['properties']); |
49 | 49 | $_SESSION['itemname'] = $content['name']; |
50 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
50 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
51 | 51 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
52 | 52 | } |
53 | -} else { |
|
53 | +} else { |
|
54 | 54 | $_SESSION['itemname'] = $_lang["new_module"]; |
55 | 55 | $content['wrap'] = '1'; |
56 | 56 | } |
57 | -if($modx->manager->hasFormValues()) { |
|
57 | +if($modx->manager->hasFormValues()) { |
|
58 | 58 | $modx->manager->loadFormValues(); |
59 | 59 | } |
60 | 60 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | <?php |
429 | 429 | // invoke OnModFormPrerender event |
430 | 430 | $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
431 | - if(is_array($evtOut)) { |
|
431 | + if(is_array($evtOut)) { |
|
432 | 432 | echo implode('', $evtOut); |
433 | 433 | } |
434 | 434 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | <option> </option> |
492 | 492 | <?php |
493 | 493 | include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
494 | - foreach(getCategories() as $n => $v) { |
|
494 | + foreach(getCategories() as $n => $v) { |
|
495 | 495 | echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
496 | 496 | } |
497 | 497 | ?> |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
644 | 644 | $groupsarray = $modx->db->getColumn('usergroup', $rs); |
645 | 645 | |
646 | - if($modx->hasPermission('access_permissions')) { |
|
646 | + if($modx->hasPermission('access_permissions')) { |
|
647 | 647 | ?> |
648 | 648 | <!-- User Group Access Permissions --> |
649 | 649 | <script type="text/javascript"> |
@@ -671,21 +671,21 @@ discard block |
||
671 | 671 | } |
672 | 672 | $chk = ''; |
673 | 673 | $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name'); |
674 | - while($row = $modx->db->getRow($rs)) { |
|
674 | + while($row = $modx->db->getRow($rs)) { |
|
675 | 675 | $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
676 | 676 | $checked = in_array($row['id'], $groupsarray); |
677 | - if($modx->hasPermission('access_permissions')) { |
|
678 | - if($checked) { |
|
677 | + if($modx->hasPermission('access_permissions')) { |
|
678 | + if($checked) { |
|
679 | 679 | $notPublic = true; |
680 | 680 | } |
681 | 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) { |
|
682 | + } else { |
|
683 | + if($checked) { |
|
684 | 684 | $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
685 | 685 | } |
686 | 686 | } |
687 | 687 | } |
688 | - if($modx->hasPermission('access_permissions')) { |
|
688 | + if($modx->hasPermission('access_permissions')) { |
|
689 | 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 | 690 | } |
691 | 691 | echo $chks; |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | <?php |
708 | 708 | // invoke OnModFormRender event |
709 | 709 | $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
710 | - if(is_array($evtOut)) { |
|
710 | + if(is_array($evtOut)) { |
|
711 | 711 | echo implode('', $evtOut); |
712 | 712 | } |
713 | 713 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('logs')) { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username'); |
29 | 29 | foreach ($logs_user as $row) { |
30 | 30 | $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : ''; |
31 | - echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n"; |
|
31 | + echo "\t\t".'<option value="'.$row['internalKey'].'"'.$selectedtext.'>'.$row['username']."</option>\n"; |
|
32 | 32 | } |
33 | 33 | ?> |
34 | 34 | </select> |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | continue; |
50 | 50 | } |
51 | 51 | $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : ''; |
52 | - echo "\t\t" . '<option value="' . $row['action'] . '"' . $selectedtext . '>' . $row['action'] . ' - ' . $action . "</option>\n"; |
|
52 | + echo "\t\t".'<option value="'.$row['action'].'"'.$selectedtext.'>'.$row['action'].' - '.$action."</option>\n"; |
|
53 | 53 | } |
54 | 54 | ?> |
55 | 55 | </select> |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid'); |
66 | 66 | foreach ($logs_items as $row) { |
67 | 67 | $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : ''; |
68 | - echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n"; |
|
68 | + echo "\t\t".'<option value="'.$row['itemid'].'"'.$selectedtext.'>'.$row['itemid']."</option>\n"; |
|
69 | 69 | } |
70 | 70 | ?> |
71 | 71 | </select> |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname'); |
82 | 82 | foreach ($logs_names as $row) { |
83 | 83 | $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : ''; |
84 | - echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n"; |
|
84 | + echo "\t\t".'<option value="'.$row['itemname'].'"'.$selectedtext.'>'.$row['itemname']."</option>\n"; |
|
85 | 85 | } |
86 | 86 | ?> |
87 | 87 | </select> |
@@ -139,26 +139,26 @@ discard block |
||
139 | 139 | // get the selections the user made. |
140 | 140 | $sqladd = array(); |
141 | 141 | if ($_REQUEST['searchuser'] != 0) { |
142 | - $sqladd[] = "internalKey='" . (int)$_REQUEST['searchuser'] . "'"; |
|
142 | + $sqladd[] = "internalKey='".(int) $_REQUEST['searchuser']."'"; |
|
143 | 143 | } |
144 | 144 | if ($_REQUEST['action'] != 0) { |
145 | - $sqladd[] = "action=" . (int)$_REQUEST['action']; |
|
145 | + $sqladd[] = "action=".(int) $_REQUEST['action']; |
|
146 | 146 | } |
147 | 147 | if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") { |
148 | - $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'"; |
|
148 | + $sqladd[] = "itemid='".$_REQUEST['itemid']."'"; |
|
149 | 149 | } |
150 | 150 | if ($_REQUEST['itemname'] != '0') { |
151 | - $sqladd[] = "itemname='" . $modx->db->escape($_REQUEST['itemname']) . "'"; |
|
151 | + $sqladd[] = "itemname='".$modx->db->escape($_REQUEST['itemname'])."'"; |
|
152 | 152 | } |
153 | 153 | if ($_REQUEST['message'] != "") { |
154 | - $sqladd[] = "message LIKE '%" . $modx->db->escape($_REQUEST['message']) . "%'"; |
|
154 | + $sqladd[] = "message LIKE '%".$modx->db->escape($_REQUEST['message'])."%'"; |
|
155 | 155 | } |
156 | 156 | // date stuff |
157 | 157 | if ($_REQUEST['datefrom'] != "") { |
158 | - $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']); |
|
158 | + $sqladd[] = "timestamp>".$modx->toTimeStamp($_REQUEST['datefrom']); |
|
159 | 159 | } |
160 | 160 | if ($_REQUEST['dateto'] != "") { |
161 | - $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']); |
|
161 | + $sqladd[] = "timestamp<".$modx->toTimeStamp($_REQUEST['dateto']); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // If current position is not set, set it to zero |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | // Number of result to display on the page, will be in the LIMIT of the sql query also |
172 | 172 | $int_num_result = is_numeric($_REQUEST['nrresults']) ? $_REQUEST['nrresults'] : $number_of_logs; |
173 | 173 | |
174 | - $extargv = "&a=13&searchuser=" . $_REQUEST['searchuser'] . "&action=" . $_REQUEST['action'] . "&itemid=" . $_REQUEST['itemid'] . "&itemname=" . $_REQUEST['itemname'] . "&message=" . $_REQUEST['message'] . "&dateto=" . $_REQUEST['dateto'] . "&datefrom=" . $_REQUEST['datefrom'] . "&nrresults=" . $int_num_result . "&log_submit=" . $_REQUEST['log_submit']; // extra argv here (could be anything depending on your page) |
|
174 | + $extargv = "&a=13&searchuser=".$_REQUEST['searchuser']."&action=".$_REQUEST['action']."&itemid=".$_REQUEST['itemid']."&itemname=".$_REQUEST['itemname']."&message=".$_REQUEST['message']."&dateto=".$_REQUEST['dateto']."&datefrom=".$_REQUEST['datefrom']."&nrresults=".$int_num_result."&log_submit=".$_REQUEST['log_submit']; // extra argv here (could be anything depending on your page) |
|
175 | 175 | |
176 | 176 | // build the sql |
177 | 177 | $limit = $num_rows = $modx->db->getValue($modx->db->select('COUNT(*)', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''))); |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}"); |
180 | 180 | |
181 | 181 | if ($limit < 1) { |
182 | - echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>'; |
|
182 | + echo '<p>'.$_lang["mgrlog_emptysrch"].'</p>'; |
|
183 | 183 | } else { |
184 | - echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>'; |
|
184 | + echo '<p>'.$_lang["mgrlog_sortinst"].'</p>'; |
|
185 | 185 | |
186 | 186 | // New instance of the Paging class, you can modify the color and the width of the html table |
187 | 187 | $p = new EvolutionCMS\Support\Paginate($num_rows, $int_cur_position, $int_num_result, $extargv); |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | $current_row = $int_cur_position / $int_num_result; |
193 | 193 | |
194 | 194 | // Display the result as you like... |
195 | - print "<p>" . $_lang["paging_showing"] . " " . $array_paging['lower']; |
|
196 | - print " " . $_lang["paging_to"] . " " . $array_paging['upper']; |
|
197 | - print " (" . $array_paging['total'] . " " . $_lang["paging_total"] . ")<br />"; |
|
198 | - $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " "); |
|
199 | - $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " "); |
|
195 | + print "<p>".$_lang["paging_showing"]." ".$array_paging['lower']; |
|
196 | + print " ".$_lang["paging_to"]." ".$array_paging['upper']; |
|
197 | + print " (".$array_paging['total']." ".$_lang["paging_total"].")<br />"; |
|
198 | + $paging = $array_paging['first_link'].$_lang["paging_first"].(isset($array_paging['first_link']) ? "</a> " : " "); |
|
199 | + $paging .= $array_paging['previous_link'].$_lang["paging_prev"].(isset($array_paging['previous_link']) ? "</a> " : " "); |
|
200 | 200 | $pagesfound = sizeof($array_row_paging); |
201 | 201 | if ($pagesfound > 6) { |
202 | 202 | $paging .= $array_row_paging[$current_row - 2]; // ." "; |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | $paging .= $array_row_paging[$current_row + 2]; // ." "; |
207 | 207 | } else { |
208 | 208 | for ($i = 0; $i < $pagesfound; $i++) { |
209 | - $paging .= $array_row_paging[$i] . " "; |
|
209 | + $paging .= $array_row_paging[$i]." "; |
|
210 | 210 | } |
211 | 211 | } |
212 | - $paging .= $array_paging['next_link'] . $_lang["paging_next"] . (isset($array_paging['next_link']) ? "</a> " : " ") . " "; |
|
213 | - $paging .= $array_paging['last_link'] . $_lang["paging_last"] . (isset($array_paging['last_link']) ? "</a> " : " ") . " "; |
|
212 | + $paging .= $array_paging['next_link'].$_lang["paging_next"].(isset($array_paging['next_link']) ? "</a> " : " ")." "; |
|
213 | + $paging .= $array_paging['last_link'].$_lang["paging_last"].(isset($array_paging['last_link']) ? "</a> " : " ")." "; |
|
214 | 214 | // The above exemple print somethings like: |
215 | 215 | // Results 1 to 20 of 597 <<< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 >>> |
216 | 216 | // Of course you can now play with array_row_paging in order to print |
@@ -246,16 +246,16 @@ discard block |
||
246 | 246 | if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) { |
247 | 247 | $item = '<div style="text-align:center;">-</div>'; |
248 | 248 | } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) { |
249 | - $item = '<a href="index.php?a=3&id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>'; |
|
249 | + $item = '<a href="index.php?a=3&id='.$logentry['itemid'].'">'.$logentry['itemname'].'</a>'; |
|
250 | 250 | } else { |
251 | 251 | $item = $logentry['itemname']; |
252 | 252 | } |
253 | 253 | //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true' |
254 | - $user_drill = 'index.php?a=13&searchuser=' . $logentry['internalKey'] . '&itemname=0&log_submit=true'; |
|
254 | + $user_drill = 'index.php?a=13&searchuser='.$logentry['internalKey'].'&itemname=0&log_submit=true'; |
|
255 | 255 | ?> |
256 | 256 | <tr> |
257 | - <td><?= '<a href="' . $user_drill . '">' . $logentry['username'] . '</a>' ?></td> |
|
258 | - <td class="text-nowrap"><?= '[' . $logentry['action'] . '] ' . $logentry['message'] ?></td> |
|
257 | + <td><?= '<a href="'.$user_drill.'">'.$logentry['username'].'</a>' ?></td> |
|
258 | + <td class="text-nowrap"><?= '['.$logentry['action'].'] '.$logentry['message'] ?></td> |
|
259 | 259 | <td class="text-xs-right"><?= $logentry['itemid'] ?></td> |
260 | 260 | <td><?= $item ?></td> |
261 | 261 | <td class="text-nowrap"><?= $modx->toDateFormat($logentry['timestamp'] + $server_offset_time) ?></td> |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if (!$modx->hasPermission('logs')) { |
|
5 | +if (!$modx->hasPermission('logs')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | <?php |
27 | 27 | // get all users currently in the log |
28 | 28 | $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username'); |
29 | - foreach ($logs_user as $row) { |
|
29 | + foreach ($logs_user as $row) { |
|
30 | 30 | $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : ''; |
31 | 31 | echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n"; |
32 | 32 | } |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | // get all available actions in the log |
44 | 44 | include_once "actionlist.inc.php"; |
45 | 45 | $logs_actions = record_sort(array_unique_multi($logs, 'action'), 'action'); |
46 | - foreach ($logs_actions as $row) { |
|
46 | + foreach ($logs_actions as $row) { |
|
47 | 47 | $action = getAction($row['action']); |
48 | - if ($action == 'Idle') { |
|
48 | + if ($action == 'Idle') { |
|
49 | 49 | continue; |
50 | 50 | } |
51 | 51 | $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : ''; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | <?php |
64 | 64 | // get all itemid currently in logging |
65 | 65 | $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid'); |
66 | - foreach ($logs_items as $row) { |
|
66 | + foreach ($logs_items as $row) { |
|
67 | 67 | $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : ''; |
68 | 68 | echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n"; |
69 | 69 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | <?php |
80 | 80 | // get all itemname currently in logging |
81 | 81 | $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname'); |
82 | - foreach ($logs_names as $row) { |
|
82 | + foreach ($logs_names as $row) { |
|
83 | 83 | $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : ''; |
84 | 84 | echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n"; |
85 | 85 | } |
@@ -135,36 +135,36 @@ discard block |
||
135 | 135 | <div class="container container-body"> |
136 | 136 | |
137 | 137 | <?php |
138 | -if (isset($_REQUEST['log_submit'])) { |
|
138 | +if (isset($_REQUEST['log_submit'])) { |
|
139 | 139 | // get the selections the user made. |
140 | 140 | $sqladd = array(); |
141 | - if ($_REQUEST['searchuser'] != 0) { |
|
141 | + if ($_REQUEST['searchuser'] != 0) { |
|
142 | 142 | $sqladd[] = "internalKey='" . (int)$_REQUEST['searchuser'] . "'"; |
143 | 143 | } |
144 | - if ($_REQUEST['action'] != 0) { |
|
144 | + if ($_REQUEST['action'] != 0) { |
|
145 | 145 | $sqladd[] = "action=" . (int)$_REQUEST['action']; |
146 | 146 | } |
147 | - if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") { |
|
147 | + if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") { |
|
148 | 148 | $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'"; |
149 | 149 | } |
150 | - if ($_REQUEST['itemname'] != '0') { |
|
150 | + if ($_REQUEST['itemname'] != '0') { |
|
151 | 151 | $sqladd[] = "itemname='" . $modx->db->escape($_REQUEST['itemname']) . "'"; |
152 | 152 | } |
153 | - if ($_REQUEST['message'] != "") { |
|
153 | + if ($_REQUEST['message'] != "") { |
|
154 | 154 | $sqladd[] = "message LIKE '%" . $modx->db->escape($_REQUEST['message']) . "%'"; |
155 | 155 | } |
156 | 156 | // date stuff |
157 | - if ($_REQUEST['datefrom'] != "") { |
|
157 | + if ($_REQUEST['datefrom'] != "") { |
|
158 | 158 | $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']); |
159 | 159 | } |
160 | - if ($_REQUEST['dateto'] != "") { |
|
160 | + if ($_REQUEST['dateto'] != "") { |
|
161 | 161 | $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']); |
162 | 162 | } |
163 | 163 | |
164 | 164 | // If current position is not set, set it to zero |
165 | - if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) { |
|
165 | + if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) { |
|
166 | 166 | $int_cur_position = 0; |
167 | - } else { |
|
167 | + } else { |
|
168 | 168 | $int_cur_position = $_REQUEST['int_cur_position']; |
169 | 169 | } |
170 | 170 | |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | |
179 | 179 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}"); |
180 | 180 | |
181 | -if ($limit < 1) { |
|
181 | +if ($limit < 1) { |
|
182 | 182 | echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>'; |
183 | -} else { |
|
183 | +} else { |
|
184 | 184 | echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>'; |
185 | 185 | |
186 | 186 | // New instance of the Paging class, you can modify the color and the width of the html table |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " "); |
199 | 199 | $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " "); |
200 | 200 | $pagesfound = sizeof($array_row_paging); |
201 | - if ($pagesfound > 6) { |
|
201 | + if ($pagesfound > 6) { |
|
202 | 202 | $paging .= $array_row_paging[$current_row - 2]; // ." "; |
203 | 203 | $paging .= $array_row_paging[$current_row - 1]; // ." "; |
204 | 204 | $paging .= $array_row_paging[$current_row]; // ." "; |
205 | 205 | $paging .= $array_row_paging[$current_row + 1]; // ." "; |
206 | 206 | $paging .= $array_row_paging[$current_row + 2]; // ." "; |
207 | - } else { |
|
208 | - for ($i = 0; $i < $pagesfound; $i++) { |
|
207 | + } else { |
|
208 | + for ($i = 0; $i < $pagesfound; $i++) { |
|
209 | 209 | $paging .= $array_row_paging[$i] . " "; |
210 | 210 | } |
211 | 211 | } |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | // grab the entire log file... |
243 | 243 | $logentries = array(); |
244 | 244 | $i = 0; |
245 | - while ($logentry = $modx->db->getRow($rs)) { |
|
246 | - if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) { |
|
245 | + while ($logentry = $modx->db->getRow($rs)) { |
|
246 | + if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) { |
|
247 | 247 | $item = '<div style="text-align:center;">-</div>'; |
248 | - } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) { |
|
248 | + } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) { |
|
249 | 249 | $item = '<a href="index.php?a=3&id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>'; |
250 | - } else { |
|
250 | + } else { |
|
251 | 251 | $item = $logentry['itemname']; |
252 | 252 | } |
253 | 253 | //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true' |
@@ -284,6 +284,6 @@ discard block |
||
284 | 284 | // @see index.php @ 915 |
285 | 285 | global $action; |
286 | 286 | $action = 1; |
287 | -} else { |
|
287 | +} else { |
|
288 | 288 | echo $_lang["mgrlog_noquery"]; |
289 | 289 | } |
@@ -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,21 +1,21 @@ |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -$logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">'; |
|
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( |
|
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 | 11 | 'http://extras.evolution-cms.com/', |
12 | 12 | 'https://github.com/extras-evolution' |
13 | 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 |
@@ -44,7 +44,7 @@ |
||
44 | 44 | <div class="container container-body"> |
45 | 45 | <?php |
46 | 46 | if (!isset($_POST['import'])) { |
47 | - echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>"; |
|
47 | + echo "<div class=\"element-edit-message\">".$_lang['import_site_message']."</div>"; |
|
48 | 48 | ?> |
49 | 49 | <form action="index.php" method="post" name="importFrm"> |
50 | 50 | <input type="hidden" name="import" value="import"/> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('bk_manager')) { |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | $dbase = trim($dbase, '`'); |
10 | 10 | |
11 | 11 | if (!isset($modx->config['snapshot_path'])) { |
12 | - if (is_dir(MODX_BASE_PATH . 'temp/backup/')) { |
|
13 | - $modx->config['snapshot_path'] = MODX_BASE_PATH . 'temp/backup/'; |
|
12 | + if (is_dir(MODX_BASE_PATH.'temp/backup/')) { |
|
13 | + $modx->config['snapshot_path'] = MODX_BASE_PATH.'temp/backup/'; |
|
14 | 14 | } else { |
15 | - $modx->config['snapshot_path'] = MODX_BASE_PATH . 'assets/backup/'; |
|
15 | + $modx->config['snapshot_path'] = MODX_BASE_PATH.'assets/backup/'; |
|
16 | 16 | } |
17 | 17 | } |
18 | 18 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | if ($mode == 'restore1') { |
24 | 24 | if (isset($_POST['textarea']) && !empty($_POST['textarea'])) { |
25 | 25 | $source = trim($_POST['textarea']); |
26 | - $_SESSION['textarea'] = $source . "\n"; |
|
26 | + $_SESSION['textarea'] = $source."\n"; |
|
27 | 27 | } else { |
28 | 28 | $source = file_get_contents($_FILES['sqlfile']['tmp_name']); |
29 | 29 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | header('Location: index.php?r=9&a=93'); |
32 | 32 | exit; |
33 | 33 | } elseif ($mode == 'restore2') { |
34 | - $path = $modx->config['snapshot_path'] . $_POST['filename']; |
|
34 | + $path = $modx->config['snapshot_path'].$_POST['filename']; |
|
35 | 35 | if (file_exists($path)) { |
36 | 36 | $source = file_get_contents($path); |
37 | 37 | import_sql($source); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | if (!is_writable(rtrim($modx->config['snapshot_path'], '/'))) { |
78 | 78 | $modx->webAlertAndQuit(parsePlaceholder($_lang["bkmgr_alert_mkdir"], array('snapshot_path' => $modx->config['snapshot_path']))); |
79 | 79 | } |
80 | - $sql = "SHOW TABLE STATUS FROM `{$dbase}` LIKE '" . $modx->db->escape($modx->db->config['table_prefix']) . "%'"; |
|
80 | + $sql = "SHOW TABLE STATUS FROM `{$dbase}` LIKE '".$modx->db->escape($modx->db->config['table_prefix'])."%'"; |
|
81 | 81 | $rs = $modx->db->query($sql); |
82 | 82 | $tables = $modx->db->getColumn('Name', $rs); |
83 | 83 | $today = date('Y-m-d_H-i-s'); |
@@ -109,18 +109,18 @@ discard block |
||
109 | 109 | $modx->webAlertAndQuit('Unable to Backup Database'); |
110 | 110 | } |
111 | 111 | } else { |
112 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; // start normal header |
|
112 | + include_once MODX_MANAGER_PATH."includes/header.inc.php"; // start normal header |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | if (isset($_SESSION['result_msg']) && $_SESSION['result_msg'] != '') { |
116 | 116 | switch ($_SESSION['result_msg']) { |
117 | 117 | case 'import_ok': |
118 | - $ph['result_msg_import'] = '<div class="alert alert-success">' . $_lang["bkmgr_import_ok"] . '</div>'; |
|
119 | - $ph['result_msg_snapshot'] = '<div class="alert alert-success">' . $_lang["bkmgr_import_ok"] . '</div>'; |
|
118 | + $ph['result_msg_import'] = '<div class="alert alert-success">'.$_lang["bkmgr_import_ok"].'</div>'; |
|
119 | + $ph['result_msg_snapshot'] = '<div class="alert alert-success">'.$_lang["bkmgr_import_ok"].'</div>'; |
|
120 | 120 | break; |
121 | 121 | case 'snapshot_ok': |
122 | 122 | $ph['result_msg_import'] = ''; |
123 | - $ph['result_msg_snapshot'] = '<div class="alert alert-success">' . $_lang["bkmgr_snapshot_ok"] . '</div>'; |
|
123 | + $ph['result_msg_snapshot'] = '<div class="alert alert-success">'.$_lang["bkmgr_snapshot_ok"].'</div>'; |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | $_SESSION['result_msg'] = ''; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | f.style.display = 'none'; |
180 | 180 | } |
181 | 181 | } |
182 | - <?= (isset($_REQUEST['r']) ? " doRefresh(" . $_REQUEST['r'] . ");" : "") ?> |
|
182 | + <?= (isset($_REQUEST['r']) ? " doRefresh(".$_REQUEST['r'].");" : "") ?> |
|
183 | 183 | |
184 | 184 | </script> |
185 | 185 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | </thead> |
224 | 224 | <tbody> |
225 | 225 | <?php |
226 | - $sql = "SHOW TABLE STATUS FROM `{$dbase}` LIKE '" . $modx->db->escape($modx->db->config['table_prefix']) . "%'"; |
|
226 | + $sql = "SHOW TABLE STATUS FROM `{$dbase}` LIKE '".$modx->db->escape($modx->db->config['table_prefix'])."%'"; |
|
227 | 227 | $rs = $modx->db->query($sql); |
228 | 228 | $i = 0; |
229 | 229 | while ($db_status = $modx->db->getRow($rs)) { |
@@ -233,29 +233,29 @@ discard block |
||
233 | 233 | $table_string = ''; |
234 | 234 | } |
235 | 235 | |
236 | - echo '<tr>' . "\n" . '<td><label class="form-check form-check-label"><input type="checkbox" name="chk[]" class="form-check-input" value="' . $db_status['Name'] . '"' . (strstr($table_string, $db_status['Name']) === false ? '' : ' checked="checked"') . ' /><b class="text-primary">' . $db_status['Name'] . '</b></label></td>' . "\n"; |
|
237 | - echo '<td class="text-xs-center">' . (!empty($db_status['Comment']) ? '<i class="' . $_style['actions_help'] . '" data-tooltip="' . $db_status['Comment'] . '"></i>' : '') . '</td>' . "\n"; |
|
238 | - echo '<td class="text-xs-right">' . $db_status['Rows'] . '</td>' . "\n"; |
|
239 | - echo '<td class="text-xs-right">' . $db_status['Collation'] . '</td>' . "\n"; |
|
236 | + echo '<tr>'."\n".'<td><label class="form-check form-check-label"><input type="checkbox" name="chk[]" class="form-check-input" value="'.$db_status['Name'].'"'.(strstr($table_string, $db_status['Name']) === false ? '' : ' checked="checked"').' /><b class="text-primary">'.$db_status['Name'].'</b></label></td>'."\n"; |
|
237 | + echo '<td class="text-xs-center">'.(!empty($db_status['Comment']) ? '<i class="'.$_style['actions_help'].'" data-tooltip="'.$db_status['Comment'].'"></i>' : '').'</td>'."\n"; |
|
238 | + echo '<td class="text-xs-right">'.$db_status['Rows'].'</td>'."\n"; |
|
239 | + echo '<td class="text-xs-right">'.$db_status['Collation'].'</td>'."\n"; |
|
240 | 240 | |
241 | 241 | // Enable record deletion for certain tables (TRUNCATE TABLE) if they're not already empty |
242 | 242 | $truncateable = array( |
243 | - $modx->db->config['table_prefix'] . 'event_log', |
|
244 | - $modx->db->config['table_prefix'] . 'manager_log', |
|
243 | + $modx->db->config['table_prefix'].'event_log', |
|
244 | + $modx->db->config['table_prefix'].'manager_log', |
|
245 | 245 | ); |
246 | 246 | if ($modx->hasPermission('settings') && in_array($db_status['Name'], $truncateable) && $db_status['Rows'] > 0) { |
247 | - echo '<td class="text-xs-right"><a class="text-danger" href="index.php?a=54&mode=' . $action . '&u=' . $db_status['Name'] . '" title="' . $_lang['truncate_table'] . '">' . $modx->nicesize($db_status['Data_length'] + $db_status['Data_free']) . '</a>' . '</td>' . "\n"; |
|
247 | + echo '<td class="text-xs-right"><a class="text-danger" href="index.php?a=54&mode='.$action.'&u='.$db_status['Name'].'" title="'.$_lang['truncate_table'].'">'.$modx->nicesize($db_status['Data_length'] + $db_status['Data_free']).'</a>'.'</td>'."\n"; |
|
248 | 248 | } else { |
249 | - echo '<td class="text-xs-right">' . $modx->nicesize($db_status['Data_length'] + $db_status['Data_free']) . '</td>' . "\n"; |
|
249 | + echo '<td class="text-xs-right">'.$modx->nicesize($db_status['Data_length'] + $db_status['Data_free']).'</td>'."\n"; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | if ($modx->hasPermission('settings')) { |
253 | - echo '<td class="text-xs-right">' . ($db_status['Data_free'] > 0 ? '<a class="text-danger" href="index.php?a=54&mode=' . $action . '&t=' . $db_status['Name'] . '" title="' . $_lang['optimize_table'] . '">' . $modx->nicesize($db_status['Data_free']) . '</a>' : '-') . '</td>' . "\n"; |
|
253 | + echo '<td class="text-xs-right">'.($db_status['Data_free'] > 0 ? '<a class="text-danger" href="index.php?a=54&mode='.$action.'&t='.$db_status['Name'].'" title="'.$_lang['optimize_table'].'">'.$modx->nicesize($db_status['Data_free']).'</a>' : '-').'</td>'."\n"; |
|
254 | 254 | } else { |
255 | - echo '<td class="text-xs-right">' . ($db_status['Data_free'] > 0 ? $modx->nicesize($db_status['Data_free']) : '-') . '</td>' . "\n"; |
|
255 | + echo '<td class="text-xs-right">'.($db_status['Data_free'] > 0 ? $modx->nicesize($db_status['Data_free']) : '-').'</td>'."\n"; |
|
256 | 256 | } |
257 | 257 | |
258 | - echo '<td class="text-xs-right">' . $modx->nicesize($db_status['Data_length'] - $db_status['Data_free']) . '</td>' . "\n" . '<td class="text-xs-right">' . $modx->nicesize($db_status['Index_length']) . '</td>' . "\n" . '<td class="text-xs-right">' . $modx->nicesize($db_status['Index_length'] + $db_status['Data_length'] + $db_status['Data_free']) . '</td>' . "\n" . "</tr>"; |
|
258 | + echo '<td class="text-xs-right">'.$modx->nicesize($db_status['Data_length'] - $db_status['Data_free']).'</td>'."\n".'<td class="text-xs-right">'.$modx->nicesize($db_status['Index_length']).'</td>'."\n".'<td class="text-xs-right">'.$modx->nicesize($db_status['Index_length'] + $db_status['Data_length'] + $db_status['Data_free']).'</td>'."\n"."</tr>"; |
|
259 | 259 | |
260 | 260 | $total = $total + $db_status['Index_length'] + $db_status['Data_length']; |
261 | 261 | $totaloverhead = $totaloverhead + $db_status['Data_free']; |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | <tr> |
267 | 267 | <td class="text-xs-right"><?= $_lang['database_table_totals'] ?></td> |
268 | 268 | <td colspan="4"> </td> |
269 | - <td class="text-xs-right"><?= $totaloverhead > 0 ? '<b class="text-danger">' . $modx->nicesize($totaloverhead) . '</b><br />(' . number_format($totaloverhead) . ' B)' : '-' ?></td> |
|
269 | + <td class="text-xs-right"><?= $totaloverhead > 0 ? '<b class="text-danger">'.$modx->nicesize($totaloverhead).'</b><br />('.number_format($totaloverhead).' B)' : '-' ?></td> |
|
270 | 270 | <td colspan="2"> </td> |
271 | - <td class="text-xs-right"><?= "<b>" . $modx->nicesize($total) . "</b><br />(" . number_format($total) . " B)" ?></td> |
|
271 | + <td class="text-xs-right"><?= "<b>".$modx->nicesize($total)."</b><br />(".number_format($total)." B)" ?></td> |
|
272 | 272 | </tr> |
273 | 273 | </tfoot> |
274 | 274 | </table> |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | foreach ($last_result['0'] as $k => $v) { |
320 | 320 | $title[] = $k; |
321 | 321 | } |
322 | - $result = '<thead><tr><th>' . implode('</th><th>', $title) . '</th></tr></thead>'; |
|
322 | + $result = '<thead><tr><th>'.implode('</th><th>', $title).'</th></tr></thead>'; |
|
323 | 323 | $result .= '<tbody>'; |
324 | 324 | foreach ($last_result as $row) { |
325 | 325 | $result_value = array(); |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | foreach ($row as $k => $v) { |
328 | 328 | $result_value[] = $v; |
329 | 329 | } |
330 | - $result .= '<tr><td>' . implode('</td><td>', $result_value) . '</td></tr>'; |
|
330 | + $result .= '<tr><td>'.implode('</td><td>', $result_value).'</td></tr>'; |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | $result .= '</tbody>'; |
334 | - $result = '<table class="table data">' . $result . '</table>'; |
|
334 | + $result = '<table class="table data">'.$result.'</table>'; |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | while ($count < 11) { |
434 | 434 | $line = fgets($file); |
435 | 435 | foreach ($detailFields as $label) { |
436 | - $fileLabel = '# ' . $label; |
|
436 | + $fileLabel = '# '.$label; |
|
437 | 437 | if (strpos($line, $fileLabel) !== false) { |
438 | 438 | $details[$label] = htmlentities(trim(str_replace(array( |
439 | 439 | $fileLabel, |
@@ -446,10 +446,10 @@ discard block |
||
446 | 446 | }; |
447 | 447 | fclose($file); |
448 | 448 | |
449 | - $tooltip = "Generation Time: " . $details["Generation Time"] . "\n"; |
|
450 | - $tooltip .= "Server version: " . $details["Server version"] . "\n"; |
|
451 | - $tooltip .= "PHP Version: " . $details["PHP Version"] . "\n"; |
|
452 | - $tooltip .= "Host: " . $details["Host"] . "\n"; |
|
449 | + $tooltip = "Generation Time: ".$details["Generation Time"]."\n"; |
|
450 | + $tooltip .= "Server version: ".$details["Server version"]."\n"; |
|
451 | + $tooltip .= "PHP Version: ".$details["PHP Version"]."\n"; |
|
452 | + $tooltip .= "Host: ".$details["Host"]."\n"; |
|
453 | 453 | ?> |
454 | 454 | <tr> |
455 | 455 | <td><?= $filename ?></td> |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | <?php |
482 | 482 | |
483 | 483 | if (is_numeric($_GET['tab'])) { |
484 | - echo '<script type="text/javascript">tpDBM.setSelectedIndex( ' . $_GET['tab'] . ' );</script>'; |
|
484 | + echo '<script type="text/javascript">tpDBM.setSelectedIndex( '.$_GET['tab'].' );</script>'; |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | include_once "footer.inc.php"; // send footer |
@@ -491,4 +491,6 @@ |
||
491 | 491 | /** |
492 | 492 | * @deprecated use EvolutionCMS\Support\MysqlDumper |
493 | 493 | */ |
494 | -class Mysqldumper extends EvolutionCMS\Support\MysqlDumper{} |
|
494 | +class Mysqldumper extends EvolutionCMS\Support\MysqlDumper |
|
495 | +{ |
|
496 | +} |