@@ -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_user')) { |
|
5 | +if (!$modx->hasPermission('save_user')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | $input = $_POST; |
16 | 16 | |
17 | -$id = (int)$input['id']; |
|
17 | +$id = (int) $input['id']; |
|
18 | 18 | $oldusername = $input['oldusername']; |
19 | 19 | $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User"; |
20 | 20 | $fullname = $input['fullname']; |
@@ -44,56 +44,56 @@ discard block |
||
44 | 44 | $user_groups = $input['user_groups']; |
45 | 45 | |
46 | 46 | // verify password |
47 | -if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
47 | +if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
48 | 48 | webAlertAndQuit("Password typed is mismatched"); |
49 | 49 | } |
50 | 50 | |
51 | 51 | // verify email |
52 | -if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
52 | +if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
53 | 53 | webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
54 | 54 | } |
55 | 55 | |
56 | 56 | // verify admin security |
57 | -if($_SESSION['mgrRole'] != 1) { |
|
57 | +if ($_SESSION['mgrRole'] != 1) { |
|
58 | 58 | // Check to see if user tried to spoof a "1" (admin) role |
59 | - if(!$modx->hasPermission('save_role')) { |
|
59 | + if (!$modx->hasPermission('save_role')) { |
|
60 | 60 | webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!"); |
61 | 61 | } |
62 | 62 | // Verify that the user being edited wasn't an admin and the user ID got spoofed |
63 | 63 | $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1"); |
64 | 64 | $limit = $modx->db->getValue($rs); |
65 | - if($limit > 0) { |
|
65 | + if ($limit > 0) { |
|
66 | 66 | webAlertAndQuit("You cannot alter an administrative user."); |
67 | 67 | } |
68 | 68 | |
69 | 69 | } |
70 | 70 | |
71 | -switch($input['mode']) { |
|
71 | +switch ($input['mode']) { |
|
72 | 72 | case '11' : // new user |
73 | 73 | // check if this user name already exist |
74 | 74 | $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername))); |
75 | 75 | $limit = $modx->db->getValue($rs); |
76 | - if($limit > 0) { |
|
76 | + if ($limit > 0) { |
|
77 | 77 | webAlertAndQuit("User name is already in use!"); |
78 | 78 | } |
79 | 79 | |
80 | 80 | // check if the email address already exist |
81 | 81 | $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id)); |
82 | 82 | $limit = $modx->db->getValue($rs); |
83 | - if($limit > 0) { |
|
83 | + if ($limit > 0) { |
|
84 | 84 | webAlertAndQuit("Email is already in use!"); |
85 | 85 | } |
86 | 86 | |
87 | 87 | // generate a new password for this user |
88 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
89 | - if(strlen($specifiedpassword) < 6) { |
|
88 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
89 | + if (strlen($specifiedpassword) < 6) { |
|
90 | 90 | webAlertAndQuit("Password is too short!"); |
91 | 91 | } else { |
92 | 92 | $newpassword = $specifiedpassword; |
93 | 93 | } |
94 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
94 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
95 | 95 | webAlertAndQuit("You didn't specify a password for this user!"); |
96 | - } elseif($passwordgenmethod == 'g') { |
|
96 | + } elseif ($passwordgenmethod == 'g') { |
|
97 | 97 | $newpassword = generate_password(8); |
98 | 98 | } else { |
99 | 99 | webAlertAndQuit("No password generation method specified!"); |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | /*******************************************************************************/ |
142 | 142 | // put the user in the user_groups he/ she should be in |
143 | 143 | // first, check that up_perms are switched on! |
144 | - if($use_udperms == 1) { |
|
145 | - if(!empty($user_groups)) { |
|
146 | - for($i = 0; $i < count($user_groups); $i++) { |
|
144 | + if ($use_udperms == 1) { |
|
145 | + if (!empty($user_groups)) { |
|
146 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
147 | 147 | $f = array(); |
148 | - $f['user_group'] = (int)$user_groups[$i]; |
|
148 | + $f['user_group'] = (int) $user_groups[$i]; |
|
149 | 149 | $f['member'] = $internalKey; |
150 | 150 | $modx->db->insert($f, $tbl_member_groups); |
151 | 151 | } |
@@ -153,20 +153,20 @@ discard block |
||
153 | 153 | } |
154 | 154 | // end of user_groups stuff! |
155 | 155 | |
156 | - if($passwordnotifymethod == 'e') { |
|
156 | + if ($passwordnotifymethod == 'e') { |
|
157 | 157 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
158 | - if($input['stay'] != '') { |
|
158 | + if ($input['stay'] != '') { |
|
159 | 159 | $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
160 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
160 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
161 | 161 | header($header); |
162 | 162 | } else { |
163 | 163 | $header = "Location: index.php?a=75&r=2"; |
164 | 164 | header($header); |
165 | 165 | } |
166 | 166 | } else { |
167 | - if($input['stay'] != '') { |
|
167 | + if ($input['stay'] != '') { |
|
168 | 168 | $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
169 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
169 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
170 | 170 | } else { |
171 | 171 | $stayUrl = "index.php?a=75&r=2"; |
172 | 172 | } |
@@ -199,36 +199,36 @@ discard block |
||
199 | 199 | break; |
200 | 200 | case '12' : // edit user |
201 | 201 | // generate a new password for this user |
202 | - if($genpassword == 1) { |
|
203 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
204 | - if(strlen($specifiedpassword) < 6) { |
|
202 | + if ($genpassword == 1) { |
|
203 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
204 | + if (strlen($specifiedpassword) < 6) { |
|
205 | 205 | webAlertAndQuit("Password is too short!"); |
206 | 206 | } else { |
207 | 207 | $newpassword = $specifiedpassword; |
208 | 208 | } |
209 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
209 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
210 | 210 | webAlertAndQuit("You didn't specify a password for this user!"); |
211 | - } elseif($passwordgenmethod == 'g') { |
|
211 | + } elseif ($passwordgenmethod == 'g') { |
|
212 | 212 | $newpassword = generate_password(8); |
213 | 213 | } else { |
214 | 214 | webAlertAndQuit("No password generation method specified!"); |
215 | 215 | } |
216 | 216 | } |
217 | - if($passwordnotifymethod == 'e') { |
|
217 | + if ($passwordnotifymethod == 'e') { |
|
218 | 218 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
219 | 219 | } |
220 | 220 | |
221 | 221 | // check if the username already exist |
222 | 222 | $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id)); |
223 | 223 | $limit = $modx->db->getValue($rs); |
224 | - if($limit > 0) { |
|
224 | + if ($limit > 0) { |
|
225 | 225 | webAlertAndQuit("User name is already in use!"); |
226 | 226 | } |
227 | 227 | |
228 | 228 | // check if the email address already exists |
229 | 229 | $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id)); |
230 | 230 | $limit = $modx->db->getValue($rs); |
231 | - if($limit > 0) { |
|
231 | + if ($limit > 0) { |
|
232 | 232 | webAlertAndQuit("Email is already in use!"); |
233 | 233 | } |
234 | 234 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | // update user name and password |
242 | 242 | $field = array(); |
243 | 243 | $field['username'] = $modx->db->escape($newusername); |
244 | - if($genpassword == 1) { |
|
244 | + if ($genpassword == 1) { |
|
245 | 245 | $field['password'] = $modx->phpass->HashPassword($newpassword); |
246 | 246 | } |
247 | 247 | $modx->db->update($field, $tbl_manager_users, "id='{$id}'"); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | )); |
270 | 270 | |
271 | 271 | // invoke OnManagerChangePassword event |
272 | - if($genpassword == 1) { |
|
272 | + if ($genpassword == 1) { |
|
273 | 273 | $modx->invokeEvent("OnManagerChangePassword", array( |
274 | 274 | "userid" => $id, |
275 | 275 | "username" => $newusername, |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | /*******************************************************************************/ |
287 | 287 | // put the user in the user_groups he/ she should be in |
288 | 288 | // first, check that up_perms are switched on! |
289 | - if($use_udperms == 1) { |
|
289 | + if ($use_udperms == 1) { |
|
290 | 290 | // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
291 | 291 | $modx->db->delete($tbl_member_groups, "member='{$id}'"); |
292 | - if(!empty($user_groups)) { |
|
293 | - for($i = 0; $i < count($user_groups); $i++) { |
|
292 | + if (!empty($user_groups)) { |
|
293 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
294 | 294 | $field = array(); |
295 | - $field['user_group'] = (int)$user_groups[$i]; |
|
295 | + $field['user_group'] = (int) $user_groups[$i]; |
|
296 | 296 | $field['member'] = $id; |
297 | 297 | $modx->db->insert($field, $tbl_member_groups); |
298 | 298 | } |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | } |
301 | 301 | // end of user_groups stuff! |
302 | 302 | /*******************************************************************************/ |
303 | - if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
303 | + if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
304 | 304 | $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
305 | 305 | } |
306 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
307 | - if($input['stay'] != '') { |
|
306 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
307 | + if ($input['stay'] != '') { |
|
308 | 308 | $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
309 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
309 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
310 | 310 | } else { |
311 | 311 | $stayUrl = "index.php?a=75&r=2"; |
312 | 312 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | <div class="sectionHeader"><?php echo $_lang['user_title']; ?></div> |
327 | 327 | <div class="sectionBody"> |
328 | 328 | <div id="disp"> |
329 | - <p><?php echo sprintf($_lang["password_msg"], $modx->htmlspecialchars($newusername), $modx->htmlspecialchars($newpassword)) . (($id == $modx->getLoginUserID()) ? ' ' . $_lang['user_changeddata'] : ''); ?></p> |
|
329 | + <p><?php echo sprintf($_lang["password_msg"], $modx->htmlspecialchars($newusername), $modx->htmlspecialchars($newpassword)).(($id == $modx->getLoginUserID()) ? ' '.$_lang['user_changeddata'] : ''); ?></p> |
|
330 | 330 | </div> |
331 | 331 | </div> |
332 | 332 | </div> |
@@ -334,9 +334,9 @@ discard block |
||
334 | 334 | |
335 | 335 | include_once "footer.inc.php"; |
336 | 336 | } else { |
337 | - if($input['stay'] != '') { |
|
337 | + if ($input['stay'] != '') { |
|
338 | 338 | $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
339 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
339 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
340 | 340 | header($header); |
341 | 341 | } else { |
342 | 342 | $header = "Location: index.php?a=75&r=2"; |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | webAlertAndQuit("No operation set in request."); |
349 | 349 | } |
350 | 350 | |
351 | -if(!function_exists('sendMailMessage')) { |
|
351 | +if (!function_exists('sendMailMessage')) { |
|
352 | 352 | /** |
353 | 353 | * Send an email to the user |
354 | 354 | * |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | -if(!function_exists('saveUserSettings')) { |
|
391 | +if (!function_exists('saveUserSettings')) { |
|
392 | 392 | /** |
393 | 393 | * Save User Settings |
394 | 394 | * |
@@ -456,10 +456,10 @@ discard block |
||
456 | 456 | } |
457 | 457 | |
458 | 458 | foreach ($defaults as $k) { |
459 | - if (isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') { |
|
459 | + if (isset($settings['default_'.$k]) && $settings['default_'.$k] == '1') { |
|
460 | 460 | unset($settings[$k]); |
461 | 461 | } |
462 | - unset($settings['default_' . $k]); |
|
462 | + unset($settings['default_'.$k]); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | $modx->db->delete($tbl_user_settings, "user='{$id}'"); |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | } |
481 | 481 | } |
482 | 482 | |
483 | -if(!function_exists('webAlertAndQuit')) { |
|
483 | +if (!function_exists('webAlertAndQuit')) { |
|
484 | 484 | /** |
485 | 485 | * Web alert - sends an alert to web browser |
486 | 486 | * |
@@ -491,11 +491,11 @@ discard block |
||
491 | 491 | global $id, $modx; |
492 | 492 | $mode = $_POST['mode']; |
493 | 493 | $modx->manager->saveFormValues($mode); |
494 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '12' ? "&id={$id}" : '')); |
|
494 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode == '12' ? "&id={$id}" : '')); |
|
495 | 495 | } |
496 | 496 | } |
497 | 497 | |
498 | -if(!function_exists('generate_password')) { |
|
498 | +if (!function_exists('generate_password')) { |
|
499 | 499 | /** |
500 | 500 | * Generate password |
501 | 501 | * |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | { |
507 | 507 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
508 | 508 | $ps_len = strlen($allowable_characters); |
509 | - mt_srand((double)microtime() * 1000000); |
|
509 | + mt_srand((double) microtime() * 1000000); |
|
510 | 510 | $pass = ""; |
511 | 511 | for ($i = 0; $i < $length; $i++) { |
512 | 512 | $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('new_module')) { |
|
5 | +if (!$modx->hasPermission('new_module')) { |
|
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 | -if(!function_exists('createGUID')) { |
|
14 | +if (!function_exists('createGUID')) { |
|
15 | 15 | /** |
16 | 16 | * create globally unique identifiers (guid) |
17 | 17 | * |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function createGUID() |
21 | 21 | { |
22 | - srand((double)microtime() * 1000000); |
|
22 | + srand((double) microtime() * 1000000); |
|
23 | 23 | $r = rand(); |
24 | - $u = uniqid(getmypid() . $r . (double)microtime() * 1000000, 1); |
|
24 | + $u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1); |
|
25 | 25 | $m = md5($u); |
26 | 26 | |
27 | 27 | return $m; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | // count duplicates |
32 | 32 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
33 | 33 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
34 | -if($count>=1) $count = ' '.($count+1); |
|
34 | +if ($count >= 1) $count = ' '.($count + 1); |
|
35 | 35 | else $count = ''; |
36 | 36 | |
37 | 37 | // duplicate module |
@@ -76,5 +76,5 @@ discard block |
||
76 | 76 | $_SESSION['itemname'] = $name; |
77 | 77 | |
78 | 78 | // finish duplicating - redirect to new module |
79 | -$header="Location: index.php?r=2&a=108&id=$newid"; |
|
79 | +$header = "Location: index.php?r=2&a=108&id=$newid"; |
|
80 | 80 | header($header); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('save_module')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = (int)$_POST['id']; |
|
9 | +$id = (int) $_POST['id']; |
|
10 | 10 | $name = $modx->db->escape(trim($_POST['name'])); |
11 | 11 | $description = $modx->db->escape($_POST['description']); |
12 | 12 | $resourcefile = $modx->db->escape($_POST['resourcefile']); |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | //Kyle Jaebker - added category support |
27 | 27 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
28 | - $categoryid = (int)$_POST['categoryid']; |
|
28 | + $categoryid = (int) $_POST['categoryid']; |
|
29 | 29 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
30 | 30 | $categoryid = 0; |
31 | 31 | } else { |
32 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
32 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
33 | 33 | $categoryid = checkCategory($_POST['newcategory']); |
34 | 34 | if (!$categoryid) { |
35 | 35 | $categoryid = newCategory($_POST['newcategory']); |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | $name = isset($parsed['name']) ? $parsed['name'] : $name; |
46 | 46 | $properties = isset($parsed['properties']) ? $parsed['properties'] : $properties; |
47 | 47 | $guid = isset($parsed['guid']) ? $parsed['guid'] : $guid; |
48 | - $enable_sharedparams = isset($parsed['shareparams']) ? (int)$parsed['shareparams'] : $enable_sharedparams; |
|
48 | + $enable_sharedparams = isset($parsed['shareparams']) ? (int) $parsed['shareparams'] : $enable_sharedparams; |
|
49 | 49 | |
50 | 50 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
51 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
51 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
52 | 52 | if ($version) { |
53 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
53 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
54 | 54 | } |
55 | 55 | if (isset($parsed['modx_category'])) { |
56 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
56 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
57 | 57 | $categoryid = getCategory($parsed['modx_category']); |
58 | 58 | } |
59 | 59 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | // finished emptying cache - redirect |
112 | 112 | if ($_POST['stay'] != '') { |
113 | 113 | $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
114 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
115 | 115 | header($header); |
116 | 116 | } else { |
117 | 117 | $header = "Location: index.php?a=106&r=2"; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | // finished emptying cache - redirect |
169 | 169 | if ($_POST['stay'] != '') { |
170 | 170 | $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
171 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
171 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
172 | 172 | header($header); |
173 | 173 | } else { |
174 | 174 | $modx->unlockElement(6, $id); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $modx->webAlertAndQuit("No operation set in request."); |
181 | 181 | } |
182 | 182 | |
183 | -if(!function_exists('saveUserGroupAccessPermissons')) { |
|
183 | +if (!function_exists('saveUserGroupAccessPermissons')) { |
|
184 | 184 | /** |
185 | 185 | * saves module user group access |
186 | 186 | */ |
@@ -1,20 +1,20 @@ 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('edit_document')) { |
|
5 | +if (!$modx->hasPermission('edit_document')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
|
10 | -$documentID = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
9 | +$newParentID = isset($_REQUEST['new_parent']) ? (int) $_REQUEST['new_parent'] : 0; |
|
10 | +$documentID = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
11 | 11 | |
12 | 12 | // ok, two things to check. |
13 | 13 | // first, document cannot be moved to itself |
14 | 14 | // second, new parent must be a folder. If not, set it to folder. |
15 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
15 | +if ($documentID == $newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | +if ($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | +if ($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
18 | 18 | |
19 | 19 | $parents = $modx->getParentIds($newParentID); |
20 | 20 | if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | -if(!function_exists('allChildren')) { |
|
40 | +if (!function_exists('allChildren')) { |
|
41 | 41 | /** |
42 | 42 | * @param int $currDocID |
43 | 43 | * @return array |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | -$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
|
60 | +$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array( |
|
61 | 61 | "id_document" => $documentID, |
62 | 62 | "old_parent" => $oldparent, |
63 | 63 | "new_parent" => $newParentID |
64 | 64 | )); |
65 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
65 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
66 | 66 | $newParent = array_pop($evtOut); |
67 | - if($newParent == $oldparent) { |
|
67 | + if ($newParent == $oldparent) { |
|
68 | 68 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
69 | - }else{ |
|
69 | + } else { |
|
70 | 70 | $newParentID = $newParent; |
71 | 71 | } |
72 | 72 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
88 | 88 | $limit = $modx->db->getValue($rs); |
89 | 89 | |
90 | - if(!$limit>0) { |
|
90 | + if (!$limit > 0) { |
|
91 | 91 | $modx->db->update(array( |
92 | 92 | 'isfolder' => 0, |
93 | 93 | ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
97 | 97 | $_SESSION['itemname'] = $pagetitle; |
98 | 98 | |
99 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
99 | + $modx->invokeEvent("onAfterMoveDocument", array( |
|
100 | 100 | "id_document" => $documentID, |
101 | 101 | "old_parent" => $oldparent, |
102 | 102 | "new_parent" => $newParentID |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | // empty cache & sync site |
106 | 106 | $modx->clearCache('full'); |
107 | 107 | |
108 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
108 | + $header = "Location: index.php?a=3&id={$documentID}&r=9"; |
|
109 | 109 | header($header); |
110 | 110 | } else { |
111 | 111 | $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
@@ -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 = sanitize($v); |
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"); |
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!"); |
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!"); |
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!"); |
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!"); |
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!"); |
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!"); |
@@ -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 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
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!"); |
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!"); |
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!"); |
206 | 206 | } |
207 | 207 | } |
208 | - if($passwordnotifymethod == 'e') { |
|
208 | + if ($passwordnotifymethod == 'e') { |
|
209 | 209 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
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!"); |
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!"); |
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"; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | webAlertAndQuit("No operation set in request."); |
339 | 339 | } |
340 | 340 | |
341 | -if(!function_exists('save_user_quoted_printable')) { |
|
341 | +if (!function_exists('save_user_quoted_printable')) { |
|
342 | 342 | /** |
343 | 343 | * in case any plugins include a quoted_printable function |
344 | 344 | * |
@@ -348,18 +348,18 @@ discard block |
||
348 | 348 | function save_user_quoted_printable($string) |
349 | 349 | { |
350 | 350 | $crlf = "\n"; |
351 | - $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
|
351 | + $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string).$crlf; |
|
352 | 352 | $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
353 | 353 | $r[] = "'=' . sprintf('%02X', ord('\\1'))"; |
354 | - $f[] = '/([\011\040])' . $crlf . '/e'; |
|
355 | - $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'"; |
|
354 | + $f[] = '/([\011\040])'.$crlf.'/e'; |
|
355 | + $r[] = "'=' . sprintf('%02X', ord('\\1')) . '".$crlf."'"; |
|
356 | 356 | $string = preg_replace($f, $r, $string); |
357 | 357 | |
358 | - return trim(wordwrap($string, 70, ' =' . $crlf)); |
|
358 | + return trim(wordwrap($string, 70, ' ='.$crlf)); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
362 | -if(!function_exists('sendMailMessage')) { |
|
362 | +if (!function_exists('sendMailMessage')) { |
|
363 | 363 | /** |
364 | 364 | * Send an email to the user |
365 | 365 | * |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | } |
399 | 399 | } |
400 | 400 | |
401 | -if(!function_exists('saveUserSettings')) { |
|
401 | +if (!function_exists('saveUserSettings')) { |
|
402 | 402 | // Save User Settings |
403 | 403 | function saveUserSettings($id) |
404 | 404 | { |
@@ -430,24 +430,24 @@ discard block |
||
430 | 430 | } |
431 | 431 | } |
432 | 432 | |
433 | -if(!function_exists('webAlertAndQuit')) { |
|
433 | +if (!function_exists('webAlertAndQuit')) { |
|
434 | 434 | // Web alert - sends an alert to web browser |
435 | 435 | function webAlertAndQuit($msg) |
436 | 436 | { |
437 | 437 | global $id, $modx; |
438 | 438 | $mode = $_POST['mode']; |
439 | 439 | $modx->manager->saveFormValues($mode); |
440 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : '')); |
|
440 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode == '88' ? "&id={$id}" : '')); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | |
444 | -if(!function_exists('generate_password')) { |
|
444 | +if (!function_exists('generate_password')) { |
|
445 | 445 | // Generate password |
446 | 446 | function generate_password($length = 10) |
447 | 447 | { |
448 | 448 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
449 | 449 | $ps_len = strlen($allowable_characters); |
450 | - mt_srand((double)microtime() * 1000000); |
|
450 | + mt_srand((double) microtime() * 1000000); |
|
451 | 451 | $pass = ""; |
452 | 452 | for ($i = 0; $i < $length; $i++) { |
453 | 453 | $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | } |
458 | 458 | } |
459 | 459 | |
460 | -if(!function_exists('sanitize')) { |
|
460 | +if (!function_exists('sanitize')) { |
|
461 | 461 | function sanitize($str = '', $safecount = 0) |
462 | 462 | { |
463 | 463 | $modx = evolutionCMS(); |
@@ -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 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
37 | 37 | } |
38 | 38 | |
39 | -if (! function_exists('getChildren')) { |
|
39 | +if (!function_exists('getChildren')) { |
|
40 | 40 | /** |
41 | 41 | * @param int $parent |
42 | 42 | */ |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | "children"=>$children |
82 | 82 | )); |
83 | 83 | |
84 | -if (count($children)>0) { |
|
84 | +if (count($children) > 0) { |
|
85 | 85 | $modx->db->update( |
86 | 86 | array( |
87 | 87 | 'deleted' => 1, |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | ), $modx->getFullTableName('site_content'), "id IN (".implode(", ", $children).")"); |
91 | 91 | } |
92 | 92 | |
93 | -if ($site_start==$id) { |
|
93 | +if ($site_start == $id) { |
|
94 | 94 | $modx->webAlertAndQuit("Document is 'Site start' and cannot be deleted!"); |
95 | 95 | } |
96 | 96 | |
97 | -if ($site_unavailable_page==$id) { |
|
97 | +if ($site_unavailable_page == $id) { |
|
98 | 98 | $modx->webAlertAndQuit("Document is used as the 'Site unavailable page' and cannot be deleted!"); |
99 | 99 | } |
100 | 100 | |
101 | -if ($error_page==$id) { |
|
101 | +if ($error_page == $id) { |
|
102 | 102 | $modx->webAlertAndQuit("Document is used as the 'Site error page' and cannot be deleted!"); |
103 | 103 | } |
104 | 104 | |
105 | -if ($unauthorized_page==$id) { |
|
105 | +if ($unauthorized_page == $id) { |
|
106 | 106 | $modx->webAlertAndQuit("Document is used as the 'Site unauthorized page' and cannot be deleted!"); |
107 | 107 | } |
108 | 108 | |
@@ -128,5 +128,5 @@ discard block |
||
128 | 128 | $modx->clearCache('full'); |
129 | 129 | |
130 | 130 | // finished emptying cache - redirect |
131 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
131 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
132 | 132 | header($header); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('save_template')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = (int)$_POST['id']; |
|
9 | +$id = (int) $_POST['id']; |
|
10 | 10 | $name = $modx->db->escape(trim($_POST['name'])); |
11 | 11 | $description = $modx->db->escape($_POST['description']); |
12 | 12 | $caption = $modx->db->escape($_POST['caption']); |
@@ -17,17 +17,17 @@ discard block |
||
17 | 17 | $display = $modx->db->escape($_POST['display']); |
18 | 18 | $params = $modx->db->escape($_POST['params']); |
19 | 19 | $locked = $_POST['locked'] == 'on' ? 1 : 0; |
20 | -$origin = isset($_REQUEST['or']) ? (int)$_REQUEST['or'] : 76; |
|
21 | -$originId = isset($_REQUEST['oid']) ? (int)$_REQUEST['oid'] : null; |
|
20 | +$origin = isset($_REQUEST['or']) ? (int) $_REQUEST['or'] : 76; |
|
21 | +$originId = isset($_REQUEST['oid']) ? (int) $_REQUEST['oid'] : null; |
|
22 | 22 | $currentdate = time() + $modx->config['server_offset_time']; |
23 | 23 | |
24 | 24 | //Kyle Jaebker - added category support |
25 | 25 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
26 | - $categoryid = (int)$_POST['categoryid']; |
|
26 | + $categoryid = (int) $_POST['categoryid']; |
|
27 | 27 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
28 | 28 | $categoryid = 0; |
29 | 29 | } else { |
30 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
30 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
31 | 31 | $categoryid = checkCategory($_POST['newcategory']); |
32 | 32 | if (!$categoryid) { |
33 | 33 | $categoryid = newCategory($_POST['newcategory']); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // finished emptying cache - redirect |
100 | 100 | if ($_POST['stay'] != '') { |
101 | 101 | $a = ($_POST['stay'] == '2') ? "301&id=$newid" : "300"; |
102 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
102 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
103 | 103 | header($header); |
104 | 104 | } else { |
105 | 105 | $header = "Location: index.php?a=76&r=2"; |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | // finished emptying cache - redirect |
161 | 161 | if ($_POST['stay'] != '') { |
162 | 162 | $a = ($_POST['stay'] == '2') ? "301&id=$id" : "300"; |
163 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'] . "&or=" . $origin . "&oid=" . $originId; |
|
163 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']."&or=".$origin."&oid=".$originId; |
|
164 | 164 | header($header); |
165 | 165 | } else { |
166 | 166 | $modx->unlockElement(2, $id); |
167 | - $header = "Location: index.php?a=" . $origin . "&r=2" . (empty($originId) ? '' : '&id=' . $originId); |
|
167 | + $header = "Location: index.php?a=".$origin."&r=2".(empty($originId) ? '' : '&id='.$originId); |
|
168 | 168 | header($header); |
169 | 169 | } |
170 | 170 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $modx->webAlertAndQuit("No operation set in request."); |
174 | 174 | } |
175 | 175 | |
176 | -if(!function_exists('saveTemplateVarAccess')) { |
|
176 | +if (!function_exists('saveTemplateVarAccess')) { |
|
177 | 177 | /** |
178 | 178 | * @return void |
179 | 179 | */ |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | -if(!function_exists('saveDocumentAccessPermissons')) { |
|
215 | +if (!function_exists('saveDocumentAccessPermissons')) { |
|
216 | 216 | function saveDocumentAccessPermissons() |
217 | 217 | { |
218 | 218 | global $id, $newid; |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if(!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) { |
|
5 | +if (!$modx->hasPermission('new_document') || !$modx->hasPermission('save_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 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $udperms->role = $_SESSION['mgrRole']; |
21 | 21 | $udperms->duplicateDoc = true; |
22 | 22 | |
23 | -if(!$udperms->checkPermissions()) { |
|
23 | +if (!$udperms->checkPermissions()) { |
|
24 | 24 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
25 | 25 | } |
26 | 26 | |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $_SESSION['itemname'] = $name; |
33 | 33 | |
34 | 34 | // finish cloning - redirect |
35 | -$header="Location: index.php?r=1&a=3&id=$id"; |
|
35 | +$header = "Location: index.php?r=1&a=3&id=$id"; |
|
36 | 36 | header($header); |
37 | 37 | |
38 | -if(!function_exists('duplicateDocument')) { |
|
38 | +if (!function_exists('duplicateDocument')) { |
|
39 | 39 | /** |
40 | 40 | * @param int $docid |
41 | 41 | * @param null|int $parent |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), |
90 | 90 | "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
91 | 91 | if ($count >= 1) { |
92 | - $count = ' ' . ($count + 1); |
|
92 | + $count = ' '.($count + 1); |
|
93 | 93 | } else { |
94 | 94 | $count = ''; |
95 | 95 | } |
96 | 96 | |
97 | - $content['pagetitle'] = $_lang['duplicated_el_suffix'] . $count . ' ' . $content['pagetitle']; |
|
97 | + $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
|
98 | 98 | $content['alias'] = null; |
99 | 99 | } elseif ($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
100 | 100 | $content['alias'] = null; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | -if(!function_exists('duplicateTVs')) { |
|
155 | +if (!function_exists('duplicateTVs')) { |
|
156 | 156 | /** |
157 | 157 | * Duplicate Document TVs |
158 | 158 | * |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | |
166 | 166 | $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
167 | 167 | |
168 | - $newid = (int)$newid; |
|
169 | - $oldid = (int)$oldid; |
|
168 | + $newid = (int) $newid; |
|
169 | + $oldid = (int) $oldid; |
|
170 | 170 | |
171 | 171 | $modx->db->insert( |
172 | 172 | array('contentid' => '', 'tmplvarid' => '', 'value' => ''), $tbltvc, // Insert into |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | } |
177 | 177 | |
178 | -if(!function_exists('duplicateAccess')) { |
|
178 | +if (!function_exists('duplicateAccess')) { |
|
179 | 179 | /** |
180 | 180 | * Duplicate Document Access Permissions |
181 | 181 | * |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | |
189 | 189 | $tbldg = $modx->getFullTableName('document_groups'); |
190 | 190 | |
191 | - $newid = (int)$newid; |
|
192 | - $oldid = (int)$oldid; |
|
191 | + $newid = (int) $newid; |
|
192 | + $oldid = (int) $oldid; |
|
193 | 193 | |
194 | 194 | $modx->db->insert( |
195 | 195 | array('document' => '', 'document_group' => ''), $tbldg, // Insert into |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * |
13 | 13 | */ |
14 | 14 | |
15 | -if (! function_exists('rmdirRecursive')) { |
|
15 | +if (!function_exists('rmdirRecursive')) { |
|
16 | 16 | /** |
17 | 17 | * rmdirRecursive - detects symbollic links on unix |
18 | 18 | * |
@@ -37,18 +37,18 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | $msg = ''; |
40 | -$pth = dirname(dirname(__DIR__)) . '/install/'; |
|
40 | +$pth = dirname(dirname(__DIR__)).'/install/'; |
|
41 | 41 | $pth = str_replace('\\', '/', $pth); |
42 | 42 | |
43 | 43 | if (isset($_GET['rminstall'])) { |
44 | 44 | if (is_dir($pth)) { |
45 | - if (! rmdirRecursive($pth)) { |
|
45 | + if (!rmdirRecursive($pth)) { |
|
46 | 46 | $msg = 'An error occured while attempting to remove the install folder'; |
47 | 47 | } |
48 | 48 | } |
49 | 49 | } |
50 | 50 | if ($msg) { |
51 | - echo "<script>alert('" . addslashes($msg) . "');</script>"; |
|
51 | + echo "<script>alert('".addslashes($msg)."');</script>"; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | echo "<script>window.location='../index.php?a=2';</script>"; |