@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE != "true") { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('save_web_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $tbl_web_users = $modx->getFullTableName('web_users'); |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | |
13 | 13 | $input = $_POST; |
14 | 14 | foreach($input as $k => $v) { |
15 | - if($k !== 'comment') { |
|
16 | - $v = sanitize($v); |
|
17 | - } |
|
18 | - $input[$k] = $v; |
|
15 | + if($k !== 'comment') { |
|
16 | + $v = sanitize($v); |
|
17 | + } |
|
18 | + $input[$k] = $v; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = intval($input['id']); |
@@ -51,80 +51,80 @@ discard block |
||
51 | 51 | |
52 | 52 | // verify password |
53 | 53 | if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
54 | - webAlertAndQuit("Password typed is mismatched"); |
|
54 | + webAlertAndQuit("Password typed is mismatched"); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // verify email |
58 | 58 | if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
59 | - webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
|
59 | + webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | switch($input['mode']) { |
63 | - case '87' : // new user |
|
64 | - // check if this user name already exist |
|
65 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
66 | - $limit = $modx->db->getValue($rs); |
|
67 | - if($limit > 0) { |
|
68 | - webAlertAndQuit("User name is already in use!"); |
|
69 | - } |
|
70 | - |
|
71 | - // check if the email address already exist |
|
72 | - $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
73 | - $limit = $modx->db->getValue($rs); |
|
74 | - if($limit > 0) { |
|
75 | - webAlertAndQuit("Email is already in use!"); |
|
76 | - } |
|
77 | - |
|
78 | - // generate a new password for this user |
|
79 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
80 | - if(strlen($specifiedpassword) < 6) { |
|
81 | - webAlertAndQuit("Password is too short!"); |
|
82 | - } else { |
|
83 | - $newpassword = $specifiedpassword; |
|
84 | - } |
|
85 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
86 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
87 | - } elseif($passwordgenmethod == 'g') { |
|
88 | - $newpassword = generate_password(8); |
|
89 | - } else { |
|
90 | - webAlertAndQuit("No password generation method specified!"); |
|
91 | - } |
|
92 | - |
|
93 | - // invoke OnBeforeWUsrFormSave event |
|
94 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
95 | - "mode" => "new", |
|
96 | - )); |
|
97 | - |
|
98 | - // create the user account |
|
99 | - $field = array(); |
|
100 | - $field['username'] = $esc_newusername; |
|
101 | - $field['password'] = md5($newpassword); |
|
102 | - $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
103 | - |
|
104 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
105 | - $field = $modx->db->escape($field); |
|
106 | - $modx->db->insert($field, $tbl_web_user_attributes); |
|
107 | - |
|
108 | - // Save User Settings |
|
109 | - saveUserSettings($internalKey); |
|
110 | - |
|
111 | - // Set the item name for logger |
|
112 | - $_SESSION['itemname'] = $newusername; |
|
113 | - |
|
114 | - /*******************************************************************************/ |
|
115 | - // put the user in the user_groups he/ she should be in |
|
116 | - // first, check that up_perms are switched on! |
|
117 | - if($use_udperms == 1) { |
|
118 | - if(!empty($user_groups)) { |
|
119 | - for($i = 0; $i < count($user_groups); $i++) { |
|
120 | - $f = array(); |
|
121 | - $f['webgroup'] = intval($user_groups[$i]); |
|
122 | - $f['webuser'] = $internalKey; |
|
123 | - $modx->db->insert($f, $tbl_web_groups); |
|
124 | - } |
|
125 | - } |
|
126 | - } |
|
127 | - // end of user_groups stuff! |
|
63 | + case '87' : // new user |
|
64 | + // check if this user name already exist |
|
65 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'"); |
|
66 | + $limit = $modx->db->getValue($rs); |
|
67 | + if($limit > 0) { |
|
68 | + webAlertAndQuit("User name is already in use!"); |
|
69 | + } |
|
70 | + |
|
71 | + // check if the email address already exist |
|
72 | + $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'"); |
|
73 | + $limit = $modx->db->getValue($rs); |
|
74 | + if($limit > 0) { |
|
75 | + webAlertAndQuit("Email is already in use!"); |
|
76 | + } |
|
77 | + |
|
78 | + // generate a new password for this user |
|
79 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
80 | + if(strlen($specifiedpassword) < 6) { |
|
81 | + webAlertAndQuit("Password is too short!"); |
|
82 | + } else { |
|
83 | + $newpassword = $specifiedpassword; |
|
84 | + } |
|
85 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
86 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
87 | + } elseif($passwordgenmethod == 'g') { |
|
88 | + $newpassword = generate_password(8); |
|
89 | + } else { |
|
90 | + webAlertAndQuit("No password generation method specified!"); |
|
91 | + } |
|
92 | + |
|
93 | + // invoke OnBeforeWUsrFormSave event |
|
94 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
95 | + "mode" => "new", |
|
96 | + )); |
|
97 | + |
|
98 | + // create the user account |
|
99 | + $field = array(); |
|
100 | + $field['username'] = $esc_newusername; |
|
101 | + $field['password'] = md5($newpassword); |
|
102 | + $internalKey = $modx->db->insert($field, $tbl_web_users); |
|
103 | + |
|
104 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
105 | + $field = $modx->db->escape($field); |
|
106 | + $modx->db->insert($field, $tbl_web_user_attributes); |
|
107 | + |
|
108 | + // Save User Settings |
|
109 | + saveUserSettings($internalKey); |
|
110 | + |
|
111 | + // Set the item name for logger |
|
112 | + $_SESSION['itemname'] = $newusername; |
|
113 | + |
|
114 | + /*******************************************************************************/ |
|
115 | + // put the user in the user_groups he/ she should be in |
|
116 | + // first, check that up_perms are switched on! |
|
117 | + if($use_udperms == 1) { |
|
118 | + if(!empty($user_groups)) { |
|
119 | + for($i = 0; $i < count($user_groups); $i++) { |
|
120 | + $f = array(); |
|
121 | + $f['webgroup'] = intval($user_groups[$i]); |
|
122 | + $f['webuser'] = $internalKey; |
|
123 | + $modx->db->insert($f, $tbl_web_groups); |
|
124 | + } |
|
125 | + } |
|
126 | + } |
|
127 | + // end of user_groups stuff! |
|
128 | 128 | |
129 | 129 | // invoke OnWebSaveUser event |
130 | 130 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -142,26 +142,26 @@ discard block |
||
142 | 142 | "id" => $internalKey |
143 | 143 | )); |
144 | 144 | |
145 | - if($passwordnotifymethod == 'e') { |
|
146 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
147 | - if($input['stay'] != '') { |
|
148 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
149 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
150 | - header($header); |
|
151 | - } else { |
|
152 | - $header = "Location: index.php?a=99&r=2"; |
|
153 | - header($header); |
|
154 | - } |
|
155 | - } else { |
|
156 | - if($input['stay'] != '') { |
|
157 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
158 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
159 | - } else { |
|
160 | - $stayUrl = "index.php?a=99&r=2"; |
|
161 | - } |
|
162 | - |
|
163 | - include_once "header.inc.php"; |
|
164 | - ?> |
|
145 | + if($passwordnotifymethod == 'e') { |
|
146 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
147 | + if($input['stay'] != '') { |
|
148 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
149 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
150 | + header($header); |
|
151 | + } else { |
|
152 | + $header = "Location: index.php?a=99&r=2"; |
|
153 | + header($header); |
|
154 | + } |
|
155 | + } else { |
|
156 | + if($input['stay'] != '') { |
|
157 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
158 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
159 | + } else { |
|
160 | + $stayUrl = "index.php?a=99&r=2"; |
|
161 | + } |
|
162 | + |
|
163 | + include_once "header.inc.php"; |
|
164 | + ?> |
|
165 | 165 | |
166 | 166 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
167 | 167 | |
@@ -183,84 +183,84 @@ discard block |
||
183 | 183 | </div> |
184 | 184 | <?php |
185 | 185 | |
186 | - include_once "footer.inc.php"; |
|
187 | - } |
|
188 | - break; |
|
189 | - case '88' : // edit user |
|
190 | - // generate a new password for this user |
|
191 | - if($genpassword == 1) { |
|
192 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
193 | - if(strlen($specifiedpassword) < 6) { |
|
194 | - webAlertAndQuit("Password is too short!"); |
|
195 | - } else { |
|
196 | - $newpassword = $specifiedpassword; |
|
197 | - } |
|
198 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
199 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
200 | - } elseif($passwordgenmethod == 'g') { |
|
201 | - $newpassword = generate_password(8); |
|
202 | - } else { |
|
203 | - webAlertAndQuit("No password generation method specified!"); |
|
204 | - } |
|
205 | - } |
|
206 | - if($passwordnotifymethod == 'e') { |
|
207 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
208 | - } |
|
209 | - |
|
210 | - // check if the username already exist |
|
211 | - $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
212 | - $limit = $modx->db->getValue($rs); |
|
213 | - if($limit > 0) { |
|
214 | - webAlertAndQuit("User name is already in use!"); |
|
215 | - } |
|
216 | - |
|
217 | - // check if the email address already exists |
|
218 | - $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
219 | - $limit = $modx->db->getValue($rs); |
|
220 | - if($limit > 0) { |
|
221 | - webAlertAndQuit("Email is already in use!"); |
|
222 | - } |
|
223 | - |
|
224 | - // invoke OnBeforeWUsrFormSave event |
|
225 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
226 | - "mode" => "upd", |
|
227 | - "id" => $id |
|
228 | - )); |
|
229 | - |
|
230 | - // update user name and password |
|
231 | - $field = array(); |
|
232 | - $field['username'] = $esc_newusername; |
|
233 | - if($genpassword == 1) { |
|
234 | - $field['password'] = md5($newpassword); |
|
235 | - } |
|
236 | - $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
237 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
238 | - $field = $modx->db->escape($field); |
|
239 | - $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
240 | - |
|
241 | - // Save User Settings |
|
242 | - saveUserSettings($id); |
|
243 | - |
|
244 | - // Set the item name for logger |
|
245 | - $_SESSION['itemname'] = $newusername; |
|
246 | - |
|
247 | - /*******************************************************************************/ |
|
248 | - // put the user in the user_groups he/ she should be in |
|
249 | - // first, check that up_perms are switched on! |
|
250 | - if($use_udperms == 1) { |
|
251 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
252 | - $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
253 | - if(!empty($user_groups)) { |
|
254 | - for($i = 0; $i < count($user_groups); $i++) { |
|
255 | - $field = array(); |
|
256 | - $field['webgroup'] = intval($user_groups[$i]); |
|
257 | - $field['webuser'] = $id; |
|
258 | - $modx->db->insert($field, $tbl_web_groups); |
|
259 | - } |
|
260 | - } |
|
261 | - } |
|
262 | - // end of user_groups stuff! |
|
263 | - /*******************************************************************************/ |
|
186 | + include_once "footer.inc.php"; |
|
187 | + } |
|
188 | + break; |
|
189 | + case '88' : // edit user |
|
190 | + // generate a new password for this user |
|
191 | + if($genpassword == 1) { |
|
192 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
193 | + if(strlen($specifiedpassword) < 6) { |
|
194 | + webAlertAndQuit("Password is too short!"); |
|
195 | + } else { |
|
196 | + $newpassword = $specifiedpassword; |
|
197 | + } |
|
198 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
199 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
200 | + } elseif($passwordgenmethod == 'g') { |
|
201 | + $newpassword = generate_password(8); |
|
202 | + } else { |
|
203 | + webAlertAndQuit("No password generation method specified!"); |
|
204 | + } |
|
205 | + } |
|
206 | + if($passwordnotifymethod == 'e') { |
|
207 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
208 | + } |
|
209 | + |
|
210 | + // check if the username already exist |
|
211 | + $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'"); |
|
212 | + $limit = $modx->db->getValue($rs); |
|
213 | + if($limit > 0) { |
|
214 | + webAlertAndQuit("User name is already in use!"); |
|
215 | + } |
|
216 | + |
|
217 | + // check if the email address already exists |
|
218 | + $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'"); |
|
219 | + $limit = $modx->db->getValue($rs); |
|
220 | + if($limit > 0) { |
|
221 | + webAlertAndQuit("Email is already in use!"); |
|
222 | + } |
|
223 | + |
|
224 | + // invoke OnBeforeWUsrFormSave event |
|
225 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
226 | + "mode" => "upd", |
|
227 | + "id" => $id |
|
228 | + )); |
|
229 | + |
|
230 | + // update user name and password |
|
231 | + $field = array(); |
|
232 | + $field['username'] = $esc_newusername; |
|
233 | + if($genpassword == 1) { |
|
234 | + $field['password'] = md5($newpassword); |
|
235 | + } |
|
236 | + $modx->db->update($field, $tbl_web_users, "id='{$id}'"); |
|
237 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
238 | + $field = $modx->db->escape($field); |
|
239 | + $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'"); |
|
240 | + |
|
241 | + // Save User Settings |
|
242 | + saveUserSettings($id); |
|
243 | + |
|
244 | + // Set the item name for logger |
|
245 | + $_SESSION['itemname'] = $newusername; |
|
246 | + |
|
247 | + /*******************************************************************************/ |
|
248 | + // put the user in the user_groups he/ she should be in |
|
249 | + // first, check that up_perms are switched on! |
|
250 | + if($use_udperms == 1) { |
|
251 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
252 | + $modx->db->delete($tbl_web_groups, "webuser='{$id}'"); |
|
253 | + if(!empty($user_groups)) { |
|
254 | + for($i = 0; $i < count($user_groups); $i++) { |
|
255 | + $field = array(); |
|
256 | + $field['webgroup'] = intval($user_groups[$i]); |
|
257 | + $field['webuser'] = $id; |
|
258 | + $modx->db->insert($field, $tbl_web_groups); |
|
259 | + } |
|
260 | + } |
|
261 | + } |
|
262 | + // end of user_groups stuff! |
|
263 | + /*******************************************************************************/ |
|
264 | 264 | |
265 | 265 | // invoke OnWebSaveUser event |
266 | 266 | $modx->invokeEvent("OnWebSaveUser", array( |
@@ -289,16 +289,16 @@ discard block |
||
289 | 289 | "id" => $id |
290 | 290 | )); |
291 | 291 | |
292 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
293 | - if($input['stay'] != '') { |
|
294 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
295 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
296 | - } else { |
|
297 | - $stayUrl = "index.php?a=99&r=2"; |
|
298 | - } |
|
292 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
293 | + if($input['stay'] != '') { |
|
294 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
295 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
296 | + } else { |
|
297 | + $stayUrl = "index.php?a=99&r=2"; |
|
298 | + } |
|
299 | 299 | |
300 | - include_once "header.inc.php"; |
|
301 | - ?> |
|
300 | + include_once "header.inc.php"; |
|
301 | + ?> |
|
302 | 302 | |
303 | 303 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
304 | 304 | |
@@ -318,124 +318,124 @@ discard block |
||
318 | 318 | </div> |
319 | 319 | <?php |
320 | 320 | |
321 | - include_once "footer.inc.php"; |
|
322 | - } else { |
|
323 | - if($input['stay'] != '') { |
|
324 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
325 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
326 | - header($header); |
|
327 | - } else { |
|
328 | - $header = "Location: index.php?a=99&r=2"; |
|
329 | - header($header); |
|
330 | - } |
|
331 | - } |
|
332 | - break; |
|
333 | - default : |
|
334 | - webAlertAndQuit("No operation set in request."); |
|
321 | + include_once "footer.inc.php"; |
|
322 | + } else { |
|
323 | + if($input['stay'] != '') { |
|
324 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
325 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
326 | + header($header); |
|
327 | + } else { |
|
328 | + $header = "Location: index.php?a=99&r=2"; |
|
329 | + header($header); |
|
330 | + } |
|
331 | + } |
|
332 | + break; |
|
333 | + default : |
|
334 | + webAlertAndQuit("No operation set in request."); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | // in case any plugins include a quoted_printable function |
338 | 338 | function save_user_quoted_printable($string) { |
339 | - $crlf = "\n"; |
|
340 | - $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
|
341 | - $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
|
342 | - $r[] = "'=' . sprintf('%02X', ord('\\1'))"; |
|
343 | - $f[] = '/([\011\040])' . $crlf . '/e'; |
|
344 | - $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'"; |
|
345 | - $string = preg_replace($f, $r, $string); |
|
346 | - return trim(wordwrap($string, 70, ' =' . $crlf)); |
|
339 | + $crlf = "\n"; |
|
340 | + $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
|
341 | + $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
|
342 | + $r[] = "'=' . sprintf('%02X', ord('\\1'))"; |
|
343 | + $f[] = '/([\011\040])' . $crlf . '/e'; |
|
344 | + $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'"; |
|
345 | + $string = preg_replace($f, $r, $string); |
|
346 | + return trim(wordwrap($string, 70, ' =' . $crlf)); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | // Send an email to the user |
350 | 350 | function sendMailMessage($email, $uid, $pwd, $ufn) { |
351 | - global $modx, $_lang, $websignupemail_message; |
|
352 | - global $emailsubject, $emailsender; |
|
353 | - global $site_name, $site_url; |
|
354 | - $message = sprintf($websignupemail_message, $uid, $pwd); // use old method |
|
355 | - // replace placeholders |
|
356 | - $message = str_replace("[+uid+]", $uid, $message); |
|
357 | - $message = str_replace("[+pwd+]", $pwd, $message); |
|
358 | - $message = str_replace("[+ufn+]", $ufn, $message); |
|
359 | - $message = str_replace("[+sname+]", $site_name, $message); |
|
360 | - $message = str_replace("[+saddr+]", $emailsender, $message); |
|
361 | - $message = str_replace("[+semail+]", $emailsender, $message); |
|
362 | - $message = str_replace("[+surl+]", $site_url, $message); |
|
363 | - |
|
364 | - $param = array(); |
|
365 | - $param['from'] = "{$site_name}<{$emailsender}>"; |
|
366 | - $param['subject'] = $emailsubject; |
|
367 | - $param['body'] = $message; |
|
368 | - $param['to'] = $email; |
|
369 | - $param['type'] = 'text'; |
|
370 | - $rs = $modx->sendmail($param); |
|
371 | - if(!$rs) { |
|
372 | - $modx->manager->saveFormValues(); |
|
373 | - $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
|
374 | - } |
|
351 | + global $modx, $_lang, $websignupemail_message; |
|
352 | + global $emailsubject, $emailsender; |
|
353 | + global $site_name, $site_url; |
|
354 | + $message = sprintf($websignupemail_message, $uid, $pwd); // use old method |
|
355 | + // replace placeholders |
|
356 | + $message = str_replace("[+uid+]", $uid, $message); |
|
357 | + $message = str_replace("[+pwd+]", $pwd, $message); |
|
358 | + $message = str_replace("[+ufn+]", $ufn, $message); |
|
359 | + $message = str_replace("[+sname+]", $site_name, $message); |
|
360 | + $message = str_replace("[+saddr+]", $emailsender, $message); |
|
361 | + $message = str_replace("[+semail+]", $emailsender, $message); |
|
362 | + $message = str_replace("[+surl+]", $site_url, $message); |
|
363 | + |
|
364 | + $param = array(); |
|
365 | + $param['from'] = "{$site_name}<{$emailsender}>"; |
|
366 | + $param['subject'] = $emailsubject; |
|
367 | + $param['body'] = $message; |
|
368 | + $param['to'] = $email; |
|
369 | + $param['type'] = 'text'; |
|
370 | + $rs = $modx->sendmail($param); |
|
371 | + if(!$rs) { |
|
372 | + $modx->manager->saveFormValues(); |
|
373 | + $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
|
374 | + } |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | // Save User Settings |
378 | 378 | function saveUserSettings($id) { |
379 | - global $modx; |
|
380 | - $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
|
381 | - |
|
382 | - $settings = array( |
|
383 | - "login_home", |
|
384 | - "allowed_ip", |
|
385 | - "allowed_days" |
|
386 | - ); |
|
387 | - |
|
388 | - $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'"); |
|
389 | - |
|
390 | - foreach($settings as $n) { |
|
391 | - $vl = $_POST[$n]; |
|
392 | - if(is_array($vl)) { |
|
393 | - $vl = implode(",", $vl); |
|
394 | - } |
|
395 | - if($vl != '') { |
|
396 | - $f = array(); |
|
397 | - $f['webuser'] = $id; |
|
398 | - $f['setting_name'] = $n; |
|
399 | - $f['setting_value'] = $vl; |
|
400 | - $f = $modx->db->escape($f); |
|
401 | - $modx->db->insert($f, $tbl_web_user_settings); |
|
402 | - } |
|
403 | - } |
|
379 | + global $modx; |
|
380 | + $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
|
381 | + |
|
382 | + $settings = array( |
|
383 | + "login_home", |
|
384 | + "allowed_ip", |
|
385 | + "allowed_days" |
|
386 | + ); |
|
387 | + |
|
388 | + $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'"); |
|
389 | + |
|
390 | + foreach($settings as $n) { |
|
391 | + $vl = $_POST[$n]; |
|
392 | + if(is_array($vl)) { |
|
393 | + $vl = implode(",", $vl); |
|
394 | + } |
|
395 | + if($vl != '') { |
|
396 | + $f = array(); |
|
397 | + $f['webuser'] = $id; |
|
398 | + $f['setting_name'] = $n; |
|
399 | + $f['setting_value'] = $vl; |
|
400 | + $f = $modx->db->escape($f); |
|
401 | + $modx->db->insert($f, $tbl_web_user_settings); |
|
402 | + } |
|
403 | + } |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | // Web alert - sends an alert to web browser |
407 | 407 | function webAlertAndQuit($msg) { |
408 | - global $id, $modx; |
|
409 | - $mode = $_POST['mode']; |
|
410 | - $modx->manager->saveFormValues($mode); |
|
411 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : '')); |
|
408 | + global $id, $modx; |
|
409 | + $mode = $_POST['mode']; |
|
410 | + $modx->manager->saveFormValues($mode); |
|
411 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : '')); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | // Generate password |
415 | 415 | function generate_password($length = 10) { |
416 | - $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
|
417 | - $ps_len = strlen($allowable_characters); |
|
418 | - mt_srand((double) microtime() * 1000000); |
|
419 | - $pass = ""; |
|
420 | - for($i = 0; $i < $length; $i++) { |
|
421 | - $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
|
422 | - } |
|
423 | - return $pass; |
|
416 | + $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
|
417 | + $ps_len = strlen($allowable_characters); |
|
418 | + mt_srand((double) microtime() * 1000000); |
|
419 | + $pass = ""; |
|
420 | + for($i = 0; $i < $length; $i++) { |
|
421 | + $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
|
422 | + } |
|
423 | + return $pass; |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | function sanitize($str = '', $safecount = 0) { |
427 | - global $modx; |
|
428 | - $safecount++; |
|
429 | - if(1000 < $safecount) { |
|
430 | - exit("error too many loops '{$safecount}'"); |
|
431 | - } |
|
432 | - if(is_array($str)) { |
|
433 | - foreach($str as $i => $v) { |
|
434 | - $str[$i] = sanitize($v, $safecount); |
|
435 | - } |
|
436 | - } else { |
|
437 | - // $str = strip_tags($str); // LEAVE < and > intact |
|
438 | - $str = htmlspecialchars($str, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
439 | - } |
|
440 | - return $str; |
|
427 | + global $modx; |
|
428 | + $safecount++; |
|
429 | + if(1000 < $safecount) { |
|
430 | + exit("error too many loops '{$safecount}'"); |
|
431 | + } |
|
432 | + if(is_array($str)) { |
|
433 | + foreach($str as $i => $v) { |
|
434 | + $str[$i] = sanitize($v, $safecount); |
|
435 | + } |
|
436 | + } else { |
|
437 | + // $str = strip_tags($str); // LEAVE < and > intact |
|
438 | + $str = htmlspecialchars($str, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
439 | + } |
|
440 | + return $str; |
|
441 | 441 | } |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('edit_template')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
8 | 8 | if($id==0) { |
9 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // count duplicates |
@@ -17,37 +17,37 @@ discard block |
||
17 | 17 | |
18 | 18 | // duplicate TV |
19 | 19 | $newid = $modx->db->insert( |
20 | - array( |
|
21 | - 'type'=>'', |
|
22 | - 'name'=>'', |
|
23 | - 'caption'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'default_text'=>'', |
|
26 | - 'elements'=>'', |
|
27 | - 'rank'=>'', |
|
28 | - 'display'=>'', |
|
29 | - 'display_params'=>'', |
|
30 | - 'category'=>'', |
|
31 | - ), $modx->getFullTableName('site_tmplvars'), // Insert into |
|
32 | - "type, CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, CONCAT(caption, ' Duplicate{$count}') AS caption, description, default_text, elements, rank, display, display_params, category", $modx->getFullTableName('site_tmplvars'), "id='{$id}'"); // Copy from |
|
20 | + array( |
|
21 | + 'type'=>'', |
|
22 | + 'name'=>'', |
|
23 | + 'caption'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'default_text'=>'', |
|
26 | + 'elements'=>'', |
|
27 | + 'rank'=>'', |
|
28 | + 'display'=>'', |
|
29 | + 'display_params'=>'', |
|
30 | + 'category'=>'', |
|
31 | + ), $modx->getFullTableName('site_tmplvars'), // Insert into |
|
32 | + "type, CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, CONCAT(caption, ' Duplicate{$count}') AS caption, description, default_text, elements, rank, display, display_params, category", $modx->getFullTableName('site_tmplvars'), "id='{$id}'"); // Copy from |
|
33 | 33 | |
34 | 34 | |
35 | 35 | // duplicate TV Template Access Permissions |
36 | 36 | $modx->db->insert( |
37 | - array( |
|
38 | - 'tmplvarid'=>'', |
|
39 | - 'templateid'=>'', |
|
40 | - 'rank'=>'', |
|
41 | - ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into |
|
42 | - "'{$newid}', templateid, rank", $modx->getFullTableName('site_tmplvar_templates'), "tmplvarid='{$id}'"); // Copy from |
|
37 | + array( |
|
38 | + 'tmplvarid'=>'', |
|
39 | + 'templateid'=>'', |
|
40 | + 'rank'=>'', |
|
41 | + ), $modx->getFullTableName('site_tmplvar_templates'), // Insert into |
|
42 | + "'{$newid}', templateid, rank", $modx->getFullTableName('site_tmplvar_templates'), "tmplvarid='{$id}'"); // Copy from |
|
43 | 43 | |
44 | 44 | // duplicate TV Access Permissions |
45 | 45 | $modx->db->insert( |
46 | - array( |
|
47 | - 'tmplvarid'=>'', |
|
48 | - 'documentgroup'=>'', |
|
49 | - ), $modx->getFullTableName('site_tmplvar_access'), // Insert into |
|
50 | - "'{$newid}', documentgroup", $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); // Copy from |
|
46 | + array( |
|
47 | + 'tmplvarid'=>'', |
|
48 | + 'documentgroup'=>'', |
|
49 | + ), $modx->getFullTableName('site_tmplvar_access'), // Insert into |
|
50 | + "'{$newid}', documentgroup", $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); // Copy from |
|
51 | 51 | |
52 | 52 | // Set the item name for logger |
53 | 53 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$newid}'")); |
@@ -1,17 +1,17 @@ |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('delete_eventlog')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | if (isset($_GET['cls']) && $_GET['cls']==1) { |
8 | - $where = ''; |
|
8 | + $where = ''; |
|
9 | 9 | } else { |
10 | - $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
11 | - if($id==0) { |
|
12 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
13 | - } |
|
14 | - $where = "id='{$id}'"; |
|
10 | + $id = isset($_GET['id'])? intval($_GET['id']) : 0; |
|
11 | + if($id==0) { |
|
12 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
13 | + } |
|
14 | + $where = "id='{$id}'"; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | // delete event log |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('export_static')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $maxtime = (is_numeric($_POST['maxtime'])) ? $_POST['maxtime'] : 30; |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | $modx->export->targetDir = $export_dir; |
16 | 16 | |
17 | 17 | if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path']))) |
18 | - return $_lang['export_site.static.php6']; |
|
18 | + return $_lang['export_site.static.php6']; |
|
19 | 19 | elseif($modx->config['rb_base_dir'] === $export_dir . '/') |
20 | - return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']); |
|
20 | + return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']); |
|
21 | 21 | elseif(!is_writable($export_dir)) |
22 | - return $_lang['export_site_target_unwritable']; |
|
22 | + return $_lang['export_site_target_unwritable']; |
|
23 | 23 | |
24 | 24 | $modx->export->generate_mode = $_POST['generate_mode']; |
25 | 25 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | ||$includenoncache!==$_POST['includenoncache'] |
36 | 36 | ||$repl_before!==$_POST['repl_before'] |
37 | 37 | ||$repl_after !==$_POST['repl_after']) { |
38 | - $modx->clearCache('full'); |
|
38 | + $modx->clearCache('full'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $total = $modx->export->getTotal($_POST['ignore_ids'], $modx->config['export_includenoncache']); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
3 | 3 | if(!$modx->hasPermission('messages')) { |
4 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
4 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | $sendto = $_REQUEST['sendto']; |
@@ -14,55 +14,55 @@ discard block |
||
14 | 14 | $postdate = time(); |
15 | 15 | |
16 | 16 | if($sendto=='u') { |
17 | - if($userid==0) { |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_user_selected"]); |
|
19 | - } |
|
20 | - $modx->db->insert( |
|
21 | - array( |
|
22 | - 'recipient' => $userid, |
|
23 | - 'sender' => $modx->getLoginUserID(), |
|
24 | - 'subject' => $subject, |
|
25 | - 'message' => $message, |
|
26 | - 'postdate' => $postdate, |
|
27 | - 'type' => 'Message', |
|
28 | - 'private' => 1, |
|
29 | - ), $modx->getFullTableName('user_messages')); |
|
17 | + if($userid==0) { |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_user_selected"]); |
|
19 | + } |
|
20 | + $modx->db->insert( |
|
21 | + array( |
|
22 | + 'recipient' => $userid, |
|
23 | + 'sender' => $modx->getLoginUserID(), |
|
24 | + 'subject' => $subject, |
|
25 | + 'message' => $message, |
|
26 | + 'postdate' => $postdate, |
|
27 | + 'type' => 'Message', |
|
28 | + 'private' => 1, |
|
29 | + ), $modx->getFullTableName('user_messages')); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | if($sendto=='g') { |
33 | - if($groupid==0) { |
|
34 | - $modx->webAlertAndQuit($_lang["error_no_group_selected"]); |
|
35 | - } |
|
36 | - $rs = $modx->db->select('internalKey', $modx->getFullTableName('user_attributes'), "role='{$groupid}' AND internalKey!='".$modx->getLoginUserID()."'"); |
|
37 | - while ($row=$modx->db->getRow($rs)) { |
|
38 | - $modx->db->insert( |
|
39 | - array( |
|
40 | - 'recipient' => $row['internalKey'], |
|
41 | - 'sender' => $modx->getLoginUserID(), |
|
42 | - 'subject' => $subject, |
|
43 | - 'message' => $message, |
|
44 | - 'postdate' => $postdate, |
|
45 | - 'type' => 'Message', |
|
46 | - 'private' => 0, |
|
47 | - ), $modx->getFullTableName('user_messages')); |
|
48 | - } |
|
33 | + if($groupid==0) { |
|
34 | + $modx->webAlertAndQuit($_lang["error_no_group_selected"]); |
|
35 | + } |
|
36 | + $rs = $modx->db->select('internalKey', $modx->getFullTableName('user_attributes'), "role='{$groupid}' AND internalKey!='".$modx->getLoginUserID()."'"); |
|
37 | + while ($row=$modx->db->getRow($rs)) { |
|
38 | + $modx->db->insert( |
|
39 | + array( |
|
40 | + 'recipient' => $row['internalKey'], |
|
41 | + 'sender' => $modx->getLoginUserID(), |
|
42 | + 'subject' => $subject, |
|
43 | + 'message' => $message, |
|
44 | + 'postdate' => $postdate, |
|
45 | + 'type' => 'Message', |
|
46 | + 'private' => 0, |
|
47 | + ), $modx->getFullTableName('user_messages')); |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | if($sendto=='a') { |
53 | - $rs = $modx->db->select('id', $modx->getFullTableName('manager_users'), "id!='".$modx->getLoginUserID()."'"); |
|
54 | - while ($row=$modx->db->getRow($rs)) { |
|
55 | - $modx->db->insert( |
|
56 | - array( |
|
57 | - 'recipient' => $row['id'], |
|
58 | - 'sender' => $modx->getLoginUserID(), |
|
59 | - 'subject' => $subject, |
|
60 | - 'message' => $message, |
|
61 | - 'postdate' => $postdate, |
|
62 | - 'type' => 'Message', |
|
63 | - 'private' => 0, |
|
64 | - ), $modx->getFullTableName('user_messages')); |
|
65 | - } |
|
53 | + $rs = $modx->db->select('id', $modx->getFullTableName('manager_users'), "id!='".$modx->getLoginUserID()."'"); |
|
54 | + while ($row=$modx->db->getRow($rs)) { |
|
55 | + $modx->db->insert( |
|
56 | + array( |
|
57 | + 'recipient' => $row['id'], |
|
58 | + 'sender' => $modx->getLoginUserID(), |
|
59 | + 'subject' => $subject, |
|
60 | + 'message' => $message, |
|
61 | + 'postdate' => $postdate, |
|
62 | + 'type' => 'Message', |
|
63 | + 'private' => 0, |
|
64 | + ), $modx->getFullTableName('user_messages')); |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $header = "Location: index.php?a=10"; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
3 | - header('HTTP/1.0 404 Not Found'); |
|
4 | - exit('error'); |
|
3 | + header('HTTP/1.0 404 Not Found'); |
|
4 | + exit('error'); |
|
5 | 5 | } |
6 | 6 | define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
7 | 7 | define('MODX_API_MODE', true); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | include_once("{$core_path}lang/english.inc.php"); |
19 | 19 | |
20 | 20 | if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
21 | - include_once("{$core_path}lang/{$manager_language}.inc.php"); |
|
21 | + include_once("{$core_path}lang/{$manager_language}.inc.php"); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | // include the logger |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | // Initialize System Alert Message Queque |
28 | 28 | if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
29 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
29 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
30 | 30 | } |
31 | 31 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
32 | 32 | |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | |
42 | 42 | // invoke OnBeforeManagerLogin event |
43 | 43 | $modx->invokeEvent('OnBeforeManagerLogin', array( |
44 | - 'username' => $username, |
|
45 | - 'userpassword' => $givenPassword, |
|
46 | - 'rememberme' => $rememberme |
|
47 | - )); |
|
44 | + 'username' => $username, |
|
45 | + 'userpassword' => $givenPassword, |
|
46 | + 'rememberme' => $rememberme |
|
47 | + )); |
|
48 | 48 | $fields = 'mu.*, ua.*'; |
49 | 49 | $from = '[+prefix+]manager_users AS mu, [+prefix+]user_attributes AS ua'; |
50 | 50 | $where = "BINARY mu.username='{$username}' and ua.internalKey=mu.id"; |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | $limit = $modx->db->getRecordCount($rs); |
53 | 53 | |
54 | 54 | if($limit == 0 || $limit > 1) { |
55 | - jsAlert($_lang['login_processor_unknown_user']); |
|
56 | - return; |
|
55 | + jsAlert($_lang['login_processor_unknown_user']); |
|
56 | + return; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | $row = $modx->db->getRow($rs); |
@@ -74,127 +74,127 @@ discard block |
||
74 | 74 | // get the user settings from the database |
75 | 75 | $rs = $modx->db->select('setting_name, setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_value!=''"); |
76 | 76 | while($row = $modx->db->getRow($rs)) { |
77 | - extract($row); |
|
78 | - ${$setting_name} = $setting_value; |
|
77 | + extract($row); |
|
78 | + ${$setting_name} = $setting_value; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | // blocked due to number of login errors. |
82 | 82 | if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
83 | - @session_destroy(); |
|
84 | - session_unset(); |
|
85 | - if($cip = getenv("HTTP_CLIENT_IP")) { |
|
86 | - $ip = $cip; |
|
87 | - } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
88 | - $ip = $cip; |
|
89 | - } elseif($cip = getenv("REMOTE_ADDR")) { |
|
90 | - $ip = $cip; |
|
91 | - } else { |
|
92 | - $ip = "UNKNOWN"; |
|
93 | - } |
|
94 | - $log = new logHandler; |
|
95 | - $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
96 | - jsAlert($_lang['login_processor_many_failed_logins']); |
|
97 | - return; |
|
83 | + @session_destroy(); |
|
84 | + session_unset(); |
|
85 | + if($cip = getenv("HTTP_CLIENT_IP")) { |
|
86 | + $ip = $cip; |
|
87 | + } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
88 | + $ip = $cip; |
|
89 | + } elseif($cip = getenv("REMOTE_ADDR")) { |
|
90 | + $ip = $cip; |
|
91 | + } else { |
|
92 | + $ip = "UNKNOWN"; |
|
93 | + } |
|
94 | + $log = new logHandler; |
|
95 | + $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
96 | + jsAlert($_lang['login_processor_many_failed_logins']); |
|
97 | + return; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | // blocked due to number of login errors, but get to try again |
101 | 101 | if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
102 | - $fields = array(); |
|
103 | - $fields['failedlogincount'] = '0'; |
|
104 | - $fields['blockeduntil'] = time() - 1; |
|
105 | - $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
102 | + $fields = array(); |
|
103 | + $fields['failedlogincount'] = '0'; |
|
104 | + $fields['blockeduntil'] = time() - 1; |
|
105 | + $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | // this user has been blocked by an admin, so no way he's loggin in! |
109 | 109 | if($blocked == '1') { |
110 | - @session_destroy(); |
|
111 | - session_unset(); |
|
112 | - jsAlert($_lang['login_processor_blocked1']); |
|
113 | - return; |
|
110 | + @session_destroy(); |
|
111 | + session_unset(); |
|
112 | + jsAlert($_lang['login_processor_blocked1']); |
|
113 | + return; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | // blockuntil: this user has a block until date |
117 | 117 | if($blockeduntildate > time()) { |
118 | - @session_destroy(); |
|
119 | - session_unset(); |
|
120 | - jsAlert($_lang['login_processor_blocked2']); |
|
121 | - return; |
|
118 | + @session_destroy(); |
|
119 | + session_unset(); |
|
120 | + jsAlert($_lang['login_processor_blocked2']); |
|
121 | + return; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | // blockafter: this user has a block after date |
125 | 125 | if($blockedafterdate > 0 && $blockedafterdate < time()) { |
126 | - @session_destroy(); |
|
127 | - session_unset(); |
|
128 | - jsAlert($_lang['login_processor_blocked3']); |
|
129 | - return; |
|
126 | + @session_destroy(); |
|
127 | + session_unset(); |
|
128 | + jsAlert($_lang['login_processor_blocked3']); |
|
129 | + return; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | // allowed ip |
133 | 133 | if($allowed_ip) { |
134 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
135 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
136 | - jsAlert($_lang['login_processor_remotehost_ip']); |
|
137 | - return; |
|
138 | - } |
|
139 | - } |
|
140 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
141 | - jsAlert($_lang['login_processor_remote_ip']); |
|
142 | - return; |
|
143 | - } |
|
134 | + if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
135 | + if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
136 | + jsAlert($_lang['login_processor_remotehost_ip']); |
|
137 | + return; |
|
138 | + } |
|
139 | + } |
|
140 | + if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
141 | + jsAlert($_lang['login_processor_remote_ip']); |
|
142 | + return; |
|
143 | + } |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | // allowed days |
147 | 147 | if($allowed_days) { |
148 | - $date = getdate(); |
|
149 | - $day = $date['wday'] + 1; |
|
150 | - if(strpos($allowed_days, $day) === false) { |
|
151 | - jsAlert($_lang['login_processor_date']); |
|
152 | - return; |
|
153 | - } |
|
148 | + $date = getdate(); |
|
149 | + $day = $date['wday'] + 1; |
|
150 | + if(strpos($allowed_days, $day) === false) { |
|
151 | + jsAlert($_lang['login_processor_date']); |
|
152 | + return; |
|
153 | + } |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // invoke OnManagerAuthentication event |
157 | 157 | $rt = $modx->invokeEvent('OnManagerAuthentication', array( |
158 | - 'userid' => $internalKey, |
|
159 | - 'username' => $username, |
|
160 | - 'userpassword' => $givenPassword, |
|
161 | - 'savedpassword' => $dbasePassword, |
|
162 | - 'rememberme' => $rememberme |
|
163 | - )); |
|
158 | + 'userid' => $internalKey, |
|
159 | + 'username' => $username, |
|
160 | + 'userpassword' => $givenPassword, |
|
161 | + 'savedpassword' => $dbasePassword, |
|
162 | + 'rememberme' => $rememberme |
|
163 | + )); |
|
164 | 164 | |
165 | 165 | // check if plugin authenticated the user |
166 | 166 | $matchPassword = false; |
167 | 167 | if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
168 | - // check user password - local authentication |
|
169 | - $hashType = $modx->manager->getHashType($dbasePassword); |
|
170 | - if($hashType == 'phpass') { |
|
171 | - $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
|
172 | - } elseif($hashType == 'md5') { |
|
173 | - $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
174 | - } elseif($hashType == 'v1') { |
|
175 | - $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
176 | - } else { |
|
177 | - $matchPassword = false; |
|
178 | - } |
|
168 | + // check user password - local authentication |
|
169 | + $hashType = $modx->manager->getHashType($dbasePassword); |
|
170 | + if($hashType == 'phpass') { |
|
171 | + $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
|
172 | + } elseif($hashType == 'md5') { |
|
173 | + $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
174 | + } elseif($hashType == 'v1') { |
|
175 | + $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
176 | + } else { |
|
177 | + $matchPassword = false; |
|
178 | + } |
|
179 | 179 | } else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
180 | - $matchPassword = true; |
|
180 | + $matchPassword = true; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | if(!$matchPassword) { |
184 | - jsAlert($_lang['login_processor_wrong_password']); |
|
185 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
186 | - return; |
|
184 | + jsAlert($_lang['login_processor_wrong_password']); |
|
185 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
186 | + return; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | if($modx->config['use_captcha'] == 1) { |
190 | - if(!isset ($_SESSION['veriword'])) { |
|
191 | - jsAlert($_lang['login_processor_captcha_config']); |
|
192 | - return; |
|
193 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
194 | - jsAlert($_lang['login_processor_bad_code']); |
|
195 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
196 | - return; |
|
197 | - } |
|
190 | + if(!isset ($_SESSION['veriword'])) { |
|
191 | + jsAlert($_lang['login_processor_captcha_config']); |
|
192 | + return; |
|
193 | + } elseif($_SESSION['veriword'] != $captcha_code) { |
|
194 | + jsAlert($_lang['login_processor_bad_code']); |
|
195 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
196 | + return; |
|
197 | + } |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $modx->cleanupExpiredLocks(); |
@@ -229,36 +229,36 @@ discard block |
||
229 | 229 | $_SESSION['mgrToken'] = md5($currentsessionid); |
230 | 230 | |
231 | 231 | if($rememberme == '1') { |
232 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = intval($modx->config['session.cookie.lifetime']); |
|
233 | - |
|
234 | - // Set a cookie separate from the session cookie with the username in it. |
|
235 | - // Are we using secure connection? If so, make sure the cookie is secure |
|
236 | - global $https_port; |
|
237 | - |
|
238 | - $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
239 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
240 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
241 | - } else { |
|
242 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
243 | - } |
|
232 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = intval($modx->config['session.cookie.lifetime']); |
|
233 | + |
|
234 | + // Set a cookie separate from the session cookie with the username in it. |
|
235 | + // Are we using secure connection? If so, make sure the cookie is secure |
|
236 | + global $https_port; |
|
237 | + |
|
238 | + $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
239 | + if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
240 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
241 | + } else { |
|
242 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
243 | + } |
|
244 | 244 | } else { |
245 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
245 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
246 | 246 | |
247 | - // Remove the Remember Me cookie |
|
248 | - setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
247 | + // Remove the Remember Me cookie |
|
248 | + setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | // Check if user already has an active session, if not check if user pressed logout end of last session |
252 | 252 | $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
253 | 253 | $activeSession = $modx->db->getValue($rs); |
254 | 254 | if(!$activeSession) { |
255 | - $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
256 | - if($lastHit = $modx->db->getValue($rs)) { |
|
257 | - $_SESSION['show_logout_reminder'] = array( |
|
258 | - 'type' => 'logout_reminder', |
|
259 | - 'lastHit' => $lastHit |
|
260 | - ); |
|
261 | - } |
|
255 | + $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
256 | + if($lastHit = $modx->db->getValue($rs)) { |
|
257 | + $_SESSION['show_logout_reminder'] = array( |
|
258 | + 'type' => 'logout_reminder', |
|
259 | + 'lastHit' => $lastHit |
|
260 | + ); |
|
261 | + } |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | $log = new logHandler; |
@@ -266,109 +266,109 @@ discard block |
||
266 | 266 | |
267 | 267 | // invoke OnManagerLogin event |
268 | 268 | $modx->invokeEvent('OnManagerLogin', array( |
269 | - 'userid' => $internalKey, |
|
270 | - 'username' => $username, |
|
271 | - 'userpassword' => $givenPassword, |
|
272 | - 'rememberme' => $rememberme |
|
273 | - )); |
|
269 | + 'userid' => $internalKey, |
|
270 | + 'username' => $username, |
|
271 | + 'userpassword' => $givenPassword, |
|
272 | + 'rememberme' => $rememberme |
|
273 | + )); |
|
274 | 274 | |
275 | 275 | // check if we should redirect user to a web page |
276 | 276 | $rs = $modx->db->select('setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_name='manager_login_startup'"); |
277 | 277 | $id = intval($modx->db->getValue($rs)); |
278 | 278 | if($id > 0) { |
279 | - $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
280 | - if($_POST['ajax'] == 1) { |
|
281 | - echo $header; |
|
282 | - } else { |
|
283 | - header($header); |
|
284 | - } |
|
279 | + $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
280 | + if($_POST['ajax'] == 1) { |
|
281 | + echo $header; |
|
282 | + } else { |
|
283 | + header($header); |
|
284 | + } |
|
285 | 285 | } else { |
286 | - $header = 'Location: ' . MODX_MANAGER_URL; |
|
287 | - if($_POST['ajax'] == 1) { |
|
288 | - echo $header; |
|
289 | - } else { |
|
290 | - header($header); |
|
291 | - } |
|
286 | + $header = 'Location: ' . MODX_MANAGER_URL; |
|
287 | + if($_POST['ajax'] == 1) { |
|
288 | + echo $header; |
|
289 | + } else { |
|
290 | + header($header); |
|
291 | + } |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // show javascript alert |
295 | 295 | function jsAlert($msg) { |
296 | - global $modx; |
|
297 | - if($_POST['ajax'] != 1) { |
|
298 | - echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>"; |
|
299 | - } else { |
|
300 | - echo $msg . "\n"; |
|
301 | - } |
|
296 | + global $modx; |
|
297 | + if($_POST['ajax'] != 1) { |
|
298 | + echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>"; |
|
299 | + } else { |
|
300 | + echo $msg . "\n"; |
|
301 | + } |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | function login($username, $givenPassword, $dbasePassword) { |
305 | - global $modx; |
|
306 | - return $modx->phpass->CheckPassword($givenPassword, $dbasePassword); |
|
305 | + global $modx; |
|
306 | + return $modx->phpass->CheckPassword($givenPassword, $dbasePassword); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | function loginV1($internalKey, $givenPassword, $dbasePassword, $username) { |
310 | - global $modx; |
|
310 | + global $modx; |
|
311 | 311 | |
312 | - $user_algo = $modx->manager->getV1UserHashAlgorithm($internalKey); |
|
312 | + $user_algo = $modx->manager->getV1UserHashAlgorithm($internalKey); |
|
313 | 313 | |
314 | - if(!isset($modx->config['pwd_hash_algo']) || empty($modx->config['pwd_hash_algo'])) { |
|
315 | - $modx->config['pwd_hash_algo'] = 'UNCRYPT'; |
|
316 | - } |
|
314 | + if(!isset($modx->config['pwd_hash_algo']) || empty($modx->config['pwd_hash_algo'])) { |
|
315 | + $modx->config['pwd_hash_algo'] = 'UNCRYPT'; |
|
316 | + } |
|
317 | 317 | |
318 | - if($user_algo !== $modx->config['pwd_hash_algo']) { |
|
319 | - $bk_pwd_hash_algo = $modx->config['pwd_hash_algo']; |
|
320 | - $modx->config['pwd_hash_algo'] = $user_algo; |
|
321 | - } |
|
318 | + if($user_algo !== $modx->config['pwd_hash_algo']) { |
|
319 | + $bk_pwd_hash_algo = $modx->config['pwd_hash_algo']; |
|
320 | + $modx->config['pwd_hash_algo'] = $user_algo; |
|
321 | + } |
|
322 | 322 | |
323 | - if($dbasePassword != $modx->manager->genV1Hash($givenPassword, $internalKey)) { |
|
324 | - return false; |
|
325 | - } |
|
323 | + if($dbasePassword != $modx->manager->genV1Hash($givenPassword, $internalKey)) { |
|
324 | + return false; |
|
325 | + } |
|
326 | 326 | |
327 | - updateNewHash($username, $givenPassword); |
|
327 | + updateNewHash($username, $givenPassword); |
|
328 | 328 | |
329 | - return true; |
|
329 | + return true; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | function loginMD5($internalKey, $givenPassword, $dbasePassword, $username) { |
333 | - global $modx; |
|
333 | + global $modx; |
|
334 | 334 | |
335 | - if($dbasePassword != md5($givenPassword)) { |
|
336 | - return false; |
|
337 | - } |
|
338 | - updateNewHash($username, $givenPassword); |
|
339 | - return true; |
|
335 | + if($dbasePassword != md5($givenPassword)) { |
|
336 | + return false; |
|
337 | + } |
|
338 | + updateNewHash($username, $givenPassword); |
|
339 | + return true; |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | function updateNewHash($username, $password) { |
343 | - global $modx; |
|
343 | + global $modx; |
|
344 | 344 | |
345 | - $field = array(); |
|
346 | - $field['password'] = $modx->phpass->HashPassword($password); |
|
347 | - $modx->db->update($field, '[+prefix+]manager_users', "username='{$username}'"); |
|
345 | + $field = array(); |
|
346 | + $field['password'] = $modx->phpass->HashPassword($password); |
|
347 | + $modx->db->update($field, '[+prefix+]manager_users', "username='{$username}'"); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes) { |
351 | - global $modx; |
|
352 | - |
|
353 | - $failedlogins += 1; |
|
354 | - |
|
355 | - $fields = array('failedlogincount' => $failedlogins); |
|
356 | - if($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
357 | - { |
|
358 | - $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
|
359 | - } |
|
360 | - |
|
361 | - $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
362 | - |
|
363 | - if($failedlogins < $failed_allowed) { |
|
364 | - //sleep to help prevent brute force attacks |
|
365 | - $sleep = (int) $failedlogins / 2; |
|
366 | - if($sleep > 5) { |
|
367 | - $sleep = 5; |
|
368 | - } |
|
369 | - sleep($sleep); |
|
370 | - } |
|
371 | - @session_destroy(); |
|
372 | - session_unset(); |
|
373 | - return; |
|
351 | + global $modx; |
|
352 | + |
|
353 | + $failedlogins += 1; |
|
354 | + |
|
355 | + $fields = array('failedlogincount' => $failedlogins); |
|
356 | + if($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
357 | + { |
|
358 | + $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
|
359 | + } |
|
360 | + |
|
361 | + $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
362 | + |
|
363 | + if($failedlogins < $failed_allowed) { |
|
364 | + //sleep to help prevent brute force attacks |
|
365 | + $sleep = (int) $failedlogins / 2; |
|
366 | + if($sleep > 5) { |
|
367 | + $sleep = 5; |
|
368 | + } |
|
369 | + sleep($sleep); |
|
370 | + } |
|
371 | + @session_destroy(); |
|
372 | + session_unset(); |
|
373 | + return; |
|
374 | 374 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(IN_MANAGER_MODE != 'true') { |
3 | - die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.'); |
|
3 | + die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -11,575 +11,575 @@ discard block |
||
11 | 11 | * @param string $hereid |
12 | 12 | */ |
13 | 13 | function makeHTML($indent, $parent, $expandAll, $theme, $hereid = '') { |
14 | - global $modx; |
|
15 | - global $icons, $iconsPrivate, $_style; |
|
16 | - global $_lang, $opened, $opened2, $closed2; //added global vars |
|
17 | - global $modx_textdir; |
|
18 | - |
|
19 | - $output = ''; |
|
20 | - |
|
21 | - // setup spacer |
|
22 | - $level = 0; |
|
23 | - $spacer = '<span class="indent">'; |
|
24 | - for($i = 2; $i <= $indent; $i++) { |
|
25 | - $spacer .= '<i></i>'; |
|
26 | - $level++; |
|
27 | - } |
|
28 | - $spacer .= '</span>'; |
|
29 | - |
|
30 | - // manage order-by |
|
31 | - if(!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) { |
|
32 | - // This is the first startup, set default sort order |
|
33 | - $_SESSION['tree_sortby'] = 'menuindex'; |
|
34 | - $_SESSION['tree_sortdir'] = 'ASC'; |
|
35 | - } |
|
36 | - |
|
37 | - switch($_SESSION['tree_sortby']) { |
|
38 | - case 'createdon': |
|
39 | - case 'editedon': |
|
40 | - case 'publishedon': |
|
41 | - case 'pub_date': |
|
42 | - case 'unpub_date': |
|
43 | - $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'], 'sc.' . $_SESSION['tree_sortby']); |
|
44 | - break; |
|
45 | - default: |
|
46 | - $sortby = 'sc.' . $_SESSION['tree_sortby']; |
|
47 | - }; |
|
48 | - |
|
49 | - $orderby = $modx->db->escape($sortby . ' ' . $_SESSION['tree_sortdir']); |
|
50 | - |
|
51 | - // Folder sorting gets special setup ;) Add menuindex and pagetitle |
|
52 | - if($_SESSION['tree_sortby'] == 'isfolder') { |
|
53 | - $orderby .= ', menuindex ASC, pagetitle'; |
|
54 | - } |
|
55 | - |
|
56 | - $tblsc = $modx->getFullTableName('site_content'); |
|
57 | - $tbldg = $modx->getFullTableName('document_groups'); |
|
58 | - $tblst = $modx->getFullTableName('site_templates'); |
|
59 | - // get document groups for current user |
|
60 | - $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
|
61 | - $showProtected = false; |
|
62 | - if(isset ($modx->config['tree_show_protected'])) { |
|
63 | - $showProtected = (boolean) $modx->config['tree_show_protected']; |
|
64 | - } |
|
65 | - $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
66 | - if($showProtected == false) { |
|
67 | - $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
68 | - } else { |
|
69 | - $access = ''; |
|
70 | - } |
|
71 | - $docgrp_cond = $docgrp ? "OR dg.document_group IN ({$docgrp})" : ''; |
|
72 | - $field = "DISTINCT sc.id, pagetitle, longtitle, menutitle, parent, isfolder, published, pub_date, unpub_date, richtext, searchable, cacheable, deleted, type, template, templatename, menuindex, donthit, hidemenu, alias, contentType, privateweb, privatemgr, |
|
14 | + global $modx; |
|
15 | + global $icons, $iconsPrivate, $_style; |
|
16 | + global $_lang, $opened, $opened2, $closed2; //added global vars |
|
17 | + global $modx_textdir; |
|
18 | + |
|
19 | + $output = ''; |
|
20 | + |
|
21 | + // setup spacer |
|
22 | + $level = 0; |
|
23 | + $spacer = '<span class="indent">'; |
|
24 | + for($i = 2; $i <= $indent; $i++) { |
|
25 | + $spacer .= '<i></i>'; |
|
26 | + $level++; |
|
27 | + } |
|
28 | + $spacer .= '</span>'; |
|
29 | + |
|
30 | + // manage order-by |
|
31 | + if(!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) { |
|
32 | + // This is the first startup, set default sort order |
|
33 | + $_SESSION['tree_sortby'] = 'menuindex'; |
|
34 | + $_SESSION['tree_sortdir'] = 'ASC'; |
|
35 | + } |
|
36 | + |
|
37 | + switch($_SESSION['tree_sortby']) { |
|
38 | + case 'createdon': |
|
39 | + case 'editedon': |
|
40 | + case 'publishedon': |
|
41 | + case 'pub_date': |
|
42 | + case 'unpub_date': |
|
43 | + $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'], 'sc.' . $_SESSION['tree_sortby']); |
|
44 | + break; |
|
45 | + default: |
|
46 | + $sortby = 'sc.' . $_SESSION['tree_sortby']; |
|
47 | + }; |
|
48 | + |
|
49 | + $orderby = $modx->db->escape($sortby . ' ' . $_SESSION['tree_sortdir']); |
|
50 | + |
|
51 | + // Folder sorting gets special setup ;) Add menuindex and pagetitle |
|
52 | + if($_SESSION['tree_sortby'] == 'isfolder') { |
|
53 | + $orderby .= ', menuindex ASC, pagetitle'; |
|
54 | + } |
|
55 | + |
|
56 | + $tblsc = $modx->getFullTableName('site_content'); |
|
57 | + $tbldg = $modx->getFullTableName('document_groups'); |
|
58 | + $tblst = $modx->getFullTableName('site_templates'); |
|
59 | + // get document groups for current user |
|
60 | + $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
|
61 | + $showProtected = false; |
|
62 | + if(isset ($modx->config['tree_show_protected'])) { |
|
63 | + $showProtected = (boolean) $modx->config['tree_show_protected']; |
|
64 | + } |
|
65 | + $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
66 | + if($showProtected == false) { |
|
67 | + $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
68 | + } else { |
|
69 | + $access = ''; |
|
70 | + } |
|
71 | + $docgrp_cond = $docgrp ? "OR dg.document_group IN ({$docgrp})" : ''; |
|
72 | + $field = "DISTINCT sc.id, pagetitle, longtitle, menutitle, parent, isfolder, published, pub_date, unpub_date, richtext, searchable, cacheable, deleted, type, template, templatename, menuindex, donthit, hidemenu, alias, contentType, privateweb, privatemgr, |
|
73 | 73 | MAX(IF(1={$mgrRole} OR sc.privatemgr=0 {$docgrp_cond}, 1, 0)) AS hasAccess, GROUP_CONCAT(document_group SEPARATOR ',') AS roles"; |
74 | - $from = "{$tblsc} AS sc LEFT JOIN {$tbldg} dg on dg.document = sc.id LEFT JOIN {$tblst} st on st.id = sc.template"; |
|
75 | - $where = "(parent={$parent}) {$access} GROUP BY sc.id"; |
|
76 | - $result = $modx->db->select($field, $from, $where, $orderby); |
|
77 | - if($modx->db->getRecordCount($result) == 0) { |
|
78 | - $output .= sprintf('<div><a class="empty">%s%s <span class="empty">%s</span></a></div>', $spacer, $_style['tree_deletedpage'], $_lang['empty_folder']); |
|
79 | - } |
|
80 | - |
|
81 | - $nodeNameSource = $_SESSION['tree_nodename'] == 'default' ? $modx->config['resource_tree_node_name'] : $_SESSION['tree_nodename']; |
|
82 | - |
|
83 | - while($row = $modx->db->getRow($result)) { |
|
84 | - $node = ''; |
|
85 | - |
|
86 | - $nodetitle = getNodeTitle($nodeNameSource, $row); |
|
87 | - $nodetitleDisplay = $nodetitle; |
|
88 | - |
|
89 | - $treeNodeClass = 'node'; |
|
90 | - $treeNodeClass .= $row['hasAccess'] == 0 ? ' protected' : ''; |
|
91 | - |
|
92 | - if($row['deleted'] == 1) { |
|
93 | - $treeNodeClass .= ' deleted'; |
|
94 | - //$nodetitleDisplay = sprintf('<span class="deletedNode">%s</span>', $nodetitle); |
|
95 | - } elseif($row['published'] == 0) { |
|
96 | - $treeNodeClass .= ' unpublished'; |
|
97 | - //$nodetitleDisplay = sprintf('<span class="unpublishedNode">%s</span>', $nodetitle); |
|
98 | - } elseif($row['hidemenu'] == 1) { |
|
99 | - $treeNodeClass .= ' hidemenu'; |
|
100 | - //$nodetitleDisplay = sprintf('<span class="notInMenuNode%s">%s</span>', $protectedClass, $nodetitle); |
|
101 | - } else { |
|
102 | - //$nodetitleDisplay = sprintf('<span class="publishedNode%s">%s</span>', $protectedClass, $nodetitle); |
|
103 | - } |
|
104 | - |
|
105 | - if($row['id'] == $hereid) { |
|
106 | - $treeNodeClass .= ' current'; |
|
107 | - } |
|
108 | - |
|
109 | - $weblinkDisplay = $row['type'] == 'reference' ? sprintf(' %s', $_style['tree_linkgo']) : ''; |
|
110 | - $pageIdDisplay = '<small>(' . ($modx_textdir ? '‏' : '') . $row['id'] . ')</small>'; |
|
111 | - |
|
112 | - // Prepare displaying user-locks |
|
113 | - $lockedByUser = ''; |
|
114 | - $rowLock = $modx->elementIsLocked(7, $row['id'], true); |
|
115 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
116 | - if($rowLock['sid'] == $modx->sid) { |
|
117 | - $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
118 | - 'element_type' => $_lang["lock_element_type_7"], |
|
119 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
120 | - )); |
|
121 | - $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>'; |
|
122 | - } else { |
|
123 | - $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
124 | - 'element_type' => $_lang["lock_element_type_7"], |
|
125 | - 'username' => $rowLock['username'], |
|
126 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
127 | - )); |
|
128 | - if($modx->hasPermission('remove_locks')) { |
|
129 | - $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
130 | - } else { |
|
131 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
132 | - } |
|
133 | - } |
|
134 | - } |
|
135 | - |
|
136 | - $url = $modx->makeUrl($row['id']); |
|
137 | - |
|
138 | - $title = ''; |
|
139 | - if(isDateNode($nodeNameSource)) { |
|
140 | - $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]'; |
|
141 | - } |
|
142 | - $title .= $_lang['id'] . ': ' . $row['id']; |
|
143 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle']; |
|
144 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex']; |
|
145 | - $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-'); |
|
146 | - $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename']; |
|
147 | - $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']); |
|
148 | - $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']); |
|
149 | - $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
150 | - $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
151 | - $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
152 | - $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
153 | - $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
154 | - $title = $modx->htmlspecialchars($title); |
|
155 | - $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
156 | - |
|
157 | - $data = array( |
|
158 | - 'id' => $row['id'], |
|
159 | - 'pagetitle' => $row['pagetitle'], |
|
160 | - 'longtitle' => $row['longtitle'], |
|
161 | - 'menutitle' => $row['menutitle'], |
|
162 | - 'parent' => $parent, |
|
163 | - 'isfolder' => $row['isfolder'], |
|
164 | - 'published' => $row['published'], |
|
165 | - 'deleted' => $row['deleted'], |
|
166 | - 'type' => $row['type'], |
|
167 | - 'menuindex' => $row['menuindex'], |
|
168 | - 'donthit' => $row['donthit'], |
|
169 | - 'hidemenu' => $row['hidemenu'], |
|
170 | - 'alias' => $row['alias'], |
|
171 | - 'contenttype' => $row['contentType'], |
|
172 | - 'privateweb' => $row['privateweb'], |
|
173 | - 'privatemgr' => $row['privatemgr'], |
|
174 | - 'hasAccess' => $row['hasAccess'], |
|
175 | - 'template' => $row['template'], |
|
176 | - 'nodetitle' => $nodetitle, |
|
177 | - 'url' => $url, |
|
178 | - 'title' => $title, |
|
179 | - 'nodetitleDisplay' => $nodetitleDisplay, |
|
180 | - 'weblinkDisplay' => $weblinkDisplay, |
|
181 | - 'pageIdDisplay' => $pageIdDisplay, |
|
182 | - 'lockedByUser' => $lockedByUser, |
|
183 | - 'treeNodeClass' => $treeNodeClass, |
|
184 | - 'treeNodeSelected' => $row['id'] == $hereid ? ' treeNodeSelected' : '', |
|
185 | - 'tree_page_click' => $modx->config['tree_page_click'], |
|
186 | - 'showChildren' => 1, |
|
187 | - 'openFolder' => 1, |
|
188 | - 'contextmenu' => '', |
|
189 | - 'tree_minusnode' => $_style['tree_minusnode'], |
|
190 | - 'tree_plusnode' => $_style['tree_plusnode'], |
|
191 | - 'spacer' => $spacer, |
|
192 | - 'subMenuState' => '', |
|
193 | - 'level' => $level, |
|
194 | - 'isPrivate' => 0, |
|
195 | - 'roles' => ($row['roles'] ? $row['roles'] : '') |
|
196 | - ); |
|
197 | - |
|
198 | - $ph = $data; |
|
199 | - $ph['nodetitle_esc'] = addslashes($nodetitle); |
|
200 | - $ph['indent'] = $indent + 1; |
|
201 | - $ph['expandAll'] = $expandAll; |
|
202 | - $ph['isPrivate'] = ($row['privateweb'] || $row['privatemgr']) ? 1 : 0; |
|
203 | - |
|
204 | - if(!$row['isfolder']) { |
|
205 | - $tpl = getTplSingleNode(); |
|
206 | - switch($row['id']) { |
|
207 | - case $modx->config['site_start'] : |
|
208 | - $icon = $_style['tree_page_home']; |
|
209 | - break; |
|
210 | - case $modx->config['error_page'] : |
|
211 | - $icon = $_style['tree_page_404']; |
|
212 | - break; |
|
213 | - case $modx->config['site_unavailable_page'] : |
|
214 | - $icon = $_style['tree_page_hourglass']; |
|
215 | - break; |
|
216 | - case $modx->config['unauthorized_page'] : |
|
217 | - $icon = $_style['tree_page_info']; |
|
218 | - break; |
|
219 | - default: |
|
220 | - if(isset($icons[$row['contentType']])) { |
|
221 | - $icon = $icons[$row['contentType']]; |
|
222 | - } else { |
|
223 | - $icon = $_style['tree_page']; |
|
224 | - } |
|
225 | - } |
|
226 | - $ph['icon'] = $icon; |
|
227 | - |
|
228 | - // invoke OnManagerNodePrerender event |
|
229 | - $prenode = $modx->invokeEvent("OnManagerNodePrerender", array('ph' => $ph)); |
|
230 | - if(is_array($prenode)) { |
|
231 | - $phnew = array(); |
|
232 | - foreach($prenode as $pnode) { |
|
233 | - $phnew = array_merge($phnew, unserialize($pnode)); |
|
234 | - } |
|
235 | - $ph = (count($phnew) > 0) ? $phnew : $ph; |
|
236 | - } |
|
237 | - |
|
238 | - if($ph['contextmenu']) { |
|
239 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
240 | - } |
|
241 | - |
|
242 | - if($_SESSION['tree_show_only_folders']) { |
|
243 | - if($row['parent'] == 0) { |
|
244 | - $node .= $modx->parseText($tpl, $ph); |
|
245 | - } else { |
|
246 | - $node .= ''; |
|
247 | - } |
|
248 | - } else { |
|
249 | - $node .= $modx->parseText($tpl, $ph); |
|
250 | - } |
|
251 | - |
|
252 | - } else { |
|
253 | - $ph['icon_folder_open'] = $_style['tree_folderopen_new']; |
|
254 | - $ph['icon_folder_close'] = $_style['tree_folder_new']; |
|
255 | - |
|
256 | - if($_SESSION['tree_show_only_folders']) { |
|
257 | - $tpl = getTplFolderNodeNotChildren(); |
|
258 | - $checkFolders = checkIsFolder($row['id'], 1) ? 1 : 0; // folders |
|
259 | - $checkDocs = checkIsFolder($row['id'], 0) ? 1 : 0; // no folders |
|
260 | - $ph['tree_page_click'] = 3; |
|
261 | - |
|
262 | - // expandAll: two type for partial expansion |
|
263 | - if($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
264 | - if($expandAll == 1) { |
|
265 | - $opened2[] = $row['id']; |
|
266 | - } |
|
267 | - $ph['icon'] = $ph['icon_folder_open']; |
|
268 | - $ph['icon_node_toggle'] = $ph['tree_minusnode']; |
|
269 | - $ph['node_toggle'] = 1; |
|
270 | - $ph['subMenuState'] = ' open'; |
|
271 | - |
|
272 | - if(($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
273 | - $ph['showChildren'] = 1; |
|
274 | - $ph['icon_node_toggle'] = ''; |
|
275 | - $ph['icon'] = $ph['icon_folder_close']; |
|
276 | - } elseif(!$checkDocs && $checkFolders) { |
|
277 | - $ph['showChildren'] = 0; |
|
278 | - $ph['openFolder'] = 2; |
|
279 | - } else { |
|
280 | - $ph['openFolder'] = 2; |
|
281 | - } |
|
282 | - |
|
283 | - // invoke OnManagerNodePrerender event |
|
284 | - $prenode = $modx->invokeEvent("OnManagerNodePrerender", array( |
|
285 | - 'ph' => $ph, |
|
286 | - 'opened' => '1' |
|
287 | - )); |
|
288 | - if(is_array($prenode)) { |
|
289 | - $phnew = array(); |
|
290 | - foreach($prenode as $pnode) { |
|
291 | - $phnew = array_merge($phnew, unserialize($pnode)); |
|
292 | - } |
|
293 | - $ph = (count($phnew) > 0) ? $phnew : $ph; |
|
294 | - } |
|
295 | - |
|
296 | - if($ph['contextmenu']) { |
|
297 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
298 | - } |
|
299 | - |
|
300 | - $node .= $modx->parseText($tpl, $ph); |
|
301 | - if($checkFolders) { |
|
302 | - $node .= makeHTML($indent + 1, $row['id'], $expandAll, $theme, $hereid); |
|
303 | - } |
|
304 | - $node .= '</div></div>'; |
|
305 | - } else { |
|
306 | - $closed2[] = $row['id']; |
|
307 | - $ph['icon'] = $ph['icon_folder_close']; |
|
308 | - $ph['icon_node_toggle'] = $ph['tree_plusnode']; |
|
309 | - $ph['node_toggle'] = 0; |
|
310 | - |
|
311 | - if(($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
312 | - $ph['showChildren'] = 1; |
|
313 | - $ph['icon_node_toggle'] = ''; |
|
314 | - } elseif(!$checkDocs && $checkFolders) { |
|
315 | - $ph['showChildren'] = 0; |
|
316 | - $ph['openFolder'] = 2; |
|
317 | - } else { |
|
318 | - $ph['openFolder'] = 2; |
|
319 | - } |
|
320 | - |
|
321 | - // invoke OnManagerNodePrerender event |
|
322 | - $prenode = $modx->invokeEvent("OnManagerNodePrerender", array( |
|
323 | - 'ph' => $ph, |
|
324 | - 'opened' => '0' |
|
325 | - )); |
|
326 | - if(is_array($prenode)) { |
|
327 | - $phnew = array(); |
|
328 | - foreach($prenode as $pnode) { |
|
329 | - $phnew = array_merge($phnew, unserialize($pnode)); |
|
330 | - } |
|
331 | - $ph = (count($phnew) > 0) ? $phnew : $ph; |
|
332 | - } |
|
333 | - |
|
334 | - if($ph['contextmenu']) { |
|
335 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
336 | - } |
|
337 | - |
|
338 | - $node .= $modx->parseText($tpl, $ph); |
|
339 | - $node .= '</div></div>'; |
|
340 | - } |
|
341 | - } else { |
|
342 | - $tpl = getTplFolderNode(); |
|
343 | - // expandAll: two type for partial expansion |
|
344 | - if($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
345 | - if($expandAll == 1) { |
|
346 | - $opened2[] = $row['id']; |
|
347 | - } |
|
348 | - $ph['icon'] = $ph['icon_folder_open']; |
|
349 | - $ph['icon_node_toggle'] = $ph['tree_minusnode']; |
|
350 | - $ph['node_toggle'] = 1; |
|
351 | - $ph['subMenuState'] = ' open'; |
|
352 | - |
|
353 | - if($ph['donthit'] == 1) { |
|
354 | - $ph['tree_page_click'] = 3; |
|
355 | - $ph['icon_node_toggle'] = ''; |
|
356 | - $ph['icon'] = $ph['icon_folder_close']; |
|
357 | - $ph['showChildren'] = 0; |
|
358 | - } |
|
359 | - |
|
360 | - // invoke OnManagerNodePrerender event |
|
361 | - $prenode = $modx->invokeEvent("OnManagerNodePrerender", array( |
|
362 | - 'ph' => $ph, |
|
363 | - 'opened' => '1' |
|
364 | - )); |
|
365 | - if(is_array($prenode)) { |
|
366 | - $phnew = array(); |
|
367 | - foreach($prenode as $pnode) { |
|
368 | - $phnew = array_merge($phnew, unserialize($pnode)); |
|
369 | - } |
|
370 | - $ph = (count($phnew) > 0) ? $phnew : $ph; |
|
371 | - if($ph['showChildren'] == 0) { |
|
372 | - unset($opened2[$row['id']]); |
|
373 | - $ph['node_toggle'] = 0; |
|
374 | - $ph['subMenuState'] = ''; |
|
375 | - } |
|
376 | - } |
|
377 | - |
|
378 | - if($ph['showChildren'] == 0) { |
|
379 | - $ph['icon_node_toggle'] = ''; |
|
380 | - $ph['donthit'] = 1; |
|
381 | - $ph['icon'] = $ph['icon_folder_close']; |
|
382 | - $tpl = getTplFolderNodeNotChildren(); |
|
383 | - } |
|
384 | - |
|
385 | - if($ph['contextmenu']) { |
|
386 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
387 | - } |
|
388 | - |
|
389 | - $node .= $modx->parseText($tpl, $ph); |
|
390 | - if($ph['donthit'] == 0) { |
|
391 | - $node .= makeHTML($indent + 1, $row['id'], $expandAll, $theme, $hereid); |
|
392 | - } |
|
393 | - $node .= '</div></div>'; |
|
394 | - } else { |
|
395 | - $closed2[] = $row['id']; |
|
396 | - $ph['icon'] = $ph['icon_folder_close']; |
|
397 | - $ph['icon_node_toggle'] = $ph['tree_plusnode']; |
|
398 | - $ph['node_toggle'] = 0; |
|
399 | - |
|
400 | - if($ph['donthit'] == 1) { |
|
401 | - $ph['tree_page_click'] = 3; |
|
402 | - $ph['icon_node_toggle'] = ''; |
|
403 | - $ph['icon'] = $ph['icon_folder_close']; |
|
404 | - $ph['showChildren'] = 0; |
|
405 | - } |
|
406 | - |
|
407 | - // invoke OnManagerNodePrerender event |
|
408 | - $prenode = $modx->invokeEvent("OnManagerNodePrerender", array( |
|
409 | - 'ph' => $ph, |
|
410 | - 'opened' => '0' |
|
411 | - )); |
|
412 | - if(is_array($prenode)) { |
|
413 | - $phnew = array(); |
|
414 | - foreach($prenode as $pnode) { |
|
415 | - $phnew = array_merge($phnew, unserialize($pnode)); |
|
416 | - } |
|
417 | - $ph = (count($phnew) > 0) ? $phnew : $ph; |
|
418 | - } |
|
419 | - |
|
420 | - if($ph['showChildren'] == 0) { |
|
421 | - $ph['icon_node_toggle'] = ''; |
|
422 | - $ph['donthit'] = 1; |
|
423 | - $ph['icon'] = $ph['icon_folder_close']; |
|
424 | - $tpl = getTplFolderNodeNotChildren(); |
|
425 | - } |
|
426 | - |
|
427 | - if($ph['contextmenu']) { |
|
428 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
429 | - } |
|
430 | - |
|
431 | - $node .= $modx->parseText($tpl, $ph); |
|
432 | - $node .= '</div></div>'; |
|
433 | - } |
|
434 | - } |
|
435 | - } |
|
436 | - |
|
437 | - // invoke OnManagerNodeRender event |
|
438 | - $data['node'] = $node; |
|
439 | - $evtOut = $modx->invokeEvent('OnManagerNodeRender', $data); |
|
440 | - if(is_array($evtOut)) { |
|
441 | - $evtOut = implode("\n", $evtOut); |
|
442 | - } |
|
443 | - if($evtOut != '') { |
|
444 | - $node = trim($evtOut); |
|
445 | - } |
|
446 | - |
|
447 | - $output .= $node; |
|
448 | - } |
|
449 | - |
|
450 | - return $output; |
|
74 | + $from = "{$tblsc} AS sc LEFT JOIN {$tbldg} dg on dg.document = sc.id LEFT JOIN {$tblst} st on st.id = sc.template"; |
|
75 | + $where = "(parent={$parent}) {$access} GROUP BY sc.id"; |
|
76 | + $result = $modx->db->select($field, $from, $where, $orderby); |
|
77 | + if($modx->db->getRecordCount($result) == 0) { |
|
78 | + $output .= sprintf('<div><a class="empty">%s%s <span class="empty">%s</span></a></div>', $spacer, $_style['tree_deletedpage'], $_lang['empty_folder']); |
|
79 | + } |
|
80 | + |
|
81 | + $nodeNameSource = $_SESSION['tree_nodename'] == 'default' ? $modx->config['resource_tree_node_name'] : $_SESSION['tree_nodename']; |
|
82 | + |
|
83 | + while($row = $modx->db->getRow($result)) { |
|
84 | + $node = ''; |
|
85 | + |
|
86 | + $nodetitle = getNodeTitle($nodeNameSource, $row); |
|
87 | + $nodetitleDisplay = $nodetitle; |
|
88 | + |
|
89 | + $treeNodeClass = 'node'; |
|
90 | + $treeNodeClass .= $row['hasAccess'] == 0 ? ' protected' : ''; |
|
91 | + |
|
92 | + if($row['deleted'] == 1) { |
|
93 | + $treeNodeClass .= ' deleted'; |
|
94 | + //$nodetitleDisplay = sprintf('<span class="deletedNode">%s</span>', $nodetitle); |
|
95 | + } elseif($row['published'] == 0) { |
|
96 | + $treeNodeClass .= ' unpublished'; |
|
97 | + //$nodetitleDisplay = sprintf('<span class="unpublishedNode">%s</span>', $nodetitle); |
|
98 | + } elseif($row['hidemenu'] == 1) { |
|
99 | + $treeNodeClass .= ' hidemenu'; |
|
100 | + //$nodetitleDisplay = sprintf('<span class="notInMenuNode%s">%s</span>', $protectedClass, $nodetitle); |
|
101 | + } else { |
|
102 | + //$nodetitleDisplay = sprintf('<span class="publishedNode%s">%s</span>', $protectedClass, $nodetitle); |
|
103 | + } |
|
104 | + |
|
105 | + if($row['id'] == $hereid) { |
|
106 | + $treeNodeClass .= ' current'; |
|
107 | + } |
|
108 | + |
|
109 | + $weblinkDisplay = $row['type'] == 'reference' ? sprintf(' %s', $_style['tree_linkgo']) : ''; |
|
110 | + $pageIdDisplay = '<small>(' . ($modx_textdir ? '‏' : '') . $row['id'] . ')</small>'; |
|
111 | + |
|
112 | + // Prepare displaying user-locks |
|
113 | + $lockedByUser = ''; |
|
114 | + $rowLock = $modx->elementIsLocked(7, $row['id'], true); |
|
115 | + if($rowLock && $modx->hasPermission('display_locks')) { |
|
116 | + if($rowLock['sid'] == $modx->sid) { |
|
117 | + $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
118 | + 'element_type' => $_lang["lock_element_type_7"], |
|
119 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
120 | + )); |
|
121 | + $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>'; |
|
122 | + } else { |
|
123 | + $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
124 | + 'element_type' => $_lang["lock_element_type_7"], |
|
125 | + 'username' => $rowLock['username'], |
|
126 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
127 | + )); |
|
128 | + if($modx->hasPermission('remove_locks')) { |
|
129 | + $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
130 | + } else { |
|
131 | + $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
132 | + } |
|
133 | + } |
|
134 | + } |
|
135 | + |
|
136 | + $url = $modx->makeUrl($row['id']); |
|
137 | + |
|
138 | + $title = ''; |
|
139 | + if(isDateNode($nodeNameSource)) { |
|
140 | + $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]'; |
|
141 | + } |
|
142 | + $title .= $_lang['id'] . ': ' . $row['id']; |
|
143 | + $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle']; |
|
144 | + $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex']; |
|
145 | + $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-'); |
|
146 | + $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename']; |
|
147 | + $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']); |
|
148 | + $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']); |
|
149 | + $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
150 | + $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
151 | + $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
152 | + $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
153 | + $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
154 | + $title = $modx->htmlspecialchars($title); |
|
155 | + $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
156 | + |
|
157 | + $data = array( |
|
158 | + 'id' => $row['id'], |
|
159 | + 'pagetitle' => $row['pagetitle'], |
|
160 | + 'longtitle' => $row['longtitle'], |
|
161 | + 'menutitle' => $row['menutitle'], |
|
162 | + 'parent' => $parent, |
|
163 | + 'isfolder' => $row['isfolder'], |
|
164 | + 'published' => $row['published'], |
|
165 | + 'deleted' => $row['deleted'], |
|
166 | + 'type' => $row['type'], |
|
167 | + 'menuindex' => $row['menuindex'], |
|
168 | + 'donthit' => $row['donthit'], |
|
169 | + 'hidemenu' => $row['hidemenu'], |
|
170 | + 'alias' => $row['alias'], |
|
171 | + 'contenttype' => $row['contentType'], |
|
172 | + 'privateweb' => $row['privateweb'], |
|
173 | + 'privatemgr' => $row['privatemgr'], |
|
174 | + 'hasAccess' => $row['hasAccess'], |
|
175 | + 'template' => $row['template'], |
|
176 | + 'nodetitle' => $nodetitle, |
|
177 | + 'url' => $url, |
|
178 | + 'title' => $title, |
|
179 | + 'nodetitleDisplay' => $nodetitleDisplay, |
|
180 | + 'weblinkDisplay' => $weblinkDisplay, |
|
181 | + 'pageIdDisplay' => $pageIdDisplay, |
|
182 | + 'lockedByUser' => $lockedByUser, |
|
183 | + 'treeNodeClass' => $treeNodeClass, |
|
184 | + 'treeNodeSelected' => $row['id'] == $hereid ? ' treeNodeSelected' : '', |
|
185 | + 'tree_page_click' => $modx->config['tree_page_click'], |
|
186 | + 'showChildren' => 1, |
|
187 | + 'openFolder' => 1, |
|
188 | + 'contextmenu' => '', |
|
189 | + 'tree_minusnode' => $_style['tree_minusnode'], |
|
190 | + 'tree_plusnode' => $_style['tree_plusnode'], |
|
191 | + 'spacer' => $spacer, |
|
192 | + 'subMenuState' => '', |
|
193 | + 'level' => $level, |
|
194 | + 'isPrivate' => 0, |
|
195 | + 'roles' => ($row['roles'] ? $row['roles'] : '') |
|
196 | + ); |
|
197 | + |
|
198 | + $ph = $data; |
|
199 | + $ph['nodetitle_esc'] = addslashes($nodetitle); |
|
200 | + $ph['indent'] = $indent + 1; |
|
201 | + $ph['expandAll'] = $expandAll; |
|
202 | + $ph['isPrivate'] = ($row['privateweb'] || $row['privatemgr']) ? 1 : 0; |
|
203 | + |
|
204 | + if(!$row['isfolder']) { |
|
205 | + $tpl = getTplSingleNode(); |
|
206 | + switch($row['id']) { |
|
207 | + case $modx->config['site_start'] : |
|
208 | + $icon = $_style['tree_page_home']; |
|
209 | + break; |
|
210 | + case $modx->config['error_page'] : |
|
211 | + $icon = $_style['tree_page_404']; |
|
212 | + break; |
|
213 | + case $modx->config['site_unavailable_page'] : |
|
214 | + $icon = $_style['tree_page_hourglass']; |
|
215 | + break; |
|
216 | + case $modx->config['unauthorized_page'] : |
|
217 | + $icon = $_style['tree_page_info']; |
|
218 | + break; |
|
219 | + default: |
|
220 | + if(isset($icons[$row['contentType']])) { |
|
221 | + $icon = $icons[$row['contentType']]; |
|
222 | + } else { |
|
223 | + $icon = $_style['tree_page']; |
|
224 | + } |
|
225 | + } |
|
226 | + $ph['icon'] = $icon; |
|
227 | + |
|
228 | + // invoke OnManagerNodePrerender event |
|
229 | + $prenode = $modx->invokeEvent("OnManagerNodePrerender", array('ph' => $ph)); |
|
230 | + if(is_array($prenode)) { |
|
231 | + $phnew = array(); |
|
232 | + foreach($prenode as $pnode) { |
|
233 | + $phnew = array_merge($phnew, unserialize($pnode)); |
|
234 | + } |
|
235 | + $ph = (count($phnew) > 0) ? $phnew : $ph; |
|
236 | + } |
|
237 | + |
|
238 | + if($ph['contextmenu']) { |
|
239 | + $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
240 | + } |
|
241 | + |
|
242 | + if($_SESSION['tree_show_only_folders']) { |
|
243 | + if($row['parent'] == 0) { |
|
244 | + $node .= $modx->parseText($tpl, $ph); |
|
245 | + } else { |
|
246 | + $node .= ''; |
|
247 | + } |
|
248 | + } else { |
|
249 | + $node .= $modx->parseText($tpl, $ph); |
|
250 | + } |
|
251 | + |
|
252 | + } else { |
|
253 | + $ph['icon_folder_open'] = $_style['tree_folderopen_new']; |
|
254 | + $ph['icon_folder_close'] = $_style['tree_folder_new']; |
|
255 | + |
|
256 | + if($_SESSION['tree_show_only_folders']) { |
|
257 | + $tpl = getTplFolderNodeNotChildren(); |
|
258 | + $checkFolders = checkIsFolder($row['id'], 1) ? 1 : 0; // folders |
|
259 | + $checkDocs = checkIsFolder($row['id'], 0) ? 1 : 0; // no folders |
|
260 | + $ph['tree_page_click'] = 3; |
|
261 | + |
|
262 | + // expandAll: two type for partial expansion |
|
263 | + if($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
264 | + if($expandAll == 1) { |
|
265 | + $opened2[] = $row['id']; |
|
266 | + } |
|
267 | + $ph['icon'] = $ph['icon_folder_open']; |
|
268 | + $ph['icon_node_toggle'] = $ph['tree_minusnode']; |
|
269 | + $ph['node_toggle'] = 1; |
|
270 | + $ph['subMenuState'] = ' open'; |
|
271 | + |
|
272 | + if(($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
273 | + $ph['showChildren'] = 1; |
|
274 | + $ph['icon_node_toggle'] = ''; |
|
275 | + $ph['icon'] = $ph['icon_folder_close']; |
|
276 | + } elseif(!$checkDocs && $checkFolders) { |
|
277 | + $ph['showChildren'] = 0; |
|
278 | + $ph['openFolder'] = 2; |
|
279 | + } else { |
|
280 | + $ph['openFolder'] = 2; |
|
281 | + } |
|
282 | + |
|
283 | + // invoke OnManagerNodePrerender event |
|
284 | + $prenode = $modx->invokeEvent("OnManagerNodePrerender", array( |
|
285 | + 'ph' => $ph, |
|
286 | + 'opened' => '1' |
|
287 | + )); |
|
288 | + if(is_array($prenode)) { |
|
289 | + $phnew = array(); |
|
290 | + foreach($prenode as $pnode) { |
|
291 | + $phnew = array_merge($phnew, unserialize($pnode)); |
|
292 | + } |
|
293 | + $ph = (count($phnew) > 0) ? $phnew : $ph; |
|
294 | + } |
|
295 | + |
|
296 | + if($ph['contextmenu']) { |
|
297 | + $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
298 | + } |
|
299 | + |
|
300 | + $node .= $modx->parseText($tpl, $ph); |
|
301 | + if($checkFolders) { |
|
302 | + $node .= makeHTML($indent + 1, $row['id'], $expandAll, $theme, $hereid); |
|
303 | + } |
|
304 | + $node .= '</div></div>'; |
|
305 | + } else { |
|
306 | + $closed2[] = $row['id']; |
|
307 | + $ph['icon'] = $ph['icon_folder_close']; |
|
308 | + $ph['icon_node_toggle'] = $ph['tree_plusnode']; |
|
309 | + $ph['node_toggle'] = 0; |
|
310 | + |
|
311 | + if(($checkDocs && !$checkFolders) || (!$checkDocs && !$checkFolders)) { |
|
312 | + $ph['showChildren'] = 1; |
|
313 | + $ph['icon_node_toggle'] = ''; |
|
314 | + } elseif(!$checkDocs && $checkFolders) { |
|
315 | + $ph['showChildren'] = 0; |
|
316 | + $ph['openFolder'] = 2; |
|
317 | + } else { |
|
318 | + $ph['openFolder'] = 2; |
|
319 | + } |
|
320 | + |
|
321 | + // invoke OnManagerNodePrerender event |
|
322 | + $prenode = $modx->invokeEvent("OnManagerNodePrerender", array( |
|
323 | + 'ph' => $ph, |
|
324 | + 'opened' => '0' |
|
325 | + )); |
|
326 | + if(is_array($prenode)) { |
|
327 | + $phnew = array(); |
|
328 | + foreach($prenode as $pnode) { |
|
329 | + $phnew = array_merge($phnew, unserialize($pnode)); |
|
330 | + } |
|
331 | + $ph = (count($phnew) > 0) ? $phnew : $ph; |
|
332 | + } |
|
333 | + |
|
334 | + if($ph['contextmenu']) { |
|
335 | + $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
336 | + } |
|
337 | + |
|
338 | + $node .= $modx->parseText($tpl, $ph); |
|
339 | + $node .= '</div></div>'; |
|
340 | + } |
|
341 | + } else { |
|
342 | + $tpl = getTplFolderNode(); |
|
343 | + // expandAll: two type for partial expansion |
|
344 | + if($expandAll == 1 || ($expandAll == 2 && in_array($row['id'], $opened))) { |
|
345 | + if($expandAll == 1) { |
|
346 | + $opened2[] = $row['id']; |
|
347 | + } |
|
348 | + $ph['icon'] = $ph['icon_folder_open']; |
|
349 | + $ph['icon_node_toggle'] = $ph['tree_minusnode']; |
|
350 | + $ph['node_toggle'] = 1; |
|
351 | + $ph['subMenuState'] = ' open'; |
|
352 | + |
|
353 | + if($ph['donthit'] == 1) { |
|
354 | + $ph['tree_page_click'] = 3; |
|
355 | + $ph['icon_node_toggle'] = ''; |
|
356 | + $ph['icon'] = $ph['icon_folder_close']; |
|
357 | + $ph['showChildren'] = 0; |
|
358 | + } |
|
359 | + |
|
360 | + // invoke OnManagerNodePrerender event |
|
361 | + $prenode = $modx->invokeEvent("OnManagerNodePrerender", array( |
|
362 | + 'ph' => $ph, |
|
363 | + 'opened' => '1' |
|
364 | + )); |
|
365 | + if(is_array($prenode)) { |
|
366 | + $phnew = array(); |
|
367 | + foreach($prenode as $pnode) { |
|
368 | + $phnew = array_merge($phnew, unserialize($pnode)); |
|
369 | + } |
|
370 | + $ph = (count($phnew) > 0) ? $phnew : $ph; |
|
371 | + if($ph['showChildren'] == 0) { |
|
372 | + unset($opened2[$row['id']]); |
|
373 | + $ph['node_toggle'] = 0; |
|
374 | + $ph['subMenuState'] = ''; |
|
375 | + } |
|
376 | + } |
|
377 | + |
|
378 | + if($ph['showChildren'] == 0) { |
|
379 | + $ph['icon_node_toggle'] = ''; |
|
380 | + $ph['donthit'] = 1; |
|
381 | + $ph['icon'] = $ph['icon_folder_close']; |
|
382 | + $tpl = getTplFolderNodeNotChildren(); |
|
383 | + } |
|
384 | + |
|
385 | + if($ph['contextmenu']) { |
|
386 | + $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
387 | + } |
|
388 | + |
|
389 | + $node .= $modx->parseText($tpl, $ph); |
|
390 | + if($ph['donthit'] == 0) { |
|
391 | + $node .= makeHTML($indent + 1, $row['id'], $expandAll, $theme, $hereid); |
|
392 | + } |
|
393 | + $node .= '</div></div>'; |
|
394 | + } else { |
|
395 | + $closed2[] = $row['id']; |
|
396 | + $ph['icon'] = $ph['icon_folder_close']; |
|
397 | + $ph['icon_node_toggle'] = $ph['tree_plusnode']; |
|
398 | + $ph['node_toggle'] = 0; |
|
399 | + |
|
400 | + if($ph['donthit'] == 1) { |
|
401 | + $ph['tree_page_click'] = 3; |
|
402 | + $ph['icon_node_toggle'] = ''; |
|
403 | + $ph['icon'] = $ph['icon_folder_close']; |
|
404 | + $ph['showChildren'] = 0; |
|
405 | + } |
|
406 | + |
|
407 | + // invoke OnManagerNodePrerender event |
|
408 | + $prenode = $modx->invokeEvent("OnManagerNodePrerender", array( |
|
409 | + 'ph' => $ph, |
|
410 | + 'opened' => '0' |
|
411 | + )); |
|
412 | + if(is_array($prenode)) { |
|
413 | + $phnew = array(); |
|
414 | + foreach($prenode as $pnode) { |
|
415 | + $phnew = array_merge($phnew, unserialize($pnode)); |
|
416 | + } |
|
417 | + $ph = (count($phnew) > 0) ? $phnew : $ph; |
|
418 | + } |
|
419 | + |
|
420 | + if($ph['showChildren'] == 0) { |
|
421 | + $ph['icon_node_toggle'] = ''; |
|
422 | + $ph['donthit'] = 1; |
|
423 | + $ph['icon'] = $ph['icon_folder_close']; |
|
424 | + $tpl = getTplFolderNodeNotChildren(); |
|
425 | + } |
|
426 | + |
|
427 | + if($ph['contextmenu']) { |
|
428 | + $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
429 | + } |
|
430 | + |
|
431 | + $node .= $modx->parseText($tpl, $ph); |
|
432 | + $node .= '</div></div>'; |
|
433 | + } |
|
434 | + } |
|
435 | + } |
|
436 | + |
|
437 | + // invoke OnManagerNodeRender event |
|
438 | + $data['node'] = $node; |
|
439 | + $evtOut = $modx->invokeEvent('OnManagerNodeRender', $data); |
|
440 | + if(is_array($evtOut)) { |
|
441 | + $evtOut = implode("\n", $evtOut); |
|
442 | + } |
|
443 | + if($evtOut != '') { |
|
444 | + $node = trim($evtOut); |
|
445 | + } |
|
446 | + |
|
447 | + $output .= $node; |
|
448 | + } |
|
449 | + |
|
450 | + return $output; |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | function getIconInfo($_style) { |
454 | - if(!isset($_style['tree_page_gif'])) { |
|
455 | - $_style['tree_page_gif'] = $_style['tree_page']; |
|
456 | - } |
|
457 | - if(!isset($_style['tree_page_jpg'])) { |
|
458 | - $_style['tree_page_jpg'] = $_style['tree_page']; |
|
459 | - } |
|
460 | - if(!isset($_style['tree_page_png'])) { |
|
461 | - $_style['tree_page_png'] = $_style['tree_page']; |
|
462 | - } |
|
463 | - $icons = array( |
|
464 | - 'text/html' => $_style['tree_page_html'], |
|
465 | - 'text/plain' => $_style['tree_page'], |
|
466 | - 'text/xml' => $_style['tree_page_xml'], |
|
467 | - 'text/css' => $_style['tree_page_css'], |
|
468 | - 'text/javascript' => $_style['tree_page_js'], |
|
469 | - 'application/rss+xml' => $_style['tree_page_rss'], |
|
470 | - 'application/pdf' => $_style['tree_page_pdf'], |
|
471 | - 'application/vnd.ms-word' => $_style['tree_page_word'], |
|
472 | - 'application/vnd.ms-excel' => $_style['tree_page_excel'], |
|
473 | - 'image/gif' => $_style['tree_page_gif'], |
|
474 | - 'image/jpg' => $_style['tree_page_jpg'], |
|
475 | - 'image/png' => $_style['tree_page_png'] |
|
476 | - ); |
|
477 | - return $icons; |
|
454 | + if(!isset($_style['tree_page_gif'])) { |
|
455 | + $_style['tree_page_gif'] = $_style['tree_page']; |
|
456 | + } |
|
457 | + if(!isset($_style['tree_page_jpg'])) { |
|
458 | + $_style['tree_page_jpg'] = $_style['tree_page']; |
|
459 | + } |
|
460 | + if(!isset($_style['tree_page_png'])) { |
|
461 | + $_style['tree_page_png'] = $_style['tree_page']; |
|
462 | + } |
|
463 | + $icons = array( |
|
464 | + 'text/html' => $_style['tree_page_html'], |
|
465 | + 'text/plain' => $_style['tree_page'], |
|
466 | + 'text/xml' => $_style['tree_page_xml'], |
|
467 | + 'text/css' => $_style['tree_page_css'], |
|
468 | + 'text/javascript' => $_style['tree_page_js'], |
|
469 | + 'application/rss+xml' => $_style['tree_page_rss'], |
|
470 | + 'application/pdf' => $_style['tree_page_pdf'], |
|
471 | + 'application/vnd.ms-word' => $_style['tree_page_word'], |
|
472 | + 'application/vnd.ms-excel' => $_style['tree_page_excel'], |
|
473 | + 'image/gif' => $_style['tree_page_gif'], |
|
474 | + 'image/jpg' => $_style['tree_page_jpg'], |
|
475 | + 'image/png' => $_style['tree_page_png'] |
|
476 | + ); |
|
477 | + return $icons; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | function getPrivateIconInfo($_style) { |
481 | - if(!isset($_style['tree_page_gif_secure'])) { |
|
482 | - $_style['tree_page_gif_secure'] = $_style['tree_page_secure']; |
|
483 | - } |
|
484 | - if(!isset($_style['tree_page_jpg_secure'])) { |
|
485 | - $_style['tree_page_jpg_secure'] = $_style['tree_page_secure']; |
|
486 | - } |
|
487 | - if(!isset($_style['tree_page_png_secure'])) { |
|
488 | - $_style['tree_page_png_secure'] = $_style['tree_page_secure']; |
|
489 | - } |
|
490 | - $iconsPrivate = array( |
|
491 | - 'text/html' => $_style['tree_page_html_secure'], |
|
492 | - 'text/plain' => $_style['tree_page_secure'], |
|
493 | - 'text/xml' => $_style['tree_page_xml_secure'], |
|
494 | - 'text/css' => $_style['tree_page_css_secure'], |
|
495 | - 'text/javascript' => $_style['tree_page_js_secure'], |
|
496 | - 'application/rss+xml' => $_style['tree_page_rss_secure'], |
|
497 | - 'application/pdf' => $_style['tree_page_pdf_secure'], |
|
498 | - 'application/vnd.ms-word' => $_style['tree_page_word_secure'], |
|
499 | - 'application/vnd.ms-excel' => $_style['tree_page_excel_secure'], |
|
500 | - 'image/gif' => $_style['tree_page_gif_secure'], |
|
501 | - 'image/jpg' => $_style['tree_page_jpg_secure'], |
|
502 | - 'image/png' => $_style['tree_page_png_secure'] |
|
503 | - ); |
|
504 | - return $iconsPrivate; |
|
481 | + if(!isset($_style['tree_page_gif_secure'])) { |
|
482 | + $_style['tree_page_gif_secure'] = $_style['tree_page_secure']; |
|
483 | + } |
|
484 | + if(!isset($_style['tree_page_jpg_secure'])) { |
|
485 | + $_style['tree_page_jpg_secure'] = $_style['tree_page_secure']; |
|
486 | + } |
|
487 | + if(!isset($_style['tree_page_png_secure'])) { |
|
488 | + $_style['tree_page_png_secure'] = $_style['tree_page_secure']; |
|
489 | + } |
|
490 | + $iconsPrivate = array( |
|
491 | + 'text/html' => $_style['tree_page_html_secure'], |
|
492 | + 'text/plain' => $_style['tree_page_secure'], |
|
493 | + 'text/xml' => $_style['tree_page_xml_secure'], |
|
494 | + 'text/css' => $_style['tree_page_css_secure'], |
|
495 | + 'text/javascript' => $_style['tree_page_js_secure'], |
|
496 | + 'application/rss+xml' => $_style['tree_page_rss_secure'], |
|
497 | + 'application/pdf' => $_style['tree_page_pdf_secure'], |
|
498 | + 'application/vnd.ms-word' => $_style['tree_page_word_secure'], |
|
499 | + 'application/vnd.ms-excel' => $_style['tree_page_excel_secure'], |
|
500 | + 'image/gif' => $_style['tree_page_gif_secure'], |
|
501 | + 'image/jpg' => $_style['tree_page_jpg_secure'], |
|
502 | + 'image/png' => $_style['tree_page_png_secure'] |
|
503 | + ); |
|
504 | + return $iconsPrivate; |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | function getNodeTitle($nodeNameSource, $row) { |
508 | - global $modx; |
|
509 | - |
|
510 | - switch($nodeNameSource) { |
|
511 | - case 'menutitle': |
|
512 | - $nodetitle = $row['menutitle'] ? $row['menutitle'] : $row['pagetitle']; |
|
513 | - break; |
|
514 | - case 'alias': |
|
515 | - $nodetitle = $row['alias'] ? $row['alias'] : $row['id']; |
|
516 | - if(strpos($row['alias'], '.') === false) { |
|
517 | - if($row['isfolder'] != 1 || $modx->config['make_folders'] != 1) { |
|
518 | - $nodetitle .= $modx->config['friendly_url_suffix']; |
|
519 | - } |
|
520 | - } |
|
521 | - $nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle; |
|
522 | - break; |
|
523 | - case 'pagetitle': |
|
524 | - $nodetitle = $row['pagetitle']; |
|
525 | - break; |
|
526 | - case 'longtitle': |
|
527 | - $nodetitle = $row['longtitle'] ? $row['longtitle'] : $row['pagetitle']; |
|
528 | - break; |
|
529 | - case 'createdon': |
|
530 | - case 'editedon': |
|
531 | - case 'publishedon': |
|
532 | - case 'pub_date': |
|
533 | - case 'unpub_date': |
|
534 | - $doc = $modx->getDocumentObject('id', $row['id']); |
|
535 | - $date = $doc[$nodeNameSource]; |
|
536 | - if(!empty($date)) { |
|
537 | - $nodetitle = $modx->toDateFormat($date); |
|
538 | - } else { |
|
539 | - $nodetitle = '- - -'; |
|
540 | - } |
|
541 | - break; |
|
542 | - default: |
|
543 | - $nodetitle = $row['pagetitle']; |
|
544 | - } |
|
545 | - $nodetitle = $modx->htmlspecialchars(str_replace(array( |
|
546 | - "\r\n", |
|
547 | - "\n", |
|
548 | - "\r" |
|
549 | - ), ' ', $nodetitle), ENT_COMPAT); |
|
550 | - return $nodetitle; |
|
508 | + global $modx; |
|
509 | + |
|
510 | + switch($nodeNameSource) { |
|
511 | + case 'menutitle': |
|
512 | + $nodetitle = $row['menutitle'] ? $row['menutitle'] : $row['pagetitle']; |
|
513 | + break; |
|
514 | + case 'alias': |
|
515 | + $nodetitle = $row['alias'] ? $row['alias'] : $row['id']; |
|
516 | + if(strpos($row['alias'], '.') === false) { |
|
517 | + if($row['isfolder'] != 1 || $modx->config['make_folders'] != 1) { |
|
518 | + $nodetitle .= $modx->config['friendly_url_suffix']; |
|
519 | + } |
|
520 | + } |
|
521 | + $nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle; |
|
522 | + break; |
|
523 | + case 'pagetitle': |
|
524 | + $nodetitle = $row['pagetitle']; |
|
525 | + break; |
|
526 | + case 'longtitle': |
|
527 | + $nodetitle = $row['longtitle'] ? $row['longtitle'] : $row['pagetitle']; |
|
528 | + break; |
|
529 | + case 'createdon': |
|
530 | + case 'editedon': |
|
531 | + case 'publishedon': |
|
532 | + case 'pub_date': |
|
533 | + case 'unpub_date': |
|
534 | + $doc = $modx->getDocumentObject('id', $row['id']); |
|
535 | + $date = $doc[$nodeNameSource]; |
|
536 | + if(!empty($date)) { |
|
537 | + $nodetitle = $modx->toDateFormat($date); |
|
538 | + } else { |
|
539 | + $nodetitle = '- - -'; |
|
540 | + } |
|
541 | + break; |
|
542 | + default: |
|
543 | + $nodetitle = $row['pagetitle']; |
|
544 | + } |
|
545 | + $nodetitle = $modx->htmlspecialchars(str_replace(array( |
|
546 | + "\r\n", |
|
547 | + "\n", |
|
548 | + "\r" |
|
549 | + ), ' ', $nodetitle), ENT_COMPAT); |
|
550 | + return $nodetitle; |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | function isDateNode($nodeNameSource) { |
554 | - switch($nodeNameSource) { |
|
555 | - case 'createdon': |
|
556 | - case 'editedon': |
|
557 | - case 'publishedon': |
|
558 | - case 'pub_date': |
|
559 | - case 'unpub_date': |
|
560 | - return true; |
|
561 | - default: |
|
562 | - return false; |
|
563 | - } |
|
554 | + switch($nodeNameSource) { |
|
555 | + case 'createdon': |
|
556 | + case 'editedon': |
|
557 | + case 'publishedon': |
|
558 | + case 'pub_date': |
|
559 | + case 'unpub_date': |
|
560 | + return true; |
|
561 | + default: |
|
562 | + return false; |
|
563 | + } |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | function checkIsFolder($parent = 0, $isfolder = 1) { |
567 | - global $modx; |
|
567 | + global $modx; |
|
568 | 568 | |
569 | - return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' ')); |
|
569 | + return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' ')); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | function _htmlentities($array) { |
573 | - global $modx; |
|
573 | + global $modx; |
|
574 | 574 | |
575 | - $array = json_encode($array, JSON_UNESCAPED_UNICODE); |
|
576 | - $array = htmlentities($array, ENT_COMPAT, $modx->config['modx_charset']); |
|
575 | + $array = json_encode($array, JSON_UNESCAPED_UNICODE); |
|
576 | + $array = htmlentities($array, ENT_COMPAT, $modx->config['modx_charset']); |
|
577 | 577 | |
578 | - return $array; |
|
578 | + return $array; |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | function getTplSingleNode() { |
582 | - return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
|
582 | + return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
|
583 | 583 | onclick="modx.tree.treeAction(event,[+id+]);" |
584 | 584 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
585 | 585 | data-id="[+id+]" |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | } |
604 | 604 | |
605 | 605 | function getTplFolderNode() { |
606 | - return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
|
606 | + return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
|
607 | 607 | onclick="modx.tree.treeAction(event,[+id+]);" |
608 | 608 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
609 | 609 | data-id="[+id+]" |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | } |
640 | 640 | |
641 | 641 | function getTplFolderNodeNotChildren() { |
642 | - return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
|
642 | + return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
|
643 | 643 | onclick="modx.tree.treeAction(event,[+id+]);" |
644 | 644 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
645 | 645 | data-id="[+id+]" |
@@ -671,10 +671,10 @@ discard block |
||
671 | 671 | } |
672 | 672 | |
673 | 673 | function dbug($str, $flag = false) { |
674 | - print('<pre>'); |
|
675 | - print_r($str); |
|
676 | - print('</pre>'); |
|
677 | - if($flag) { |
|
678 | - exit; |
|
679 | - } |
|
674 | + print('<pre>'); |
|
675 | + print_r($str); |
|
676 | + print('</pre>'); |
|
677 | + if($flag) { |
|
678 | + exit; |
|
679 | + } |
|
680 | 680 | } |
@@ -236,9 +236,9 @@ |
||
236 | 236 | lockedElementsTranslation: <?= json_encode($unlockTranslations, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE) . "\n" ?> |
237 | 237 | }; |
238 | 238 | <?php |
239 | - $opened = array_filter(array_map('intval', explode('|', $_SESSION['openedArray']))); |
|
240 | - echo (empty($opened) ? '' : 'modx.openedArray[' . implode("] = 1;\n modx.openedArray[", $opened) . '] = 1;') . "\n"; |
|
241 | - ?> |
|
239 | + $opened = array_filter(array_map('intval', explode('|', $_SESSION['openedArray']))); |
|
240 | + echo (empty($opened) ? '' : 'modx.openedArray[' . implode("] = 1;\n modx.openedArray[", $opened) . '] = 1;') . "\n"; |
|
241 | + ?> |
|
242 | 242 | </script> |
243 | 243 | <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/modx.min.js?v=<?= $lastInstallTime ?>"></script> |
244 | 244 | <?php if ($modx->config['show_picker'] != "0") { ?> |
@@ -4,237 +4,237 @@ discard block |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | $sitemenu['bars'] = array( |
7 | - 'bars', |
|
8 | - 'main', |
|
9 | - '<i class="fa fa-bars"></i>', |
|
10 | - 'javascript:;', |
|
11 | - $_lang['home'], |
|
12 | - 'modx.resizer.toggle(); return false;', |
|
13 | - ' return false;', |
|
14 | - '', |
|
15 | - 0, |
|
16 | - 10, |
|
17 | - '' |
|
7 | + 'bars', |
|
8 | + 'main', |
|
9 | + '<i class="fa fa-bars"></i>', |
|
10 | + 'javascript:;', |
|
11 | + $_lang['home'], |
|
12 | + 'modx.resizer.toggle(); return false;', |
|
13 | + ' return false;', |
|
14 | + '', |
|
15 | + 0, |
|
16 | + 10, |
|
17 | + '' |
|
18 | 18 | ); |
19 | 19 | |
20 | 20 | //mainMenu |
21 | 21 | $sitemenu['site'] = array( |
22 | - 'site', |
|
23 | - 'main', |
|
24 | - '<i class="fa fa-home"></i>' . $_lang['home'], |
|
25 | - 'index.php?a=2', |
|
26 | - $_lang['home'], |
|
27 | - '', |
|
28 | - '', |
|
29 | - 'main', |
|
30 | - 0, |
|
31 | - 10, |
|
32 | - 'active' |
|
22 | + 'site', |
|
23 | + 'main', |
|
24 | + '<i class="fa fa-home"></i>' . $_lang['home'], |
|
25 | + 'index.php?a=2', |
|
26 | + $_lang['home'], |
|
27 | + '', |
|
28 | + '', |
|
29 | + 'main', |
|
30 | + 0, |
|
31 | + 10, |
|
32 | + 'active' |
|
33 | 33 | ); |
34 | 34 | |
35 | 35 | if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('file_manager')) { |
36 | - $sitemenu['elements'] = array( |
|
37 | - 'elements', |
|
38 | - 'main', |
|
39 | - '<i class="fa fa-th"></i>' . $_lang['elements'], |
|
40 | - 'javascript:;', |
|
41 | - $_lang['elements'], |
|
42 | - ' return false;', |
|
43 | - '', |
|
44 | - '', |
|
45 | - 0, |
|
46 | - 20, |
|
47 | - '' |
|
48 | - ); |
|
36 | + $sitemenu['elements'] = array( |
|
37 | + 'elements', |
|
38 | + 'main', |
|
39 | + '<i class="fa fa-th"></i>' . $_lang['elements'], |
|
40 | + 'javascript:;', |
|
41 | + $_lang['elements'], |
|
42 | + ' return false;', |
|
43 | + '', |
|
44 | + '', |
|
45 | + 0, |
|
46 | + 20, |
|
47 | + '' |
|
48 | + ); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if($modx->hasPermission('exec_module')) { |
52 | - $sitemenu['modules'] = array( |
|
53 | - 'modules', |
|
54 | - 'main', |
|
55 | - '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['modules'], |
|
56 | - 'javascript:;', |
|
57 | - $_lang['modules'], |
|
58 | - ' return false;', |
|
59 | - '', |
|
60 | - '', |
|
61 | - 0, |
|
62 | - 30, |
|
63 | - '' |
|
64 | - ); |
|
52 | + $sitemenu['modules'] = array( |
|
53 | + 'modules', |
|
54 | + 'main', |
|
55 | + '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['modules'], |
|
56 | + 'javascript:;', |
|
57 | + $_lang['modules'], |
|
58 | + ' return false;', |
|
59 | + '', |
|
60 | + '', |
|
61 | + 0, |
|
62 | + 30, |
|
63 | + '' |
|
64 | + ); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | if($modx->hasPermission('edit_user') || $modx->hasPermission('edit_web_user') || $modx->hasPermission('edit_role') || $modx->hasPermission('access_permissions') || $modx->hasPermission('web_access_permissions')) { |
68 | - $sitemenu['users'] = array( |
|
69 | - 'users', |
|
70 | - 'main', |
|
71 | - '<i class="fa fa-users"></i>' . $_lang['users'], |
|
72 | - 'javascript:;', |
|
73 | - $_lang['users'], |
|
74 | - ' return false;', |
|
75 | - 'edit_user', |
|
76 | - '', |
|
77 | - 0, |
|
78 | - 40, |
|
79 | - '' |
|
80 | - ); |
|
68 | + $sitemenu['users'] = array( |
|
69 | + 'users', |
|
70 | + 'main', |
|
71 | + '<i class="fa fa-users"></i>' . $_lang['users'], |
|
72 | + 'javascript:;', |
|
73 | + $_lang['users'], |
|
74 | + ' return false;', |
|
75 | + 'edit_user', |
|
76 | + '', |
|
77 | + 0, |
|
78 | + 40, |
|
79 | + '' |
|
80 | + ); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | if($modx->hasPermission('empty_cache') || $modx->hasPermission('bk_manager') || $modx->hasPermission('remove_locks') || $modx->hasPermission('import_static') || $modx->hasPermission('export_static')) { |
84 | - $sitemenu['tools'] = array( |
|
85 | - 'tools', |
|
86 | - 'main', |
|
87 | - '<i class="fa fa-wrench"></i>' . $_lang['tools'], |
|
88 | - 'javascript:;', |
|
89 | - $_lang['tools'], |
|
90 | - ' return false;', |
|
91 | - '', |
|
92 | - '', |
|
93 | - 0, |
|
94 | - 50, |
|
95 | - '' |
|
96 | - ); |
|
84 | + $sitemenu['tools'] = array( |
|
85 | + 'tools', |
|
86 | + 'main', |
|
87 | + '<i class="fa fa-wrench"></i>' . $_lang['tools'], |
|
88 | + 'javascript:;', |
|
89 | + $_lang['tools'], |
|
90 | + ' return false;', |
|
91 | + '', |
|
92 | + '', |
|
93 | + 0, |
|
94 | + 50, |
|
95 | + '' |
|
96 | + ); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | $tab = 0; |
100 | 100 | if($modx->hasPermission('edit_template')) { |
101 | - $sitemenu['element_templates'] = array( |
|
102 | - 'element_templates', |
|
103 | - 'elements', |
|
104 | - '<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>', |
|
105 | - 'index.php?a=76&tab=' . $tab++, |
|
106 | - $_lang['manage_templates'], |
|
107 | - '', |
|
108 | - 'new_template,edit_template', |
|
109 | - 'main', |
|
110 | - 0, |
|
111 | - 10, |
|
112 | - 'dropdown-toggle' |
|
113 | - ); |
|
101 | + $sitemenu['element_templates'] = array( |
|
102 | + 'element_templates', |
|
103 | + 'elements', |
|
104 | + '<i class="fa fa-newspaper-o"></i>' . $_lang['manage_templates'] . '<i class="fa fa-angle-right toggle"></i>', |
|
105 | + 'index.php?a=76&tab=' . $tab++, |
|
106 | + $_lang['manage_templates'], |
|
107 | + '', |
|
108 | + 'new_template,edit_template', |
|
109 | + 'main', |
|
110 | + 0, |
|
111 | + 10, |
|
112 | + 'dropdown-toggle' |
|
113 | + ); |
|
114 | 114 | } |
115 | 115 | if($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
116 | - $sitemenu['element_tplvars'] = array( |
|
117 | - 'element_tplvars', |
|
118 | - 'elements', |
|
119 | - '<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>', |
|
120 | - 'index.php?a=76&tab=' . $tab++, |
|
121 | - $_lang['tmplvars'], |
|
122 | - '', |
|
123 | - 'new_template,edit_template', |
|
124 | - 'main', |
|
125 | - 0, |
|
126 | - 20, |
|
127 | - 'dropdown-toggle' |
|
128 | - ); |
|
116 | + $sitemenu['element_tplvars'] = array( |
|
117 | + 'element_tplvars', |
|
118 | + 'elements', |
|
119 | + '<i class="fa fa-list-alt"></i>' . $_lang['tmplvars'] . '<i class="fa fa-angle-right toggle"></i>', |
|
120 | + 'index.php?a=76&tab=' . $tab++, |
|
121 | + $_lang['tmplvars'], |
|
122 | + '', |
|
123 | + 'new_template,edit_template', |
|
124 | + 'main', |
|
125 | + 0, |
|
126 | + 20, |
|
127 | + 'dropdown-toggle' |
|
128 | + ); |
|
129 | 129 | } |
130 | 130 | if($modx->hasPermission('edit_chunk')) { |
131 | - $sitemenu['element_htmlsnippets'] = array( |
|
132 | - 'element_htmlsnippets', |
|
133 | - 'elements', |
|
134 | - '<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
135 | - 'index.php?a=76&tab=' . $tab++, |
|
136 | - $_lang['manage_htmlsnippets'], |
|
137 | - '', |
|
138 | - 'new_chunk,edit_chunk', |
|
139 | - 'main', |
|
140 | - 0, |
|
141 | - 30, |
|
142 | - 'dropdown-toggle' |
|
143 | - ); |
|
131 | + $sitemenu['element_htmlsnippets'] = array( |
|
132 | + 'element_htmlsnippets', |
|
133 | + 'elements', |
|
134 | + '<i class="fa fa-th-large"></i>' . $_lang['manage_htmlsnippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
135 | + 'index.php?a=76&tab=' . $tab++, |
|
136 | + $_lang['manage_htmlsnippets'], |
|
137 | + '', |
|
138 | + 'new_chunk,edit_chunk', |
|
139 | + 'main', |
|
140 | + 0, |
|
141 | + 30, |
|
142 | + 'dropdown-toggle' |
|
143 | + ); |
|
144 | 144 | } |
145 | 145 | if($modx->hasPermission('edit_snippet')) { |
146 | - $sitemenu['element_snippets'] = array( |
|
147 | - 'element_snippets', |
|
148 | - 'elements', |
|
149 | - '<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
150 | - 'index.php?a=76&tab=' . $tab++, |
|
151 | - $_lang['manage_snippets'], |
|
152 | - '', |
|
153 | - 'new_snippet,edit_snippet', |
|
154 | - 'main', |
|
155 | - 0, |
|
156 | - 40, |
|
157 | - 'dropdown-toggle' |
|
158 | - ); |
|
146 | + $sitemenu['element_snippets'] = array( |
|
147 | + 'element_snippets', |
|
148 | + 'elements', |
|
149 | + '<i class="fa fa-code"></i>' . $_lang['manage_snippets'] . '<i class="fa fa-angle-right toggle"></i>', |
|
150 | + 'index.php?a=76&tab=' . $tab++, |
|
151 | + $_lang['manage_snippets'], |
|
152 | + '', |
|
153 | + 'new_snippet,edit_snippet', |
|
154 | + 'main', |
|
155 | + 0, |
|
156 | + 40, |
|
157 | + 'dropdown-toggle' |
|
158 | + ); |
|
159 | 159 | } |
160 | 160 | if($modx->hasPermission('edit_plugin')) { |
161 | - $sitemenu['element_plugins'] = array( |
|
162 | - 'element_plugins', |
|
163 | - 'elements', |
|
164 | - '<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>', |
|
165 | - 'index.php?a=76&tab=' . $tab++, |
|
166 | - $_lang['manage_plugins'], |
|
167 | - '', |
|
168 | - 'new_plugin,edit_plugin', |
|
169 | - 'main', |
|
170 | - 0, |
|
171 | - 50, |
|
172 | - 'dropdown-toggle' |
|
173 | - ); |
|
161 | + $sitemenu['element_plugins'] = array( |
|
162 | + 'element_plugins', |
|
163 | + 'elements', |
|
164 | + '<i class="fa fa-plug"></i>' . $_lang['manage_plugins'] . '<i class="fa fa-angle-right toggle"></i>', |
|
165 | + 'index.php?a=76&tab=' . $tab++, |
|
166 | + $_lang['manage_plugins'], |
|
167 | + '', |
|
168 | + 'new_plugin,edit_plugin', |
|
169 | + 'main', |
|
170 | + 0, |
|
171 | + 50, |
|
172 | + 'dropdown-toggle' |
|
173 | + ); |
|
174 | 174 | } |
175 | 175 | //$sitemenu['element_categories'] = array('element_categories','elements',$_lang['element_categories'],'index.php?a=76&tab=5',$_lang['element_categories'],'','new_template,edit_template,new_snippet,edit_snippet,new_chunk,edit_chunk,new_plugin,edit_plugin','main',1,60,''); |
176 | 176 | |
177 | 177 | if($modx->hasPermission('file_manager')) { |
178 | - $sitemenu['manage_files'] = array( |
|
179 | - 'manage_files', |
|
180 | - 'elements', |
|
181 | - '<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'], |
|
182 | - 'index.php?a=31', |
|
183 | - $_lang['manage_files'], |
|
184 | - '', |
|
185 | - 'file_manager', |
|
186 | - 'main', |
|
187 | - 0, |
|
188 | - 70, |
|
189 | - '' |
|
190 | - ); |
|
178 | + $sitemenu['manage_files'] = array( |
|
179 | + 'manage_files', |
|
180 | + 'elements', |
|
181 | + '<i class="fa fa-folder-open-o"></i>' . $_lang['manage_files'], |
|
182 | + 'index.php?a=31', |
|
183 | + $_lang['manage_files'], |
|
184 | + '', |
|
185 | + 'file_manager', |
|
186 | + 'main', |
|
187 | + 0, |
|
188 | + 70, |
|
189 | + '' |
|
190 | + ); |
|
191 | 191 | } |
192 | 192 | if($modx->hasPermission('category_manager')) { |
193 | - $sitemenu['manage_categories'] = array( |
|
194 | - 'manage_categories', |
|
195 | - 'elements', |
|
196 | - '<i class="fa fa-object-group"></i>' . $_lang['manage_categories'], |
|
197 | - 'index.php?a=120', |
|
198 | - $_lang['manage_categories'], |
|
199 | - '', |
|
200 | - 'category_manager', |
|
201 | - 'main', |
|
202 | - 0, |
|
203 | - 80, |
|
204 | - '' |
|
205 | - ); |
|
193 | + $sitemenu['manage_categories'] = array( |
|
194 | + 'manage_categories', |
|
195 | + 'elements', |
|
196 | + '<i class="fa fa-object-group"></i>' . $_lang['manage_categories'], |
|
197 | + 'index.php?a=120', |
|
198 | + $_lang['manage_categories'], |
|
199 | + '', |
|
200 | + 'category_manager', |
|
201 | + 'main', |
|
202 | + 0, |
|
203 | + 80, |
|
204 | + '' |
|
205 | + ); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | // Modules Menu Items |
209 | 209 | if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('save_module')) { |
210 | - $sitemenu['new_module'] = array( |
|
211 | - 'new_module', |
|
212 | - 'modules', |
|
213 | - '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'], |
|
214 | - 'index.php?a=106', |
|
215 | - $_lang['module_management'], |
|
216 | - '', |
|
217 | - 'new_module,edit_module', |
|
218 | - 'main', |
|
219 | - 1, |
|
220 | - 0, |
|
221 | - '' |
|
222 | - ); |
|
210 | + $sitemenu['new_module'] = array( |
|
211 | + 'new_module', |
|
212 | + 'modules', |
|
213 | + '<i class="'.$_style['icons_modules'] .'"></i>' . $_lang['module_management'], |
|
214 | + 'index.php?a=106', |
|
215 | + $_lang['module_management'], |
|
216 | + '', |
|
217 | + 'new_module,edit_module', |
|
218 | + 'main', |
|
219 | + 1, |
|
220 | + 0, |
|
221 | + '' |
|
222 | + ); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | if($modx->hasPermission('exec_module')) { |
226 | - if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) { |
|
227 | - $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member |
|
226 | + if($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) { |
|
227 | + $rs = $modx->db->query('SELECT DISTINCT sm.id, sm.name, sm.icon, mg.member |
|
228 | 228 | FROM ' . $modx->getFullTableName('site_modules') . ' AS sm |
229 | 229 | LEFT JOIN ' . $modx->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id |
230 | 230 | LEFT JOIN ' . $modx->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group |
231 | 231 | WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1 |
232 | 232 | ORDER BY sm.name'); |
233 | - } else { |
|
234 | - $rs = $modx->db->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name'); |
|
235 | - } |
|
236 | - if($modx->db->getRecordCount($rs)) { |
|
237 | - while ($row = $modx->db->getRow($rs)) { |
|
233 | + } else { |
|
234 | + $rs = $modx->db->select('*', $modx->getFullTableName('site_modules'), 'disabled != 1', 'name'); |
|
235 | + } |
|
236 | + if($modx->db->getRecordCount($rs)) { |
|
237 | + while ($row = $modx->db->getRow($rs)) { |
|
238 | 238 | $sitemenu['module' . $row['id']] = array( |
239 | 239 | 'module' . $row['id'], |
240 | 240 | 'modules', |
@@ -255,83 +255,83 @@ discard block |
||
255 | 255 | // security menu items (users) |
256 | 256 | |
257 | 257 | if($modx->hasPermission('edit_user')) { |
258 | - $sitemenu['user_management_title'] = array( |
|
259 | - 'user_management_title', |
|
260 | - 'users', |
|
261 | - '<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
262 | - 'index.php?a=75', |
|
263 | - $_lang['user_management_title'], |
|
264 | - '', |
|
265 | - 'edit_user', |
|
266 | - 'main', |
|
267 | - 0, |
|
268 | - 10, |
|
269 | - 'dropdown-toggle' |
|
270 | - ); |
|
258 | + $sitemenu['user_management_title'] = array( |
|
259 | + 'user_management_title', |
|
260 | + 'users', |
|
261 | + '<i class="fa fa fa-user"></i>' . $_lang['user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
262 | + 'index.php?a=75', |
|
263 | + $_lang['user_management_title'], |
|
264 | + '', |
|
265 | + 'edit_user', |
|
266 | + 'main', |
|
267 | + 0, |
|
268 | + 10, |
|
269 | + 'dropdown-toggle' |
|
270 | + ); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | if($modx->hasPermission('edit_web_user')) { |
274 | - $sitemenu['web_user_management_title'] = array( |
|
275 | - 'web_user_management_title', |
|
276 | - 'users', |
|
277 | - '<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
278 | - 'index.php?a=99', |
|
279 | - $_lang['web_user_management_title'], |
|
280 | - '', |
|
281 | - 'edit_web_user', |
|
282 | - 'main', |
|
283 | - 0, |
|
284 | - 20, |
|
285 | - 'dropdown-toggle' |
|
286 | - ); |
|
274 | + $sitemenu['web_user_management_title'] = array( |
|
275 | + 'web_user_management_title', |
|
276 | + 'users', |
|
277 | + '<i class="fa fa-users"></i>' . $_lang['web_user_management_title'] . '<i class="fa fa-angle-right toggle"></i>', |
|
278 | + 'index.php?a=99', |
|
279 | + $_lang['web_user_management_title'], |
|
280 | + '', |
|
281 | + 'edit_web_user', |
|
282 | + 'main', |
|
283 | + 0, |
|
284 | + 20, |
|
285 | + 'dropdown-toggle' |
|
286 | + ); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | if($modx->hasPermission('edit_role')) { |
290 | - $sitemenu['role_management_title'] = array( |
|
291 | - 'role_management_title', |
|
292 | - 'users', |
|
293 | - '<i class="fa fa-legal"></i>' . $_lang['role_management_title'], |
|
294 | - 'index.php?a=86', |
|
295 | - $_lang['role_management_title'], |
|
296 | - '', |
|
297 | - 'new_role,edit_role,delete_role', |
|
298 | - 'main', |
|
299 | - 0, |
|
300 | - 30, |
|
301 | - '' |
|
302 | - ); |
|
290 | + $sitemenu['role_management_title'] = array( |
|
291 | + 'role_management_title', |
|
292 | + 'users', |
|
293 | + '<i class="fa fa-legal"></i>' . $_lang['role_management_title'], |
|
294 | + 'index.php?a=86', |
|
295 | + $_lang['role_management_title'], |
|
296 | + '', |
|
297 | + 'new_role,edit_role,delete_role', |
|
298 | + 'main', |
|
299 | + 0, |
|
300 | + 30, |
|
301 | + '' |
|
302 | + ); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | if($modx->hasPermission('access_permissions')) { |
306 | - $sitemenu['manager_permissions'] = array( |
|
307 | - 'manager_permissions', |
|
308 | - 'users', |
|
309 | - '<i class="fa fa-male"></i>' . $_lang['manager_permissions'], |
|
310 | - 'index.php?a=40', |
|
311 | - $_lang['manager_permissions'], |
|
312 | - '', |
|
313 | - 'access_permissions', |
|
314 | - 'main', |
|
315 | - 0, |
|
316 | - 40, |
|
317 | - '' |
|
318 | - ); |
|
306 | + $sitemenu['manager_permissions'] = array( |
|
307 | + 'manager_permissions', |
|
308 | + 'users', |
|
309 | + '<i class="fa fa-male"></i>' . $_lang['manager_permissions'], |
|
310 | + 'index.php?a=40', |
|
311 | + $_lang['manager_permissions'], |
|
312 | + '', |
|
313 | + 'access_permissions', |
|
314 | + 'main', |
|
315 | + 0, |
|
316 | + 40, |
|
317 | + '' |
|
318 | + ); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | if($modx->hasPermission('web_access_permissions')) { |
322 | - $sitemenu['web_permissions'] = array( |
|
323 | - 'web_permissions', |
|
324 | - 'users', |
|
325 | - '<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'], |
|
326 | - 'index.php?a=91', |
|
327 | - $_lang['web_permissions'], |
|
328 | - '', |
|
329 | - 'web_access_permissions', |
|
330 | - 'main', |
|
331 | - 0, |
|
332 | - 50, |
|
333 | - '' |
|
334 | - ); |
|
322 | + $sitemenu['web_permissions'] = array( |
|
323 | + 'web_permissions', |
|
324 | + 'users', |
|
325 | + '<i class="fa fa-universal-access"></i>' . $_lang['web_permissions'], |
|
326 | + 'index.php?a=91', |
|
327 | + $_lang['web_permissions'], |
|
328 | + '', |
|
329 | + 'web_access_permissions', |
|
330 | + 'main', |
|
331 | + 0, |
|
332 | + 50, |
|
333 | + '' |
|
334 | + ); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | // Tools Menu |
@@ -361,104 +361,104 @@ discard block |
||
361 | 361 | ); |
362 | 362 | |
363 | 363 | $sitemenu['search'] = array( |
364 | - 'search', |
|
365 | - 'tools', |
|
366 | - '<i class="fa fa-search"></i>' . $_lang['search'], |
|
367 | - 'index.php?a=71', |
|
368 | - $_lang['search'], |
|
369 | - '', |
|
370 | - '', |
|
371 | - 'main', |
|
372 | - 1, |
|
373 | - 9, |
|
374 | - '' |
|
364 | + 'search', |
|
365 | + 'tools', |
|
366 | + '<i class="fa fa-search"></i>' . $_lang['search'], |
|
367 | + 'index.php?a=71', |
|
368 | + $_lang['search'], |
|
369 | + '', |
|
370 | + '', |
|
371 | + 'main', |
|
372 | + 1, |
|
373 | + 9, |
|
374 | + '' |
|
375 | 375 | ); |
376 | 376 | |
377 | 377 | if($modx->hasPermission('bk_manager')) { |
378 | - $sitemenu['bk_manager'] = array( |
|
379 | - 'bk_manager', |
|
380 | - 'tools', |
|
381 | - '<i class="fa fa-database"></i>' . $_lang['bk_manager'], |
|
382 | - 'index.php?a=93', |
|
383 | - $_lang['bk_manager'], |
|
384 | - '', |
|
385 | - 'bk_manager', |
|
386 | - 'main', |
|
387 | - 0, |
|
388 | - 10, |
|
389 | - '' |
|
390 | - ); |
|
378 | + $sitemenu['bk_manager'] = array( |
|
379 | + 'bk_manager', |
|
380 | + 'tools', |
|
381 | + '<i class="fa fa-database"></i>' . $_lang['bk_manager'], |
|
382 | + 'index.php?a=93', |
|
383 | + $_lang['bk_manager'], |
|
384 | + '', |
|
385 | + 'bk_manager', |
|
386 | + 'main', |
|
387 | + 0, |
|
388 | + 10, |
|
389 | + '' |
|
390 | + ); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | if($modx->hasPermission('remove_locks')) { |
394 | - $sitemenu['remove_locks'] = array( |
|
395 | - 'remove_locks', |
|
396 | - 'tools', |
|
397 | - '<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'], |
|
398 | - 'javascript:modx.removeLocks();', |
|
399 | - $_lang['remove_locks'], |
|
400 | - '', |
|
401 | - 'remove_locks', |
|
402 | - '', |
|
403 | - 0, |
|
404 | - 20, |
|
405 | - '' |
|
406 | - ); |
|
394 | + $sitemenu['remove_locks'] = array( |
|
395 | + 'remove_locks', |
|
396 | + 'tools', |
|
397 | + '<i class="fa fa-hourglass"></i>' . $_lang['remove_locks'], |
|
398 | + 'javascript:modx.removeLocks();', |
|
399 | + $_lang['remove_locks'], |
|
400 | + '', |
|
401 | + 'remove_locks', |
|
402 | + '', |
|
403 | + 0, |
|
404 | + 20, |
|
405 | + '' |
|
406 | + ); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if($modx->hasPermission('import_static')) { |
410 | - $sitemenu['import_site'] = array( |
|
411 | - 'import_site', |
|
412 | - 'tools', |
|
413 | - '<i class="fa fa-upload"></i>' . $_lang['import_site'], |
|
414 | - 'index.php?a=95', |
|
415 | - $_lang['import_site'], |
|
416 | - '', |
|
417 | - 'import_static', |
|
418 | - 'main', |
|
419 | - 0, |
|
420 | - 30, |
|
421 | - '' |
|
422 | - ); |
|
410 | + $sitemenu['import_site'] = array( |
|
411 | + 'import_site', |
|
412 | + 'tools', |
|
413 | + '<i class="fa fa-upload"></i>' . $_lang['import_site'], |
|
414 | + 'index.php?a=95', |
|
415 | + $_lang['import_site'], |
|
416 | + '', |
|
417 | + 'import_static', |
|
418 | + 'main', |
|
419 | + 0, |
|
420 | + 30, |
|
421 | + '' |
|
422 | + ); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | if($modx->hasPermission('export_static')) { |
426 | - $sitemenu['export_site'] = array( |
|
427 | - 'export_site', |
|
428 | - 'tools', |
|
429 | - '<i class="fa fa-download"></i>' . $_lang['export_site'], |
|
430 | - 'index.php?a=83', |
|
431 | - $_lang['export_site'], |
|
432 | - '', |
|
433 | - 'export_static', |
|
434 | - 'main', |
|
435 | - 1, |
|
436 | - 40, |
|
437 | - '' |
|
438 | - ); |
|
426 | + $sitemenu['export_site'] = array( |
|
427 | + 'export_site', |
|
428 | + 'tools', |
|
429 | + '<i class="fa fa-download"></i>' . $_lang['export_site'], |
|
430 | + 'index.php?a=83', |
|
431 | + $_lang['export_site'], |
|
432 | + '', |
|
433 | + 'export_static', |
|
434 | + 'main', |
|
435 | + 1, |
|
436 | + 40, |
|
437 | + '' |
|
438 | + ); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | $menu = $modx->invokeEvent("OnManagerMenuPrerender", array('menu' => $sitemenu)); |
442 | 442 | if(is_array($menu)) { |
443 | - $newmenu = array(); |
|
444 | - foreach($menu as $item){ |
|
445 | - if(is_array(unserialize($item))){ |
|
446 | - $newmenu = array_merge($newmenu, unserialize($item)); |
|
447 | - } |
|
448 | - } |
|
449 | - if(count($newmenu)> 0) $sitemenu = $newmenu; |
|
443 | + $newmenu = array(); |
|
444 | + foreach($menu as $item){ |
|
445 | + if(is_array(unserialize($item))){ |
|
446 | + $newmenu = array_merge($newmenu, unserialize($item)); |
|
447 | + } |
|
448 | + } |
|
449 | + if(count($newmenu)> 0) $sitemenu = $newmenu; |
|
450 | 450 | } |
451 | 451 | |
452 | 452 | if(file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php')) { |
453 | - include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php'); |
|
453 | + include_once(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/includes/menu.class.inc.php'); |
|
454 | 454 | } else { |
455 | - include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php'); |
|
455 | + include_once(MODX_MANAGER_PATH . 'includes/menu.class.inc.php'); |
|
456 | 456 | } |
457 | 457 | $menu = new EVOmenu(); |
458 | 458 | $menu->Build($sitemenu, array( |
459 | - 'outerClass' => 'nav', |
|
460 | - 'innerClass' => 'dropdown-menu', |
|
461 | - 'parentClass' => 'dropdown', |
|
459 | + 'outerClass' => 'nav', |
|
460 | + 'innerClass' => 'dropdown-menu', |
|
461 | + 'parentClass' => 'dropdown', |
|
462 | 462 | 'parentLinkClass' => 'dropdown-toggle', |
463 | 463 | 'parentLinkAttr' => '', |
464 | 464 | 'parentLinkIn' => '' |