@@ -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 | } |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('delete_web_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (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,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeWUsrFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeWUsrFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the user. |
25 | 25 | $modx->getDatabase()->delete($modx->getFullTableName('web_users'), "id='{$id}'"); |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | |
33 | 33 | // invoke OnWebDeleteUser event |
34 | 34 | $modx->invokeEvent("OnWebDeleteUser", |
35 | - array( |
|
36 | - "userid" => $id, |
|
37 | - "username" => $username |
|
38 | - )); |
|
35 | + array( |
|
36 | + "userid" => $id, |
|
37 | + "username" => $username |
|
38 | + )); |
|
39 | 39 | |
40 | 40 | // invoke OnWUsrFormDelete event |
41 | 41 | $modx->invokeEvent("OnWUsrFormDelete", |
42 | - array( |
|
43 | - "id" => $id |
|
44 | - )); |
|
42 | + array( |
|
43 | + "id" => $id |
|
44 | + )); |
|
45 | 45 | |
46 | 46 | $header="Location: index.php?a=99"; |
47 | 47 | header($header); |
@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('delete_template')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id']) ? (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 template, but first check it doesn't have any documents using it |
15 | 15 | $rs = $modx->getDatabase()->select('id, pagetitle,introtext', $modx->getFullTableName('site_content'), "template='{$id}' AND deleted=0"); |
16 | 16 | $limit = $modx->getDatabase()->getRecordCount($rs); |
17 | 17 | if($limit > 0) { |
18 | - include "header.inc.php"; |
|
19 | - ?> |
|
18 | + include "header.inc.php"; |
|
19 | + ?> |
|
20 | 20 | |
21 | 21 | <h1><?php echo $_lang['manage_templates']; ?></h1> |
22 | 22 | |
@@ -28,20 +28,20 @@ discard block |
||
28 | 28 | <p>Documents using this template:</p> |
29 | 29 | <ul> |
30 | 30 | <?php |
31 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
32 | - echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
33 | - } |
|
34 | - ?> |
|
31 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
32 | + echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>'; |
|
33 | + } |
|
34 | + ?> |
|
35 | 35 | </ul> |
36 | 36 | </div> |
37 | 37 | </div> |
38 | 38 | <?php |
39 | - include_once "footer.inc.php"; |
|
40 | - exit; |
|
39 | + include_once "footer.inc.php"; |
|
40 | + exit; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if($id == $default_template) { |
44 | - $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
|
44 | + $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template."); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set the item name for logger |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | |
51 | 51 | // invoke OnBeforeTempFormDelete event |
52 | 52 | $modx->invokeEvent("OnBeforeTempFormDelete", array( |
53 | - "id" => $id |
|
54 | - )); |
|
53 | + "id" => $id |
|
54 | + )); |
|
55 | 55 | |
56 | 56 | // delete the document. |
57 | 57 | $modx->getDatabase()->delete($modx->getFullTableName('site_templates'), "id='{$id}'"); |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | // invoke OnTempFormDelete event |
62 | 62 | $modx->invokeEvent("OnTempFormDelete", array( |
63 | - "id" => $id |
|
64 | - )); |
|
63 | + "id" => $id |
|
64 | + )); |
|
65 | 65 | |
66 | 66 | // empty cache |
67 | 67 | $modx->clearCache('full'); |
@@ -3,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('settings')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | $data = $_POST; |
9 | 9 | // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972 |
@@ -11,41 +11,41 @@ discard block |
||
11 | 11 | |
12 | 12 | if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false) |
13 | 13 | { |
14 | - $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
15 | - $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
16 | - $dir = '/' . trim($modx->config['base_url'],'/'); |
|
17 | - if(is_file($htaccess)) |
|
18 | - { |
|
19 | - $_ = file_get_contents($htaccess); |
|
20 | - if(strpos($_,'RewriteBase')===false) |
|
21 | - { |
|
22 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
23 | - } |
|
24 | - elseif(is_writable($htaccess)) |
|
25 | - { |
|
26 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
27 | - if(!@file_put_contents($htaccess,$_)) |
|
28 | - { |
|
29 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
30 | - } |
|
31 | - } |
|
32 | - } |
|
33 | - elseif(is_file($sample_htaccess)) |
|
34 | - { |
|
35 | - if(!@rename($sample_htaccess,$htaccess)) |
|
14 | + $htaccess = $modx->config['base_path'] . '.htaccess'; |
|
15 | + $sample_htaccess = $modx->config['base_path'] . 'ht.access'; |
|
16 | + $dir = '/' . trim($modx->config['base_url'],'/'); |
|
17 | + if(is_file($htaccess)) |
|
18 | + { |
|
19 | + $_ = file_get_contents($htaccess); |
|
20 | + if(strpos($_,'RewriteBase')===false) |
|
36 | 21 | { |
37 | - $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
38 | - } |
|
39 | - elseif($modx->config['base_url']!=='/') |
|
40 | - { |
|
41 | - $_ = file_get_contents($htaccess); |
|
42 | - $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
43 | - if(!@file_put_contents($htaccess,$_)) |
|
44 | - { |
|
45 | - $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
46 | - } |
|
47 | - } |
|
48 | - } |
|
22 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
23 | + } |
|
24 | + elseif(is_writable($htaccess)) |
|
25 | + { |
|
26 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
27 | + if(!@file_put_contents($htaccess,$_)) |
|
28 | + { |
|
29 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
30 | + } |
|
31 | + } |
|
32 | + } |
|
33 | + elseif(is_file($sample_htaccess)) |
|
34 | + { |
|
35 | + if(!@rename($sample_htaccess,$htaccess)) |
|
36 | + { |
|
37 | + $warnings[] = $_lang["settings_friendlyurls_alert"]; |
|
38 | + } |
|
39 | + elseif($modx->config['base_url']!=='/') |
|
40 | + { |
|
41 | + $_ = file_get_contents($htaccess); |
|
42 | + $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_); |
|
43 | + if(!@file_put_contents($htaccess,$_)) |
|
44 | + { |
|
45 | + $warnings[] = $_lang["settings_friendlyurls_alert2"]; |
|
46 | + } |
|
47 | + } |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
@@ -56,22 +56,22 @@ discard block |
||
56 | 56 | $data['rb_base_dir'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']); |
57 | 57 | |
58 | 58 | if (isset($data) && count($data) > 0) { |
59 | - if(isset($data['manager_language'])) { |
|
60 | - $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
61 | - if(is_file($lang_path)) { |
|
62 | - include($lang_path); |
|
59 | + if(isset($data['manager_language'])) { |
|
60 | + $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php'; |
|
61 | + if(is_file($lang_path)) { |
|
62 | + include($lang_path); |
|
63 | 63 | global $modx_lang_attribute; |
64 | 64 | $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute; |
65 | - } |
|
66 | - } |
|
67 | - $savethese = array(); |
|
68 | - $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
|
69 | - $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
70 | - foreach ($data as $k => $v) { |
|
71 | - switch ($k) { |
|
72 | - case 'site_name': |
|
73 | - $v = htmlspecialchars($v); |
|
74 | - break; |
|
65 | + } |
|
66 | + } |
|
67 | + $savethese = array(); |
|
68 | + $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']); |
|
69 | + $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute |
|
70 | + foreach ($data as $k => $v) { |
|
71 | + switch ($k) { |
|
72 | + case 'site_name': |
|
73 | + $v = htmlspecialchars($v); |
|
74 | + break; |
|
75 | 75 | case 'settings_version':{ |
76 | 76 | if($modx->getVersionData('version')!=$data['settings_version']){ |
77 | 77 | $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version'); |
@@ -79,24 +79,24 @@ discard block |
||
79 | 79 | } |
80 | 80 | break; |
81 | 81 | } |
82 | - case 'error_page': |
|
83 | - case 'unauthorized_page': |
|
84 | - if (trim($v) == '' || !is_numeric($v)) { |
|
85 | - $v = $data['site_start']; |
|
86 | - } |
|
87 | - break; |
|
82 | + case 'error_page': |
|
83 | + case 'unauthorized_page': |
|
84 | + if (trim($v) == '' || !is_numeric($v)) { |
|
85 | + $v = $data['site_start']; |
|
86 | + } |
|
87 | + break; |
|
88 | 88 | |
89 | - case 'lst_custom_contenttype': |
|
90 | - case 'txt_custom_contenttype': |
|
91 | - // Skip these |
|
92 | - $k = ''; |
|
93 | - break; |
|
94 | - case 'rb_base_dir': |
|
95 | - case 'rb_base_url': |
|
96 | - case 'filemanager_path': |
|
97 | - $v = trim($v); |
|
98 | - $v = rtrim($v,'/') . '/'; |
|
99 | - break; |
|
89 | + case 'lst_custom_contenttype': |
|
90 | + case 'txt_custom_contenttype': |
|
91 | + // Skip these |
|
92 | + $k = ''; |
|
93 | + break; |
|
94 | + case 'rb_base_dir': |
|
95 | + case 'rb_base_url': |
|
96 | + case 'filemanager_path': |
|
97 | + $v = trim($v); |
|
98 | + $v = rtrim($v,'/') . '/'; |
|
99 | + break; |
|
100 | 100 | case 'manager_language': |
101 | 101 | $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang'); |
102 | 102 | $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php'); |
@@ -104,56 +104,56 @@ discard block |
||
104 | 104 | if($langDir !== $langFileDir || !file_exists($langFile)) { |
105 | 105 | $v = 'english'; |
106 | 106 | } |
107 | - break; |
|
108 | - case 'smtppw': |
|
109 | - if ($v !== '********************' && $v !== '') { |
|
110 | - $v = trim($v); |
|
111 | - $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | - $v = str_replace('=','%',$v); |
|
113 | - } elseif ($v === '********************') { |
|
114 | - $k = ''; |
|
115 | - } |
|
116 | - break; |
|
107 | + break; |
|
108 | + case 'smtppw': |
|
109 | + if ($v !== '********************' && $v !== '') { |
|
110 | + $v = trim($v); |
|
111 | + $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7); |
|
112 | + $v = str_replace('=','%',$v); |
|
113 | + } elseif ($v === '********************') { |
|
114 | + $k = ''; |
|
115 | + } |
|
116 | + break; |
|
117 | 117 | case 'valid_hostnames': |
118 | - $v = str_replace(array(' ,', ', '), ',', $v); |
|
119 | - if ($v !== ',') { |
|
120 | - $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
121 | - $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
122 | - @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
123 | - } |
|
124 | - $k = ''; |
|
125 | - break; |
|
126 | - case 'session_timeout': |
|
127 | - $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
128 | - $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
129 | - break; |
|
130 | - default: |
|
131 | - break; |
|
132 | - } |
|
133 | - $v = is_array($v) ? implode(",", $v) : $v; |
|
118 | + $v = str_replace(array(' ,', ', '), ',', $v); |
|
119 | + if ($v !== ',') { |
|
120 | + $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : ''; |
|
121 | + $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n"; |
|
122 | + @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString); |
|
123 | + } |
|
124 | + $k = ''; |
|
125 | + break; |
|
126 | + case 'session_timeout': |
|
127 | + $mail_check_timeperiod = $data['mail_check_timeperiod']; |
|
128 | + $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum |
|
129 | + break; |
|
130 | + default: |
|
131 | + break; |
|
132 | + } |
|
133 | + $v = is_array($v) ? implode(",", $v) : $v; |
|
134 | 134 | |
135 | - $modx->config[$k] = $v; |
|
135 | + $modx->config[$k] = $v; |
|
136 | 136 | |
137 | - if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
138 | - } |
|
137 | + if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')'; |
|
138 | + } |
|
139 | 139 | |
140 | - // Run a single query to save all the values |
|
141 | - $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
140 | + // Run a single query to save all the values |
|
141 | + $sql = "REPLACE INTO ".$modx->getFullTableName("system_settings")." (setting_name, setting_value) |
|
142 | 142 | VALUES ".implode(', ', $savethese); |
143 | - $modx->getDatabase()->query($sql); |
|
143 | + $modx->getDatabase()->query($sql); |
|
144 | 144 | |
145 | - // Reset Template Pages |
|
146 | - if (isset($data['reset_template'])) { |
|
147 | - $newtemplate = (int)$data['default_template']; |
|
148 | - $oldtemplate = (int)$data['old_template']; |
|
149 | - $tbl = $modx->getFullTableName('site_content'); |
|
150 | - $reset = $data['reset_template']; |
|
151 | - if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | - else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
153 | - } |
|
145 | + // Reset Template Pages |
|
146 | + if (isset($data['reset_template'])) { |
|
147 | + $newtemplate = (int)$data['default_template']; |
|
148 | + $oldtemplate = (int)$data['old_template']; |
|
149 | + $tbl = $modx->getFullTableName('site_content'); |
|
150 | + $reset = $data['reset_template']; |
|
151 | + if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'"); |
|
152 | + else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'"); |
|
153 | + } |
|
154 | 154 | |
155 | - // empty cache |
|
156 | - $modx->clearCache('full'); |
|
155 | + // empty cache |
|
156 | + $modx->clearCache('full'); |
|
157 | 157 | } |
158 | 158 | $header="Location: index.php?a=7&r=10"; |
159 | 159 | 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_plugin')) { |
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,25 +19,25 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate Plugin |
21 | 21 | $newid = $modx->getDatabase()->insert( |
22 | - array( |
|
23 | - 'name'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'disabled'=>'', |
|
26 | - 'moduleguid'=>'', |
|
27 | - 'plugincode'=>'', |
|
28 | - 'properties'=>'', |
|
29 | - 'category'=>'', |
|
30 | - ), $modx->getFullTableName('site_plugins'), // Insert into |
|
31 | - "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'name'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'disabled'=>'', |
|
26 | + 'moduleguid'=>'', |
|
27 | + 'plugincode'=>'', |
|
28 | + 'properties'=>'', |
|
29 | + 'category'=>'', |
|
30 | + ), $modx->getFullTableName('site_plugins'), // Insert into |
|
31 | + "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from |
|
32 | 32 | |
33 | 33 | // duplicate Plugin Event Listeners |
34 | 34 | $modx->getDatabase()->insert( |
35 | - array( |
|
36 | - 'pluginid'=>'', |
|
37 | - 'evtid'=>'', |
|
38 | - 'priority'=>'', |
|
39 | - ), $modx->getFullTableName('site_plugin_events'), // Insert into |
|
40 | - "'{$newid}', evtid, priority", $modx->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from |
|
35 | + array( |
|
36 | + 'pluginid'=>'', |
|
37 | + 'evtid'=>'', |
|
38 | + 'priority'=>'', |
|
39 | + ), $modx->getFullTableName('site_plugin_events'), // Insert into |
|
40 | + "'{$newid}', evtid, priority", $modx->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from |
|
41 | 41 | |
42 | 42 | // Set the item name for logger |
43 | 43 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_plugins'), "id='{$newid}'")); |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('new_snippet')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (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,14 +19,14 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate Snippet |
21 | 21 | $newid = $modx->getDatabase()->insert( |
22 | - array( |
|
23 | - 'name'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'snippet'=>'', |
|
26 | - 'properties'=>'', |
|
27 | - 'category'=>'', |
|
28 | - ), $modx->getFullTableName('site_snippets'), // Insert into |
|
29 | - "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'name'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'snippet'=>'', |
|
26 | + 'properties'=>'', |
|
27 | + 'category'=>'', |
|
28 | + ), $modx->getFullTableName('site_snippets'), // Insert into |
|
29 | + "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from |
|
30 | 30 | |
31 | 31 | // Set the item name for logger |
32 | 32 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_snippets'), "id='{$newid}'")); |
@@ -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_template')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (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,22 +19,22 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate template |
21 | 21 | $newid = $modx->getDatabase()->insert( |
22 | - array( |
|
23 | - 'templatename'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'content'=>'', |
|
26 | - 'category'=>'', |
|
27 | - ), $modx->getFullTableName('site_templates'), // Insert into |
|
28 | - "CONCAT(templatename, ' {$_lang['duplicated_el_suffix']}{$count}') AS templatename, description, content, category", $modx->getFullTableName('site_templates'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'templatename'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'content'=>'', |
|
26 | + 'category'=>'', |
|
27 | + ), $modx->getFullTableName('site_templates'), // Insert into |
|
28 | + "CONCAT(templatename, ' {$_lang['duplicated_el_suffix']}{$count}') AS templatename, description, content, category", $modx->getFullTableName('site_templates'), "id='{$id}'"); // Copy from |
|
29 | 29 | |
30 | 30 | // duplicate TV values |
31 | 31 | $modx->getDatabase()->insert( |
32 | - array( |
|
33 | - 'tmplvarid'=>'', |
|
34 | - 'templateid'=>'', |
|
35 | - 'rank'=>'', |
|
36 | - ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into |
|
37 | - "tmplvarid, '{$newid}', rank", $modx->getFullTableName('site_tmplvar_templates'), "templateid='{$id}'"); // Copy from |
|
32 | + array( |
|
33 | + 'tmplvarid'=>'', |
|
34 | + 'templateid'=>'', |
|
35 | + 'rank'=>'', |
|
36 | + ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into |
|
37 | + "tmplvarid, '{$newid}', rank", $modx->getFullTableName('site_tmplvar_templates'), "templateid='{$id}'"); // Copy from |
|
38 | 38 | |
39 | 39 | // Set the item name for logger |
40 | 40 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('templatename', $modx->getFullTableName('site_templates'), "id='{$newid}'")); |
@@ -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_module')) { |
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,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeModFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeModFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the module. |
25 | 25 | $modx->getDatabase()->delete($modx->getFullTableName('site_modules'), "id='{$id}'"); |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | // invoke OnModFormDelete event |
34 | 34 | $modx->invokeEvent("OnModFormDelete", |
35 | - array( |
|
36 | - "id" => $id |
|
37 | - )); |
|
35 | + array( |
|
36 | + "id" => $id |
|
37 | + )); |
|
38 | 38 | |
39 | 39 | // empty cache |
40 | 40 | $modx->clearCache('full'); |