@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('settings')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $modx->db->truncate($modx->getFullTableName('manager_log')); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('settings')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('settings')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | 7 | $modx->db->truncate($modx->getFullTableName('manager_log')); |
8 | 8 | |
9 | -$header="Location: index.php?a=13"; |
|
9 | +$header = "Location: index.php?a=13"; |
|
10 | 10 | header($header); |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('settings')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('delete_module')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // Set the item name for logger |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | |
16 | 16 | // invoke OnBeforeModFormDelete event |
17 | 17 | $modx->invokeEvent("OnBeforeModFormDelete", |
18 | - array( |
|
19 | - "id" => $id |
|
20 | - )); |
|
18 | + array( |
|
19 | + "id" => $id |
|
20 | + )); |
|
21 | 21 | |
22 | 22 | // delete the module. |
23 | 23 | $modx->db->delete($modx->getFullTableName('site_modules'), "id='{$id}'"); |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | |
31 | 31 | // invoke OnModFormDelete event |
32 | 32 | $modx->invokeEvent("OnModFormDelete", |
33 | - array( |
|
34 | - "id" => $id |
|
35 | - )); |
|
33 | + array( |
|
34 | + "id" => $id |
|
35 | + )); |
|
36 | 36 | |
37 | 37 | // empty cache |
38 | 38 | $modx->clearCache('full'); |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('delete_module')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('delete_module')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
@@ -38,5 +38,5 @@ discard block |
||
38 | 38 | $modx->clearCache('full'); |
39 | 39 | |
40 | 40 | // finished emptying cache - redirect |
41 | -$header="Location: index.php?a=106&r=2"; |
|
41 | +$header = "Location: index.php?a=106&r=2"; |
|
42 | 42 | header($header); |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('delete_module')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('save_password')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = $_POST['id']; |
@@ -9,26 +9,26 @@ discard block |
||
9 | 9 | $pass2 = $_POST['pass2']; |
10 | 10 | |
11 | 11 | if($pass1!=$pass2){ |
12 | - $modx->webAlertAndQuit("Passwords don't match!"); |
|
12 | + $modx->webAlertAndQuit("Passwords don't match!"); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | if(strlen($pass1)<6){ |
16 | - $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
|
16 | + $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | $pass1 = $modx->htmlspecialchars($pass1, ENT_NOQUOTES); |
20 | - $tbl_manager_users = $modx->getFullTableName('manager_users'); |
|
21 | - $uid = $modx->getLoginUserID(); |
|
22 | - $modx->loadExtension('phpass'); |
|
23 | - $f['password'] = $modx->phpass->HashPassword($pass1); |
|
24 | - $modx->db->update($f,$tbl_manager_users,"id='{$uid}'"); |
|
20 | + $tbl_manager_users = $modx->getFullTableName('manager_users'); |
|
21 | + $uid = $modx->getLoginUserID(); |
|
22 | + $modx->loadExtension('phpass'); |
|
23 | + $f['password'] = $modx->phpass->HashPassword($pass1); |
|
24 | + $modx->db->update($f,$tbl_manager_users,"id='{$uid}'"); |
|
25 | 25 | |
26 | - // invoke OnManagerChangePassword event |
|
27 | - $modx->invokeEvent('OnManagerChangePassword', array ( |
|
28 | - 'userid' => $uid, |
|
29 | - 'username' => $_SESSION['mgrShortname'], |
|
30 | - 'userpassword' => $pass1 |
|
31 | - )); |
|
26 | + // invoke OnManagerChangePassword event |
|
27 | + $modx->invokeEvent('OnManagerChangePassword', array ( |
|
28 | + 'userid' => $uid, |
|
29 | + 'username' => $_SESSION['mgrShortname'], |
|
30 | + 'userpassword' => $pass1 |
|
31 | + )); |
|
32 | 32 | |
33 | 33 | $header="Location: index.php?a=2"; |
34 | 34 | header($header); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('save_password')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('save_password')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | $pass1 = $_POST['pass1']; |
9 | 9 | $pass2 = $_POST['pass2']; |
10 | 10 | |
11 | -if($pass1!=$pass2){ |
|
11 | +if ($pass1 != $pass2) { |
|
12 | 12 | $modx->webAlertAndQuit("Passwords don't match!"); |
13 | 13 | } |
14 | 14 | |
15 | -if(strlen($pass1)<6){ |
|
15 | +if (strlen($pass1) < 6) { |
|
16 | 16 | $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
17 | 17 | } |
18 | 18 | |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | $uid = $modx->getLoginUserID(); |
22 | 22 | $modx->loadExtension('phpass'); |
23 | 23 | $f['password'] = $modx->phpass->HashPassword($pass1); |
24 | - $modx->db->update($f,$tbl_manager_users,"id='{$uid}'"); |
|
24 | + $modx->db->update($f, $tbl_manager_users, "id='{$uid}'"); |
|
25 | 25 | |
26 | 26 | // invoke OnManagerChangePassword event |
27 | - $modx->invokeEvent('OnManagerChangePassword', array ( |
|
27 | + $modx->invokeEvent('OnManagerChangePassword', array( |
|
28 | 28 | 'userid' => $uid, |
29 | 29 | 'username' => $_SESSION['mgrShortname'], |
30 | 30 | 'userpassword' => $pass1 |
31 | 31 | )); |
32 | 32 | |
33 | -$header="Location: index.php?a=2"; |
|
33 | +$header = "Location: index.php?a=2"; |
|
34 | 34 | header($header); |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('save_password')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -8,11 +10,11 @@ discard block |
||
8 | 10 | $pass1 = $_POST['pass1']; |
9 | 11 | $pass2 = $_POST['pass2']; |
10 | 12 | |
11 | -if($pass1!=$pass2){ |
|
13 | +if($pass1!=$pass2) { |
|
12 | 14 | $modx->webAlertAndQuit("Passwords don't match!"); |
13 | 15 | } |
14 | 16 | |
15 | -if(strlen($pass1)<6){ |
|
17 | +if(strlen($pass1)<6) { |
|
16 | 18 | $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
17 | 19 | } |
18 | 20 |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('delete_snippet')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // Set the item name for logger |
@@ -15,18 +15,18 @@ discard block |
||
15 | 15 | |
16 | 16 | // invoke OnBeforeChunkFormDelete event |
17 | 17 | $modx->invokeEvent("OnBeforeChunkFormDelete", |
18 | - array( |
|
19 | - "id" => $id |
|
20 | - )); |
|
18 | + array( |
|
19 | + "id" => $id |
|
20 | + )); |
|
21 | 21 | |
22 | 22 | // delete the chunk. |
23 | 23 | $modx->db->delete($modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); |
24 | 24 | |
25 | 25 | // invoke OnChunkFormDelete event |
26 | 26 | $modx->invokeEvent("OnChunkFormDelete", |
27 | - array( |
|
28 | - "id" => $id |
|
29 | - )); |
|
27 | + array( |
|
28 | + "id" => $id |
|
29 | + )); |
|
30 | 30 | |
31 | 31 | // empty cache |
32 | 32 | $modx->clearCache('full'); |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('delete_snippet')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('delete_snippet')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
@@ -32,5 +32,5 @@ discard block |
||
32 | 32 | $modx->clearCache('full'); |
33 | 33 | |
34 | 34 | // finished emptying cache - redirect |
35 | -$header="Location: index.php?a=76&r=2"; |
|
35 | +$header = "Location: index.php?a=76&r=2"; |
|
36 | 36 | header($header); |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('delete_snippet')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('access_permissions')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | // access group processor. |
@@ -18,113 +18,113 @@ discard block |
||
18 | 18 | $operation = $_REQUEST['operation']; |
19 | 19 | |
20 | 20 | switch ($operation) { |
21 | - case "add_user_group" : |
|
22 | - $newgroup = $_REQUEST['newusergroup']; |
|
23 | - if(empty($newgroup)) { |
|
24 | - $modx->webAlertAndQuit("No group name specified."); |
|
25 | - } else { |
|
26 | - $id = $modx->db->insert(array('name' => $modx->db->escape($newgroup)), $tbl_membergroup_names); |
|
21 | + case "add_user_group" : |
|
22 | + $newgroup = $_REQUEST['newusergroup']; |
|
23 | + if(empty($newgroup)) { |
|
24 | + $modx->webAlertAndQuit("No group name specified."); |
|
25 | + } else { |
|
26 | + $id = $modx->db->insert(array('name' => $modx->db->escape($newgroup)), $tbl_membergroup_names); |
|
27 | 27 | |
28 | - // invoke OnManagerCreateGroup event |
|
29 | - $modx->invokeEvent('OnManagerCreateGroup', array( |
|
30 | - 'groupid' => $id, |
|
31 | - 'groupname' => $newgroup, |
|
32 | - )); |
|
33 | - } |
|
34 | - break; |
|
35 | - case "add_document_group" : |
|
36 | - $newgroup = $_REQUEST['newdocgroup']; |
|
37 | - if(empty($newgroup)) { |
|
38 | - $modx->webAlertAndQuit("No group name specified."); |
|
39 | - } else { |
|
40 | - $id = $modx->db->insert(array('name' => $modx->db->escape($newgroup)), $tbl_documentgroup_names); |
|
28 | + // invoke OnManagerCreateGroup event |
|
29 | + $modx->invokeEvent('OnManagerCreateGroup', array( |
|
30 | + 'groupid' => $id, |
|
31 | + 'groupname' => $newgroup, |
|
32 | + )); |
|
33 | + } |
|
34 | + break; |
|
35 | + case "add_document_group" : |
|
36 | + $newgroup = $_REQUEST['newdocgroup']; |
|
37 | + if(empty($newgroup)) { |
|
38 | + $modx->webAlertAndQuit("No group name specified."); |
|
39 | + } else { |
|
40 | + $id = $modx->db->insert(array('name' => $modx->db->escape($newgroup)), $tbl_documentgroup_names); |
|
41 | 41 | |
42 | - // invoke OnCreateDocGroup event |
|
43 | - $modx->invokeEvent('OnCreateDocGroup', array( |
|
44 | - 'groupid' => $id, |
|
45 | - 'groupname' => $newgroup, |
|
46 | - )); |
|
47 | - } |
|
48 | - break; |
|
49 | - case "delete_user_group" : |
|
50 | - $updategroupaccess = true; |
|
51 | - $usergroup = intval($_REQUEST['usergroup']); |
|
52 | - if(empty($usergroup)) { |
|
53 | - $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
54 | - } else { |
|
55 | - $modx->db->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
|
42 | + // invoke OnCreateDocGroup event |
|
43 | + $modx->invokeEvent('OnCreateDocGroup', array( |
|
44 | + 'groupid' => $id, |
|
45 | + 'groupname' => $newgroup, |
|
46 | + )); |
|
47 | + } |
|
48 | + break; |
|
49 | + case "delete_user_group" : |
|
50 | + $updategroupaccess = true; |
|
51 | + $usergroup = intval($_REQUEST['usergroup']); |
|
52 | + if(empty($usergroup)) { |
|
53 | + $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
54 | + } else { |
|
55 | + $modx->db->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
|
56 | 56 | |
57 | - $modx->db->delete($tbl_membergroup_access, "membergroup='{$usergroup}'"); |
|
57 | + $modx->db->delete($tbl_membergroup_access, "membergroup='{$usergroup}'"); |
|
58 | 58 | |
59 | - $modx->db->delete($tbl_member_groups, "user_group='{$usergroup}'"); |
|
60 | - } |
|
61 | - break; |
|
62 | - case "delete_document_group" : |
|
63 | - $group = intval($_REQUEST['documentgroup']); |
|
64 | - if(empty($group)) { |
|
65 | - $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
66 | - } else { |
|
67 | - $modx->db->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
59 | + $modx->db->delete($tbl_member_groups, "user_group='{$usergroup}'"); |
|
60 | + } |
|
61 | + break; |
|
62 | + case "delete_document_group" : |
|
63 | + $group = intval($_REQUEST['documentgroup']); |
|
64 | + if(empty($group)) { |
|
65 | + $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
66 | + } else { |
|
67 | + $modx->db->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
68 | 68 | |
69 | - $modx->db->delete($tbl_membergroup_access, "documentgroup='{$group}'"); |
|
69 | + $modx->db->delete($tbl_membergroup_access, "documentgroup='{$group}'"); |
|
70 | 70 | |
71 | - $modx->db->delete($tbl_document_groups, "document_group='{$group}'"); |
|
72 | - } |
|
73 | - break; |
|
74 | - case "rename_user_group" : |
|
75 | - $newgroupname = $_REQUEST['newgroupname']; |
|
76 | - if(empty($newgroupname)) { |
|
77 | - $modx->webAlertAndQuit("No group name specified."); |
|
78 | - } |
|
79 | - $groupid = intval($_REQUEST['groupid']); |
|
80 | - if(empty($groupid)) { |
|
81 | - $modx->webAlertAndQuit("No group id specified for rename."); |
|
82 | - } |
|
71 | + $modx->db->delete($tbl_document_groups, "document_group='{$group}'"); |
|
72 | + } |
|
73 | + break; |
|
74 | + case "rename_user_group" : |
|
75 | + $newgroupname = $_REQUEST['newgroupname']; |
|
76 | + if(empty($newgroupname)) { |
|
77 | + $modx->webAlertAndQuit("No group name specified."); |
|
78 | + } |
|
79 | + $groupid = intval($_REQUEST['groupid']); |
|
80 | + if(empty($groupid)) { |
|
81 | + $modx->webAlertAndQuit("No group id specified for rename."); |
|
82 | + } |
|
83 | 83 | |
84 | - $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_membergroup_names, "id='{$groupid}'"); |
|
85 | - break; |
|
86 | - case "rename_document_group" : |
|
87 | - $newgroupname = $_REQUEST['newgroupname']; |
|
88 | - if(empty($newgroupname)) { |
|
89 | - $modx->webAlertAndQuit("No group name specified."); |
|
90 | - } |
|
91 | - $groupid = intval($_REQUEST['groupid']); |
|
92 | - if(empty($groupid)) { |
|
93 | - $modx->webAlertAndQuit("No group id specified for rename."); |
|
94 | - } |
|
84 | + $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_membergroup_names, "id='{$groupid}'"); |
|
85 | + break; |
|
86 | + case "rename_document_group" : |
|
87 | + $newgroupname = $_REQUEST['newgroupname']; |
|
88 | + if(empty($newgroupname)) { |
|
89 | + $modx->webAlertAndQuit("No group name specified."); |
|
90 | + } |
|
91 | + $groupid = intval($_REQUEST['groupid']); |
|
92 | + if(empty($groupid)) { |
|
93 | + $modx->webAlertAndQuit("No group id specified for rename."); |
|
94 | + } |
|
95 | 95 | |
96 | - $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
97 | - break; |
|
98 | - case "add_document_group_to_user_group" : |
|
99 | - $updategroupaccess = true; |
|
100 | - $usergroup = intval($_REQUEST['usergroup']); |
|
101 | - $docgroup = intval($_REQUEST['docgroup']); |
|
102 | - $rs = $modx->db->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
103 | - $limit = $modx->db->getValue($rs); |
|
104 | - if($limit<=0) { |
|
105 | - $modx->db->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
|
106 | - } else { |
|
107 | - //alert user that coupling already exists? |
|
108 | - } |
|
109 | - break; |
|
110 | - case "remove_document_group_from_user_group" : |
|
111 | - $updategroupaccess = true; |
|
112 | - $coupling = intval($_REQUEST['coupling']); |
|
113 | - $modx->db->delete($tbl_membergroup_access, "id='{$coupling}'"); |
|
114 | - break; |
|
115 | - default : |
|
116 | - $modx->webAlertAndQuit("No operation set in request."); |
|
96 | + $modx->db->update(array('name' => $modx->db->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
97 | + break; |
|
98 | + case "add_document_group_to_user_group" : |
|
99 | + $updategroupaccess = true; |
|
100 | + $usergroup = intval($_REQUEST['usergroup']); |
|
101 | + $docgroup = intval($_REQUEST['docgroup']); |
|
102 | + $rs = $modx->db->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
103 | + $limit = $modx->db->getValue($rs); |
|
104 | + if($limit<=0) { |
|
105 | + $modx->db->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
|
106 | + } else { |
|
107 | + //alert user that coupling already exists? |
|
108 | + } |
|
109 | + break; |
|
110 | + case "remove_document_group_from_user_group" : |
|
111 | + $updategroupaccess = true; |
|
112 | + $coupling = intval($_REQUEST['coupling']); |
|
113 | + $modx->db->delete($tbl_membergroup_access, "id='{$coupling}'"); |
|
114 | + break; |
|
115 | + default : |
|
116 | + $modx->webAlertAndQuit("No operation set in request."); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // secure manager documents - flag as private |
120 | 120 | if($updategroupaccess==true){ |
121 | - include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
122 | - secureMgrDocument(); |
|
121 | + include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
122 | + secureMgrDocument(); |
|
123 | 123 | |
124 | - // Update the private group column |
|
125 | - $modx->db->update( |
|
126 | - 'dgn.private_memgroup = (mga.membergroup IS NOT NULL)', |
|
127 | - "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_membergroup_access} AS mga ON mga.documentgroup = dgn.id"); |
|
124 | + // Update the private group column |
|
125 | + $modx->db->update( |
|
126 | + 'dgn.private_memgroup = (mga.membergroup IS NOT NULL)', |
|
127 | + "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_membergroup_access} AS mga ON mga.documentgroup = dgn.id"); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | $header = "Location: index.php?a=40"; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('access_permissions')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('access_permissions')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | switch ($operation) { |
21 | 21 | case "add_user_group" : |
22 | 22 | $newgroup = $_REQUEST['newusergroup']; |
23 | - if(empty($newgroup)) { |
|
23 | + if (empty($newgroup)) { |
|
24 | 24 | $modx->webAlertAndQuit("No group name specified."); |
25 | 25 | } else { |
26 | 26 | $id = $modx->db->insert(array('name' => $modx->db->escape($newgroup)), $tbl_membergroup_names); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | break; |
35 | 35 | case "add_document_group" : |
36 | 36 | $newgroup = $_REQUEST['newdocgroup']; |
37 | - if(empty($newgroup)) { |
|
37 | + if (empty($newgroup)) { |
|
38 | 38 | $modx->webAlertAndQuit("No group name specified."); |
39 | 39 | } else { |
40 | 40 | $id = $modx->db->insert(array('name' => $modx->db->escape($newgroup)), $tbl_documentgroup_names); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | case "delete_user_group" : |
50 | 50 | $updategroupaccess = true; |
51 | 51 | $usergroup = intval($_REQUEST['usergroup']); |
52 | - if(empty($usergroup)) { |
|
52 | + if (empty($usergroup)) { |
|
53 | 53 | $modx->webAlertAndQuit("No user group id specified for deletion."); |
54 | 54 | } else { |
55 | 55 | $modx->db->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | break; |
62 | 62 | case "delete_document_group" : |
63 | 63 | $group = intval($_REQUEST['documentgroup']); |
64 | - if(empty($group)) { |
|
64 | + if (empty($group)) { |
|
65 | 65 | $modx->webAlertAndQuit("No document group id specified for deletion."); |
66 | 66 | } else { |
67 | 67 | $modx->db->delete($tbl_documentgroup_names, "id='{$group}'"); |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | break; |
74 | 74 | case "rename_user_group" : |
75 | 75 | $newgroupname = $_REQUEST['newgroupname']; |
76 | - if(empty($newgroupname)) { |
|
76 | + if (empty($newgroupname)) { |
|
77 | 77 | $modx->webAlertAndQuit("No group name specified."); |
78 | 78 | } |
79 | 79 | $groupid = intval($_REQUEST['groupid']); |
80 | - if(empty($groupid)) { |
|
80 | + if (empty($groupid)) { |
|
81 | 81 | $modx->webAlertAndQuit("No group id specified for rename."); |
82 | 82 | } |
83 | 83 | |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | break; |
86 | 86 | case "rename_document_group" : |
87 | 87 | $newgroupname = $_REQUEST['newgroupname']; |
88 | - if(empty($newgroupname)) { |
|
88 | + if (empty($newgroupname)) { |
|
89 | 89 | $modx->webAlertAndQuit("No group name specified."); |
90 | 90 | } |
91 | 91 | $groupid = intval($_REQUEST['groupid']); |
92 | - if(empty($groupid)) { |
|
92 | + if (empty($groupid)) { |
|
93 | 93 | $modx->webAlertAndQuit("No group id specified for rename."); |
94 | 94 | } |
95 | 95 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $docgroup = intval($_REQUEST['docgroup']); |
102 | 102 | $rs = $modx->db->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
103 | 103 | $limit = $modx->db->getValue($rs); |
104 | - if($limit<=0) { |
|
104 | + if ($limit <= 0) { |
|
105 | 105 | $modx->db->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
106 | 106 | } else { |
107 | 107 | //alert user that coupling already exists? |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | // secure manager documents - flag as private |
120 | -if($updategroupaccess==true){ |
|
120 | +if ($updategroupaccess == true) { |
|
121 | 121 | include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
122 | 122 | secureMgrDocument(); |
123 | 123 |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('access_permissions')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -117,7 +119,7 @@ discard block |
||
117 | 119 | } |
118 | 120 | |
119 | 121 | // secure manager documents - flag as private |
120 | -if($updategroupaccess==true){ |
|
122 | +if($updategroupaccess==true) { |
|
121 | 123 | include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
122 | 124 | secureMgrDocument(); |
123 | 125 |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(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 = sanitize($v); |
|
17 | - } |
|
18 | - $input[$k] = $v; |
|
15 | + if($k !== 'comment') { |
|
16 | + $v = sanitize($v); |
|
17 | + } |
|
18 | + $input[$k] = $v; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = intval($input['id']); |
@@ -51,80 +51,80 @@ discard block |
||
51 | 51 | |
52 | 52 | // verify password |
53 | 53 | if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
54 | - webAlertAndQuit("Password typed is mismatched"); |
|
54 | + webAlertAndQuit("Password typed is mismatched"); |
|
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!"); |
|
59 | + webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
|
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!"); |
|
69 | - } |
|
70 | - |
|
71 | - // check if the email address already exist |
|
72 | - $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
73 | - $limit = $modx->db->getValue($rs); |
|
74 | - if($limit > 0) { |
|
75 | - webAlertAndQuit("Email is already in use!"); |
|
76 | - } |
|
77 | - |
|
78 | - // generate a new password for this user |
|
79 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
80 | - if(strlen($specifiedpassword) < 6) { |
|
81 | - webAlertAndQuit("Password is too short!"); |
|
82 | - } else { |
|
83 | - $newpassword = $specifiedpassword; |
|
84 | - } |
|
85 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
86 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
87 | - } elseif($passwordgenmethod == 'g') { |
|
88 | - $newpassword = generate_password(8); |
|
89 | - } else { |
|
90 | - webAlertAndQuit("No password generation method specified!"); |
|
91 | - } |
|
92 | - |
|
93 | - // invoke OnBeforeWUsrFormSave event |
|
94 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
95 | - "mode" => "new", |
|
96 | - )); |
|
97 | - |
|
98 | - // create the user account |
|
99 | - $field = array(); |
|
100 | - $field['username'] = $esc_newusername; |
|
101 | - $field['password'] = md5($newpassword); |
|
102 | - $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
103 | - |
|
104 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
105 | - $field = $modx->db->escape($field); |
|
106 | - $modx->db->insert($field, $tbl_web_user_attributes); |
|
107 | - |
|
108 | - // Save User Settings |
|
109 | - saveUserSettings($internalKey); |
|
110 | - |
|
111 | - // Set the item name for logger |
|
112 | - $_SESSION['itemname'] = $newusername; |
|
113 | - |
|
114 | - /*******************************************************************************/ |
|
115 | - // put the user in the user_groups he/ she should be in |
|
116 | - // first, check that up_perms are switched on! |
|
117 | - if($use_udperms == 1) { |
|
118 | - if(!empty($user_groups)) { |
|
119 | - for($i = 0; $i < count($user_groups); $i++) { |
|
120 | - $f = array(); |
|
121 | - $f['webgroup'] = intval($user_groups[$i]); |
|
122 | - $f['webuser'] = $internalKey; |
|
123 | - $modx->db->insert($f, $tbl_web_groups); |
|
124 | - } |
|
125 | - } |
|
126 | - } |
|
127 | - // end of user_groups stuff! |
|
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!"); |
|
69 | + } |
|
70 | + |
|
71 | + // check if the email address already exist |
|
72 | + $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
73 | + $limit = $modx->db->getValue($rs); |
|
74 | + if($limit > 0) { |
|
75 | + webAlertAndQuit("Email is already in use!"); |
|
76 | + } |
|
77 | + |
|
78 | + // generate a new password for this user |
|
79 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
80 | + if(strlen($specifiedpassword) < 6) { |
|
81 | + webAlertAndQuit("Password is too short!"); |
|
82 | + } else { |
|
83 | + $newpassword = $specifiedpassword; |
|
84 | + } |
|
85 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
86 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
87 | + } elseif($passwordgenmethod == 'g') { |
|
88 | + $newpassword = generate_password(8); |
|
89 | + } else { |
|
90 | + webAlertAndQuit("No password generation method specified!"); |
|
91 | + } |
|
92 | + |
|
93 | + // invoke OnBeforeWUsrFormSave event |
|
94 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
95 | + "mode" => "new", |
|
96 | + )); |
|
97 | + |
|
98 | + // create the user account |
|
99 | + $field = array(); |
|
100 | + $field['username'] = $esc_newusername; |
|
101 | + $field['password'] = md5($newpassword); |
|
102 | + $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
103 | + |
|
104 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
105 | + $field = $modx->db->escape($field); |
|
106 | + $modx->db->insert($field, $tbl_web_user_attributes); |
|
107 | + |
|
108 | + // Save User Settings |
|
109 | + saveUserSettings($internalKey); |
|
110 | + |
|
111 | + // Set the item name for logger |
|
112 | + $_SESSION['itemname'] = $newusername; |
|
113 | + |
|
114 | + /*******************************************************************************/ |
|
115 | + // put the user in the user_groups he/ she should be in |
|
116 | + // first, check that up_perms are switched on! |
|
117 | + if($use_udperms == 1) { |
|
118 | + if(!empty($user_groups)) { |
|
119 | + for($i = 0; $i < count($user_groups); $i++) { |
|
120 | + $f = array(); |
|
121 | + $f['webgroup'] = intval($user_groups[$i]); |
|
122 | + $f['webuser'] = $internalKey; |
|
123 | + $modx->db->insert($f, $tbl_web_groups); |
|
124 | + } |
|
125 | + } |
|
126 | + } |
|
127 | + // end of user_groups stuff! |
|
128 | 128 | |
129 | 129 | // invoke OnWebSaveUser event |
130 | 130 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -142,26 +142,26 @@ discard block |
||
142 | 142 | "id" => $internalKey |
143 | 143 | )); |
144 | 144 | |
145 | - if($passwordnotifymethod == 'e') { |
|
146 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
147 | - if($input['stay'] != '') { |
|
148 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
149 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
150 | - header($header); |
|
151 | - } else { |
|
152 | - $header = "Location: index.php?a=99&r=2"; |
|
153 | - header($header); |
|
154 | - } |
|
155 | - } else { |
|
156 | - if($input['stay'] != '') { |
|
157 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
158 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
159 | - } else { |
|
160 | - $stayUrl = "index.php?a=99&r=2"; |
|
161 | - } |
|
162 | - |
|
163 | - include_once "header.inc.php"; |
|
164 | - ?> |
|
145 | + if($passwordnotifymethod == 'e') { |
|
146 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
147 | + if($input['stay'] != '') { |
|
148 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
149 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
150 | + header($header); |
|
151 | + } else { |
|
152 | + $header = "Location: index.php?a=99&r=2"; |
|
153 | + header($header); |
|
154 | + } |
|
155 | + } else { |
|
156 | + if($input['stay'] != '') { |
|
157 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
158 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
159 | + } else { |
|
160 | + $stayUrl = "index.php?a=99&r=2"; |
|
161 | + } |
|
162 | + |
|
163 | + include_once "header.inc.php"; |
|
164 | + ?> |
|
165 | 165 | |
166 | 166 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
167 | 167 | |
@@ -183,84 +183,84 @@ discard block |
||
183 | 183 | </div> |
184 | 184 | <?php |
185 | 185 | |
186 | - include_once "footer.inc.php"; |
|
187 | - } |
|
188 | - break; |
|
189 | - case '88' : // edit user |
|
190 | - // generate a new password for this user |
|
191 | - if($genpassword == 1) { |
|
192 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
193 | - if(strlen($specifiedpassword) < 6) { |
|
194 | - webAlertAndQuit("Password is too short!"); |
|
195 | - } else { |
|
196 | - $newpassword = $specifiedpassword; |
|
197 | - } |
|
198 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
199 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
200 | - } elseif($passwordgenmethod == 'g') { |
|
201 | - $newpassword = generate_password(8); |
|
202 | - } else { |
|
203 | - webAlertAndQuit("No password generation method specified!"); |
|
204 | - } |
|
205 | - } |
|
206 | - if($passwordnotifymethod == 'e') { |
|
207 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
208 | - } |
|
209 | - |
|
210 | - // check if the username already exist |
|
211 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
212 | - $limit = $modx->db->getValue($rs); |
|
213 | - if($limit > 0) { |
|
214 | - webAlertAndQuit("User name is already in use!"); |
|
215 | - } |
|
216 | - |
|
217 | - // check if the email address already exists |
|
218 | - $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
219 | - $limit = $modx->db->getValue($rs); |
|
220 | - if($limit > 0) { |
|
221 | - webAlertAndQuit("Email is already in use!"); |
|
222 | - } |
|
223 | - |
|
224 | - // invoke OnBeforeWUsrFormSave event |
|
225 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
226 | - "mode" => "upd", |
|
227 | - "id" => $id |
|
228 | - )); |
|
229 | - |
|
230 | - // update user name and password |
|
231 | - $field = array(); |
|
232 | - $field['username'] = $esc_newusername; |
|
233 | - if($genpassword == 1) { |
|
234 | - $field['password'] = md5($newpassword); |
|
235 | - } |
|
236 | - $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
237 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
238 | - $field = $modx->db->escape($field); |
|
239 | - $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
240 | - |
|
241 | - // Save User Settings |
|
242 | - saveUserSettings($id); |
|
243 | - |
|
244 | - // Set the item name for logger |
|
245 | - $_SESSION['itemname'] = $newusername; |
|
246 | - |
|
247 | - /*******************************************************************************/ |
|
248 | - // put the user in the user_groups he/ she should be in |
|
249 | - // first, check that up_perms are switched on! |
|
250 | - if($use_udperms == 1) { |
|
251 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
252 | - $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
253 | - if(!empty($user_groups)) { |
|
254 | - for($i = 0; $i < count($user_groups); $i++) { |
|
255 | - $field = array(); |
|
256 | - $field['webgroup'] = intval($user_groups[$i]); |
|
257 | - $field['webuser'] = $id; |
|
258 | - $modx->db->insert($field, $tbl_web_groups); |
|
259 | - } |
|
260 | - } |
|
261 | - } |
|
262 | - // end of user_groups stuff! |
|
263 | - /*******************************************************************************/ |
|
186 | + include_once "footer.inc.php"; |
|
187 | + } |
|
188 | + break; |
|
189 | + case '88' : // edit user |
|
190 | + // generate a new password for this user |
|
191 | + if($genpassword == 1) { |
|
192 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
193 | + if(strlen($specifiedpassword) < 6) { |
|
194 | + webAlertAndQuit("Password is too short!"); |
|
195 | + } else { |
|
196 | + $newpassword = $specifiedpassword; |
|
197 | + } |
|
198 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
199 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
200 | + } elseif($passwordgenmethod == 'g') { |
|
201 | + $newpassword = generate_password(8); |
|
202 | + } else { |
|
203 | + webAlertAndQuit("No password generation method specified!"); |
|
204 | + } |
|
205 | + } |
|
206 | + if($passwordnotifymethod == 'e') { |
|
207 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
208 | + } |
|
209 | + |
|
210 | + // check if the username already exist |
|
211 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
212 | + $limit = $modx->db->getValue($rs); |
|
213 | + if($limit > 0) { |
|
214 | + webAlertAndQuit("User name is already in use!"); |
|
215 | + } |
|
216 | + |
|
217 | + // check if the email address already exists |
|
218 | + $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
219 | + $limit = $modx->db->getValue($rs); |
|
220 | + if($limit > 0) { |
|
221 | + webAlertAndQuit("Email is already in use!"); |
|
222 | + } |
|
223 | + |
|
224 | + // invoke OnBeforeWUsrFormSave event |
|
225 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
226 | + "mode" => "upd", |
|
227 | + "id" => $id |
|
228 | + )); |
|
229 | + |
|
230 | + // update user name and password |
|
231 | + $field = array(); |
|
232 | + $field['username'] = $esc_newusername; |
|
233 | + if($genpassword == 1) { |
|
234 | + $field['password'] = md5($newpassword); |
|
235 | + } |
|
236 | + $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
237 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
238 | + $field = $modx->db->escape($field); |
|
239 | + $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
240 | + |
|
241 | + // Save User Settings |
|
242 | + saveUserSettings($id); |
|
243 | + |
|
244 | + // Set the item name for logger |
|
245 | + $_SESSION['itemname'] = $newusername; |
|
246 | + |
|
247 | + /*******************************************************************************/ |
|
248 | + // put the user in the user_groups he/ she should be in |
|
249 | + // first, check that up_perms are switched on! |
|
250 | + if($use_udperms == 1) { |
|
251 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
252 | + $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
253 | + if(!empty($user_groups)) { |
|
254 | + for($i = 0; $i < count($user_groups); $i++) { |
|
255 | + $field = array(); |
|
256 | + $field['webgroup'] = intval($user_groups[$i]); |
|
257 | + $field['webuser'] = $id; |
|
258 | + $modx->db->insert($field, $tbl_web_groups); |
|
259 | + } |
|
260 | + } |
|
261 | + } |
|
262 | + // end of user_groups stuff! |
|
263 | + /*******************************************************************************/ |
|
264 | 264 | |
265 | 265 | // invoke OnWebSaveUser event |
266 | 266 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -289,16 +289,16 @@ discard block |
||
289 | 289 | "id" => $id |
290 | 290 | )); |
291 | 291 | |
292 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
293 | - if($input['stay'] != '') { |
|
294 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
295 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
296 | - } else { |
|
297 | - $stayUrl = "index.php?a=99&r=2"; |
|
298 | - } |
|
292 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
293 | + if($input['stay'] != '') { |
|
294 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
295 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
296 | + } else { |
|
297 | + $stayUrl = "index.php?a=99&r=2"; |
|
298 | + } |
|
299 | 299 | |
300 | - include_once "header.inc.php"; |
|
301 | - ?> |
|
300 | + include_once "header.inc.php"; |
|
301 | + ?> |
|
302 | 302 | |
303 | 303 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
304 | 304 | |
@@ -318,124 +318,124 @@ discard block |
||
318 | 318 | </div> |
319 | 319 | <?php |
320 | 320 | |
321 | - include_once "footer.inc.php"; |
|
322 | - } else { |
|
323 | - if($input['stay'] != '') { |
|
324 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
325 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
326 | - header($header); |
|
327 | - } else { |
|
328 | - $header = "Location: index.php?a=99&r=2"; |
|
329 | - header($header); |
|
330 | - } |
|
331 | - } |
|
332 | - break; |
|
333 | - default : |
|
334 | - webAlertAndQuit("No operation set in request."); |
|
321 | + include_once "footer.inc.php"; |
|
322 | + } else { |
|
323 | + if($input['stay'] != '') { |
|
324 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
325 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
326 | + header($header); |
|
327 | + } else { |
|
328 | + $header = "Location: index.php?a=99&r=2"; |
|
329 | + header($header); |
|
330 | + } |
|
331 | + } |
|
332 | + break; |
|
333 | + default : |
|
334 | + webAlertAndQuit("No operation set in request."); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | // in case any plugins include a quoted_printable function |
338 | 338 | function save_user_quoted_printable($string) { |
339 | - $crlf = "\n"; |
|
340 | - $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
|
341 | - $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
|
342 | - $r[] = "'=' . sprintf('%02X', ord('\\1'))"; |
|
343 | - $f[] = '/([\011\040])' . $crlf . '/e'; |
|
344 | - $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'"; |
|
345 | - $string = preg_replace($f, $r, $string); |
|
346 | - return trim(wordwrap($string, 70, ' =' . $crlf)); |
|
339 | + $crlf = "\n"; |
|
340 | + $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
|
341 | + $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
|
342 | + $r[] = "'=' . sprintf('%02X', ord('\\1'))"; |
|
343 | + $f[] = '/([\011\040])' . $crlf . '/e'; |
|
344 | + $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'"; |
|
345 | + $string = preg_replace($f, $r, $string); |
|
346 | + return trim(wordwrap($string, 70, ' =' . $crlf)); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | // Send an email to the user |
350 | 350 | function sendMailMessage($email, $uid, $pwd, $ufn) { |
351 | - global $modx, $_lang, $websignupemail_message; |
|
352 | - global $emailsubject, $emailsender; |
|
353 | - global $site_name, $site_url; |
|
354 | - $message = sprintf($websignupemail_message, $uid, $pwd); // use old method |
|
355 | - // replace placeholders |
|
356 | - $message = str_replace("[+uid+]", $uid, $message); |
|
357 | - $message = str_replace("[+pwd+]", $pwd, $message); |
|
358 | - $message = str_replace("[+ufn+]", $ufn, $message); |
|
359 | - $message = str_replace("[+sname+]", $site_name, $message); |
|
360 | - $message = str_replace("[+saddr+]", $emailsender, $message); |
|
361 | - $message = str_replace("[+semail+]", $emailsender, $message); |
|
362 | - $message = str_replace("[+surl+]", $site_url, $message); |
|
363 | - |
|
364 | - $param = array(); |
|
365 | - $param['from'] = "{$site_name}<{$emailsender}>"; |
|
366 | - $param['subject'] = $emailsubject; |
|
367 | - $param['body'] = $message; |
|
368 | - $param['to'] = $email; |
|
369 | - $param['type'] = 'text'; |
|
370 | - $rs = $modx->sendmail($param); |
|
371 | - if(!$rs) { |
|
372 | - $modx->manager->saveFormValues(); |
|
373 | - $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
|
374 | - } |
|
351 | + global $modx, $_lang, $websignupemail_message; |
|
352 | + global $emailsubject, $emailsender; |
|
353 | + global $site_name, $site_url; |
|
354 | + $message = sprintf($websignupemail_message, $uid, $pwd); // use old method |
|
355 | + // replace placeholders |
|
356 | + $message = str_replace("[+uid+]", $uid, $message); |
|
357 | + $message = str_replace("[+pwd+]", $pwd, $message); |
|
358 | + $message = str_replace("[+ufn+]", $ufn, $message); |
|
359 | + $message = str_replace("[+sname+]", $site_name, $message); |
|
360 | + $message = str_replace("[+saddr+]", $emailsender, $message); |
|
361 | + $message = str_replace("[+semail+]", $emailsender, $message); |
|
362 | + $message = str_replace("[+surl+]", $site_url, $message); |
|
363 | + |
|
364 | + $param = array(); |
|
365 | + $param['from'] = "{$site_name}<{$emailsender}>"; |
|
366 | + $param['subject'] = $emailsubject; |
|
367 | + $param['body'] = $message; |
|
368 | + $param['to'] = $email; |
|
369 | + $param['type'] = 'text'; |
|
370 | + $rs = $modx->sendmail($param); |
|
371 | + if(!$rs) { |
|
372 | + $modx->manager->saveFormValues(); |
|
373 | + $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
|
374 | + } |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | // Save User Settings |
378 | 378 | function saveUserSettings($id) { |
379 | - global $modx; |
|
380 | - $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
|
381 | - |
|
382 | - $settings = array( |
|
383 | - "login_home", |
|
384 | - "allowed_ip", |
|
385 | - "allowed_days" |
|
386 | - ); |
|
387 | - |
|
388 | - $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'"); |
|
389 | - |
|
390 | - foreach($settings as $n) { |
|
391 | - $vl = $_POST[$n]; |
|
392 | - if(is_array($vl)) { |
|
393 | - $vl = implode(",", $vl); |
|
394 | - } |
|
395 | - if($vl != '') { |
|
396 | - $f = array(); |
|
397 | - $f['webuser'] = $id; |
|
398 | - $f['setting_name'] = $n; |
|
399 | - $f['setting_value'] = $vl; |
|
400 | - $f = $modx->db->escape($f); |
|
401 | - $modx->db->insert($f, $tbl_web_user_settings); |
|
402 | - } |
|
403 | - } |
|
379 | + global $modx; |
|
380 | + $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
|
381 | + |
|
382 | + $settings = array( |
|
383 | + "login_home", |
|
384 | + "allowed_ip", |
|
385 | + "allowed_days" |
|
386 | + ); |
|
387 | + |
|
388 | + $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'"); |
|
389 | + |
|
390 | + foreach($settings as $n) { |
|
391 | + $vl = $_POST[$n]; |
|
392 | + if(is_array($vl)) { |
|
393 | + $vl = implode(",", $vl); |
|
394 | + } |
|
395 | + if($vl != '') { |
|
396 | + $f = array(); |
|
397 | + $f['webuser'] = $id; |
|
398 | + $f['setting_name'] = $n; |
|
399 | + $f['setting_value'] = $vl; |
|
400 | + $f = $modx->db->escape($f); |
|
401 | + $modx->db->insert($f, $tbl_web_user_settings); |
|
402 | + } |
|
403 | + } |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | // Web alert - sends an alert to web browser |
407 | 407 | function webAlertAndQuit($msg) { |
408 | - global $id, $modx; |
|
409 | - $mode = $_POST['mode']; |
|
410 | - $modx->manager->saveFormValues($mode); |
|
411 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : '')); |
|
408 | + global $id, $modx; |
|
409 | + $mode = $_POST['mode']; |
|
410 | + $modx->manager->saveFormValues($mode); |
|
411 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : '')); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | // Generate password |
415 | 415 | function generate_password($length = 10) { |
416 | - $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
|
417 | - $ps_len = strlen($allowable_characters); |
|
418 | - mt_srand((double) microtime() * 1000000); |
|
419 | - $pass = ""; |
|
420 | - for($i = 0; $i < $length; $i++) { |
|
421 | - $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
|
422 | - } |
|
423 | - return $pass; |
|
416 | + $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
|
417 | + $ps_len = strlen($allowable_characters); |
|
418 | + mt_srand((double) microtime() * 1000000); |
|
419 | + $pass = ""; |
|
420 | + for($i = 0; $i < $length; $i++) { |
|
421 | + $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
|
422 | + } |
|
423 | + return $pass; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | function sanitize($str = '', $safecount = 0) { |
427 | - global $modx; |
|
428 | - $safecount++; |
|
429 | - if(1000 < $safecount) { |
|
430 | - exit("error too many loops '{$safecount}'"); |
|
431 | - } |
|
432 | - if(is_array($str)) { |
|
433 | - foreach($str as $i => $v) { |
|
434 | - $str[$i] = sanitize($v, $safecount); |
|
435 | - } |
|
436 | - } else { |
|
437 | - // $str = strip_tags($str); // LEAVE < and > intact |
|
438 | - $str = htmlspecialchars($str, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
439 | - } |
|
440 | - return $str; |
|
427 | + global $modx; |
|
428 | + $safecount++; |
|
429 | + if(1000 < $safecount) { |
|
430 | + exit("error too many loops '{$safecount}'"); |
|
431 | + } |
|
432 | + if(is_array($str)) { |
|
433 | + foreach($str as $i => $v) { |
|
434 | + $str[$i] = sanitize($v, $safecount); |
|
435 | + } |
|
436 | + } else { |
|
437 | + // $str = strip_tags($str); // LEAVE < and > intact |
|
438 | + $str = htmlspecialchars($str, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
439 | + } |
|
440 | + return $str; |
|
441 | 441 | } |
@@ -60,108 +60,108 @@ 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!"); |
|
69 | - } |
|
70 | - |
|
71 | - // check if the email address already exist |
|
72 | - $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
73 | - $limit = $modx->db->getValue($rs); |
|
74 | - if($limit > 0) { |
|
75 | - webAlertAndQuit("Email is already in use!"); |
|
76 | - } |
|
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!"); |
|
69 | + } |
|
70 | + |
|
71 | + // check if the email address already exist |
|
72 | + $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
73 | + $limit = $modx->db->getValue($rs); |
|
74 | + if($limit > 0) { |
|
75 | + webAlertAndQuit("Email is already in use!"); |
|
76 | + } |
|
77 | + |
|
78 | + // generate a new password for this user |
|
79 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
80 | + if(strlen($specifiedpassword) < 6) { |
|
81 | + webAlertAndQuit("Password is too short!"); |
|
82 | + } else { |
|
83 | + $newpassword = $specifiedpassword; |
|
84 | + } |
|
85 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
86 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
87 | + } elseif($passwordgenmethod == 'g') { |
|
88 | + $newpassword = generate_password(8); |
|
89 | + } else { |
|
90 | + webAlertAndQuit("No password generation method specified!"); |
|
91 | + } |
|
92 | + |
|
93 | + // invoke OnBeforeWUsrFormSave event |
|
94 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
95 | + "mode" => "new", |
|
96 | + )); |
|
97 | + |
|
98 | + // create the user account |
|
99 | + $field = array(); |
|
100 | + $field['username'] = $esc_newusername; |
|
101 | + $field['password'] = md5($newpassword); |
|
102 | + $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
103 | + |
|
104 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
105 | + $field = $modx->db->escape($field); |
|
106 | + $modx->db->insert($field, $tbl_web_user_attributes); |
|
107 | + |
|
108 | + // Save User Settings |
|
109 | + saveUserSettings($internalKey); |
|
110 | + |
|
111 | + // Set the item name for logger |
|
112 | + $_SESSION['itemname'] = $newusername; |
|
113 | + |
|
114 | + /*******************************************************************************/ |
|
115 | + // put the user in the user_groups he/ she should be in |
|
116 | + // first, check that up_perms are switched on! |
|
117 | + if($use_udperms == 1) { |
|
118 | + if(!empty($user_groups)) { |
|
119 | + for($i = 0; $i < count($user_groups); $i++) { |
|
120 | + $f = array(); |
|
121 | + $f['webgroup'] = intval($user_groups[$i]); |
|
122 | + $f['webuser'] = $internalKey; |
|
123 | + $modx->db->insert($f, $tbl_web_groups); |
|
124 | + } |
|
125 | + } |
|
126 | + } |
|
127 | + // end of user_groups stuff! |
|
128 | + |
|
129 | + // invoke OnWebSaveUser event |
|
130 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
131 | + "mode" => "new", |
|
132 | + "userid" => $internalKey, |
|
133 | + "username" => $newusername, |
|
134 | + "userpassword" => $newpassword, |
|
135 | + "useremail" => $email, |
|
136 | + "userfullname" => $fullname |
|
137 | + )); |
|
77 | 138 | |
78 | - // generate a new password for this user |
|
79 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
80 | - if(strlen($specifiedpassword) < 6) { |
|
81 | - webAlertAndQuit("Password is too short!"); |
|
82 | - } else { |
|
83 | - $newpassword = $specifiedpassword; |
|
84 | - } |
|
85 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
86 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
87 | - } elseif($passwordgenmethod == 'g') { |
|
88 | - $newpassword = generate_password(8); |
|
89 | - } else { |
|
90 | - webAlertAndQuit("No password generation method specified!"); |
|
91 | - } |
|
139 | + // invoke OnWUsrFormSave event |
|
140 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
141 | + "mode" => "new", |
|
142 | + "id" => $internalKey |
|
143 | + )); |
|
92 | 144 | |
93 | - // invoke OnBeforeWUsrFormSave event |
|
94 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
95 | - "mode" => "new", |
|
96 | - )); |
|
97 | - |
|
98 | - // create the user account |
|
99 | - $field = array(); |
|
100 | - $field['username'] = $esc_newusername; |
|
101 | - $field['password'] = md5($newpassword); |
|
102 | - $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
103 | - |
|
104 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
105 | - $field = $modx->db->escape($field); |
|
106 | - $modx->db->insert($field, $tbl_web_user_attributes); |
|
107 | - |
|
108 | - // Save User Settings |
|
109 | - saveUserSettings($internalKey); |
|
110 | - |
|
111 | - // Set the item name for logger |
|
112 | - $_SESSION['itemname'] = $newusername; |
|
113 | - |
|
114 | - /*******************************************************************************/ |
|
115 | - // put the user in the user_groups he/ she should be in |
|
116 | - // first, check that up_perms are switched on! |
|
117 | - if($use_udperms == 1) { |
|
118 | - if(!empty($user_groups)) { |
|
119 | - for($i = 0; $i < count($user_groups); $i++) { |
|
120 | - $f = array(); |
|
121 | - $f['webgroup'] = intval($user_groups[$i]); |
|
122 | - $f['webuser'] = $internalKey; |
|
123 | - $modx->db->insert($f, $tbl_web_groups); |
|
124 | - } |
|
125 | - } |
|
126 | - } |
|
127 | - // end of user_groups stuff! |
|
128 | - |
|
129 | - // invoke OnWebSaveUser event |
|
130 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
131 | - "mode" => "new", |
|
132 | - "userid" => $internalKey, |
|
133 | - "username" => $newusername, |
|
134 | - "userpassword" => $newpassword, |
|
135 | - "useremail" => $email, |
|
136 | - "userfullname" => $fullname |
|
137 | - )); |
|
138 | - |
|
139 | - // invoke OnWUsrFormSave event |
|
140 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
141 | - "mode" => "new", |
|
142 | - "id" => $internalKey |
|
143 | - )); |
|
144 | - |
|
145 | - if($passwordnotifymethod == 'e') { |
|
146 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
147 | - if($input['stay'] != '') { |
|
148 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
149 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
150 | - header($header); |
|
151 | - } else { |
|
152 | - $header = "Location: index.php?a=99&r=2"; |
|
153 | - header($header); |
|
154 | - } |
|
155 | - } else { |
|
156 | - if($input['stay'] != '') { |
|
157 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
158 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
159 | - } else { |
|
160 | - $stayUrl = "index.php?a=99&r=2"; |
|
161 | - } |
|
162 | - |
|
163 | - include_once "header.inc.php"; |
|
164 | - ?> |
|
145 | + if($passwordnotifymethod == 'e') { |
|
146 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
147 | + if($input['stay'] != '') { |
|
148 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
149 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
150 | + header($header); |
|
151 | + } else { |
|
152 | + $header = "Location: index.php?a=99&r=2"; |
|
153 | + header($header); |
|
154 | + } |
|
155 | + } else { |
|
156 | + if($input['stay'] != '') { |
|
157 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
158 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
159 | + } else { |
|
160 | + $stayUrl = "index.php?a=99&r=2"; |
|
161 | + } |
|
162 | + |
|
163 | + include_once "header.inc.php"; |
|
164 | + ?> |
|
165 | 165 | |
166 | 166 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
167 | 167 | |
@@ -183,122 +183,122 @@ discard block |
||
183 | 183 | </div> |
184 | 184 | <?php |
185 | 185 | |
186 | - include_once "footer.inc.php"; |
|
187 | - } |
|
188 | - break; |
|
189 | - case '88' : // edit user |
|
190 | - // generate a new password for this user |
|
191 | - if($genpassword == 1) { |
|
192 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
193 | - if(strlen($specifiedpassword) < 6) { |
|
194 | - webAlertAndQuit("Password is too short!"); |
|
195 | - } else { |
|
196 | - $newpassword = $specifiedpassword; |
|
197 | - } |
|
198 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
199 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
200 | - } elseif($passwordgenmethod == 'g') { |
|
201 | - $newpassword = generate_password(8); |
|
202 | - } else { |
|
203 | - webAlertAndQuit("No password generation method specified!"); |
|
204 | - } |
|
205 | - } |
|
206 | - if($passwordnotifymethod == 'e') { |
|
207 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
208 | - } |
|
209 | - |
|
210 | - // check if the username already exist |
|
211 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
212 | - $limit = $modx->db->getValue($rs); |
|
213 | - if($limit > 0) { |
|
214 | - webAlertAndQuit("User name is already in use!"); |
|
215 | - } |
|
216 | - |
|
217 | - // check if the email address already exists |
|
218 | - $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
219 | - $limit = $modx->db->getValue($rs); |
|
220 | - if($limit > 0) { |
|
221 | - webAlertAndQuit("Email is already in use!"); |
|
222 | - } |
|
223 | - |
|
224 | - // invoke OnBeforeWUsrFormSave event |
|
225 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
226 | - "mode" => "upd", |
|
227 | - "id" => $id |
|
228 | - )); |
|
229 | - |
|
230 | - // update user name and password |
|
231 | - $field = array(); |
|
232 | - $field['username'] = $esc_newusername; |
|
233 | - if($genpassword == 1) { |
|
234 | - $field['password'] = md5($newpassword); |
|
235 | - } |
|
236 | - $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
237 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
238 | - $field = $modx->db->escape($field); |
|
239 | - $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
240 | - |
|
241 | - // Save User Settings |
|
242 | - saveUserSettings($id); |
|
243 | - |
|
244 | - // Set the item name for logger |
|
245 | - $_SESSION['itemname'] = $newusername; |
|
246 | - |
|
247 | - /*******************************************************************************/ |
|
248 | - // put the user in the user_groups he/ she should be in |
|
249 | - // first, check that up_perms are switched on! |
|
250 | - if($use_udperms == 1) { |
|
251 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
252 | - $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
253 | - if(!empty($user_groups)) { |
|
254 | - for($i = 0; $i < count($user_groups); $i++) { |
|
255 | - $field = array(); |
|
256 | - $field['webgroup'] = intval($user_groups[$i]); |
|
257 | - $field['webuser'] = $id; |
|
258 | - $modx->db->insert($field, $tbl_web_groups); |
|
259 | - } |
|
260 | - } |
|
261 | - } |
|
262 | - // end of user_groups stuff! |
|
263 | - /*******************************************************************************/ |
|
264 | - |
|
265 | - // invoke OnWebSaveUser event |
|
266 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
267 | - "mode" => "upd", |
|
268 | - "userid" => $id, |
|
269 | - "username" => $newusername, |
|
270 | - "userpassword" => $newpassword, |
|
271 | - "useremail" => $email, |
|
272 | - "userfullname" => $fullname, |
|
273 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
274 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
275 | - )); |
|
276 | - |
|
277 | - // invoke OnWebChangePassword event |
|
278 | - if($genpassword == 1) { |
|
279 | - $modx->invokeEvent("OnWebChangePassword", array( |
|
186 | + include_once "footer.inc.php"; |
|
187 | + } |
|
188 | + break; |
|
189 | + case '88' : // edit user |
|
190 | + // generate a new password for this user |
|
191 | + if($genpassword == 1) { |
|
192 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
193 | + if(strlen($specifiedpassword) < 6) { |
|
194 | + webAlertAndQuit("Password is too short!"); |
|
195 | + } else { |
|
196 | + $newpassword = $specifiedpassword; |
|
197 | + } |
|
198 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
199 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
200 | + } elseif($passwordgenmethod == 'g') { |
|
201 | + $newpassword = generate_password(8); |
|
202 | + } else { |
|
203 | + webAlertAndQuit("No password generation method specified!"); |
|
204 | + } |
|
205 | + } |
|
206 | + if($passwordnotifymethod == 'e') { |
|
207 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
208 | + } |
|
209 | + |
|
210 | + // check if the username already exist |
|
211 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
212 | + $limit = $modx->db->getValue($rs); |
|
213 | + if($limit > 0) { |
|
214 | + webAlertAndQuit("User name is already in use!"); |
|
215 | + } |
|
216 | + |
|
217 | + // check if the email address already exists |
|
218 | + $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
219 | + $limit = $modx->db->getValue($rs); |
|
220 | + if($limit > 0) { |
|
221 | + webAlertAndQuit("Email is already in use!"); |
|
222 | + } |
|
223 | + |
|
224 | + // invoke OnBeforeWUsrFormSave event |
|
225 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
226 | + "mode" => "upd", |
|
227 | + "id" => $id |
|
228 | + )); |
|
229 | + |
|
230 | + // update user name and password |
|
231 | + $field = array(); |
|
232 | + $field['username'] = $esc_newusername; |
|
233 | + if($genpassword == 1) { |
|
234 | + $field['password'] = md5($newpassword); |
|
235 | + } |
|
236 | + $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
237 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
238 | + $field = $modx->db->escape($field); |
|
239 | + $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
240 | + |
|
241 | + // Save User Settings |
|
242 | + saveUserSettings($id); |
|
243 | + |
|
244 | + // Set the item name for logger |
|
245 | + $_SESSION['itemname'] = $newusername; |
|
246 | + |
|
247 | + /*******************************************************************************/ |
|
248 | + // put the user in the user_groups he/ she should be in |
|
249 | + // first, check that up_perms are switched on! |
|
250 | + if($use_udperms == 1) { |
|
251 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
252 | + $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
253 | + if(!empty($user_groups)) { |
|
254 | + for($i = 0; $i < count($user_groups); $i++) { |
|
255 | + $field = array(); |
|
256 | + $field['webgroup'] = intval($user_groups[$i]); |
|
257 | + $field['webuser'] = $id; |
|
258 | + $modx->db->insert($field, $tbl_web_groups); |
|
259 | + } |
|
260 | + } |
|
261 | + } |
|
262 | + // end of user_groups stuff! |
|
263 | + /*******************************************************************************/ |
|
264 | + |
|
265 | + // invoke OnWebSaveUser event |
|
266 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
267 | + "mode" => "upd", |
|
280 | 268 | "userid" => $id, |
281 | 269 | "username" => $newusername, |
282 | - "userpassword" => $newpassword |
|
270 | + "userpassword" => $newpassword, |
|
271 | + "useremail" => $email, |
|
272 | + "userfullname" => $fullname, |
|
273 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
274 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
283 | 275 | )); |
284 | - } |
|
285 | 276 | |
286 | - // invoke OnWUsrFormSave event |
|
287 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
288 | - "mode" => "upd", |
|
289 | - "id" => $id |
|
290 | - )); |
|
277 | + // invoke OnWebChangePassword event |
|
278 | + if($genpassword == 1) { |
|
279 | + $modx->invokeEvent("OnWebChangePassword", array( |
|
280 | + "userid" => $id, |
|
281 | + "username" => $newusername, |
|
282 | + "userpassword" => $newpassword |
|
283 | + )); |
|
284 | + } |
|
285 | + |
|
286 | + // invoke OnWUsrFormSave event |
|
287 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
288 | + "mode" => "upd", |
|
289 | + "id" => $id |
|
290 | + )); |
|
291 | 291 | |
292 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
293 | - if($input['stay'] != '') { |
|
294 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
295 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
296 | - } else { |
|
297 | - $stayUrl = "index.php?a=99&r=2"; |
|
298 | - } |
|
292 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
293 | + if($input['stay'] != '') { |
|
294 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
295 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
296 | + } else { |
|
297 | + $stayUrl = "index.php?a=99&r=2"; |
|
298 | + } |
|
299 | 299 | |
300 | - include_once "header.inc.php"; |
|
301 | - ?> |
|
300 | + include_once "header.inc.php"; |
|
301 | + ?> |
|
302 | 302 | |
303 | 303 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
304 | 304 | |
@@ -318,20 +318,20 @@ discard block |
||
318 | 318 | </div> |
319 | 319 | <?php |
320 | 320 | |
321 | - include_once "footer.inc.php"; |
|
322 | - } else { |
|
323 | - if($input['stay'] != '') { |
|
324 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
325 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
326 | - header($header); |
|
327 | - } else { |
|
328 | - $header = "Location: index.php?a=99&r=2"; |
|
329 | - header($header); |
|
330 | - } |
|
331 | - } |
|
332 | - break; |
|
333 | - default : |
|
334 | - webAlertAndQuit("No operation set in request."); |
|
321 | + include_once "footer.inc.php"; |
|
322 | + } else { |
|
323 | + if($input['stay'] != '') { |
|
324 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
325 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
326 | + header($header); |
|
327 | + } else { |
|
328 | + $header = "Location: index.php?a=99&r=2"; |
|
329 | + header($header); |
|
330 | + } |
|
331 | + } |
|
332 | + break; |
|
333 | + default : |
|
334 | + webAlertAndQuit("No operation set in request."); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | // in case any plugins include a quoted_printable function |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE != "true") { |
|
2 | +if (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,8 +11,8 @@ 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; |
@@ -50,41 +50,41 @@ 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 | |
71 | 71 | // check if the email address already exist |
72 | 72 | $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
73 | 73 | $limit = $modx->db->getValue($rs); |
74 | - if($limit > 0) { |
|
74 | + if ($limit > 0) { |
|
75 | 75 | webAlertAndQuit("Email is already in use!"); |
76 | 76 | } |
77 | 77 | |
78 | 78 | // generate a new password for this user |
79 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
80 | - if(strlen($specifiedpassword) < 6) { |
|
79 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
80 | + if (strlen($specifiedpassword) < 6) { |
|
81 | 81 | webAlertAndQuit("Password is too short!"); |
82 | 82 | } else { |
83 | 83 | $newpassword = $specifiedpassword; |
84 | 84 | } |
85 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
85 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
86 | 86 | webAlertAndQuit("You didn't specify a password for this user!"); |
87 | - } elseif($passwordgenmethod == 'g') { |
|
87 | + } elseif ($passwordgenmethod == 'g') { |
|
88 | 88 | $newpassword = generate_password(8); |
89 | 89 | } else { |
90 | 90 | webAlertAndQuit("No password generation method specified!"); |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | /*******************************************************************************/ |
115 | 115 | // put the user in the user_groups he/ she should be in |
116 | 116 | // first, check that up_perms are switched on! |
117 | - if($use_udperms == 1) { |
|
118 | - if(!empty($user_groups)) { |
|
119 | - for($i = 0; $i < count($user_groups); $i++) { |
|
117 | + if ($use_udperms == 1) { |
|
118 | + if (!empty($user_groups)) { |
|
119 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
120 | 120 | $f = array(); |
121 | 121 | $f['webgroup'] = intval($user_groups[$i]); |
122 | 122 | $f['webuser'] = $internalKey; |
@@ -142,20 +142,20 @@ discard block |
||
142 | 142 | "id" => $internalKey |
143 | 143 | )); |
144 | 144 | |
145 | - if($passwordnotifymethod == 'e') { |
|
145 | + if ($passwordnotifymethod == 'e') { |
|
146 | 146 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
147 | - if($input['stay'] != '') { |
|
147 | + if ($input['stay'] != '') { |
|
148 | 148 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
149 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
149 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
150 | 150 | header($header); |
151 | 151 | } else { |
152 | 152 | $header = "Location: index.php?a=99&r=2"; |
153 | 153 | header($header); |
154 | 154 | } |
155 | 155 | } else { |
156 | - if($input['stay'] != '') { |
|
156 | + if ($input['stay'] != '') { |
|
157 | 157 | $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
158 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
158 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
159 | 159 | } else { |
160 | 160 | $stayUrl = "index.php?a=99&r=2"; |
161 | 161 | } |
@@ -188,36 +188,36 @@ discard block |
||
188 | 188 | break; |
189 | 189 | case '88' : // edit user |
190 | 190 | // generate a new password for this user |
191 | - if($genpassword == 1) { |
|
192 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
193 | - if(strlen($specifiedpassword) < 6) { |
|
191 | + if ($genpassword == 1) { |
|
192 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
193 | + if (strlen($specifiedpassword) < 6) { |
|
194 | 194 | webAlertAndQuit("Password is too short!"); |
195 | 195 | } else { |
196 | 196 | $newpassword = $specifiedpassword; |
197 | 197 | } |
198 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
198 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
199 | 199 | webAlertAndQuit("You didn't specify a password for this user!"); |
200 | - } elseif($passwordgenmethod == 'g') { |
|
200 | + } elseif ($passwordgenmethod == 'g') { |
|
201 | 201 | $newpassword = generate_password(8); |
202 | 202 | } else { |
203 | 203 | webAlertAndQuit("No password generation method specified!"); |
204 | 204 | } |
205 | 205 | } |
206 | - if($passwordnotifymethod == 'e') { |
|
206 | + if ($passwordnotifymethod == 'e') { |
|
207 | 207 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
208 | 208 | } |
209 | 209 | |
210 | 210 | // check if the username already exist |
211 | 211 | $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
212 | 212 | $limit = $modx->db->getValue($rs); |
213 | - if($limit > 0) { |
|
213 | + if ($limit > 0) { |
|
214 | 214 | webAlertAndQuit("User name is already in use!"); |
215 | 215 | } |
216 | 216 | |
217 | 217 | // check if the email address already exists |
218 | 218 | $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
219 | 219 | $limit = $modx->db->getValue($rs); |
220 | - if($limit > 0) { |
|
220 | + if ($limit > 0) { |
|
221 | 221 | webAlertAndQuit("Email is already in use!"); |
222 | 222 | } |
223 | 223 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | // update user name and password |
231 | 231 | $field = array(); |
232 | 232 | $field['username'] = $esc_newusername; |
233 | - if($genpassword == 1) { |
|
233 | + if ($genpassword == 1) { |
|
234 | 234 | $field['password'] = md5($newpassword); |
235 | 235 | } |
236 | 236 | $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | /*******************************************************************************/ |
248 | 248 | // put the user in the user_groups he/ she should be in |
249 | 249 | // first, check that up_perms are switched on! |
250 | - if($use_udperms == 1) { |
|
250 | + if ($use_udperms == 1) { |
|
251 | 251 | // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
252 | 252 | $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
253 | - if(!empty($user_groups)) { |
|
254 | - for($i = 0; $i < count($user_groups); $i++) { |
|
253 | + if (!empty($user_groups)) { |
|
254 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
255 | 255 | $field = array(); |
256 | 256 | $field['webgroup'] = intval($user_groups[$i]); |
257 | 257 | $field['webuser'] = $id; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | )); |
276 | 276 | |
277 | 277 | // invoke OnWebChangePassword event |
278 | - if($genpassword == 1) { |
|
278 | + if ($genpassword == 1) { |
|
279 | 279 | $modx->invokeEvent("OnWebChangePassword", array( |
280 | 280 | "userid" => $id, |
281 | 281 | "username" => $newusername, |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | "id" => $id |
290 | 290 | )); |
291 | 291 | |
292 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
293 | - if($input['stay'] != '') { |
|
292 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
293 | + if ($input['stay'] != '') { |
|
294 | 294 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
295 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
295 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
296 | 296 | } else { |
297 | 297 | $stayUrl = "index.php?a=99&r=2"; |
298 | 298 | } |
@@ -320,9 +320,9 @@ discard block |
||
320 | 320 | |
321 | 321 | include_once "footer.inc.php"; |
322 | 322 | } else { |
323 | - if($input['stay'] != '') { |
|
323 | + if ($input['stay'] != '') { |
|
324 | 324 | $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
325 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
325 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
326 | 326 | header($header); |
327 | 327 | } else { |
328 | 328 | $header = "Location: index.php?a=99&r=2"; |
@@ -335,19 +335,19 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | // in case any plugins include a quoted_printable function |
338 | -function save_user_quoted_printable($string) { |
|
338 | +function save_user_quoted_printable($string){ |
|
339 | 339 | $crlf = "\n"; |
340 | - $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
|
340 | + $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string).$crlf; |
|
341 | 341 | $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
342 | 342 | $r[] = "'=' . sprintf('%02X', ord('\\1'))"; |
343 | - $f[] = '/([\011\040])' . $crlf . '/e'; |
|
344 | - $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'"; |
|
343 | + $f[] = '/([\011\040])'.$crlf.'/e'; |
|
344 | + $r[] = "'=' . sprintf('%02X', ord('\\1')) . '".$crlf."'"; |
|
345 | 345 | $string = preg_replace($f, $r, $string); |
346 | - return trim(wordwrap($string, 70, ' =' . $crlf)); |
|
346 | + return trim(wordwrap($string, 70, ' ='.$crlf)); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | // Send an email to the user |
350 | -function sendMailMessage($email, $uid, $pwd, $ufn) { |
|
350 | +function sendMailMessage($email, $uid, $pwd, $ufn){ |
|
351 | 351 | global $modx, $_lang, $websignupemail_message; |
352 | 352 | global $emailsubject, $emailsender; |
353 | 353 | global $site_name, $site_url; |
@@ -368,14 +368,14 @@ discard block |
||
368 | 368 | $param['to'] = $email; |
369 | 369 | $param['type'] = 'text'; |
370 | 370 | $rs = $modx->sendmail($param); |
371 | - if(!$rs) { |
|
371 | + if (!$rs) { |
|
372 | 372 | $modx->manager->saveFormValues(); |
373 | 373 | $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
377 | 377 | // Save User Settings |
378 | -function saveUserSettings($id) { |
|
378 | +function saveUserSettings($id){ |
|
379 | 379 | global $modx; |
380 | 380 | $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
381 | 381 | |
@@ -387,12 +387,12 @@ discard block |
||
387 | 387 | |
388 | 388 | $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'"); |
389 | 389 | |
390 | - foreach($settings as $n) { |
|
390 | + foreach ($settings as $n) { |
|
391 | 391 | $vl = $_POST[$n]; |
392 | - if(is_array($vl)) { |
|
392 | + if (is_array($vl)) { |
|
393 | 393 | $vl = implode(",", $vl); |
394 | 394 | } |
395 | - if($vl != '') { |
|
395 | + if ($vl != '') { |
|
396 | 396 | $f = array(); |
397 | 397 | $f['webuser'] = $id; |
398 | 398 | $f['setting_name'] = $n; |
@@ -404,33 +404,33 @@ discard block |
||
404 | 404 | } |
405 | 405 | |
406 | 406 | // Web alert - sends an alert to web browser |
407 | -function webAlertAndQuit($msg) { |
|
407 | +function webAlertAndQuit($msg){ |
|
408 | 408 | global $id, $modx; |
409 | 409 | $mode = $_POST['mode']; |
410 | 410 | $modx->manager->saveFormValues($mode); |
411 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : '')); |
|
411 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode == '88' ? "&id={$id}" : '')); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | // Generate password |
415 | -function generate_password($length = 10) { |
|
415 | +function generate_password($length = 10){ |
|
416 | 416 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
417 | 417 | $ps_len = strlen($allowable_characters); |
418 | 418 | mt_srand((double) microtime() * 1000000); |
419 | 419 | $pass = ""; |
420 | - for($i = 0; $i < $length; $i++) { |
|
420 | + for ($i = 0; $i < $length; $i++) { |
|
421 | 421 | $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
422 | 422 | } |
423 | 423 | return $pass; |
424 | 424 | } |
425 | 425 | |
426 | -function sanitize($str = '', $safecount = 0) { |
|
426 | +function sanitize($str = '', $safecount = 0){ |
|
427 | 427 | global $modx; |
428 | 428 | $safecount++; |
429 | - if(1000 < $safecount) { |
|
429 | + if (1000 < $safecount) { |
|
430 | 430 | exit("error too many loops '{$safecount}'"); |
431 | 431 | } |
432 | - if(is_array($str)) { |
|
433 | - foreach($str as $i => $v) { |
|
432 | + if (is_array($str)) { |
|
433 | + foreach ($str as $i => $v) { |
|
434 | 434 | $str[$i] = sanitize($v, $safecount); |
435 | 435 | } |
436 | 436 | } else { |
@@ -335,7 +335,8 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | // in case any plugins include a quoted_printable function |
338 | -function save_user_quoted_printable($string) { |
|
338 | +function save_user_quoted_printable($string) |
|
339 | +{ |
|
339 | 340 | $crlf = "\n"; |
340 | 341 | $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
341 | 342 | $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
@@ -347,7 +348,8 @@ discard block |
||
347 | 348 | } |
348 | 349 | |
349 | 350 | // Send an email to the user |
350 | -function sendMailMessage($email, $uid, $pwd, $ufn) { |
|
351 | +function sendMailMessage($email, $uid, $pwd, $ufn) |
|
352 | +{ |
|
351 | 353 | global $modx, $_lang, $websignupemail_message; |
352 | 354 | global $emailsubject, $emailsender; |
353 | 355 | global $site_name, $site_url; |
@@ -375,7 +377,8 @@ discard block |
||
375 | 377 | } |
376 | 378 | |
377 | 379 | // Save User Settings |
378 | -function saveUserSettings($id) { |
|
380 | +function saveUserSettings($id) |
|
381 | +{ |
|
379 | 382 | global $modx; |
380 | 383 | $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
381 | 384 | |
@@ -404,7 +407,8 @@ discard block |
||
404 | 407 | } |
405 | 408 | |
406 | 409 | // Web alert - sends an alert to web browser |
407 | -function webAlertAndQuit($msg) { |
|
410 | +function webAlertAndQuit($msg) |
|
411 | +{ |
|
408 | 412 | global $id, $modx; |
409 | 413 | $mode = $_POST['mode']; |
410 | 414 | $modx->manager->saveFormValues($mode); |
@@ -412,7 +416,8 @@ discard block |
||
412 | 416 | } |
413 | 417 | |
414 | 418 | // Generate password |
415 | -function generate_password($length = 10) { |
|
419 | +function generate_password($length = 10) |
|
420 | +{ |
|
416 | 421 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
417 | 422 | $ps_len = strlen($allowable_characters); |
418 | 423 | mt_srand((double) microtime() * 1000000); |
@@ -423,7 +428,8 @@ discard block |
||
423 | 428 | return $pass; |
424 | 429 | } |
425 | 430 | |
426 | -function sanitize($str = '', $safecount = 0) { |
|
431 | +function sanitize($str = '', $safecount = 0) |
|
432 | +{ |
|
427 | 433 | global $modx; |
428 | 434 | $safecount++; |
429 | 435 | if(1000 < $safecount) { |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('edit_template')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // count duplicates |
@@ -17,37 +17,37 @@ discard block |
||
17 | 17 | |
18 | 18 | // duplicate TV |
19 | 19 | $newid = $modx->db->insert( |
20 | - array( |
|
21 | - 'type'=>'', |
|
22 | - 'name'=>'', |
|
23 | - 'caption'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'default_text'=>'', |
|
26 | - 'elements'=>'', |
|
27 | - 'rank'=>'', |
|
28 | - 'display'=>'', |
|
29 | - 'display_params'=>'', |
|
30 | - 'category'=>'', |
|
31 | - ), $modx->getFullTableName('site_tmplvars'), // Insert into |
|
32 | - "type, CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, CONCAT(caption, ' Duplicate{$count}') AS caption, description, default_text, elements, rank, display, display_params, category", $modx->getFullTableName('site_tmplvars'), "id='{$id}'"); // Copy from |
|
20 | + array( |
|
21 | + 'type'=>'', |
|
22 | + 'name'=>'', |
|
23 | + 'caption'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'default_text'=>'', |
|
26 | + 'elements'=>'', |
|
27 | + 'rank'=>'', |
|
28 | + 'display'=>'', |
|
29 | + 'display_params'=>'', |
|
30 | + 'category'=>'', |
|
31 | + ), $modx->getFullTableName('site_tmplvars'), // Insert into |
|
32 | + "type, CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, CONCAT(caption, ' Duplicate{$count}') AS caption, description, default_text, elements, rank, display, display_params, category", $modx->getFullTableName('site_tmplvars'), "id='{$id}'"); // Copy from |
|
33 | 33 | |
34 | 34 | |
35 | 35 | // duplicate TV Template Access Permissions |
36 | 36 | $modx->db->insert( |
37 | - array( |
|
38 | - 'tmplvarid'=>'', |
|
39 | - 'templateid'=>'', |
|
40 | - 'rank'=>'', |
|
41 | - ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into |
|
42 | - "'{$newid}', templateid, rank", $modx->getFullTableName('site_tmplvar_templates'), "tmplvarid='{$id}'"); // Copy from |
|
37 | + array( |
|
38 | + 'tmplvarid'=>'', |
|
39 | + 'templateid'=>'', |
|
40 | + 'rank'=>'', |
|
41 | + ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into |
|
42 | + "'{$newid}', templateid, rank", $modx->getFullTableName('site_tmplvar_templates'), "tmplvarid='{$id}'"); // Copy from |
|
43 | 43 | |
44 | 44 | // duplicate TV Access Permissions |
45 | 45 | $modx->db->insert( |
46 | - array( |
|
47 | - 'tmplvarid'=>'', |
|
48 | - 'documentgroup'=>'', |
|
49 | - ), $modx->getFullTableName('site_tmplvar_access'), // Insert into |
|
50 | - "'{$newid}', documentgroup", $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); // Copy from |
|
46 | + array( |
|
47 | + 'tmplvarid'=>'', |
|
48 | + 'documentgroup'=>'', |
|
49 | + ), $modx->getFullTableName('site_tmplvar_access'), // Insert into |
|
50 | + "'{$newid}', documentgroup", $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); // Copy from |
|
51 | 51 | |
52 | 52 | // Set the item name for logger |
53 | 53 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$newid}'")); |
@@ -1,18 +1,18 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('edit_template')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('edit_template')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -$id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
8 | -if($id==0) { |
|
7 | +$id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
8 | +if ($id == 0) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
10 | 10 | } |
11 | 11 | |
12 | 12 | // count duplicates |
13 | 13 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$id}'")); |
14 | 14 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
15 | -if($count>=1) $count = ' '.($count+1); |
|
15 | +if ($count >= 1) $count = ' '.($count + 1); |
|
16 | 16 | else $count = ''; |
17 | 17 | |
18 | 18 | // duplicate TV |
@@ -54,5 +54,5 @@ discard block |
||
54 | 54 | $_SESSION['itemname'] = $name; |
55 | 55 | |
56 | 56 | // finish duplicating - redirect to new variable |
57 | -$header="Location: index.php?r=2&a=301&id=$newid"; |
|
57 | +$header = "Location: index.php?r=2&a=301&id=$newid"; |
|
58 | 58 | header($header); |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('edit_template')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -12,8 +14,11 @@ discard block |
||
12 | 14 | // count duplicates |
13 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$id}'")); |
14 | 16 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
15 | -if($count>=1) $count = ' '.($count+1); |
|
16 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
17 | 22 | |
18 | 23 | // duplicate TV |
19 | 24 | $newid = $modx->db->insert( |
@@ -1,17 +1,17 @@ |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('delete_eventlog')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | if (isset($_GET['cls']) && $_GET['cls']==1) { |
8 | - $where = ''; |
|
8 | + $where = ''; |
|
9 | 9 | } else { |
10 | - $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
11 | - if($id==0) { |
|
12 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
13 | - } |
|
14 | - $where = "id='{$id}'"; |
|
10 | + $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
11 | + if($id==0) { |
|
12 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
13 | + } |
|
14 | + $where = "id='{$id}'"; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | // delete event log |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | -if(!$modx->hasPermission('delete_eventlog')) { |
|
2 | +if (IN_MANAGER_MODE != "true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | +if (!$modx->hasPermission('delete_eventlog')) { |
|
4 | 4 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 5 | } |
6 | 6 | |
7 | -if (isset($_GET['cls']) && $_GET['cls']==1) { |
|
7 | +if (isset($_GET['cls']) && $_GET['cls'] == 1) { |
|
8 | 8 | $where = ''; |
9 | 9 | } else { |
10 | - $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
11 | - if($id==0) { |
|
10 | + $id = isset($_GET['id']) ? intval($_GET['id']) : 0; |
|
11 | + if ($id == 0) { |
|
12 | 12 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
13 | 13 | } |
14 | 14 | $where = "id='{$id}'"; |
@@ -17,5 +17,5 @@ discard block |
||
17 | 17 | // delete event log |
18 | 18 | $modx->db->delete($modx->getFullTableName('event_log'), $where); |
19 | 19 | |
20 | -$header="Location: index.php?a=114"; |
|
20 | +$header = "Location: index.php?a=114"; |
|
21 | 21 | header($header); |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('delete_eventlog')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -66,111 +66,111 @@ |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | switch ($_POST['mode']) { |
69 | - case '23': // Save new snippet |
|
70 | - |
|
71 | - // invoke OnBeforeSnipFormSave event |
|
72 | - $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
73 | - "mode" => "new", |
|
74 | - "id" => $id |
|
75 | - )); |
|
76 | - |
|
77 | - // disallow duplicate names for new snippets |
|
78 | - $rs = $modx->db->select('COUNT(id)', $modx->getFullTableName('site_snippets'), "name='{$name}'"); |
|
79 | - $count = $modx->db->getValue($rs); |
|
80 | - if ($count > 0) { |
|
81 | - $modx->manager->saveFormValues(23); |
|
82 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=23"); |
|
83 | - } |
|
84 | - |
|
85 | - //do stuff to save the new doc |
|
86 | - $newid = $modx->db->insert(array( |
|
87 | - 'name' => $name, |
|
88 | - 'description' => $description, |
|
89 | - 'snippet' => $snippet, |
|
90 | - 'moduleguid' => $moduleguid, |
|
91 | - 'locked' => $locked, |
|
92 | - 'properties' => $properties, |
|
93 | - 'category' => $categoryid, |
|
94 | - 'disabled' => $disabled, |
|
95 | - 'createdon' => $currentdate, |
|
96 | - 'editedon' => $currentdate |
|
97 | - ), $modx->getFullTableName('site_snippets')); |
|
98 | - |
|
99 | - // invoke OnSnipFormSave event |
|
100 | - $modx->invokeEvent("OnSnipFormSave", 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') ? "22&id=$newid" : "23"; |
|
114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
115 | - header($header); |
|
116 | - } else { |
|
117 | - $header = "Location: index.php?a=76&r=2"; |
|
118 | - header($header); |
|
119 | - } |
|
120 | - break; |
|
121 | - case '22': // Save existing snippet |
|
122 | - // invoke OnBeforeSnipFormSave event |
|
123 | - $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
124 | - "mode" => "upd", |
|
125 | - "id" => $id |
|
126 | - )); |
|
127 | - |
|
128 | - // disallow duplicate names for snippets |
|
129 | - $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_snippets'), "name='{$name}' AND id!='{$id}'"); |
|
130 | - if ($modx->db->getValue($rs) > 0) { |
|
131 | - $modx->manager->saveFormValues(22); |
|
132 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=22&id={$id}"); |
|
133 | - } |
|
134 | - |
|
135 | - //do stuff to save the edited doc |
|
136 | - $modx->db->update(array( |
|
137 | - 'name' => $name, |
|
138 | - 'description' => $description, |
|
139 | - 'snippet' => $snippet, |
|
140 | - 'moduleguid' => $moduleguid, |
|
141 | - 'locked' => $locked, |
|
142 | - 'properties' => $properties, |
|
143 | - 'category' => $categoryid, |
|
144 | - 'disabled' => $disabled, |
|
145 | - 'editedon' => $currentdate |
|
146 | - ), $modx->getFullTableName('site_snippets'), "id='{$id}'"); |
|
147 | - |
|
148 | - // invoke OnSnipFormSave event |
|
149 | - $modx->invokeEvent("OnSnipFormSave", array( |
|
150 | - "mode" => "upd", |
|
151 | - "id" => $id |
|
152 | - )); |
|
153 | - |
|
154 | - // Set the item name for logger |
|
155 | - $_SESSION['itemname'] = $name; |
|
156 | - |
|
157 | - // empty cache |
|
158 | - $modx->clearCache('full'); |
|
159 | - |
|
160 | - if ($_POST['runsnippet']) { |
|
161 | - run_snippet($snippet); |
|
162 | - } |
|
163 | - // finished emptying cache - redirect |
|
164 | - if ($_POST['stay'] != '') { |
|
165 | - $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23"; |
|
166 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
167 | - header($header); |
|
168 | - } else { |
|
169 | - $modx->unlockElement(4, $id); |
|
170 | - $header = "Location: index.php?a=76&r=2"; |
|
171 | - header($header); |
|
172 | - } |
|
173 | - break; |
|
174 | - default: |
|
175 | - $modx->webAlertAndQuit("No operation set in request."); |
|
69 | + case '23': // Save new snippet |
|
70 | + |
|
71 | + // invoke OnBeforeSnipFormSave event |
|
72 | + $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
73 | + "mode" => "new", |
|
74 | + "id" => $id |
|
75 | + )); |
|
76 | + |
|
77 | + // disallow duplicate names for new snippets |
|
78 | + $rs = $modx->db->select('COUNT(id)', $modx->getFullTableName('site_snippets'), "name='{$name}'"); |
|
79 | + $count = $modx->db->getValue($rs); |
|
80 | + if ($count > 0) { |
|
81 | + $modx->manager->saveFormValues(23); |
|
82 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=23"); |
|
83 | + } |
|
84 | + |
|
85 | + //do stuff to save the new doc |
|
86 | + $newid = $modx->db->insert(array( |
|
87 | + 'name' => $name, |
|
88 | + 'description' => $description, |
|
89 | + 'snippet' => $snippet, |
|
90 | + 'moduleguid' => $moduleguid, |
|
91 | + 'locked' => $locked, |
|
92 | + 'properties' => $properties, |
|
93 | + 'category' => $categoryid, |
|
94 | + 'disabled' => $disabled, |
|
95 | + 'createdon' => $currentdate, |
|
96 | + 'editedon' => $currentdate |
|
97 | + ), $modx->getFullTableName('site_snippets')); |
|
98 | + |
|
99 | + // invoke OnSnipFormSave event |
|
100 | + $modx->invokeEvent("OnSnipFormSave", 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') ? "22&id=$newid" : "23"; |
|
114 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
115 | + header($header); |
|
116 | + } else { |
|
117 | + $header = "Location: index.php?a=76&r=2"; |
|
118 | + header($header); |
|
119 | + } |
|
120 | + break; |
|
121 | + case '22': // Save existing snippet |
|
122 | + // invoke OnBeforeSnipFormSave event |
|
123 | + $modx->invokeEvent("OnBeforeSnipFormSave", array( |
|
124 | + "mode" => "upd", |
|
125 | + "id" => $id |
|
126 | + )); |
|
127 | + |
|
128 | + // disallow duplicate names for snippets |
|
129 | + $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_snippets'), "name='{$name}' AND id!='{$id}'"); |
|
130 | + if ($modx->db->getValue($rs) > 0) { |
|
131 | + $modx->manager->saveFormValues(22); |
|
132 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=22&id={$id}"); |
|
133 | + } |
|
134 | + |
|
135 | + //do stuff to save the edited doc |
|
136 | + $modx->db->update(array( |
|
137 | + 'name' => $name, |
|
138 | + 'description' => $description, |
|
139 | + 'snippet' => $snippet, |
|
140 | + 'moduleguid' => $moduleguid, |
|
141 | + 'locked' => $locked, |
|
142 | + 'properties' => $properties, |
|
143 | + 'category' => $categoryid, |
|
144 | + 'disabled' => $disabled, |
|
145 | + 'editedon' => $currentdate |
|
146 | + ), $modx->getFullTableName('site_snippets'), "id='{$id}'"); |
|
147 | + |
|
148 | + // invoke OnSnipFormSave event |
|
149 | + $modx->invokeEvent("OnSnipFormSave", array( |
|
150 | + "mode" => "upd", |
|
151 | + "id" => $id |
|
152 | + )); |
|
153 | + |
|
154 | + // Set the item name for logger |
|
155 | + $_SESSION['itemname'] = $name; |
|
156 | + |
|
157 | + // empty cache |
|
158 | + $modx->clearCache('full'); |
|
159 | + |
|
160 | + if ($_POST['runsnippet']) { |
|
161 | + run_snippet($snippet); |
|
162 | + } |
|
163 | + // finished emptying cache - redirect |
|
164 | + if ($_POST['stay'] != '') { |
|
165 | + $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23"; |
|
166 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
167 | + header($header); |
|
168 | + } else { |
|
169 | + $modx->unlockElement(4, $id); |
|
170 | + $header = "Location: index.php?a=76&r=2"; |
|
171 | + header($header); |
|
172 | + } |
|
173 | + break; |
|
174 | + default: |
|
175 | + $modx->webAlertAndQuit("No operation set in request."); |
|
176 | 176 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
38 | 38 | $categoryid = 0; |
39 | 39 | } else { |
40 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
40 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
41 | 41 | $categoryid = checkCategory($_POST['newcategory']); |
42 | 42 | if (!$categoryid) { |
43 | 43 | $categoryid = newCategory($_POST['newcategory']); |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid; |
56 | 56 | |
57 | 57 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
58 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
58 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
59 | 59 | if ($version) { |
60 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
60 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
61 | 61 | } |
62 | 62 | if (isset($parsed['modx_category'])) { |
63 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
63 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
64 | 64 | $categoryid = getCategory($parsed['modx_category']); |
65 | 65 | } |
66 | 66 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | // finished emptying cache - redirect |
112 | 112 | if ($_POST['stay'] != '') { |
113 | 113 | $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23"; |
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=76&r=2"; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | // finished emptying cache - redirect |
164 | 164 | if ($_POST['stay'] != '') { |
165 | 165 | $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23"; |
166 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
166 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
167 | 167 | header($header); |
168 | 168 | } else { |
169 | 169 | $modx->unlockElement(4, $id); |