@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('delete_snippet')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Set the item name for logger |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeChunkFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeChunkFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the chunk. |
25 | 25 | $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$id}'"); |
26 | 26 | |
27 | 27 | // invoke OnChunkFormDelete event |
28 | 28 | $modx->invokeEvent("OnChunkFormDelete", |
29 | - array( |
|
30 | - "id" => $id |
|
31 | - )); |
|
29 | + array( |
|
30 | + "id" => $id |
|
31 | + )); |
|
32 | 32 | |
33 | 33 | // empty cache |
34 | 34 | $modx->clearCache('full'); |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('edit_template')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
@@ -19,37 +19,37 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate TV |
21 | 21 | $newid = $modx->getDatabase()->insert( |
22 | - array( |
|
23 | - 'type'=>'', |
|
24 | - 'name'=>'', |
|
25 | - 'caption'=>'', |
|
26 | - 'description'=>'', |
|
27 | - 'default_text'=>'', |
|
28 | - 'elements'=>'', |
|
29 | - 'rank'=>'', |
|
30 | - 'display'=>'', |
|
31 | - 'display_params'=>'', |
|
32 | - 'category'=>'', |
|
33 | - ), $modx->getDatabase()->getFullTableName('site_tmplvars'), // Insert into |
|
34 | - "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->getDatabase()->getFullTableName('site_tmplvars'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'type'=>'', |
|
24 | + 'name'=>'', |
|
25 | + 'caption'=>'', |
|
26 | + 'description'=>'', |
|
27 | + 'default_text'=>'', |
|
28 | + 'elements'=>'', |
|
29 | + 'rank'=>'', |
|
30 | + 'display'=>'', |
|
31 | + 'display_params'=>'', |
|
32 | + 'category'=>'', |
|
33 | + ), $modx->getDatabase()->getFullTableName('site_tmplvars'), // Insert into |
|
34 | + "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->getDatabase()->getFullTableName('site_tmplvars'), "id='{$id}'"); // Copy from |
|
35 | 35 | |
36 | 36 | |
37 | 37 | // duplicate TV Template Access Permissions |
38 | 38 | $modx->getDatabase()->insert( |
39 | - array( |
|
40 | - 'tmplvarid'=>'', |
|
41 | - 'templateid'=>'', |
|
42 | - 'rank'=>'', |
|
43 | - ), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), // Insert into |
|
44 | - "'{$newid}', templateid, rank", $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), "tmplvarid='{$id}'"); // Copy from |
|
39 | + array( |
|
40 | + 'tmplvarid'=>'', |
|
41 | + 'templateid'=>'', |
|
42 | + 'rank'=>'', |
|
43 | + ), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), // Insert into |
|
44 | + "'{$newid}', templateid, rank", $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), "tmplvarid='{$id}'"); // Copy from |
|
45 | 45 | |
46 | 46 | // duplicate TV Access Permissions |
47 | 47 | $modx->getDatabase()->insert( |
48 | - array( |
|
49 | - 'tmplvarid'=>'', |
|
50 | - 'documentgroup'=>'', |
|
51 | - ), $modx->getDatabase()->getFullTableName('site_tmplvar_access'), // Insert into |
|
52 | - "'{$newid}', documentgroup", $modx->getDatabase()->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); // Copy from |
|
48 | + array( |
|
49 | + 'tmplvarid'=>'', |
|
50 | + 'documentgroup'=>'', |
|
51 | + ), $modx->getDatabase()->getFullTableName('site_tmplvar_access'), // Insert into |
|
52 | + "'{$newid}', documentgroup", $modx->getDatabase()->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); // Copy from |
|
53 | 53 | |
54 | 54 | // Set the item name for logger |
55 | 55 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_tmplvars'), "id='{$newid}'")); |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('delete_snippet')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Set the item name for logger |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeSnipFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeSnipFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the snippet. |
25 | 25 | $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('site_snippets'), "id='{$id}'"); |
26 | 26 | |
27 | 27 | // invoke OnSnipFormDelete event |
28 | 28 | $modx->invokeEvent("OnSnipFormDelete", |
29 | - array( |
|
30 | - "id" => $id |
|
31 | - )); |
|
29 | + array( |
|
30 | + "id" => $id |
|
31 | + )); |
|
32 | 32 | |
33 | 33 | // empty cache |
34 | 34 | $modx->clearCache('full'); |
@@ -4,23 +4,23 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | if(!isset($_GET['id'])) { |
7 | - if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + if(!$modx->hasPermission('remove_locks')) $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
8 | 8 | |
9 | - // Remove all locks |
|
10 | - $modx->getDatabase()->truncate($modx->getDatabase()->getFullTableName('active_user_locks')); |
|
9 | + // Remove all locks |
|
10 | + $modx->getDatabase()->truncate($modx->getDatabase()->getFullTableName('active_user_locks')); |
|
11 | 11 | |
12 | - $header = "Location: index.php?a=2"; |
|
13 | - header($header); |
|
12 | + $header = "Location: index.php?a=2"; |
|
13 | + header($header); |
|
14 | 14 | } else { |
15 | - // Remove single locks via AJAX / window.onbeforeunload |
|
16 | - $type = (int)$_GET['type']; |
|
17 | - $id = (int)$_GET['id']; |
|
18 | - $includeAllUsers = $modx->hasPermission('remove_locks'); // Enables usage of "unlock"-ajax-button |
|
19 | - if($type && $id) { |
|
20 | - $modx->unlockElement($type, $id, $includeAllUsers); |
|
21 | - echo '1'; |
|
22 | - exit; |
|
23 | - } else { |
|
24 | - echo 'No type or id sent with request.'; |
|
25 | - } |
|
15 | + // Remove single locks via AJAX / window.onbeforeunload |
|
16 | + $type = (int)$_GET['type']; |
|
17 | + $id = (int)$_GET['id']; |
|
18 | + $includeAllUsers = $modx->hasPermission('remove_locks'); // Enables usage of "unlock"-ajax-button |
|
19 | + if($type && $id) { |
|
20 | + $modx->unlockElement($type, $id, $includeAllUsers); |
|
21 | + echo '1'; |
|
22 | + exit; |
|
23 | + } else { |
|
24 | + echo 'No type or id sent with request.'; |
|
25 | + } |
|
26 | 26 | } |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('delete_web_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Set the item name for logger |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeWUsrFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeWUsrFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the user. |
25 | 25 | $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('web_users'), "id='{$id}'"); |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | |
33 | 33 | // invoke OnWebDeleteUser event |
34 | 34 | $modx->invokeEvent("OnWebDeleteUser", |
35 | - array( |
|
36 | - "userid" => $id, |
|
37 | - "username" => $username |
|
38 | - )); |
|
35 | + array( |
|
36 | + "userid" => $id, |
|
37 | + "username" => $username |
|
38 | + )); |
|
39 | 39 | |
40 | 40 | // invoke OnWUsrFormDelete event |
41 | 41 | $modx->invokeEvent("OnWUsrFormDelete", |
42 | - array( |
|
43 | - "id" => $id |
|
44 | - )); |
|
42 | + array( |
|
43 | + "id" => $id |
|
44 | + )); |
|
45 | 45 | |
46 | 46 | $header="Location: index.php?a=99"; |
47 | 47 | header($header); |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('new_plugin')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // count duplicates |
@@ -19,25 +19,25 @@ discard block |
||
19 | 19 | |
20 | 20 | // duplicate Plugin |
21 | 21 | $newid = $modx->getDatabase()->insert( |
22 | - array( |
|
23 | - 'name'=>'', |
|
24 | - 'description'=>'', |
|
25 | - 'disabled'=>'', |
|
26 | - 'moduleguid'=>'', |
|
27 | - 'plugincode'=>'', |
|
28 | - 'properties'=>'', |
|
29 | - 'category'=>'', |
|
30 | - ), $modx->getDatabase()->getFullTableName('site_plugins'), // Insert into |
|
31 | - "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getDatabase()->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from |
|
22 | + array( |
|
23 | + 'name'=>'', |
|
24 | + 'description'=>'', |
|
25 | + 'disabled'=>'', |
|
26 | + 'moduleguid'=>'', |
|
27 | + 'plugincode'=>'', |
|
28 | + 'properties'=>'', |
|
29 | + 'category'=>'', |
|
30 | + ), $modx->getDatabase()->getFullTableName('site_plugins'), // Insert into |
|
31 | + "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getDatabase()->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from |
|
32 | 32 | |
33 | 33 | // duplicate Plugin Event Listeners |
34 | 34 | $modx->getDatabase()->insert( |
35 | - array( |
|
36 | - 'pluginid'=>'', |
|
37 | - 'evtid'=>'', |
|
38 | - 'priority'=>'', |
|
39 | - ), $modx->getDatabase()->getFullTableName('site_plugin_events'), // Insert into |
|
40 | - "'{$newid}', evtid, priority", $modx->getDatabase()->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from |
|
35 | + array( |
|
36 | + 'pluginid'=>'', |
|
37 | + 'evtid'=>'', |
|
38 | + 'priority'=>'', |
|
39 | + ), $modx->getDatabase()->getFullTableName('site_plugin_events'), // Insert into |
|
40 | + "'{$newid}', evtid, priority", $modx->getDatabase()->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from |
|
41 | 41 | |
42 | 42 | // Set the item name for logger |
43 | 43 | $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_plugins'), "id='{$newid}'")); |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('save_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $tbl_manager_users = $modx->getDatabase()->getFullTableName('manager_users'); |
@@ -43,134 +43,134 @@ discard block |
||
43 | 43 | |
44 | 44 | // verify password |
45 | 45 | if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
46 | - webAlertAndQuit("Password typed is mismatched", 12); |
|
46 | + webAlertAndQuit("Password typed is mismatched", 12); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // verify email |
50 | 50 | if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
51 | - webAlertAndQuit("E-mail address doesn't seem to be valid!", 12); |
|
51 | + webAlertAndQuit("E-mail address doesn't seem to be valid!", 12); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | // verify admin security |
55 | 55 | if($_SESSION['mgrRole'] != 1) { |
56 | - // Check to see if user tried to spoof a "1" (admin) role |
|
57 | - if(!$modx->hasPermission('save_user')) { |
|
58 | - webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12); |
|
59 | - } |
|
60 | - // Verify that the user being edited wasn't an admin and the user ID got spoofed |
|
61 | - $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1"); |
|
62 | - $limit = $modx->getDatabase()->getValue($rs); |
|
63 | - if($limit > 0) { |
|
64 | - webAlertAndQuit("You cannot alter an administrative user.", 12); |
|
65 | - } |
|
56 | + // Check to see if user tried to spoof a "1" (admin) role |
|
57 | + if(!$modx->hasPermission('save_user')) { |
|
58 | + webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12); |
|
59 | + } |
|
60 | + // Verify that the user being edited wasn't an admin and the user ID got spoofed |
|
61 | + $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1"); |
|
62 | + $limit = $modx->getDatabase()->getValue($rs); |
|
63 | + if($limit > 0) { |
|
64 | + webAlertAndQuit("You cannot alter an administrative user.", 12); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | } |
68 | 68 | |
69 | 69 | switch($input['mode']) { |
70 | - case '11' : // new user |
|
71 | - // check if this user name already exist |
|
72 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->getDatabase()->escape($newusername))); |
|
73 | - $limit = $modx->getDatabase()->getValue($rs); |
|
74 | - if($limit > 0) { |
|
75 | - webAlertAndQuit("User name is already in use!", 12); |
|
76 | - } |
|
77 | - |
|
78 | - // check if the email address already exist |
|
79 | - $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->getDatabase()->escape($email), $id)); |
|
80 | - $limit = $modx->getDatabase()->getValue($rs); |
|
81 | - if($limit > 0) { |
|
82 | - webAlertAndQuit("Email is already in use!", 12); |
|
83 | - } |
|
84 | - |
|
85 | - // generate a new password for this user |
|
86 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
87 | - if(strlen($specifiedpassword) < 6) { |
|
88 | - webAlertAndQuit("Password is too short!", 12); |
|
89 | - } else { |
|
90 | - $newpassword = $specifiedpassword; |
|
91 | - } |
|
92 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
93 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
94 | - } elseif($passwordgenmethod == 'g') { |
|
95 | - $newpassword = generate_password(8); |
|
96 | - } else { |
|
97 | - webAlertAndQuit("No password generation method specified!", 12); |
|
98 | - } |
|
99 | - |
|
100 | - // invoke OnBeforeUserFormSave event |
|
101 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
102 | - "mode" => "new", |
|
103 | - )); |
|
104 | - |
|
105 | - // create the user account |
|
106 | - $internalKey = $modx->getDatabase()->insert(array('username' => $modx->getDatabase()->escape($newusername)), $tbl_manager_users); |
|
107 | - |
|
108 | - $field = array(); |
|
109 | - $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
110 | - $modx->getDatabase()->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
111 | - |
|
112 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
113 | - $field = $modx->getDatabase()->escape($field); |
|
114 | - $modx->getDatabase()->insert($field, $tbl_user_attributes); |
|
115 | - |
|
116 | - // Save user settings |
|
70 | + case '11' : // new user |
|
71 | + // check if this user name already exist |
|
72 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->getDatabase()->escape($newusername))); |
|
73 | + $limit = $modx->getDatabase()->getValue($rs); |
|
74 | + if($limit > 0) { |
|
75 | + webAlertAndQuit("User name is already in use!", 12); |
|
76 | + } |
|
77 | + |
|
78 | + // check if the email address already exist |
|
79 | + $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->getDatabase()->escape($email), $id)); |
|
80 | + $limit = $modx->getDatabase()->getValue($rs); |
|
81 | + if($limit > 0) { |
|
82 | + webAlertAndQuit("Email is already in use!", 12); |
|
83 | + } |
|
84 | + |
|
85 | + // generate a new password for this user |
|
86 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
87 | + if(strlen($specifiedpassword) < 6) { |
|
88 | + webAlertAndQuit("Password is too short!", 12); |
|
89 | + } else { |
|
90 | + $newpassword = $specifiedpassword; |
|
91 | + } |
|
92 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
93 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
94 | + } elseif($passwordgenmethod == 'g') { |
|
95 | + $newpassword = generate_password(8); |
|
96 | + } else { |
|
97 | + webAlertAndQuit("No password generation method specified!", 12); |
|
98 | + } |
|
99 | + |
|
100 | + // invoke OnBeforeUserFormSave event |
|
101 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
102 | + "mode" => "new", |
|
103 | + )); |
|
104 | + |
|
105 | + // create the user account |
|
106 | + $internalKey = $modx->getDatabase()->insert(array('username' => $modx->getDatabase()->escape($newusername)), $tbl_manager_users); |
|
107 | + |
|
108 | + $field = array(); |
|
109 | + $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
110 | + $modx->getDatabase()->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
111 | + |
|
112 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
113 | + $field = $modx->getDatabase()->escape($field); |
|
114 | + $modx->getDatabase()->insert($field, $tbl_user_attributes); |
|
115 | + |
|
116 | + // Save user settings |
|
117 | 117 | saveManagerUserSettings($internalKey); |
118 | 118 | |
119 | - // invoke OnManagerSaveUser event |
|
120 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
121 | - "mode" => "new", |
|
122 | - "userid" => $internalKey, |
|
123 | - "username" => $newusername, |
|
124 | - "userpassword" => $newpassword, |
|
125 | - "useremail" => $email, |
|
126 | - "userfullname" => $fullname, |
|
127 | - "userroleid" => $role |
|
128 | - )); |
|
129 | - |
|
130 | - // invoke OnUserFormSave event |
|
131 | - $modx->invokeEvent("OnUserFormSave", array( |
|
132 | - "mode" => "new", |
|
133 | - "id" => $internalKey |
|
134 | - )); |
|
135 | - |
|
136 | - // Set the item name for logger |
|
137 | - $_SESSION['itemname'] = $newusername; |
|
138 | - |
|
139 | - /*******************************************************************************/ |
|
140 | - // put the user in the user_groups he/ she should be in |
|
141 | - // first, check that up_perms are switched on! |
|
142 | - if($use_udperms == 1) { |
|
143 | - if(!empty($user_groups)) { |
|
144 | - for($i = 0; $i < count($user_groups); $i++) { |
|
145 | - $f = array(); |
|
146 | - $f['user_group'] = (int)$user_groups[$i]; |
|
147 | - $f['member'] = $internalKey; |
|
148 | - $modx->getDatabase()->insert($f, $tbl_member_groups); |
|
149 | - } |
|
150 | - } |
|
151 | - } |
|
152 | - // end of user_groups stuff! |
|
153 | - |
|
154 | - if($passwordnotifymethod == 'e') { |
|
119 | + // invoke OnManagerSaveUser event |
|
120 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
121 | + "mode" => "new", |
|
122 | + "userid" => $internalKey, |
|
123 | + "username" => $newusername, |
|
124 | + "userpassword" => $newpassword, |
|
125 | + "useremail" => $email, |
|
126 | + "userfullname" => $fullname, |
|
127 | + "userroleid" => $role |
|
128 | + )); |
|
129 | + |
|
130 | + // invoke OnUserFormSave event |
|
131 | + $modx->invokeEvent("OnUserFormSave", array( |
|
132 | + "mode" => "new", |
|
133 | + "id" => $internalKey |
|
134 | + )); |
|
135 | + |
|
136 | + // Set the item name for logger |
|
137 | + $_SESSION['itemname'] = $newusername; |
|
138 | + |
|
139 | + /*******************************************************************************/ |
|
140 | + // put the user in the user_groups he/ she should be in |
|
141 | + // first, check that up_perms are switched on! |
|
142 | + if($use_udperms == 1) { |
|
143 | + if(!empty($user_groups)) { |
|
144 | + for($i = 0; $i < count($user_groups); $i++) { |
|
145 | + $f = array(); |
|
146 | + $f['user_group'] = (int)$user_groups[$i]; |
|
147 | + $f['member'] = $internalKey; |
|
148 | + $modx->getDatabase()->insert($f, $tbl_member_groups); |
|
149 | + } |
|
150 | + } |
|
151 | + } |
|
152 | + // end of user_groups stuff! |
|
153 | + |
|
154 | + if($passwordnotifymethod == 'e') { |
|
155 | 155 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
156 | - if($input['stay'] != '') { |
|
157 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
158 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
159 | - header($header); |
|
160 | - } else { |
|
161 | - $header = "Location: index.php?a=75&r=2"; |
|
162 | - header($header); |
|
163 | - } |
|
164 | - } else { |
|
165 | - if($input['stay'] != '') { |
|
166 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
167 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
168 | - } else { |
|
169 | - $stayUrl = "index.php?a=75&r=2"; |
|
170 | - } |
|
171 | - |
|
172 | - include_once "header.inc.php"; |
|
173 | - ?> |
|
156 | + if($input['stay'] != '') { |
|
157 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
158 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
159 | + header($header); |
|
160 | + } else { |
|
161 | + $header = "Location: index.php?a=75&r=2"; |
|
162 | + header($header); |
|
163 | + } |
|
164 | + } else { |
|
165 | + if($input['stay'] != '') { |
|
166 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
167 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
168 | + } else { |
|
169 | + $stayUrl = "index.php?a=75&r=2"; |
|
170 | + } |
|
171 | + |
|
172 | + include_once "header.inc.php"; |
|
173 | + ?> |
|
174 | 174 | |
175 | 175 | <h1><?php echo $_lang['user_title']; ?></h1> |
176 | 176 | |
@@ -192,125 +192,125 @@ discard block |
||
192 | 192 | </div> |
193 | 193 | <?php |
194 | 194 | |
195 | - include_once "footer.inc.php"; |
|
196 | - } |
|
197 | - break; |
|
198 | - case '12' : // edit user |
|
199 | - // generate a new password for this user |
|
200 | - if($genpassword == 1) { |
|
201 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
202 | - if(strlen($specifiedpassword) < 6) { |
|
203 | - webAlertAndQuit("Password is too short!", 12); |
|
204 | - } else { |
|
205 | - $newpassword = $specifiedpassword; |
|
206 | - } |
|
207 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
208 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
209 | - } elseif($passwordgenmethod == 'g') { |
|
210 | - $newpassword = generate_password(8); |
|
211 | - } else { |
|
212 | - webAlertAndQuit("No password generation method specified!", 12); |
|
213 | - } |
|
214 | - } |
|
215 | - if($passwordnotifymethod == 'e') { |
|
195 | + include_once "footer.inc.php"; |
|
196 | + } |
|
197 | + break; |
|
198 | + case '12' : // edit user |
|
199 | + // generate a new password for this user |
|
200 | + if($genpassword == 1) { |
|
201 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
202 | + if(strlen($specifiedpassword) < 6) { |
|
203 | + webAlertAndQuit("Password is too short!", 12); |
|
204 | + } else { |
|
205 | + $newpassword = $specifiedpassword; |
|
206 | + } |
|
207 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
208 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
209 | + } elseif($passwordgenmethod == 'g') { |
|
210 | + $newpassword = generate_password(8); |
|
211 | + } else { |
|
212 | + webAlertAndQuit("No password generation method specified!", 12); |
|
213 | + } |
|
214 | + } |
|
215 | + if($passwordnotifymethod == 'e') { |
|
216 | 216 | sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
217 | - } |
|
218 | - |
|
219 | - // check if the username already exist |
|
220 | - $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->getDatabase()->escape($newusername), $id)); |
|
221 | - $limit = $modx->getDatabase()->getValue($rs); |
|
222 | - if($limit > 0) { |
|
223 | - webAlertAndQuit("User name is already in use!", 12); |
|
224 | - } |
|
225 | - |
|
226 | - // check if the email address already exists |
|
227 | - $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->getDatabase()->escape($email), $id)); |
|
228 | - $limit = $modx->getDatabase()->getValue($rs); |
|
229 | - if($limit > 0) { |
|
230 | - webAlertAndQuit("Email is already in use!", 12); |
|
231 | - } |
|
232 | - |
|
233 | - // invoke OnBeforeUserFormSave event |
|
234 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
235 | - "mode" => "upd", |
|
236 | - "id" => $id |
|
237 | - )); |
|
238 | - |
|
239 | - // update user name and password |
|
240 | - $field = array(); |
|
241 | - $field['username'] = $modx->getDatabase()->escape($newusername); |
|
242 | - if($genpassword == 1) { |
|
243 | - $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
244 | - } |
|
245 | - $modx->getDatabase()->update($field, $tbl_manager_users, "id='{$id}'"); |
|
246 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
247 | - $field = $modx->getDatabase()->escape($field); |
|
248 | - $modx->getDatabase()->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
249 | - |
|
250 | - // Save user settings |
|
217 | + } |
|
218 | + |
|
219 | + // check if the username already exist |
|
220 | + $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->getDatabase()->escape($newusername), $id)); |
|
221 | + $limit = $modx->getDatabase()->getValue($rs); |
|
222 | + if($limit > 0) { |
|
223 | + webAlertAndQuit("User name is already in use!", 12); |
|
224 | + } |
|
225 | + |
|
226 | + // check if the email address already exists |
|
227 | + $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->getDatabase()->escape($email), $id)); |
|
228 | + $limit = $modx->getDatabase()->getValue($rs); |
|
229 | + if($limit > 0) { |
|
230 | + webAlertAndQuit("Email is already in use!", 12); |
|
231 | + } |
|
232 | + |
|
233 | + // invoke OnBeforeUserFormSave event |
|
234 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
235 | + "mode" => "upd", |
|
236 | + "id" => $id |
|
237 | + )); |
|
238 | + |
|
239 | + // update user name and password |
|
240 | + $field = array(); |
|
241 | + $field['username'] = $modx->getDatabase()->escape($newusername); |
|
242 | + if($genpassword == 1) { |
|
243 | + $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
244 | + } |
|
245 | + $modx->getDatabase()->update($field, $tbl_manager_users, "id='{$id}'"); |
|
246 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
247 | + $field = $modx->getDatabase()->escape($field); |
|
248 | + $modx->getDatabase()->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
249 | + |
|
250 | + // Save user settings |
|
251 | 251 | saveManagerUserSettings($id); |
252 | 252 | |
253 | - // Set the item name for logger |
|
254 | - $_SESSION['itemname'] = $newusername; |
|
255 | - |
|
256 | - // invoke OnManagerSaveUser event |
|
257 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
258 | - "mode" => "upd", |
|
259 | - "userid" => $id, |
|
260 | - "username" => $newusername, |
|
261 | - "userpassword" => $newpassword, |
|
262 | - "useremail" => $email, |
|
263 | - "userfullname" => $fullname, |
|
264 | - "userroleid" => $role, |
|
265 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
266 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
267 | - )); |
|
268 | - |
|
269 | - // invoke OnManagerChangePassword event |
|
270 | - if($genpassword == 1) { |
|
271 | - $modx->invokeEvent("OnManagerChangePassword", array( |
|
272 | - "userid" => $id, |
|
273 | - "username" => $newusername, |
|
274 | - "userpassword" => $newpassword |
|
275 | - )); |
|
276 | - } |
|
277 | - |
|
278 | - // invoke OnUserFormSave event |
|
279 | - $modx->invokeEvent("OnUserFormSave", array( |
|
280 | - "mode" => "upd", |
|
281 | - "id" => $id |
|
282 | - )); |
|
283 | - |
|
284 | - /*******************************************************************************/ |
|
285 | - // put the user in the user_groups he/ she should be in |
|
286 | - // first, check that up_perms are switched on! |
|
287 | - if($use_udperms == 1) { |
|
288 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
289 | - $modx->getDatabase()->delete($tbl_member_groups, "member='{$id}'"); |
|
290 | - if(!empty($user_groups)) { |
|
291 | - for($i = 0; $i < count($user_groups); $i++) { |
|
292 | - $field = array(); |
|
293 | - $field['user_group'] = (int)$user_groups[$i]; |
|
294 | - $field['member'] = $id; |
|
295 | - $modx->getDatabase()->insert($field, $tbl_member_groups); |
|
296 | - } |
|
297 | - } |
|
298 | - } |
|
299 | - // end of user_groups stuff! |
|
300 | - /*******************************************************************************/ |
|
301 | - if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
302 | - $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
303 | - } |
|
304 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
305 | - if($input['stay'] != '') { |
|
306 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
307 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
308 | - } else { |
|
309 | - $stayUrl = "index.php?a=75&r=2"; |
|
310 | - } |
|
311 | - |
|
312 | - include_once "header.inc.php"; |
|
313 | - ?> |
|
253 | + // Set the item name for logger |
|
254 | + $_SESSION['itemname'] = $newusername; |
|
255 | + |
|
256 | + // invoke OnManagerSaveUser event |
|
257 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
258 | + "mode" => "upd", |
|
259 | + "userid" => $id, |
|
260 | + "username" => $newusername, |
|
261 | + "userpassword" => $newpassword, |
|
262 | + "useremail" => $email, |
|
263 | + "userfullname" => $fullname, |
|
264 | + "userroleid" => $role, |
|
265 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
266 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
267 | + )); |
|
268 | + |
|
269 | + // invoke OnManagerChangePassword event |
|
270 | + if($genpassword == 1) { |
|
271 | + $modx->invokeEvent("OnManagerChangePassword", array( |
|
272 | + "userid" => $id, |
|
273 | + "username" => $newusername, |
|
274 | + "userpassword" => $newpassword |
|
275 | + )); |
|
276 | + } |
|
277 | + |
|
278 | + // invoke OnUserFormSave event |
|
279 | + $modx->invokeEvent("OnUserFormSave", array( |
|
280 | + "mode" => "upd", |
|
281 | + "id" => $id |
|
282 | + )); |
|
283 | + |
|
284 | + /*******************************************************************************/ |
|
285 | + // put the user in the user_groups he/ she should be in |
|
286 | + // first, check that up_perms are switched on! |
|
287 | + if($use_udperms == 1) { |
|
288 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
289 | + $modx->getDatabase()->delete($tbl_member_groups, "member='{$id}'"); |
|
290 | + if(!empty($user_groups)) { |
|
291 | + for($i = 0; $i < count($user_groups); $i++) { |
|
292 | + $field = array(); |
|
293 | + $field['user_group'] = (int)$user_groups[$i]; |
|
294 | + $field['member'] = $id; |
|
295 | + $modx->getDatabase()->insert($field, $tbl_member_groups); |
|
296 | + } |
|
297 | + } |
|
298 | + } |
|
299 | + // end of user_groups stuff! |
|
300 | + /*******************************************************************************/ |
|
301 | + if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
302 | + $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
303 | + } |
|
304 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
305 | + if($input['stay'] != '') { |
|
306 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
307 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
308 | + } else { |
|
309 | + $stayUrl = "index.php?a=75&r=2"; |
|
310 | + } |
|
311 | + |
|
312 | + include_once "header.inc.php"; |
|
313 | + ?> |
|
314 | 314 | |
315 | 315 | <h1><?php echo $_lang['user_title']; ?></h1> |
316 | 316 | |
@@ -330,18 +330,18 @@ discard block |
||
330 | 330 | </div> |
331 | 331 | <?php |
332 | 332 | |
333 | - include_once "footer.inc.php"; |
|
334 | - } else { |
|
335 | - if($input['stay'] != '') { |
|
336 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
337 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
338 | - header($header); |
|
339 | - } else { |
|
340 | - $header = "Location: index.php?a=75&r=2"; |
|
341 | - header($header); |
|
342 | - } |
|
343 | - } |
|
344 | - break; |
|
345 | - default: |
|
346 | - webAlertAndQuit("No operation set in request.", 12); |
|
333 | + include_once "footer.inc.php"; |
|
334 | + } else { |
|
335 | + if($input['stay'] != '') { |
|
336 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
337 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
338 | + header($header); |
|
339 | + } else { |
|
340 | + $header = "Location: index.php?a=75&r=2"; |
|
341 | + header($header); |
|
342 | + } |
|
343 | + } |
|
344 | + break; |
|
345 | + default: |
|
346 | + webAlertAndQuit("No operation set in request.", 12); |
|
347 | 347 | } |
@@ -3,51 +3,51 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('exec_module')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // check if user has access permission, except admins |
15 | 15 | if($_SESSION['mgrRole']!=1){ |
16 | - $rs = $modx->getDatabase()->select( |
|
17 | - 'sma.usergroup,mg.member', |
|
18 | - $modx->getDatabase()->getFullTableName("site_module_access")." sma |
|
16 | + $rs = $modx->getDatabase()->select( |
|
17 | + 'sma.usergroup,mg.member', |
|
18 | + $modx->getDatabase()->getFullTableName("site_module_access")." sma |
|
19 | 19 | LEFT JOIN ".$modx->getDatabase()->getFullTableName("member_groups")." mg ON mg.user_group = sma.usergroup AND member='".$modx->getLoginUserID()."'", |
20 | - "sma.module = '{$id}'" |
|
21 | - ); |
|
22 | - //initialize permission to -1, if it stays -1 no permissions |
|
23 | - //attached so permission granted |
|
24 | - $permissionAccessInt = -1; |
|
20 | + "sma.module = '{$id}'" |
|
21 | + ); |
|
22 | + //initialize permission to -1, if it stays -1 no permissions |
|
23 | + //attached so permission granted |
|
24 | + $permissionAccessInt = -1; |
|
25 | 25 | |
26 | - while ($row = $modx->getDatabase()->getRow($rs)) { |
|
27 | - if($row["usergroup"] && $row["member"]) { |
|
28 | - //if there are permissions and this member has permission, ofcourse |
|
29 | - //this is granted |
|
30 | - $permissionAccessInt = 1; |
|
31 | - } elseif ($permissionAccessInt==-1) { |
|
32 | - //if there are permissions but this member has no permission and the |
|
33 | - //variable was still in init state we set permission to 0; no permissions |
|
34 | - $permissionAccessInt = 0; |
|
35 | - } |
|
36 | - } |
|
26 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
27 | + if($row["usergroup"] && $row["member"]) { |
|
28 | + //if there are permissions and this member has permission, ofcourse |
|
29 | + //this is granted |
|
30 | + $permissionAccessInt = 1; |
|
31 | + } elseif ($permissionAccessInt==-1) { |
|
32 | + //if there are permissions but this member has no permission and the |
|
33 | + //variable was still in init state we set permission to 0; no permissions |
|
34 | + $permissionAccessInt = 0; |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | - if($permissionAccessInt==0) { |
|
39 | - $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
|
40 | - } |
|
38 | + if($permissionAccessInt==0) { |
|
39 | + $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | // get module data |
44 | 44 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName("site_modules"), "id='{$id}'"); |
45 | 45 | $content = $modx->getDatabase()->getRow($rs); |
46 | 46 | if(!$content) { |
47 | - $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
|
47 | + $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
|
48 | 48 | } |
49 | 49 | if($content['disabled']) { |
50 | - $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
|
50 | + $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | // Set the item name for logger |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | $output = evalModule($content["modulecode"],$parameter); |
64 | 64 | if (strpos(trim($output),'<')===0 && strpos(trim($output),'<?xml')!==0) { |
65 | - echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
|
65 | + echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller |
|
66 | 66 | } |
67 | 67 | echo $output; |
68 | 68 | include MODX_MANAGER_PATH."includes/sysalert.display.inc.php"; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('edit_document')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
@@ -25,68 +25,68 @@ discard block |
||
25 | 25 | // check user has permission to move document to chosen location |
26 | 26 | |
27 | 27 | if ($use_udperms == 1) { |
28 | - if ($oldparent != $newParentID) { |
|
29 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
30 | - $udperms->user = $modx->getLoginUserID(); |
|
31 | - $udperms->document = $newParentID; |
|
32 | - $udperms->role = $_SESSION['mgrRole']; |
|
28 | + if ($oldparent != $newParentID) { |
|
29 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
30 | + $udperms->user = $modx->getLoginUserID(); |
|
31 | + $udperms->document = $newParentID; |
|
32 | + $udperms->role = $_SESSION['mgrRole']; |
|
33 | 33 | |
34 | - if (!$udperms->checkPermissions()) { |
|
35 | - $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
36 | - } |
|
37 | - } |
|
34 | + if (!$udperms->checkPermissions()) { |
|
35 | + $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
36 | + } |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
41 | - "id_document" => $documentID, |
|
42 | - "old_parent" => $oldparent, |
|
43 | - "new_parent" => $newParentID |
|
41 | + "id_document" => $documentID, |
|
42 | + "old_parent" => $oldparent, |
|
43 | + "new_parent" => $newParentID |
|
44 | 44 | )); |
45 | 45 | if (is_array($evtOut) && count($evtOut) > 0){ |
46 | - $newParent = array_pop($evtOut); |
|
47 | - if($newParent == $oldparent) { |
|
48 | - $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
49 | - }else{ |
|
50 | - $newParentID = $newParent; |
|
51 | - } |
|
46 | + $newParent = array_pop($evtOut); |
|
47 | + if($newParent == $oldparent) { |
|
48 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
49 | + }else{ |
|
50 | + $newParentID = $newParent; |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $children = allChildren($documentID); |
55 | 55 | if (!array_search($newParentID, $children)) { |
56 | - $modx->getDatabase()->update(array( |
|
57 | - 'isfolder' => 1, |
|
58 | - ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
56 | + $modx->getDatabase()->update(array( |
|
57 | + 'isfolder' => 1, |
|
58 | + ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
59 | 59 | |
60 | - $modx->getDatabase()->update(array( |
|
61 | - 'parent' => $newParentID, |
|
62 | - 'editedby' => $modx->getLoginUserID(), |
|
63 | - 'editedon' => time(), |
|
64 | - ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$documentID}'"); |
|
60 | + $modx->getDatabase()->update(array( |
|
61 | + 'parent' => $newParentID, |
|
62 | + 'editedby' => $modx->getLoginUserID(), |
|
63 | + 'editedon' => time(), |
|
64 | + ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$documentID}'"); |
|
65 | 65 | |
66 | - // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
67 | - $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
68 | - $limit = $modx->getDatabase()->getValue($rs); |
|
66 | + // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
67 | + $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
68 | + $limit = $modx->getDatabase()->getValue($rs); |
|
69 | 69 | |
70 | - if(!$limit>0) { |
|
71 | - $modx->getDatabase()->update(array( |
|
72 | - 'isfolder' => 0, |
|
73 | - ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
74 | - } |
|
75 | - // Set the item name for logger |
|
76 | - $pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$documentID}'")); |
|
77 | - $_SESSION['itemname'] = $pagetitle; |
|
70 | + if(!$limit>0) { |
|
71 | + $modx->getDatabase()->update(array( |
|
72 | + 'isfolder' => 0, |
|
73 | + ), $modx->getDatabase()->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
74 | + } |
|
75 | + // Set the item name for logger |
|
76 | + $pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getDatabase()->getFullTableName('site_content'), "id='{$documentID}'")); |
|
77 | + $_SESSION['itemname'] = $pagetitle; |
|
78 | 78 | |
79 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
80 | - "id_document" => $documentID, |
|
81 | - "old_parent" => $oldparent, |
|
82 | - "new_parent" => $newParentID |
|
83 | - )); |
|
79 | + $modx->invokeEvent("onAfterMoveDocument", array ( |
|
80 | + "id_document" => $documentID, |
|
81 | + "old_parent" => $oldparent, |
|
82 | + "new_parent" => $newParentID |
|
83 | + )); |
|
84 | 84 | |
85 | - // empty cache & sync site |
|
86 | - $modx->clearCache('full'); |
|
85 | + // empty cache & sync site |
|
86 | + $modx->clearCache('full'); |
|
87 | 87 | |
88 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
89 | - header($header); |
|
88 | + $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
89 | + header($header); |
|
90 | 90 | } else { |
91 | - $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
91 | + $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
92 | 92 | } |