@@ -3,33 +3,33 @@ |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!($modx->hasPermission('settings') && ($modx->hasPermission('logs')||$modx->hasPermission('bk_manager')))) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | if (isset($_REQUEST['t'])) { |
10 | 10 | |
11 | - if (empty($_REQUEST['t'])) { |
|
12 | - $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
13 | - } |
|
11 | + if (empty($_REQUEST['t'])) { |
|
12 | + $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
13 | + } |
|
14 | 14 | |
15 | - // Set the item name for logger |
|
16 | - $_SESSION['itemname'] = $_REQUEST['t']; |
|
15 | + // Set the item name for logger |
|
16 | + $_SESSION['itemname'] = $_REQUEST['t']; |
|
17 | 17 | |
18 | - $modx->getDatabase()->optimize($_REQUEST['t']); |
|
18 | + $modx->getDatabase()->optimize($_REQUEST['t']); |
|
19 | 19 | |
20 | 20 | } elseif (isset($_REQUEST['u'])) { |
21 | 21 | |
22 | - if (empty($_REQUEST['u'])) { |
|
23 | - $modx->webAlertAndQuit($_lang["error_no_truncate_tablename"]); |
|
24 | - } |
|
22 | + if (empty($_REQUEST['u'])) { |
|
23 | + $modx->webAlertAndQuit($_lang["error_no_truncate_tablename"]); |
|
24 | + } |
|
25 | 25 | |
26 | - // Set the item name for logger |
|
27 | - $_SESSION['itemname'] = $_REQUEST['u']; |
|
26 | + // Set the item name for logger |
|
27 | + $_SESSION['itemname'] = $_REQUEST['u']; |
|
28 | 28 | |
29 | - $modx->getDatabase()->truncate($_REQUEST['u']); |
|
29 | + $modx->getDatabase()->truncate($_REQUEST['u']); |
|
30 | 30 | |
31 | 31 | } else { |
32 | - $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
32 | + $modx->webAlertAndQuit($_lang["error_no_optimise_tablename"]); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | $mode = (int)$_REQUEST['mode']; |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('delete_snippet')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Set the item name for logger |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeChunkFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeChunkFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the chunk. |
25 | 25 | $modx->getDatabase()->delete($modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); |
26 | 26 | |
27 | 27 | // invoke OnChunkFormDelete event |
28 | 28 | $modx->invokeEvent("OnChunkFormDelete", |
29 | - array( |
|
30 | - "id" => $id |
|
31 | - )); |
|
29 | + array( |
|
30 | + "id" => $id |
|
31 | + )); |
|
32 | 32 | |
33 | 33 | // empty cache |
34 | 34 | $modx->clearCache('full'); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('save_password')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = $_POST['id']; |
@@ -11,25 +11,25 @@ discard block |
||
11 | 11 | $pass2 = $_POST['pass2']; |
12 | 12 | |
13 | 13 | if($pass1!=$pass2){ |
14 | - $modx->webAlertAndQuit("Passwords don't match!"); |
|
14 | + $modx->webAlertAndQuit("Passwords don't match!"); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | if(strlen($pass1)<6){ |
18 | - $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
|
18 | + $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $pass1 = $modx->getPhpCompat()->htmlspecialchars($pass1, ENT_NOQUOTES); |
22 | - $tbl_manager_users = $modx->getFullTableName('manager_users'); |
|
23 | - $uid = $modx->getLoginUserID(); |
|
24 | - $f['password'] = $modx->getPasswordHash()->HashPassword($pass1); |
|
25 | - $modx->getDatabase()->update($f,$tbl_manager_users,"id='{$uid}'"); |
|
22 | + $tbl_manager_users = $modx->getFullTableName('manager_users'); |
|
23 | + $uid = $modx->getLoginUserID(); |
|
24 | + $f['password'] = $modx->getPasswordHash()->HashPassword($pass1); |
|
25 | + $modx->getDatabase()->update($f,$tbl_manager_users,"id='{$uid}'"); |
|
26 | 26 | |
27 | - // invoke OnManagerChangePassword event |
|
28 | - $modx->invokeEvent('OnManagerChangePassword', array ( |
|
29 | - 'userid' => $uid, |
|
30 | - 'username' => $_SESSION['mgrShortname'], |
|
31 | - 'userpassword' => $pass1 |
|
32 | - )); |
|
27 | + // invoke OnManagerChangePassword event |
|
28 | + $modx->invokeEvent('OnManagerChangePassword', array ( |
|
29 | + 'userid' => $uid, |
|
30 | + 'username' => $_SESSION['mgrShortname'], |
|
31 | + 'userpassword' => $pass1 |
|
32 | + )); |
|
33 | 33 | |
34 | 34 | $header="Location: index.php?a=2"; |
35 | 35 | header($header); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('access_permissions')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // access group processor. |
@@ -20,113 +20,113 @@ discard block |
||
20 | 20 | $operation = $_REQUEST['operation']; |
21 | 21 | |
22 | 22 | switch ($operation) { |
23 | - case "add_user_group" : |
|
24 | - $newgroup = $_REQUEST['newusergroup']; |
|
25 | - if(empty($newgroup)) { |
|
26 | - $modx->webAlertAndQuit("No group name specified."); |
|
27 | - } else { |
|
28 | - $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_membergroup_names); |
|
23 | + case "add_user_group" : |
|
24 | + $newgroup = $_REQUEST['newusergroup']; |
|
25 | + if(empty($newgroup)) { |
|
26 | + $modx->webAlertAndQuit("No group name specified."); |
|
27 | + } else { |
|
28 | + $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_membergroup_names); |
|
29 | 29 | |
30 | - // invoke OnManagerCreateGroup event |
|
31 | - $modx->invokeEvent('OnManagerCreateGroup', array( |
|
32 | - 'groupid' => $id, |
|
33 | - 'groupname' => $newgroup, |
|
34 | - )); |
|
35 | - } |
|
36 | - break; |
|
37 | - case "add_document_group" : |
|
38 | - $newgroup = $_REQUEST['newdocgroup']; |
|
39 | - if(empty($newgroup)) { |
|
40 | - $modx->webAlertAndQuit("No group name specified."); |
|
41 | - } else { |
|
42 | - $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
|
30 | + // invoke OnManagerCreateGroup event |
|
31 | + $modx->invokeEvent('OnManagerCreateGroup', array( |
|
32 | + 'groupid' => $id, |
|
33 | + 'groupname' => $newgroup, |
|
34 | + )); |
|
35 | + } |
|
36 | + break; |
|
37 | + case "add_document_group" : |
|
38 | + $newgroup = $_REQUEST['newdocgroup']; |
|
39 | + if(empty($newgroup)) { |
|
40 | + $modx->webAlertAndQuit("No group name specified."); |
|
41 | + } else { |
|
42 | + $id = $modx->getDatabase()->insert(array('name' => $modx->getDatabase()->escape($newgroup)), $tbl_documentgroup_names); |
|
43 | 43 | |
44 | - // invoke OnCreateDocGroup event |
|
45 | - $modx->invokeEvent('OnCreateDocGroup', array( |
|
46 | - 'groupid' => $id, |
|
47 | - 'groupname' => $newgroup, |
|
48 | - )); |
|
49 | - } |
|
50 | - break; |
|
51 | - case "delete_user_group" : |
|
52 | - $updategroupaccess = true; |
|
53 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
54 | - if(empty($usergroup)) { |
|
55 | - $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
56 | - } else { |
|
57 | - $modx->getDatabase()->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
|
44 | + // invoke OnCreateDocGroup event |
|
45 | + $modx->invokeEvent('OnCreateDocGroup', array( |
|
46 | + 'groupid' => $id, |
|
47 | + 'groupname' => $newgroup, |
|
48 | + )); |
|
49 | + } |
|
50 | + break; |
|
51 | + case "delete_user_group" : |
|
52 | + $updategroupaccess = true; |
|
53 | + $usergroup = (int)$_REQUEST['usergroup']; |
|
54 | + if(empty($usergroup)) { |
|
55 | + $modx->webAlertAndQuit("No user group id specified for deletion."); |
|
56 | + } else { |
|
57 | + $modx->getDatabase()->delete($tbl_membergroup_names, "id='{$usergroup}'"); |
|
58 | 58 | |
59 | - $modx->getDatabase()->delete($tbl_membergroup_access, "membergroup='{$usergroup}'"); |
|
59 | + $modx->getDatabase()->delete($tbl_membergroup_access, "membergroup='{$usergroup}'"); |
|
60 | 60 | |
61 | - $modx->getDatabase()->delete($tbl_member_groups, "user_group='{$usergroup}'"); |
|
62 | - } |
|
63 | - break; |
|
64 | - case "delete_document_group" : |
|
65 | - $group = (int)$_REQUEST['documentgroup']; |
|
66 | - if(empty($group)) { |
|
67 | - $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
68 | - } else { |
|
69 | - $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
61 | + $modx->getDatabase()->delete($tbl_member_groups, "user_group='{$usergroup}'"); |
|
62 | + } |
|
63 | + break; |
|
64 | + case "delete_document_group" : |
|
65 | + $group = (int)$_REQUEST['documentgroup']; |
|
66 | + if(empty($group)) { |
|
67 | + $modx->webAlertAndQuit("No document group id specified for deletion."); |
|
68 | + } else { |
|
69 | + $modx->getDatabase()->delete($tbl_documentgroup_names, "id='{$group}'"); |
|
70 | 70 | |
71 | - $modx->getDatabase()->delete($tbl_membergroup_access, "documentgroup='{$group}'"); |
|
71 | + $modx->getDatabase()->delete($tbl_membergroup_access, "documentgroup='{$group}'"); |
|
72 | 72 | |
73 | - $modx->getDatabase()->delete($tbl_document_groups, "document_group='{$group}'"); |
|
74 | - } |
|
75 | - break; |
|
76 | - case "rename_user_group" : |
|
77 | - $newgroupname = $_REQUEST['newgroupname']; |
|
78 | - if(empty($newgroupname)) { |
|
79 | - $modx->webAlertAndQuit("No group name specified."); |
|
80 | - } |
|
81 | - $groupid = (int)$_REQUEST['groupid']; |
|
82 | - if(empty($groupid)) { |
|
83 | - $modx->webAlertAndQuit("No group id specified for rename."); |
|
84 | - } |
|
73 | + $modx->getDatabase()->delete($tbl_document_groups, "document_group='{$group}'"); |
|
74 | + } |
|
75 | + break; |
|
76 | + case "rename_user_group" : |
|
77 | + $newgroupname = $_REQUEST['newgroupname']; |
|
78 | + if(empty($newgroupname)) { |
|
79 | + $modx->webAlertAndQuit("No group name specified."); |
|
80 | + } |
|
81 | + $groupid = (int)$_REQUEST['groupid']; |
|
82 | + if(empty($groupid)) { |
|
83 | + $modx->webAlertAndQuit("No group id specified for rename."); |
|
84 | + } |
|
85 | 85 | |
86 | - $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_membergroup_names, "id='{$groupid}'"); |
|
87 | - break; |
|
88 | - case "rename_document_group" : |
|
89 | - $newgroupname = $_REQUEST['newgroupname']; |
|
90 | - if(empty($newgroupname)) { |
|
91 | - $modx->webAlertAndQuit("No group name specified."); |
|
92 | - } |
|
93 | - $groupid = (int)$_REQUEST['groupid']; |
|
94 | - if(empty($groupid)) { |
|
95 | - $modx->webAlertAndQuit("No group id specified for rename."); |
|
96 | - } |
|
86 | + $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_membergroup_names, "id='{$groupid}'"); |
|
87 | + break; |
|
88 | + case "rename_document_group" : |
|
89 | + $newgroupname = $_REQUEST['newgroupname']; |
|
90 | + if(empty($newgroupname)) { |
|
91 | + $modx->webAlertAndQuit("No group name specified."); |
|
92 | + } |
|
93 | + $groupid = (int)$_REQUEST['groupid']; |
|
94 | + if(empty($groupid)) { |
|
95 | + $modx->webAlertAndQuit("No group id specified for rename."); |
|
96 | + } |
|
97 | 97 | |
98 | - $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
99 | - break; |
|
100 | - case "add_document_group_to_user_group" : |
|
101 | - $updategroupaccess = true; |
|
102 | - $usergroup = (int)$_REQUEST['usergroup']; |
|
103 | - $docgroup = (int)$_REQUEST['docgroup']; |
|
104 | - $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
105 | - $limit = $modx->getDatabase()->getValue($rs); |
|
106 | - if($limit<=0) { |
|
107 | - $modx->getDatabase()->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
|
108 | - } else { |
|
109 | - //alert user that coupling already exists? |
|
110 | - } |
|
111 | - break; |
|
112 | - case "remove_document_group_from_user_group" : |
|
113 | - $updategroupaccess = true; |
|
114 | - $coupling = (int)$_REQUEST['coupling']; |
|
115 | - $modx->getDatabase()->delete($tbl_membergroup_access, "id='{$coupling}'"); |
|
116 | - break; |
|
117 | - default : |
|
118 | - $modx->webAlertAndQuit("No operation set in request."); |
|
98 | + $modx->getDatabase()->update(array('name' => $modx->getDatabase()->escape($newgroupname)), $tbl_documentgroup_names, "id='{$groupid}'"); |
|
99 | + break; |
|
100 | + case "add_document_group_to_user_group" : |
|
101 | + $updategroupaccess = true; |
|
102 | + $usergroup = (int)$_REQUEST['usergroup']; |
|
103 | + $docgroup = (int)$_REQUEST['docgroup']; |
|
104 | + $rs = $modx->getDatabase()->select('COUNT(*)', $tbl_membergroup_access, "membergroup='{$usergroup}' AND documentgroup='{$docgroup}'"); |
|
105 | + $limit = $modx->getDatabase()->getValue($rs); |
|
106 | + if($limit<=0) { |
|
107 | + $modx->getDatabase()->insert(array('membergroup' => $usergroup, 'documentgroup' => $docgroup), $tbl_membergroup_access); |
|
108 | + } else { |
|
109 | + //alert user that coupling already exists? |
|
110 | + } |
|
111 | + break; |
|
112 | + case "remove_document_group_from_user_group" : |
|
113 | + $updategroupaccess = true; |
|
114 | + $coupling = (int)$_REQUEST['coupling']; |
|
115 | + $modx->getDatabase()->delete($tbl_membergroup_access, "id='{$coupling}'"); |
|
116 | + break; |
|
117 | + default : |
|
118 | + $modx->webAlertAndQuit("No operation set in request."); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | // secure manager documents - flag as private |
122 | 122 | if($updategroupaccess==true){ |
123 | - include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
124 | - secureMgrDocument(); |
|
123 | + include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
|
124 | + secureMgrDocument(); |
|
125 | 125 | |
126 | - // Update the private group column |
|
127 | - $modx->getDatabase()->update( |
|
128 | - 'dgn.private_memgroup = (mga.membergroup IS NOT NULL)', |
|
129 | - "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_membergroup_access} AS mga ON mga.documentgroup = dgn.id"); |
|
126 | + // Update the private group column |
|
127 | + $modx->getDatabase()->update( |
|
128 | + 'dgn.private_memgroup = (mga.membergroup IS NOT NULL)', |
|
129 | + "{$tbl_documentgroup_names} AS dgn LEFT JOIN {$tbl_membergroup_access} AS mga ON mga.documentgroup = dgn.id"); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | $header = "Location: index.php?a=40"; |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('delete_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // delete the user, but first check if we are deleting our own record |
15 | 15 | if($id==$modx->getLoginUserID()) { |
16 | - $modx->webAlertAndQuit("You can't delete yourself!"); |
|
16 | + $modx->webAlertAndQuit("You can't delete yourself!"); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | // Set the item name for logger |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | // invoke OnBeforeUserFormDelete event |
24 | 24 | $modx->invokeEvent("OnBeforeUserFormDelete", |
25 | - array( |
|
26 | - "id" => $id |
|
27 | - )); |
|
25 | + array( |
|
26 | + "id" => $id |
|
27 | + )); |
|
28 | 28 | |
29 | 29 | // delete the user. |
30 | 30 | $modx->getDatabase()->delete($modx->getFullTableName('manager_users'), "id='{$id}'"); |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | |
40 | 40 | // invoke OnManagerDeleteUser event |
41 | 41 | $modx->invokeEvent("OnManagerDeleteUser", |
42 | - array( |
|
43 | - "userid" => $id, |
|
44 | - "username" => $username |
|
45 | - )); |
|
42 | + array( |
|
43 | + "userid" => $id, |
|
44 | + "username" => $username |
|
45 | + )); |
|
46 | 46 | |
47 | 47 | // invoke OnUserFormDelete event |
48 | 48 | $modx->invokeEvent("OnUserFormDelete", |
49 | - array( |
|
50 | - "id" => $id |
|
51 | - )); |
|
49 | + array( |
|
50 | + "id" => $id |
|
51 | + )); |
|
52 | 52 | |
53 | 53 | $header="Location: index.php?a=75"; |
54 | 54 | header($header); |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('new_chunk')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate htmlsnippet |
21 | 21 | $newid = $modx->getDatabase()->insert( |
22 | - array( |
|
23 | - 'name'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'snippet'=>'', |
|
26 | - 'category'=>'', |
|
27 | - ), $modx->getFullTableName('site_htmlsnippets'), // Insert into |
|
28 | - "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'name'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'snippet'=>'', |
|
26 | + 'category'=>'', |
|
27 | + ), $modx->getFullTableName('site_htmlsnippets'), // Insert into |
|
28 | + "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from |
|
29 | 29 | |
30 | 30 | // Set the item name for logger |
31 | 31 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_htmlsnippets'), "id='{$newid}'")); |
@@ -1,135 +1,135 @@ |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('save_role')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | extract($_POST); |
10 | 10 | |
11 | 11 | if($name == '' || !isset ($name)) { |
12 | - $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}" . ($mode = 35 ? "&id={$id}" : "")); |
|
12 | + $modx->webAlertAndQuit("Please enter a name for this role!", "index.php?a={$mode}" . ($mode = 35 ? "&id={$id}" : "")); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | // setup fields |
16 | 16 | $fields = array( |
17 | - 'name' => $name, |
|
18 | - 'description' => $description, |
|
19 | - 'frames' => $frames, |
|
20 | - 'home' => $home, |
|
21 | - 'view_document' => $view_document, |
|
22 | - 'new_document' => $new_document, |
|
23 | - 'save_document' => $save_document, |
|
24 | - 'publish_document' => $publish_document, |
|
25 | - 'delete_document' => $delete_document, |
|
26 | - 'empty_trash' => $empty_trash, |
|
27 | - 'action_ok' => $action_ok, |
|
28 | - 'logout' => $logout, |
|
29 | - 'help' => $help, |
|
30 | - 'messages' => $messages, |
|
31 | - 'new_user' => $new_user, |
|
32 | - 'edit_user' => $edit_user, |
|
33 | - 'logs' => $logs, |
|
34 | - 'edit_parser' => (isset ($edit_parser)) ? $edit_parser : '0', |
|
35 | - 'save_parser' => (isset ($save_parser)) ? $save_parser : '0', |
|
36 | - 'edit_template' => $edit_template, |
|
37 | - 'settings' => $settings, |
|
38 | - 'credits' => $credits, |
|
39 | - 'new_template' => $new_template, |
|
40 | - 'save_template' => $save_template, |
|
41 | - 'delete_template' => $delete_template, |
|
42 | - 'edit_snippet' => $edit_snippet, |
|
43 | - 'new_snippet' => $new_snippet, |
|
44 | - 'save_snippet' => $save_snippet, |
|
45 | - 'delete_snippet' => $delete_snippet, |
|
46 | - 'edit_chunk' => $edit_chunk, |
|
47 | - 'new_chunk' => $new_chunk, |
|
48 | - 'save_chunk' => $save_chunk, |
|
49 | - 'delete_chunk' => $delete_chunk, |
|
50 | - 'empty_cache' => $empty_cache, |
|
51 | - 'edit_document' => $edit_document, |
|
52 | - 'change_password' => $change_password, |
|
53 | - 'error_dialog' => $error_dialog, |
|
54 | - 'about' => $about, |
|
55 | - 'file_manager' => $file_manager, |
|
56 | - 'assets_files' => $assets_files, |
|
57 | - 'assets_images' => $assets_images, |
|
58 | - 'save_user' => $save_user, |
|
59 | - 'delete_user' => $delete_user, |
|
60 | - 'save_password' => $save_password, |
|
61 | - 'edit_role' => $edit_role, |
|
62 | - 'save_role' => $save_role, |
|
63 | - 'delete_role' => $delete_role, |
|
64 | - 'new_role' => $new_role, |
|
65 | - 'access_permissions' => $access_permissions, |
|
66 | - 'bk_manager' => $bk_manager, |
|
67 | - 'new_plugin' => $new_plugin, |
|
68 | - 'edit_plugin' => $edit_plugin, |
|
69 | - 'save_plugin' => $save_plugin, |
|
70 | - 'delete_plugin' => $delete_plugin, |
|
71 | - 'new_module' => $new_module, |
|
72 | - 'edit_module' => $edit_module, |
|
73 | - 'save_module' => $save_module, |
|
74 | - 'delete_module' => $delete_module, |
|
75 | - 'exec_module' => $exec_module, |
|
76 | - 'view_eventlog' => $view_eventlog, |
|
77 | - 'delete_eventlog' => $delete_eventlog, |
|
78 | - 'new_web_user' => $new_web_user, |
|
79 | - 'edit_web_user' => $edit_web_user, |
|
80 | - 'save_web_user' => $save_web_user, |
|
81 | - 'delete_web_user' => $delete_web_user, |
|
82 | - 'web_access_permissions' => $web_access_permissions, |
|
83 | - 'view_unpublished' => $view_unpublished, |
|
84 | - 'import_static' => $import_static, |
|
85 | - 'export_static' => $export_static, |
|
86 | - 'remove_locks' => $remove_locks, |
|
87 | - 'display_locks' => $display_locks, |
|
88 | - 'change_resourcetype' => $change_resourcetype, |
|
89 | - 'category_manager' => $category_manager |
|
17 | + 'name' => $name, |
|
18 | + 'description' => $description, |
|
19 | + 'frames' => $frames, |
|
20 | + 'home' => $home, |
|
21 | + 'view_document' => $view_document, |
|
22 | + 'new_document' => $new_document, |
|
23 | + 'save_document' => $save_document, |
|
24 | + 'publish_document' => $publish_document, |
|
25 | + 'delete_document' => $delete_document, |
|
26 | + 'empty_trash' => $empty_trash, |
|
27 | + 'action_ok' => $action_ok, |
|
28 | + 'logout' => $logout, |
|
29 | + 'help' => $help, |
|
30 | + 'messages' => $messages, |
|
31 | + 'new_user' => $new_user, |
|
32 | + 'edit_user' => $edit_user, |
|
33 | + 'logs' => $logs, |
|
34 | + 'edit_parser' => (isset ($edit_parser)) ? $edit_parser : '0', |
|
35 | + 'save_parser' => (isset ($save_parser)) ? $save_parser : '0', |
|
36 | + 'edit_template' => $edit_template, |
|
37 | + 'settings' => $settings, |
|
38 | + 'credits' => $credits, |
|
39 | + 'new_template' => $new_template, |
|
40 | + 'save_template' => $save_template, |
|
41 | + 'delete_template' => $delete_template, |
|
42 | + 'edit_snippet' => $edit_snippet, |
|
43 | + 'new_snippet' => $new_snippet, |
|
44 | + 'save_snippet' => $save_snippet, |
|
45 | + 'delete_snippet' => $delete_snippet, |
|
46 | + 'edit_chunk' => $edit_chunk, |
|
47 | + 'new_chunk' => $new_chunk, |
|
48 | + 'save_chunk' => $save_chunk, |
|
49 | + 'delete_chunk' => $delete_chunk, |
|
50 | + 'empty_cache' => $empty_cache, |
|
51 | + 'edit_document' => $edit_document, |
|
52 | + 'change_password' => $change_password, |
|
53 | + 'error_dialog' => $error_dialog, |
|
54 | + 'about' => $about, |
|
55 | + 'file_manager' => $file_manager, |
|
56 | + 'assets_files' => $assets_files, |
|
57 | + 'assets_images' => $assets_images, |
|
58 | + 'save_user' => $save_user, |
|
59 | + 'delete_user' => $delete_user, |
|
60 | + 'save_password' => $save_password, |
|
61 | + 'edit_role' => $edit_role, |
|
62 | + 'save_role' => $save_role, |
|
63 | + 'delete_role' => $delete_role, |
|
64 | + 'new_role' => $new_role, |
|
65 | + 'access_permissions' => $access_permissions, |
|
66 | + 'bk_manager' => $bk_manager, |
|
67 | + 'new_plugin' => $new_plugin, |
|
68 | + 'edit_plugin' => $edit_plugin, |
|
69 | + 'save_plugin' => $save_plugin, |
|
70 | + 'delete_plugin' => $delete_plugin, |
|
71 | + 'new_module' => $new_module, |
|
72 | + 'edit_module' => $edit_module, |
|
73 | + 'save_module' => $save_module, |
|
74 | + 'delete_module' => $delete_module, |
|
75 | + 'exec_module' => $exec_module, |
|
76 | + 'view_eventlog' => $view_eventlog, |
|
77 | + 'delete_eventlog' => $delete_eventlog, |
|
78 | + 'new_web_user' => $new_web_user, |
|
79 | + 'edit_web_user' => $edit_web_user, |
|
80 | + 'save_web_user' => $save_web_user, |
|
81 | + 'delete_web_user' => $delete_web_user, |
|
82 | + 'web_access_permissions' => $web_access_permissions, |
|
83 | + 'view_unpublished' => $view_unpublished, |
|
84 | + 'import_static' => $import_static, |
|
85 | + 'export_static' => $export_static, |
|
86 | + 'remove_locks' => $remove_locks, |
|
87 | + 'display_locks' => $display_locks, |
|
88 | + 'change_resourcetype' => $change_resourcetype, |
|
89 | + 'category_manager' => $category_manager |
|
90 | 90 | ); |
91 | 91 | |
92 | 92 | $fields = $modx->getDatabase()->escape($fields); |
93 | 93 | |
94 | 94 | switch($_POST['mode']) { |
95 | - case '38' : |
|
96 | - $tbl = $modx->getFullTableName("user_roles"); |
|
95 | + case '38' : |
|
96 | + $tbl = $modx->getFullTableName("user_roles"); |
|
97 | 97 | |
98 | - // disallow duplicate names for role |
|
99 | - $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
|
100 | - if($modx->getDatabase()->getValue($rs) > 0) { |
|
101 | - $modx->getManagerApi()->saveFormValues(38); |
|
102 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
|
103 | - } |
|
98 | + // disallow duplicate names for role |
|
99 | + $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}'"); |
|
100 | + if($modx->getDatabase()->getValue($rs) > 0) { |
|
101 | + $modx->getManagerApi()->saveFormValues(38); |
|
102 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=38"); |
|
103 | + } |
|
104 | 104 | |
105 | - $modx->getDatabase()->insert($fields, $tbl); |
|
105 | + $modx->getDatabase()->insert($fields, $tbl); |
|
106 | 106 | |
107 | - // Set the item name for logger |
|
108 | - $_SESSION['itemname'] = $_POST['name']; |
|
107 | + // Set the item name for logger |
|
108 | + $_SESSION['itemname'] = $_POST['name']; |
|
109 | 109 | |
110 | - $header = "Location: index.php?a=86&r=2"; |
|
111 | - header($header); |
|
112 | - break; |
|
113 | - case '35' : |
|
114 | - $tbl = $modx->getFullTableName("user_roles"); |
|
110 | + $header = "Location: index.php?a=86&r=2"; |
|
111 | + header($header); |
|
112 | + break; |
|
113 | + case '35' : |
|
114 | + $tbl = $modx->getFullTableName("user_roles"); |
|
115 | 115 | |
116 | - // disallow duplicate names for role |
|
117 | - $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
|
118 | - if($modx->getDatabase()->getValue($rs) > 0) { |
|
119 | - $modx->getManagerApi()->saveFormValues(35); |
|
120 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
|
121 | - } |
|
116 | + // disallow duplicate names for role |
|
117 | + $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_roles'), "name='{$fields['name']}' AND id!='{$id}'"); |
|
118 | + if($modx->getDatabase()->getValue($rs) > 0) { |
|
119 | + $modx->getManagerApi()->saveFormValues(35); |
|
120 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['role'], $name), "index.php?a=35&id={$id}"); |
|
121 | + } |
|
122 | 122 | |
123 | - $modx->getDatabase()->update($fields, $tbl, "id='{$id}'"); |
|
123 | + $modx->getDatabase()->update($fields, $tbl, "id='{$id}'"); |
|
124 | 124 | |
125 | - // Set the item name for logger |
|
126 | - $_SESSION['itemname'] = $_POST['name']; |
|
125 | + // Set the item name for logger |
|
126 | + $_SESSION['itemname'] = $_POST['name']; |
|
127 | 127 | |
128 | - $header = "Location: index.php?a=86&r=2"; |
|
129 | - header($header); |
|
130 | - break; |
|
131 | - default : |
|
132 | - $modx->webAlertAndQuit("No operation set in request."); |
|
128 | + $header = "Location: index.php?a=86&r=2"; |
|
129 | + header($header); |
|
130 | + break; |
|
131 | + default : |
|
132 | + $modx->webAlertAndQuit("No operation set in request."); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | $modx->unlockElement(8, $id); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('edit_document')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
@@ -25,68 +25,68 @@ discard block |
||
25 | 25 | // check user has permission to move document to chosen location |
26 | 26 | |
27 | 27 | if ($use_udperms == 1) { |
28 | - if ($oldparent != $newParentID) { |
|
29 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
30 | - $udperms->user = $modx->getLoginUserID(); |
|
31 | - $udperms->document = $newParentID; |
|
32 | - $udperms->role = $_SESSION['mgrRole']; |
|
28 | + if ($oldparent != $newParentID) { |
|
29 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
30 | + $udperms->user = $modx->getLoginUserID(); |
|
31 | + $udperms->document = $newParentID; |
|
32 | + $udperms->role = $_SESSION['mgrRole']; |
|
33 | 33 | |
34 | - if (!$udperms->checkPermissions()) { |
|
35 | - $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
36 | - } |
|
37 | - } |
|
34 | + if (!$udperms->checkPermissions()) { |
|
35 | + $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
36 | + } |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
41 | - "id_document" => $documentID, |
|
42 | - "old_parent" => $oldparent, |
|
43 | - "new_parent" => $newParentID |
|
41 | + "id_document" => $documentID, |
|
42 | + "old_parent" => $oldparent, |
|
43 | + "new_parent" => $newParentID |
|
44 | 44 | )); |
45 | 45 | if (is_array($evtOut) && count($evtOut) > 0){ |
46 | - $newParent = array_pop($evtOut); |
|
47 | - if($newParent == $oldparent) { |
|
48 | - $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
49 | - }else{ |
|
50 | - $newParentID = $newParent; |
|
51 | - } |
|
46 | + $newParent = array_pop($evtOut); |
|
47 | + if($newParent == $oldparent) { |
|
48 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
49 | + }else{ |
|
50 | + $newParentID = $newParent; |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $children = allChildren($documentID); |
55 | 55 | if (!array_search($newParentID, $children)) { |
56 | - $modx->getDatabase()->update(array( |
|
57 | - 'isfolder' => 1, |
|
58 | - ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
56 | + $modx->getDatabase()->update(array( |
|
57 | + 'isfolder' => 1, |
|
58 | + ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
59 | 59 | |
60 | - $modx->getDatabase()->update(array( |
|
61 | - 'parent' => $newParentID, |
|
62 | - 'editedby' => $modx->getLoginUserID(), |
|
63 | - 'editedon' => time(), |
|
64 | - ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
60 | + $modx->getDatabase()->update(array( |
|
61 | + 'parent' => $newParentID, |
|
62 | + 'editedby' => $modx->getLoginUserID(), |
|
63 | + 'editedon' => time(), |
|
64 | + ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
65 | 65 | |
66 | - // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
67 | - $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
68 | - $limit = $modx->getDatabase()->getValue($rs); |
|
66 | + // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
67 | + $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
68 | + $limit = $modx->getDatabase()->getValue($rs); |
|
69 | 69 | |
70 | - if(!$limit>0) { |
|
71 | - $modx->getDatabase()->update(array( |
|
72 | - 'isfolder' => 0, |
|
73 | - ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
74 | - } |
|
75 | - // Set the item name for logger |
|
76 | - $pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
77 | - $_SESSION['itemname'] = $pagetitle; |
|
70 | + if(!$limit>0) { |
|
71 | + $modx->getDatabase()->update(array( |
|
72 | + 'isfolder' => 0, |
|
73 | + ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
74 | + } |
|
75 | + // Set the item name for logger |
|
76 | + $pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
77 | + $_SESSION['itemname'] = $pagetitle; |
|
78 | 78 | |
79 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
80 | - "id_document" => $documentID, |
|
81 | - "old_parent" => $oldparent, |
|
82 | - "new_parent" => $newParentID |
|
83 | - )); |
|
79 | + $modx->invokeEvent("onAfterMoveDocument", array ( |
|
80 | + "id_document" => $documentID, |
|
81 | + "old_parent" => $oldparent, |
|
82 | + "new_parent" => $newParentID |
|
83 | + )); |
|
84 | 84 | |
85 | - // empty cache & sync site |
|
86 | - $modx->clearCache('full'); |
|
85 | + // empty cache & sync site |
|
86 | + $modx->clearCache('full'); |
|
87 | 87 | |
88 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
89 | - header($header); |
|
88 | + $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
89 | + header($header); |
|
90 | 90 | } else { |
91 | - $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
91 | + $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
92 | 92 | } |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('save_web_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $tbl_web_users = $modx->getFullTableName('web_users'); |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | |
13 | 13 | $input = $_POST; |
14 | 14 | foreach($input as $k => $v) { |
15 | - if($k !== 'comment') { |
|
16 | - $v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES); |
|
17 | - } |
|
18 | - $input[$k] = $v; |
|
15 | + if($k !== 'comment') { |
|
16 | + $v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES); |
|
17 | + } |
|
18 | + $input[$k] = $v; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = (int)$input['id']; |
@@ -51,82 +51,82 @@ discard block |
||
51 | 51 | |
52 | 52 | // verify password |
53 | 53 | if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
54 | - webAlertAndQuit("Password typed is mismatched", 88); |
|
54 | + webAlertAndQuit("Password typed is mismatched", 88); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // verify email |
58 | 58 | if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
59 | - webAlertAndQuit("E-mail address doesn't seem to be valid!", 88); |
|
59 | + webAlertAndQuit("E-mail address doesn't seem to be valid!", 88); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | switch($input['mode']) { |
63 | - case '87' : // new user |
|
64 | - // check if this user name already exist |
|
65 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
66 | - $limit = $modx->getDatabase()->getValue($rs); |
|
67 | - if($limit > 0) { |
|
68 | - webAlertAndQuit("User name is already in use!", 88); |
|
69 | - } |
|
70 | - |
|
71 | - // check if the email address already exist |
|
72 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
73 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
74 | - $limit = $modx->getDatabase()->getValue($rs); |
|
75 | - if($limit > 0) { |
|
76 | - webAlertAndQuit("Email is already in use!", 88); |
|
77 | - } |
|
78 | - } |
|
79 | - |
|
80 | - // generate a new password for this user |
|
81 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | - if(strlen($specifiedpassword) < 6) { |
|
83 | - webAlertAndQuit("Password is too short!", 88); |
|
84 | - } else { |
|
85 | - $newpassword = $specifiedpassword; |
|
86 | - } |
|
87 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
88 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
89 | - } elseif($passwordgenmethod == 'g') { |
|
90 | - $newpassword = generate_password(8); |
|
91 | - } else { |
|
92 | - webAlertAndQuit("No password generation method specified!", 88); |
|
93 | - } |
|
94 | - |
|
95 | - // invoke OnBeforeWUsrFormSave event |
|
96 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
97 | - "mode" => "new", |
|
98 | - )); |
|
99 | - |
|
100 | - // create the user account |
|
101 | - $field = array(); |
|
102 | - $field['username'] = $esc_newusername; |
|
103 | - $field['password'] = md5($newpassword); |
|
104 | - $internalKey = $modx->getDatabase()->insert($field, $tbl_web_users); |
|
105 | - |
|
106 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
107 | - $field = $modx->getDatabase()->escape($field); |
|
108 | - $modx->getDatabase()->insert($field, $tbl_web_user_attributes); |
|
109 | - |
|
110 | - // Save User Settings |
|
63 | + case '87' : // new user |
|
64 | + // check if this user name already exist |
|
65 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
66 | + $limit = $modx->getDatabase()->getValue($rs); |
|
67 | + if($limit > 0) { |
|
68 | + webAlertAndQuit("User name is already in use!", 88); |
|
69 | + } |
|
70 | + |
|
71 | + // check if the email address already exist |
|
72 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
73 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
74 | + $limit = $modx->getDatabase()->getValue($rs); |
|
75 | + if($limit > 0) { |
|
76 | + webAlertAndQuit("Email is already in use!", 88); |
|
77 | + } |
|
78 | + } |
|
79 | + |
|
80 | + // generate a new password for this user |
|
81 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
82 | + if(strlen($specifiedpassword) < 6) { |
|
83 | + webAlertAndQuit("Password is too short!", 88); |
|
84 | + } else { |
|
85 | + $newpassword = $specifiedpassword; |
|
86 | + } |
|
87 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
88 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
89 | + } elseif($passwordgenmethod == 'g') { |
|
90 | + $newpassword = generate_password(8); |
|
91 | + } else { |
|
92 | + webAlertAndQuit("No password generation method specified!", 88); |
|
93 | + } |
|
94 | + |
|
95 | + // invoke OnBeforeWUsrFormSave event |
|
96 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
97 | + "mode" => "new", |
|
98 | + )); |
|
99 | + |
|
100 | + // create the user account |
|
101 | + $field = array(); |
|
102 | + $field['username'] = $esc_newusername; |
|
103 | + $field['password'] = md5($newpassword); |
|
104 | + $internalKey = $modx->getDatabase()->insert($field, $tbl_web_users); |
|
105 | + |
|
106 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
107 | + $field = $modx->getDatabase()->escape($field); |
|
108 | + $modx->getDatabase()->insert($field, $tbl_web_user_attributes); |
|
109 | + |
|
110 | + // Save User Settings |
|
111 | 111 | saveWebUserSettings($internalKey); |
112 | 112 | |
113 | - // Set the item name for logger |
|
114 | - $_SESSION['itemname'] = $newusername; |
|
115 | - |
|
116 | - /*******************************************************************************/ |
|
117 | - // put the user in the user_groups he/ she should be in |
|
118 | - // first, check that up_perms are switched on! |
|
119 | - if($use_udperms == 1) { |
|
120 | - if(!empty($user_groups)) { |
|
121 | - for($i = 0; $i < count($user_groups); $i++) { |
|
122 | - $f = array(); |
|
123 | - $f['webgroup'] = (int)$user_groups[$i]; |
|
124 | - $f['webuser'] = $internalKey; |
|
125 | - $modx->getDatabase()->insert($f, $tbl_web_groups); |
|
126 | - } |
|
127 | - } |
|
128 | - } |
|
129 | - // end of user_groups stuff! |
|
113 | + // Set the item name for logger |
|
114 | + $_SESSION['itemname'] = $newusername; |
|
115 | + |
|
116 | + /*******************************************************************************/ |
|
117 | + // put the user in the user_groups he/ she should be in |
|
118 | + // first, check that up_perms are switched on! |
|
119 | + if($use_udperms == 1) { |
|
120 | + if(!empty($user_groups)) { |
|
121 | + for($i = 0; $i < count($user_groups); $i++) { |
|
122 | + $f = array(); |
|
123 | + $f['webgroup'] = (int)$user_groups[$i]; |
|
124 | + $f['webuser'] = $internalKey; |
|
125 | + $modx->getDatabase()->insert($f, $tbl_web_groups); |
|
126 | + } |
|
127 | + } |
|
128 | + } |
|
129 | + // end of user_groups stuff! |
|
130 | 130 | |
131 | 131 | // invoke OnWebSaveUser event |
132 | 132 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -144,26 +144,26 @@ discard block |
||
144 | 144 | "id" => $internalKey |
145 | 145 | )); |
146 | 146 | |
147 | - if($passwordnotifymethod == 'e') { |
|
147 | + if($passwordnotifymethod == 'e') { |
|
148 | 148 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
149 | - if($input['stay'] != '') { |
|
150 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | - header($header); |
|
153 | - } else { |
|
154 | - $header = "Location: index.php?a=99&r=2"; |
|
155 | - header($header); |
|
156 | - } |
|
157 | - } else { |
|
158 | - if($input['stay'] != '') { |
|
159 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | - } else { |
|
162 | - $stayUrl = "index.php?a=99&r=2"; |
|
163 | - } |
|
164 | - |
|
165 | - include_once "header.inc.php"; |
|
166 | - ?> |
|
149 | + if($input['stay'] != '') { |
|
150 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
151 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | + header($header); |
|
153 | + } else { |
|
154 | + $header = "Location: index.php?a=99&r=2"; |
|
155 | + header($header); |
|
156 | + } |
|
157 | + } else { |
|
158 | + if($input['stay'] != '') { |
|
159 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
160 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | + } else { |
|
162 | + $stayUrl = "index.php?a=99&r=2"; |
|
163 | + } |
|
164 | + |
|
165 | + include_once "header.inc.php"; |
|
166 | + ?> |
|
167 | 167 | |
168 | 168 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
169 | 169 | |
@@ -185,86 +185,86 @@ discard block |
||
185 | 185 | </div> |
186 | 186 | <?php |
187 | 187 | |
188 | - include_once "footer.inc.php"; |
|
189 | - } |
|
190 | - break; |
|
191 | - case '88' : // edit user |
|
192 | - // generate a new password for this user |
|
193 | - if($genpassword == 1) { |
|
194 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | - if(strlen($specifiedpassword) < 6) { |
|
196 | - webAlertAndQuit("Password is too short!", 88); |
|
197 | - } else { |
|
198 | - $newpassword = $specifiedpassword; |
|
199 | - } |
|
200 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
202 | - } elseif($passwordgenmethod == 'g') { |
|
203 | - $newpassword = generate_password(8); |
|
204 | - } else { |
|
205 | - webAlertAndQuit("No password generation method specified!", 88); |
|
206 | - } |
|
207 | - } |
|
208 | - if($passwordnotifymethod == 'e') { |
|
188 | + include_once "footer.inc.php"; |
|
189 | + } |
|
190 | + break; |
|
191 | + case '88' : // edit user |
|
192 | + // generate a new password for this user |
|
193 | + if($genpassword == 1) { |
|
194 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | + if(strlen($specifiedpassword) < 6) { |
|
196 | + webAlertAndQuit("Password is too short!", 88); |
|
197 | + } else { |
|
198 | + $newpassword = $specifiedpassword; |
|
199 | + } |
|
200 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
202 | + } elseif($passwordgenmethod == 'g') { |
|
203 | + $newpassword = generate_password(8); |
|
204 | + } else { |
|
205 | + webAlertAndQuit("No password generation method specified!", 88); |
|
206 | + } |
|
207 | + } |
|
208 | + if($passwordnotifymethod == 'e') { |
|
209 | 209 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
210 | - } |
|
211 | - |
|
212 | - // check if the username already exist |
|
213 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
214 | - $limit = $modx->getDatabase()->getValue($rs); |
|
215 | - if($limit > 0) { |
|
216 | - webAlertAndQuit("User name is already in use!", 88); |
|
217 | - } |
|
218 | - |
|
219 | - // check if the email address already exists |
|
220 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
221 | - $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
222 | - $limit = $modx->getDatabase()->getValue($rs); |
|
223 | - if($limit > 0) { |
|
224 | - webAlertAndQuit("Email is already in use!", 88); |
|
225 | - } |
|
226 | - } |
|
227 | - |
|
228 | - // invoke OnBeforeWUsrFormSave event |
|
229 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
230 | - "mode" => "upd", |
|
231 | - "id" => $id |
|
232 | - )); |
|
233 | - |
|
234 | - // update user name and password |
|
235 | - $field = array(); |
|
236 | - $field['username'] = $esc_newusername; |
|
237 | - if($genpassword == 1) { |
|
238 | - $field['password'] = md5($newpassword); |
|
239 | - } |
|
240 | - $modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'"); |
|
241 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
242 | - $field = $modx->getDatabase()->escape($field); |
|
243 | - $modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
244 | - |
|
245 | - // Save User Settings |
|
210 | + } |
|
211 | + |
|
212 | + // check if the username already exist |
|
213 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
214 | + $limit = $modx->getDatabase()->getValue($rs); |
|
215 | + if($limit > 0) { |
|
216 | + webAlertAndQuit("User name is already in use!", 88); |
|
217 | + } |
|
218 | + |
|
219 | + // check if the email address already exists |
|
220 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
221 | + $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
222 | + $limit = $modx->getDatabase()->getValue($rs); |
|
223 | + if($limit > 0) { |
|
224 | + webAlertAndQuit("Email is already in use!", 88); |
|
225 | + } |
|
226 | + } |
|
227 | + |
|
228 | + // invoke OnBeforeWUsrFormSave event |
|
229 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
230 | + "mode" => "upd", |
|
231 | + "id" => $id |
|
232 | + )); |
|
233 | + |
|
234 | + // update user name and password |
|
235 | + $field = array(); |
|
236 | + $field['username'] = $esc_newusername; |
|
237 | + if($genpassword == 1) { |
|
238 | + $field['password'] = md5($newpassword); |
|
239 | + } |
|
240 | + $modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'"); |
|
241 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
242 | + $field = $modx->getDatabase()->escape($field); |
|
243 | + $modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
244 | + |
|
245 | + // Save User Settings |
|
246 | 246 | saveWebUserSettings($id); |
247 | 247 | |
248 | - // Set the item name for logger |
|
249 | - $_SESSION['itemname'] = $newusername; |
|
250 | - |
|
251 | - /*******************************************************************************/ |
|
252 | - // put the user in the user_groups he/ she should be in |
|
253 | - // first, check that up_perms are switched on! |
|
254 | - if($use_udperms == 1) { |
|
255 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
256 | - $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'"); |
|
257 | - if(!empty($user_groups)) { |
|
258 | - for($i = 0; $i < count($user_groups); $i++) { |
|
259 | - $field = array(); |
|
260 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
261 | - $field['webuser'] = $id; |
|
262 | - $modx->getDatabase()->insert($field, $tbl_web_groups); |
|
263 | - } |
|
264 | - } |
|
265 | - } |
|
266 | - // end of user_groups stuff! |
|
267 | - /*******************************************************************************/ |
|
248 | + // Set the item name for logger |
|
249 | + $_SESSION['itemname'] = $newusername; |
|
250 | + |
|
251 | + /*******************************************************************************/ |
|
252 | + // put the user in the user_groups he/ she should be in |
|
253 | + // first, check that up_perms are switched on! |
|
254 | + if($use_udperms == 1) { |
|
255 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
256 | + $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'"); |
|
257 | + if(!empty($user_groups)) { |
|
258 | + for($i = 0; $i < count($user_groups); $i++) { |
|
259 | + $field = array(); |
|
260 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
261 | + $field['webuser'] = $id; |
|
262 | + $modx->getDatabase()->insert($field, $tbl_web_groups); |
|
263 | + } |
|
264 | + } |
|
265 | + } |
|
266 | + // end of user_groups stuff! |
|
267 | + /*******************************************************************************/ |
|
268 | 268 | |
269 | 269 | // invoke OnWebSaveUser event |
270 | 270 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -293,16 +293,16 @@ discard block |
||
293 | 293 | "id" => $id |
294 | 294 | )); |
295 | 295 | |
296 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | - if($input['stay'] != '') { |
|
298 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
299 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
300 | - } else { |
|
301 | - $stayUrl = "index.php?a=99&r=2"; |
|
302 | - } |
|
296 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
297 | + if($input['stay'] != '') { |
|
298 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
299 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
300 | + } else { |
|
301 | + $stayUrl = "index.php?a=99&r=2"; |
|
302 | + } |
|
303 | 303 | |
304 | - include_once "header.inc.php"; |
|
305 | - ?> |
|
304 | + include_once "header.inc.php"; |
|
305 | + ?> |
|
306 | 306 | |
307 | 307 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
308 | 308 | |
@@ -322,18 +322,18 @@ discard block |
||
322 | 322 | </div> |
323 | 323 | <?php |
324 | 324 | |
325 | - include_once "footer.inc.php"; |
|
326 | - } else { |
|
327 | - if($input['stay'] != '') { |
|
328 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
329 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
330 | - header($header); |
|
331 | - } else { |
|
332 | - $header = "Location: index.php?a=99&r=2"; |
|
333 | - header($header); |
|
334 | - } |
|
335 | - } |
|
336 | - break; |
|
337 | - default : |
|
338 | - webAlertAndQuit("No operation set in request.", 88); |
|
325 | + include_once "footer.inc.php"; |
|
326 | + } else { |
|
327 | + if($input['stay'] != '') { |
|
328 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
329 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
330 | + header($header); |
|
331 | + } else { |
|
332 | + $header = "Location: index.php?a=99&r=2"; |
|
333 | + header($header); |
|
334 | + } |
|
335 | + } |
|
336 | + break; |
|
337 | + default : |
|
338 | + webAlertAndQuit("No operation set in request.", 88); |
|
339 | 339 | } |