@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch($modx->getManagerApi()->action) { |
7 | - case 88: |
|
8 | - if(!$modx->hasPermission('edit_web_user')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 87: |
|
13 | - if(!$modx->hasPermission('new_web_user')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 88: |
|
8 | + if(!$modx->hasPermission('edit_web_user')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 87: |
|
13 | + if(!$modx->hasPermission('new_web_user')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -3,18 +3,18 @@ |
||
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 | switch($modx->getManagerApi()->action) { |
6 | - case 107: |
|
7 | - if(!$modx->hasPermission('new_module')) { |
|
8 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | - } |
|
10 | - break; |
|
11 | - case 108: |
|
12 | - if(!$modx->hasPermission('edit_module')) { |
|
13 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
14 | - } |
|
15 | - break; |
|
16 | - default: |
|
17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + case 107: |
|
7 | + if(!$modx->hasPermission('new_module')) { |
|
8 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | + } |
|
10 | + break; |
|
11 | + case 108: |
|
12 | + if(!$modx->hasPermission('edit_module')) { |
|
13 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
14 | + } |
|
15 | + break; |
|
16 | + default: |
|
17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | 18 | } |
19 | 19 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
20 | 20 | // Get table names (alphabetical) |
@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch($modx->getManagerApi()->action) { |
7 | - case 12: |
|
8 | - if(!$modx->hasPermission('edit_user')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 11: |
|
13 | - if(!$modx->hasPermission('new_user')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 12: |
|
8 | + if(!$modx->hasPermission('edit_user')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 11: |
|
13 | + if(!$modx->hasPermission('new_user')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch ((int)$modx->getManagerApi()->action) { |
7 | - case 35: |
|
8 | - if (!$modx->hasPermission('edit_role')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 38: |
|
13 | - if (!$modx->hasPermission('new_role')) { |
|
7 | + case 35: |
|
8 | + if (!$modx->hasPermission('edit_role')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 38: |
|
13 | + if (!$modx->hasPermission('new_role')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
14 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -59,123 +59,123 @@ |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | switch ($_POST['mode']) { |
62 | - case '107': |
|
63 | - // invoke OnBeforeModFormSave event |
|
64 | - $modx->invokeEvent("OnBeforeModFormSave", array( |
|
65 | - "mode" => "new", |
|
66 | - "id" => $id |
|
67 | - )); |
|
68 | - |
|
69 | - // disallow duplicate names for new modules |
|
70 | - $rs = $modx->getDatabase()->select('count(id)', $modx->getDatabase()->getFullTableName('site_modules'), "name='{$name}'"); |
|
71 | - $count = $modx->getDatabase()->getValue($rs); |
|
72 | - if ($count > 0) { |
|
73 | - $modx->getManagerApi()->saveFormValues(107); |
|
74 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=107"); |
|
75 | - } |
|
76 | - |
|
77 | - // save the new module |
|
78 | - $newid = $modx->getDatabase()->insert(array( |
|
79 | - 'name' => $name, |
|
80 | - 'description' => $description, |
|
81 | - 'disabled' => $disabled, |
|
82 | - 'wrap' => $wrap, |
|
83 | - 'locked' => $locked, |
|
84 | - 'icon' => $icon, |
|
85 | - 'resourcefile' => $resourcefile, |
|
86 | - 'enable_resource' => $enable_resource, |
|
87 | - 'category' => $categoryid, |
|
88 | - 'enable_sharedparams' => $enable_sharedparams, |
|
89 | - 'guid' => $guid, |
|
90 | - 'modulecode' => $modulecode, |
|
91 | - 'properties' => $properties, |
|
92 | - 'createdon' => $currentdate, |
|
93 | - 'editedon' => $currentdate |
|
94 | - ), $modx->getDatabase()->getFullTableName('site_modules')); |
|
95 | - |
|
96 | - // save user group access permissions |
|
97 | - saveUserGroupAccessPermissons(); |
|
98 | - |
|
99 | - // invoke OnModFormSave event |
|
100 | - $modx->invokeEvent("OnModFormSave", array( |
|
101 | - "mode" => "new", |
|
102 | - "id" => $newid |
|
103 | - )); |
|
104 | - |
|
105 | - // Set the item name for logger |
|
106 | - $_SESSION['itemname'] = $name; |
|
107 | - |
|
108 | - // empty cache |
|
109 | - $modx->clearCache('full'); |
|
110 | - |
|
111 | - // finished emptying cache - redirect |
|
112 | - if ($_POST['stay'] != '') { |
|
113 | - $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
|
114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
115 | - header($header); |
|
116 | - } else { |
|
117 | - $header = "Location: index.php?a=106&r=2"; |
|
118 | - header($header); |
|
119 | - } |
|
120 | - break; |
|
121 | - case '108': |
|
122 | - // invoke OnBeforeModFormSave event |
|
123 | - $modx->invokeEvent("OnBeforeModFormSave", array( |
|
124 | - "mode" => "upd", |
|
125 | - "id" => $id |
|
126 | - )); |
|
127 | - |
|
128 | - // disallow duplicate names for new modules |
|
129 | - $rs = $modx->getDatabase()->select('count(id)', $modx->getDatabase()->getFullTableName('site_modules'), "name='{$name}' AND id!='{$id}'"); |
|
130 | - if ($modx->getDatabase()->getValue($rs) > 0) { |
|
131 | - $modx->getManagerApi()->saveFormValues(108); |
|
132 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=108&id={$id}"); |
|
133 | - } |
|
134 | - |
|
135 | - // save the edited module |
|
136 | - $modx->getDatabase()->update(array( |
|
137 | - 'name' => $name, |
|
138 | - 'description' => $description, |
|
139 | - 'icon' => $icon, |
|
140 | - 'enable_resource' => $enable_resource, |
|
141 | - 'resourcefile' => $resourcefile, |
|
142 | - 'disabled' => $disabled, |
|
143 | - 'wrap' => $wrap, |
|
144 | - 'locked' => $locked, |
|
145 | - 'category' => $categoryid, |
|
146 | - 'enable_sharedparams' => $enable_sharedparams, |
|
147 | - 'guid' => $guid, |
|
148 | - 'modulecode' => $modulecode, |
|
149 | - 'properties' => $properties, |
|
150 | - 'editedon' => $currentdate |
|
151 | - ), $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'"); |
|
152 | - |
|
153 | - // save user group access permissions |
|
154 | - saveUserGroupAccessPermissons(); |
|
155 | - |
|
156 | - // invoke OnModFormSave event |
|
157 | - $modx->invokeEvent("OnModFormSave", array( |
|
158 | - "mode" => "upd", |
|
159 | - "id" => $id |
|
160 | - )); |
|
161 | - |
|
162 | - // Set the item name for logger |
|
163 | - $_SESSION['itemname'] = $name; |
|
164 | - |
|
165 | - // empty cache |
|
166 | - $modx->clearCache('full'); |
|
167 | - |
|
168 | - // finished emptying cache - redirect |
|
169 | - if ($_POST['stay'] != '') { |
|
170 | - $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
|
171 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
172 | - header($header); |
|
173 | - } else { |
|
174 | - $modx->unlockElement(6, $id); |
|
175 | - $header = "Location: index.php?a=106&r=2"; |
|
176 | - header($header); |
|
177 | - } |
|
178 | - break; |
|
179 | - default: |
|
180 | - $modx->webAlertAndQuit("No operation set in request."); |
|
62 | + case '107': |
|
63 | + // invoke OnBeforeModFormSave event |
|
64 | + $modx->invokeEvent("OnBeforeModFormSave", array( |
|
65 | + "mode" => "new", |
|
66 | + "id" => $id |
|
67 | + )); |
|
68 | + |
|
69 | + // disallow duplicate names for new modules |
|
70 | + $rs = $modx->getDatabase()->select('count(id)', $modx->getDatabase()->getFullTableName('site_modules'), "name='{$name}'"); |
|
71 | + $count = $modx->getDatabase()->getValue($rs); |
|
72 | + if ($count > 0) { |
|
73 | + $modx->getManagerApi()->saveFormValues(107); |
|
74 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=107"); |
|
75 | + } |
|
76 | + |
|
77 | + // save the new module |
|
78 | + $newid = $modx->getDatabase()->insert(array( |
|
79 | + 'name' => $name, |
|
80 | + 'description' => $description, |
|
81 | + 'disabled' => $disabled, |
|
82 | + 'wrap' => $wrap, |
|
83 | + 'locked' => $locked, |
|
84 | + 'icon' => $icon, |
|
85 | + 'resourcefile' => $resourcefile, |
|
86 | + 'enable_resource' => $enable_resource, |
|
87 | + 'category' => $categoryid, |
|
88 | + 'enable_sharedparams' => $enable_sharedparams, |
|
89 | + 'guid' => $guid, |
|
90 | + 'modulecode' => $modulecode, |
|
91 | + 'properties' => $properties, |
|
92 | + 'createdon' => $currentdate, |
|
93 | + 'editedon' => $currentdate |
|
94 | + ), $modx->getDatabase()->getFullTableName('site_modules')); |
|
95 | + |
|
96 | + // save user group access permissions |
|
97 | + saveUserGroupAccessPermissons(); |
|
98 | + |
|
99 | + // invoke OnModFormSave event |
|
100 | + $modx->invokeEvent("OnModFormSave", array( |
|
101 | + "mode" => "new", |
|
102 | + "id" => $newid |
|
103 | + )); |
|
104 | + |
|
105 | + // Set the item name for logger |
|
106 | + $_SESSION['itemname'] = $name; |
|
107 | + |
|
108 | + // empty cache |
|
109 | + $modx->clearCache('full'); |
|
110 | + |
|
111 | + // finished emptying cache - redirect |
|
112 | + if ($_POST['stay'] != '') { |
|
113 | + $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
|
114 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
115 | + header($header); |
|
116 | + } else { |
|
117 | + $header = "Location: index.php?a=106&r=2"; |
|
118 | + header($header); |
|
119 | + } |
|
120 | + break; |
|
121 | + case '108': |
|
122 | + // invoke OnBeforeModFormSave event |
|
123 | + $modx->invokeEvent("OnBeforeModFormSave", array( |
|
124 | + "mode" => "upd", |
|
125 | + "id" => $id |
|
126 | + )); |
|
127 | + |
|
128 | + // disallow duplicate names for new modules |
|
129 | + $rs = $modx->getDatabase()->select('count(id)', $modx->getDatabase()->getFullTableName('site_modules'), "name='{$name}' AND id!='{$id}'"); |
|
130 | + if ($modx->getDatabase()->getValue($rs) > 0) { |
|
131 | + $modx->getManagerApi()->saveFormValues(108); |
|
132 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=108&id={$id}"); |
|
133 | + } |
|
134 | + |
|
135 | + // save the edited module |
|
136 | + $modx->getDatabase()->update(array( |
|
137 | + 'name' => $name, |
|
138 | + 'description' => $description, |
|
139 | + 'icon' => $icon, |
|
140 | + 'enable_resource' => $enable_resource, |
|
141 | + 'resourcefile' => $resourcefile, |
|
142 | + 'disabled' => $disabled, |
|
143 | + 'wrap' => $wrap, |
|
144 | + 'locked' => $locked, |
|
145 | + 'category' => $categoryid, |
|
146 | + 'enable_sharedparams' => $enable_sharedparams, |
|
147 | + 'guid' => $guid, |
|
148 | + 'modulecode' => $modulecode, |
|
149 | + 'properties' => $properties, |
|
150 | + 'editedon' => $currentdate |
|
151 | + ), $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'"); |
|
152 | + |
|
153 | + // save user group access permissions |
|
154 | + saveUserGroupAccessPermissons(); |
|
155 | + |
|
156 | + // invoke OnModFormSave event |
|
157 | + $modx->invokeEvent("OnModFormSave", array( |
|
158 | + "mode" => "upd", |
|
159 | + "id" => $id |
|
160 | + )); |
|
161 | + |
|
162 | + // Set the item name for logger |
|
163 | + $_SESSION['itemname'] = $name; |
|
164 | + |
|
165 | + // empty cache |
|
166 | + $modx->clearCache('full'); |
|
167 | + |
|
168 | + // finished emptying cache - redirect |
|
169 | + if ($_POST['stay'] != '') { |
|
170 | + $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
|
171 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
172 | + header($header); |
|
173 | + } else { |
|
174 | + $modx->unlockElement(6, $id); |
|
175 | + $header = "Location: index.php?a=106&r=2"; |
|
176 | + header($header); |
|
177 | + } |
|
178 | + break; |
|
179 | + default: |
|
180 | + $modx->webAlertAndQuit("No operation set in request."); |
|
181 | 181 | } |
@@ -33,113 +33,113 @@ |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | switch ($_POST['mode']) { |
36 | - case '19': |
|
37 | - |
|
38 | - // invoke OnBeforeTempFormSave event |
|
39 | - $modx->invokeEvent("OnBeforeTempFormSave", array( |
|
40 | - "mode" => "new", |
|
41 | - "id" => $id |
|
42 | - )); |
|
43 | - |
|
44 | - // disallow duplicate names for new templates |
|
45 | - $rs = $modx->getDatabase()->select('COUNT(id)', $modx->getDatabase()->getFullTableName('site_templates'), "templatename='{$templatename}'"); |
|
46 | - $count = $modx->getDatabase()->getValue($rs); |
|
47 | - if ($count > 0) { |
|
48 | - $modx->getManagerApi()->saveFormValues(19); |
|
49 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=19"); |
|
50 | - } |
|
51 | - |
|
52 | - //do stuff to save the new doc |
|
53 | - $newid = $modx->getDatabase()->insert(array( |
|
54 | - 'templatename' => $templatename, |
|
55 | - 'description' => $description, |
|
56 | - 'content' => $template, |
|
57 | - 'locked' => $locked, |
|
58 | - 'selectable' => $selectable, |
|
59 | - 'category' => $categoryid, |
|
60 | - 'createdon' => $currentdate, |
|
61 | - 'editedon' => $currentdate |
|
62 | - ), $modx->getDatabase()->getFullTableName('site_templates')); |
|
63 | - |
|
64 | - // invoke OnTempFormSave event |
|
65 | - $modx->invokeEvent("OnTempFormSave", array( |
|
66 | - "mode" => "new", |
|
67 | - "id" => $newid |
|
68 | - )); |
|
69 | - // Set new assigned Tvs |
|
70 | - saveTemplateAccess($newid); |
|
71 | - |
|
72 | - // Set the item name for logger |
|
73 | - $_SESSION['itemname'] = $templatename; |
|
74 | - |
|
75 | - // empty cache |
|
76 | - $modx->clearCache('full'); |
|
77 | - |
|
78 | - // finished emptying cache - redirect |
|
79 | - if ($_POST['stay'] != '') { |
|
80 | - $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19"; |
|
81 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
82 | - header($header); |
|
83 | - } else { |
|
84 | - $header = "Location: index.php?a=76&r=2"; |
|
85 | - header($header); |
|
86 | - } |
|
87 | - |
|
88 | - break; |
|
89 | - case '16': |
|
90 | - |
|
91 | - // invoke OnBeforeTempFormSave event |
|
92 | - $modx->invokeEvent("OnBeforeTempFormSave", array( |
|
93 | - "mode" => "upd", |
|
94 | - "id" => $id |
|
95 | - )); |
|
96 | - |
|
97 | - // disallow duplicate names for templates |
|
98 | - $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('site_templates'), "templatename='{$templatename}' AND id!='{$id}'"); |
|
99 | - $count = $modx->getDatabase()->getValue($rs); |
|
100 | - if ($count > 0) { |
|
101 | - $modx->getManagerApi()->saveFormValues(16); |
|
102 | - $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=16&id={$id}"); |
|
103 | - } |
|
104 | - |
|
105 | - //do stuff to save the edited doc |
|
106 | - $modx->getDatabase()->update(array( |
|
107 | - 'templatename' => $templatename, |
|
108 | - 'description' => $description, |
|
109 | - 'content' => $template, |
|
110 | - 'locked' => $locked, |
|
111 | - 'selectable' => $selectable, |
|
112 | - 'category' => $categoryid, |
|
113 | - 'editedon' => $currentdate |
|
114 | - ), $modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'"); |
|
115 | - // Set new assigned Tvs |
|
116 | - saveTemplateAccess($id); |
|
117 | - |
|
118 | - // invoke OnTempFormSave event |
|
119 | - $modx->invokeEvent("OnTempFormSave", array( |
|
120 | - "mode" => "upd", |
|
121 | - "id" => $id |
|
122 | - )); |
|
123 | - |
|
124 | - // Set the item name for logger |
|
125 | - $_SESSION['itemname'] = $templatename; |
|
126 | - |
|
127 | - // first empty the cache |
|
128 | - $modx->clearCache('full'); |
|
129 | - |
|
130 | - // finished emptying cache - redirect |
|
131 | - if ($_POST['stay'] != '') { |
|
132 | - $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19"; |
|
133 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
134 | - header($header); |
|
135 | - } else { |
|
136 | - $modx->unlockElement(1, $id); |
|
137 | - $header = "Location: index.php?a=76&r=2"; |
|
138 | - header($header); |
|
139 | - } |
|
140 | - |
|
141 | - |
|
142 | - break; |
|
143 | - default: |
|
144 | - $modx->webAlertAndQuit("No operation set in request."); |
|
36 | + case '19': |
|
37 | + |
|
38 | + // invoke OnBeforeTempFormSave event |
|
39 | + $modx->invokeEvent("OnBeforeTempFormSave", array( |
|
40 | + "mode" => "new", |
|
41 | + "id" => $id |
|
42 | + )); |
|
43 | + |
|
44 | + // disallow duplicate names for new templates |
|
45 | + $rs = $modx->getDatabase()->select('COUNT(id)', $modx->getDatabase()->getFullTableName('site_templates'), "templatename='{$templatename}'"); |
|
46 | + $count = $modx->getDatabase()->getValue($rs); |
|
47 | + if ($count > 0) { |
|
48 | + $modx->getManagerApi()->saveFormValues(19); |
|
49 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=19"); |
|
50 | + } |
|
51 | + |
|
52 | + //do stuff to save the new doc |
|
53 | + $newid = $modx->getDatabase()->insert(array( |
|
54 | + 'templatename' => $templatename, |
|
55 | + 'description' => $description, |
|
56 | + 'content' => $template, |
|
57 | + 'locked' => $locked, |
|
58 | + 'selectable' => $selectable, |
|
59 | + 'category' => $categoryid, |
|
60 | + 'createdon' => $currentdate, |
|
61 | + 'editedon' => $currentdate |
|
62 | + ), $modx->getDatabase()->getFullTableName('site_templates')); |
|
63 | + |
|
64 | + // invoke OnTempFormSave event |
|
65 | + $modx->invokeEvent("OnTempFormSave", array( |
|
66 | + "mode" => "new", |
|
67 | + "id" => $newid |
|
68 | + )); |
|
69 | + // Set new assigned Tvs |
|
70 | + saveTemplateAccess($newid); |
|
71 | + |
|
72 | + // Set the item name for logger |
|
73 | + $_SESSION['itemname'] = $templatename; |
|
74 | + |
|
75 | + // empty cache |
|
76 | + $modx->clearCache('full'); |
|
77 | + |
|
78 | + // finished emptying cache - redirect |
|
79 | + if ($_POST['stay'] != '') { |
|
80 | + $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19"; |
|
81 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
82 | + header($header); |
|
83 | + } else { |
|
84 | + $header = "Location: index.php?a=76&r=2"; |
|
85 | + header($header); |
|
86 | + } |
|
87 | + |
|
88 | + break; |
|
89 | + case '16': |
|
90 | + |
|
91 | + // invoke OnBeforeTempFormSave event |
|
92 | + $modx->invokeEvent("OnBeforeTempFormSave", array( |
|
93 | + "mode" => "upd", |
|
94 | + "id" => $id |
|
95 | + )); |
|
96 | + |
|
97 | + // disallow duplicate names for templates |
|
98 | + $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('site_templates'), "templatename='{$templatename}' AND id!='{$id}'"); |
|
99 | + $count = $modx->getDatabase()->getValue($rs); |
|
100 | + if ($count > 0) { |
|
101 | + $modx->getManagerApi()->saveFormValues(16); |
|
102 | + $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=16&id={$id}"); |
|
103 | + } |
|
104 | + |
|
105 | + //do stuff to save the edited doc |
|
106 | + $modx->getDatabase()->update(array( |
|
107 | + 'templatename' => $templatename, |
|
108 | + 'description' => $description, |
|
109 | + 'content' => $template, |
|
110 | + 'locked' => $locked, |
|
111 | + 'selectable' => $selectable, |
|
112 | + 'category' => $categoryid, |
|
113 | + 'editedon' => $currentdate |
|
114 | + ), $modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'"); |
|
115 | + // Set new assigned Tvs |
|
116 | + saveTemplateAccess($id); |
|
117 | + |
|
118 | + // invoke OnTempFormSave event |
|
119 | + $modx->invokeEvent("OnTempFormSave", array( |
|
120 | + "mode" => "upd", |
|
121 | + "id" => $id |
|
122 | + )); |
|
123 | + |
|
124 | + // Set the item name for logger |
|
125 | + $_SESSION['itemname'] = $templatename; |
|
126 | + |
|
127 | + // first empty the cache |
|
128 | + $modx->clearCache('full'); |
|
129 | + |
|
130 | + // finished emptying cache - redirect |
|
131 | + if ($_POST['stay'] != '') { |
|
132 | + $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19"; |
|
133 | + $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
134 | + header($header); |
|
135 | + } else { |
|
136 | + $modx->unlockElement(1, $id); |
|
137 | + $header = "Location: index.php?a=76&r=2"; |
|
138 | + header($header); |
|
139 | + } |
|
140 | + |
|
141 | + |
|
142 | + break; |
|
143 | + default: |
|
144 | + $modx->webAlertAndQuit("No operation set in request."); |
|
145 | 145 | } |
@@ -61,109 +61,109 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | switch ($input['mode']) { |
64 | - case '11' : // new user |
|
65 | - // check if this user name already exist |
|
66 | - if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->first()) { |
|
67 | - webAlertAndQuit("User name is already in use!", 12); |
|
68 | - } |
|
69 | - |
|
70 | - // check if the email address already exist |
|
71 | - if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
72 | - webAlertAndQuit("Email is already in use!", 12); |
|
73 | - } |
|
74 | - |
|
75 | - // generate a new password for this user |
|
76 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
77 | - if (strlen($specifiedpassword) < 6) { |
|
78 | - webAlertAndQuit("Password is too short!", 12); |
|
79 | - } else { |
|
80 | - $newpassword = $specifiedpassword; |
|
81 | - } |
|
82 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
83 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
84 | - } elseif ($passwordgenmethod == 'g') { |
|
85 | - $newpassword = generate_password(8); |
|
86 | - } else { |
|
87 | - webAlertAndQuit("No password generation method specified!", 12); |
|
88 | - } |
|
89 | - |
|
90 | - // invoke OnBeforeUserFormSave event |
|
91 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
92 | - "mode" => "new", |
|
93 | - )); |
|
94 | - |
|
95 | - // create the user account |
|
96 | - $field = array(); |
|
97 | - $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
98 | - $field['username'] = $newusername; |
|
99 | - $managerUser= EvolutionCMS\Models\ManagerUser::create($field); |
|
100 | - $internalKey = $managerUser->getKey(); |
|
101 | - $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
102 | - $managerUser->attributes()->create($field); |
|
103 | - |
|
104 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', |
|
105 | - 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
106 | - $field = $modx->db->escape($field); |
|
107 | - $modx->db->insert($field, $tbl_user_attributes); |
|
108 | - |
|
109 | - // Save user settings |
|
110 | - saveManagerUserSettings($internalKey); |
|
111 | - |
|
112 | - // invoke OnManagerSaveUser event |
|
113 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
114 | - "mode" => "new", |
|
115 | - "userid" => $internalKey, |
|
116 | - "username" => $newusername, |
|
117 | - "userpassword" => $newpassword, |
|
118 | - "useremail" => $email, |
|
119 | - "userfullname" => $fullname, |
|
120 | - "userroleid" => $role |
|
121 | - )); |
|
122 | - |
|
123 | - // invoke OnUserFormSave event |
|
124 | - $modx->invokeEvent("OnUserFormSave", array( |
|
125 | - "mode" => "new", |
|
126 | - "id" => $internalKey |
|
127 | - )); |
|
128 | - |
|
129 | - // Set the item name for logger |
|
130 | - $_SESSION['itemname'] = $newusername; |
|
131 | - |
|
132 | - /*******************************************************************************/ |
|
133 | - // put the user in the user_groups he/ she should be in |
|
134 | - // first, check that up_perms are switched on! |
|
135 | - if($modx->getConfig('use_udperms') == 1) { |
|
136 | - if(!empty($user_groups)) { |
|
137 | - for($i = 0; $i < count($user_groups); $i++) { |
|
138 | - $field = array(); |
|
139 | - $field['user_group'] = (int)$user_groups[$i]; |
|
140 | - $field['member'] = $id; |
|
141 | - $managerUser->memberGroups()->create($field); |
|
142 | - } |
|
143 | - } |
|
144 | - } |
|
145 | - // end of user_groups stuff! |
|
146 | - |
|
147 | - if ($passwordnotifymethod == 'e') { |
|
148 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
149 | - if ($input['stay'] != '') { |
|
150 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
151 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | - header($header); |
|
153 | - } else { |
|
154 | - $header = "Location: index.php?a=75&r=2"; |
|
155 | - header($header); |
|
156 | - } |
|
157 | - } else { |
|
158 | - if ($input['stay'] != '') { |
|
159 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
160 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | - } else { |
|
162 | - $stayUrl = "index.php?a=75&r=2"; |
|
163 | - } |
|
164 | - |
|
165 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
166 | - ?> |
|
64 | + case '11' : // new user |
|
65 | + // check if this user name already exist |
|
66 | + if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->first()) { |
|
67 | + webAlertAndQuit("User name is already in use!", 12); |
|
68 | + } |
|
69 | + |
|
70 | + // check if the email address already exist |
|
71 | + if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
72 | + webAlertAndQuit("Email is already in use!", 12); |
|
73 | + } |
|
74 | + |
|
75 | + // generate a new password for this user |
|
76 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
77 | + if (strlen($specifiedpassword) < 6) { |
|
78 | + webAlertAndQuit("Password is too short!", 12); |
|
79 | + } else { |
|
80 | + $newpassword = $specifiedpassword; |
|
81 | + } |
|
82 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
83 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
84 | + } elseif ($passwordgenmethod == 'g') { |
|
85 | + $newpassword = generate_password(8); |
|
86 | + } else { |
|
87 | + webAlertAndQuit("No password generation method specified!", 12); |
|
88 | + } |
|
89 | + |
|
90 | + // invoke OnBeforeUserFormSave event |
|
91 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
92 | + "mode" => "new", |
|
93 | + )); |
|
94 | + |
|
95 | + // create the user account |
|
96 | + $field = array(); |
|
97 | + $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
98 | + $field['username'] = $newusername; |
|
99 | + $managerUser= EvolutionCMS\Models\ManagerUser::create($field); |
|
100 | + $internalKey = $managerUser->getKey(); |
|
101 | + $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
102 | + $managerUser->attributes()->create($field); |
|
103 | + |
|
104 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', |
|
105 | + 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
106 | + $field = $modx->db->escape($field); |
|
107 | + $modx->db->insert($field, $tbl_user_attributes); |
|
108 | + |
|
109 | + // Save user settings |
|
110 | + saveManagerUserSettings($internalKey); |
|
111 | + |
|
112 | + // invoke OnManagerSaveUser event |
|
113 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
114 | + "mode" => "new", |
|
115 | + "userid" => $internalKey, |
|
116 | + "username" => $newusername, |
|
117 | + "userpassword" => $newpassword, |
|
118 | + "useremail" => $email, |
|
119 | + "userfullname" => $fullname, |
|
120 | + "userroleid" => $role |
|
121 | + )); |
|
122 | + |
|
123 | + // invoke OnUserFormSave event |
|
124 | + $modx->invokeEvent("OnUserFormSave", array( |
|
125 | + "mode" => "new", |
|
126 | + "id" => $internalKey |
|
127 | + )); |
|
128 | + |
|
129 | + // Set the item name for logger |
|
130 | + $_SESSION['itemname'] = $newusername; |
|
131 | + |
|
132 | + /*******************************************************************************/ |
|
133 | + // put the user in the user_groups he/ she should be in |
|
134 | + // first, check that up_perms are switched on! |
|
135 | + if($modx->getConfig('use_udperms') == 1) { |
|
136 | + if(!empty($user_groups)) { |
|
137 | + for($i = 0; $i < count($user_groups); $i++) { |
|
138 | + $field = array(); |
|
139 | + $field['user_group'] = (int)$user_groups[$i]; |
|
140 | + $field['member'] = $id; |
|
141 | + $managerUser->memberGroups()->create($field); |
|
142 | + } |
|
143 | + } |
|
144 | + } |
|
145 | + // end of user_groups stuff! |
|
146 | + |
|
147 | + if ($passwordnotifymethod == 'e') { |
|
148 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
149 | + if ($input['stay'] != '') { |
|
150 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
151 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
152 | + header($header); |
|
153 | + } else { |
|
154 | + $header = "Location: index.php?a=75&r=2"; |
|
155 | + header($header); |
|
156 | + } |
|
157 | + } else { |
|
158 | + if ($input['stay'] != '') { |
|
159 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
160 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | + } else { |
|
162 | + $stayUrl = "index.php?a=75&r=2"; |
|
163 | + } |
|
164 | + |
|
165 | + include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
166 | + ?> |
|
167 | 167 | |
168 | 168 | <h1><?php echo $_lang['user_title']; ?></h1> |
169 | 169 | |
@@ -185,130 +185,130 @@ discard block |
||
185 | 185 | </div> |
186 | 186 | <?php |
187 | 187 | |
188 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
189 | - } |
|
190 | - break; |
|
191 | - case '12' : // edit user |
|
192 | - // generate a new password for this user |
|
193 | - if ($genpassword == 1) { |
|
194 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | - if (strlen($specifiedpassword) < 6) { |
|
196 | - webAlertAndQuit("Password is too short!", 12); |
|
197 | - } else { |
|
198 | - $newpassword = $specifiedpassword; |
|
199 | - } |
|
200 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | - webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
202 | - } elseif ($passwordgenmethod == 'g') { |
|
203 | - $newpassword = generate_password(8); |
|
204 | - } else { |
|
205 | - webAlertAndQuit("No password generation method specified!", 12); |
|
206 | - } |
|
207 | - } |
|
208 | - if ($passwordnotifymethod == 'e') { |
|
209 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
210 | - } |
|
211 | - |
|
212 | - // check if the username already exist |
|
213 | - if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->where('id', '!=', $id)->first()) { |
|
214 | - webAlertAndQuit("User name is already in use!", 12); |
|
215 | - } |
|
216 | - |
|
217 | - // check if the email address already exists |
|
218 | - if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
219 | - webAlertAndQuit("Email is already in use!", 12); |
|
220 | - } |
|
221 | - |
|
222 | - // invoke OnBeforeUserFormSave event |
|
223 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
224 | - "mode" => "upd", |
|
225 | - "id" => $id |
|
226 | - )); |
|
227 | - |
|
228 | - // update user name and password |
|
229 | - $field = array(); |
|
230 | - $field['username'] = $newusername; |
|
231 | - if ($genpassword == 1) { |
|
232 | - $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
233 | - } |
|
234 | - $managerUser = EvolutionCMS\Models\ManagerUser::find($id); |
|
235 | - $managerUser->update($field); |
|
236 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', |
|
237 | - 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', |
|
238 | - 'blockedafter'); |
|
239 | - $managerUser->attributes->update($field); |
|
240 | - |
|
241 | - // Save user settings |
|
242 | - saveManagerUserSettings($id); |
|
243 | - |
|
244 | - // Set the item name for logger |
|
245 | - $_SESSION['itemname'] = $newusername; |
|
246 | - |
|
247 | - // invoke OnManagerSaveUser event |
|
248 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
249 | - "mode" => "upd", |
|
250 | - "userid" => $id, |
|
251 | - "username" => $newusername, |
|
252 | - "userpassword" => $newpassword, |
|
253 | - "useremail" => $email, |
|
254 | - "userfullname" => $fullname, |
|
255 | - "userroleid" => $role, |
|
256 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
257 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
258 | - )); |
|
259 | - |
|
260 | - // invoke OnManagerChangePassword event |
|
261 | - if ($genpassword == 1) { |
|
262 | - $modx->invokeEvent("OnManagerChangePassword", array( |
|
263 | - "userid" => $id, |
|
264 | - "username" => $newusername, |
|
265 | - "userpassword" => $newpassword |
|
266 | - )); |
|
267 | - } |
|
268 | - |
|
269 | - // invoke OnUserFormSave event |
|
270 | - $modx->invokeEvent("OnUserFormSave", array( |
|
271 | - "mode" => "upd", |
|
272 | - "id" => $id |
|
273 | - )); |
|
274 | - |
|
275 | - /*******************************************************************************/ |
|
276 | - // put the user in the user_groups he/ she should be in |
|
277 | - // first, check that up_perms are switched on! |
|
278 | - if($modx->getConfig('use_udperms') == 1) { |
|
279 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
280 | - $managerUser->memberGroups()->delete(); |
|
281 | - if (!empty($user_groups)) { |
|
282 | - for ($i = 0; $i < count($user_groups); $i++) { |
|
283 | - $field = array(); |
|
284 | - $field['user_group'] = (int)$user_groups[$i]; |
|
285 | - $field['member'] = $id; |
|
286 | - $managerUser->memberGroups()->create($field); |
|
287 | - } |
|
288 | - } |
|
289 | - } |
|
290 | - // end of user_groups stuff! |
|
291 | - /*******************************************************************************/ |
|
292 | - if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
293 | - $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
294 | - } |
|
295 | - if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
296 | - if ($input['stay'] != '') { |
|
297 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
298 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
299 | - } else { |
|
300 | - $stayUrl = "index.php?a=75&r=2"; |
|
301 | - } |
|
302 | - |
|
303 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
304 | - ?> |
|
188 | + include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
189 | + } |
|
190 | + break; |
|
191 | + case '12' : // edit user |
|
192 | + // generate a new password for this user |
|
193 | + if ($genpassword == 1) { |
|
194 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
195 | + if (strlen($specifiedpassword) < 6) { |
|
196 | + webAlertAndQuit("Password is too short!", 12); |
|
197 | + } else { |
|
198 | + $newpassword = $specifiedpassword; |
|
199 | + } |
|
200 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
201 | + webAlertAndQuit("You didn't specify a password for this user!", 12); |
|
202 | + } elseif ($passwordgenmethod == 'g') { |
|
203 | + $newpassword = generate_password(8); |
|
204 | + } else { |
|
205 | + webAlertAndQuit("No password generation method specified!", 12); |
|
206 | + } |
|
207 | + } |
|
208 | + if ($passwordnotifymethod == 'e') { |
|
209 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL); |
|
210 | + } |
|
211 | + |
|
212 | + // check if the username already exist |
|
213 | + if (EvolutionCMS\Models\ManagerUser::where('username', '=', $newusername)->where('id', '!=', $id)->first()) { |
|
214 | + webAlertAndQuit("User name is already in use!", 12); |
|
215 | + } |
|
216 | + |
|
217 | + // check if the email address already exists |
|
218 | + if (EvolutionCMS\Models\UserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
219 | + webAlertAndQuit("Email is already in use!", 12); |
|
220 | + } |
|
221 | + |
|
222 | + // invoke OnBeforeUserFormSave event |
|
223 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
224 | + "mode" => "upd", |
|
225 | + "id" => $id |
|
226 | + )); |
|
227 | + |
|
228 | + // update user name and password |
|
229 | + $field = array(); |
|
230 | + $field['username'] = $newusername; |
|
231 | + if ($genpassword == 1) { |
|
232 | + $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword); |
|
233 | + } |
|
234 | + $managerUser = EvolutionCMS\Models\ManagerUser::find($id); |
|
235 | + $managerUser->update($field); |
|
236 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', |
|
237 | + 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', |
|
238 | + 'blockedafter'); |
|
239 | + $managerUser->attributes->update($field); |
|
240 | + |
|
241 | + // Save user settings |
|
242 | + saveManagerUserSettings($id); |
|
243 | + |
|
244 | + // Set the item name for logger |
|
245 | + $_SESSION['itemname'] = $newusername; |
|
246 | + |
|
247 | + // invoke OnManagerSaveUser event |
|
248 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
249 | + "mode" => "upd", |
|
250 | + "userid" => $id, |
|
251 | + "username" => $newusername, |
|
252 | + "userpassword" => $newpassword, |
|
253 | + "useremail" => $email, |
|
254 | + "userfullname" => $fullname, |
|
255 | + "userroleid" => $role, |
|
256 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
257 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
258 | + )); |
|
259 | + |
|
260 | + // invoke OnManagerChangePassword event |
|
261 | + if ($genpassword == 1) { |
|
262 | + $modx->invokeEvent("OnManagerChangePassword", array( |
|
263 | + "userid" => $id, |
|
264 | + "username" => $newusername, |
|
265 | + "userpassword" => $newpassword |
|
266 | + )); |
|
267 | + } |
|
268 | + |
|
269 | + // invoke OnUserFormSave event |
|
270 | + $modx->invokeEvent("OnUserFormSave", array( |
|
271 | + "mode" => "upd", |
|
272 | + "id" => $id |
|
273 | + )); |
|
274 | + |
|
275 | + /*******************************************************************************/ |
|
276 | + // put the user in the user_groups he/ she should be in |
|
277 | + // first, check that up_perms are switched on! |
|
278 | + if($modx->getConfig('use_udperms') == 1) { |
|
279 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
280 | + $managerUser->memberGroups()->delete(); |
|
281 | + if (!empty($user_groups)) { |
|
282 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
283 | + $field = array(); |
|
284 | + $field['user_group'] = (int)$user_groups[$i]; |
|
285 | + $field['member'] = $id; |
|
286 | + $managerUser->memberGroups()->create($field); |
|
287 | + } |
|
288 | + } |
|
289 | + } |
|
290 | + // end of user_groups stuff! |
|
291 | + /*******************************************************************************/ |
|
292 | + if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
293 | + $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
294 | + } |
|
295 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
296 | + if ($input['stay'] != '') { |
|
297 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
298 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
299 | + } else { |
|
300 | + $stayUrl = "index.php?a=75&r=2"; |
|
301 | + } |
|
302 | + |
|
303 | + include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
304 | + ?> |
|
305 | 305 | |
306 | 306 | <h1><?php echo $_lang['user_title']; ?></h1> |
307 | 307 | |
308 | 308 | <div id="actions"> |
309 | 309 | <div class="btn-group"> |
310 | 310 | <a class="btn" href="<?php echo ($id == $modx->getLoginUserID()) ? 'index.php?a=8' : $stayUrl; |
311 | - ?>"><i |
|
311 | + ?>"><i |
|
312 | 312 | class="<?php echo $_style["actions_save"] ?>"></i> <?php echo ($id == $modx->getLoginUserID()) ? $_lang['logout'] : $_lang['edit']; ?> |
313 | 313 | </a> |
314 | 314 | </div> |
@@ -318,24 +318,24 @@ discard block |
||
318 | 318 | <div class="tab-page"> |
319 | 319 | <div class="container container-body" id="disp"> |
320 | 320 | <p><?php echo sprintf($_lang["password_msg"], $modx->getPhpCompat()->htmlspecialchars($newusername), |
321 | - $modx->getPhpCompat()->htmlspecialchars($newpassword)) . (($id == $modx->getLoginUserID()) ? ' ' . $_lang['user_changeddata'] : ''); ?></p> |
|
321 | + $modx->getPhpCompat()->htmlspecialchars($newpassword)) . (($id == $modx->getLoginUserID()) ? ' ' . $_lang['user_changeddata'] : ''); ?></p> |
|
322 | 322 | </div> |
323 | 323 | </div> |
324 | 324 | </div> |
325 | 325 | <?php |
326 | 326 | |
327 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
328 | - } else { |
|
329 | - if ($input['stay'] != '') { |
|
330 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
331 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
332 | - header($header); |
|
333 | - } else { |
|
334 | - $header = "Location: index.php?a=75&r=2"; |
|
335 | - header($header); |
|
336 | - } |
|
337 | - } |
|
338 | - break; |
|
339 | - default: |
|
340 | - webAlertAndQuit("No operation set in request.", 12); |
|
327 | + include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
328 | + } else { |
|
329 | + if ($input['stay'] != '') { |
|
330 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
331 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
332 | + header($header); |
|
333 | + } else { |
|
334 | + $header = "Location: index.php?a=75&r=2"; |
|
335 | + header($header); |
|
336 | + } |
|
337 | + } |
|
338 | + break; |
|
339 | + default: |
|
340 | + webAlertAndQuit("No operation set in request.", 12); |
|
341 | 341 | } |
@@ -54,109 +54,109 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | switch ($input['mode']) { |
57 | - case '87' : // new user |
|
58 | - // check if this user name already exist |
|
59 | - if (EvolutionCMS\Models\WebUser::where('username', '=', $newusername)->first()) { |
|
60 | - webAlertAndQuit("User name is already in use!", 88); |
|
61 | - } |
|
62 | - |
|
63 | - // check if the email address already exist |
|
64 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
65 | - if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
66 | - webAlertAndQuit("Email is already in use!", 88); |
|
67 | - } |
|
68 | - } |
|
69 | - |
|
70 | - // generate a new password for this user |
|
71 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
72 | - if (strlen($specifiedpassword) < 6) { |
|
73 | - webAlertAndQuit("Password is too short!", 88); |
|
74 | - } else { |
|
75 | - $newpassword = $specifiedpassword; |
|
76 | - } |
|
77 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
78 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
79 | - } elseif ($passwordgenmethod == 'g') { |
|
80 | - $newpassword = generate_password(8); |
|
81 | - } else { |
|
82 | - webAlertAndQuit("No password generation method specified!", 88); |
|
83 | - } |
|
84 | - |
|
85 | - // invoke OnBeforeWUsrFormSave event |
|
86 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
87 | - "mode" => "new", |
|
88 | - )); |
|
89 | - |
|
90 | - // create the user account |
|
91 | - $field = array(); |
|
92 | - $field['username'] = $newusername; |
|
93 | - $field['password'] = md5($newpassword); |
|
94 | - $webUser= EvolutionCMS\Models\WebUser::create($field); |
|
95 | - $internalKey = $webUser->getKey(); |
|
96 | - $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
97 | - $webUser->attributes()->create($field); |
|
98 | - |
|
99 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', |
|
100 | - 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
101 | - $field = $modx->db->escape($field); |
|
102 | - $modx->db->insert($field, $tbl_web_user_attributes); |
|
103 | - |
|
104 | - // Save User Settings |
|
105 | - saveWebUserSettings($internalKey); |
|
106 | - |
|
107 | - // Set the item name for logger |
|
108 | - $_SESSION['itemname'] = $newusername; |
|
109 | - |
|
110 | - /*******************************************************************************/ |
|
111 | - // put the user in the user_groups he/ she should be in |
|
112 | - // first, check that up_perms are switched on! |
|
113 | - if($modx->getConfig('use_udperms') == 1) { |
|
114 | - if(!empty($user_groups)) { |
|
115 | - for($i = 0; $i < count($user_groups); $i++) { |
|
116 | - $field = array(); |
|
117 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
118 | - $webUser->memberGroups()->create($field); |
|
119 | - } |
|
120 | - } |
|
121 | - } |
|
122 | - // end of user_groups stuff! |
|
123 | - |
|
124 | - // invoke OnWebSaveUser event |
|
125 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
126 | - "mode" => "new", |
|
127 | - "userid" => $internalKey, |
|
128 | - "username" => $newusername, |
|
129 | - "userpassword" => $newpassword, |
|
130 | - "useremail" => $email, |
|
131 | - "userfullname" => $fullname |
|
132 | - )); |
|
133 | - |
|
134 | - // invoke OnWUsrFormSave event |
|
135 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
136 | - "mode" => "new", |
|
137 | - "id" => $internalKey |
|
138 | - )); |
|
139 | - |
|
140 | - if ($passwordnotifymethod == 'e') { |
|
141 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
|
142 | - if ($input['stay'] != '') { |
|
143 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
144 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
145 | - header($header); |
|
146 | - } else { |
|
147 | - $header = "Location: index.php?a=99&r=2"; |
|
148 | - header($header); |
|
149 | - } |
|
150 | - } else { |
|
151 | - if ($input['stay'] != '') { |
|
152 | - $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
153 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
154 | - } else { |
|
155 | - $stayUrl = "index.php?a=99&r=2"; |
|
156 | - } |
|
157 | - |
|
158 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
159 | - ?> |
|
57 | + case '87' : // new user |
|
58 | + // check if this user name already exist |
|
59 | + if (EvolutionCMS\Models\WebUser::where('username', '=', $newusername)->first()) { |
|
60 | + webAlertAndQuit("User name is already in use!", 88); |
|
61 | + } |
|
62 | + |
|
63 | + // check if the email address already exist |
|
64 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
65 | + if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
66 | + webAlertAndQuit("Email is already in use!", 88); |
|
67 | + } |
|
68 | + } |
|
69 | + |
|
70 | + // generate a new password for this user |
|
71 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
72 | + if (strlen($specifiedpassword) < 6) { |
|
73 | + webAlertAndQuit("Password is too short!", 88); |
|
74 | + } else { |
|
75 | + $newpassword = $specifiedpassword; |
|
76 | + } |
|
77 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
78 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
79 | + } elseif ($passwordgenmethod == 'g') { |
|
80 | + $newpassword = generate_password(8); |
|
81 | + } else { |
|
82 | + webAlertAndQuit("No password generation method specified!", 88); |
|
83 | + } |
|
84 | + |
|
85 | + // invoke OnBeforeWUsrFormSave event |
|
86 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
87 | + "mode" => "new", |
|
88 | + )); |
|
89 | + |
|
90 | + // create the user account |
|
91 | + $field = array(); |
|
92 | + $field['username'] = $newusername; |
|
93 | + $field['password'] = md5($newpassword); |
|
94 | + $webUser= EvolutionCMS\Models\WebUser::create($field); |
|
95 | + $internalKey = $webUser->getKey(); |
|
96 | + $field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
97 | + $webUser->attributes()->create($field); |
|
98 | + |
|
99 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', |
|
100 | + 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
101 | + $field = $modx->db->escape($field); |
|
102 | + $modx->db->insert($field, $tbl_web_user_attributes); |
|
103 | + |
|
104 | + // Save User Settings |
|
105 | + saveWebUserSettings($internalKey); |
|
106 | + |
|
107 | + // Set the item name for logger |
|
108 | + $_SESSION['itemname'] = $newusername; |
|
109 | + |
|
110 | + /*******************************************************************************/ |
|
111 | + // put the user in the user_groups he/ she should be in |
|
112 | + // first, check that up_perms are switched on! |
|
113 | + if($modx->getConfig('use_udperms') == 1) { |
|
114 | + if(!empty($user_groups)) { |
|
115 | + for($i = 0; $i < count($user_groups); $i++) { |
|
116 | + $field = array(); |
|
117 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
118 | + $webUser->memberGroups()->create($field); |
|
119 | + } |
|
120 | + } |
|
121 | + } |
|
122 | + // end of user_groups stuff! |
|
123 | + |
|
124 | + // invoke OnWebSaveUser event |
|
125 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
126 | + "mode" => "new", |
|
127 | + "userid" => $internalKey, |
|
128 | + "username" => $newusername, |
|
129 | + "userpassword" => $newpassword, |
|
130 | + "useremail" => $email, |
|
131 | + "userfullname" => $fullname |
|
132 | + )); |
|
133 | + |
|
134 | + // invoke OnWUsrFormSave event |
|
135 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
136 | + "mode" => "new", |
|
137 | + "id" => $internalKey |
|
138 | + )); |
|
139 | + |
|
140 | + if ($passwordnotifymethod == 'e') { |
|
141 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
|
142 | + if ($input['stay'] != '') { |
|
143 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
144 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
145 | + header($header); |
|
146 | + } else { |
|
147 | + $header = "Location: index.php?a=99&r=2"; |
|
148 | + header($header); |
|
149 | + } |
|
150 | + } else { |
|
151 | + if ($input['stay'] != '') { |
|
152 | + $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87"; |
|
153 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
154 | + } else { |
|
155 | + $stayUrl = "index.php?a=99&r=2"; |
|
156 | + } |
|
157 | + |
|
158 | + include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
159 | + ?> |
|
160 | 160 | |
161 | 161 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
162 | 162 | |
@@ -178,121 +178,121 @@ discard block |
||
178 | 178 | </div> |
179 | 179 | <?php |
180 | 180 | |
181 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
182 | - } |
|
183 | - break; |
|
184 | - case '88' : // edit user |
|
185 | - // generate a new password for this user |
|
186 | - if ($genpassword == 1) { |
|
187 | - if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
188 | - if (strlen($specifiedpassword) < 6) { |
|
189 | - webAlertAndQuit("Password is too short!", 88); |
|
190 | - } else { |
|
191 | - $newpassword = $specifiedpassword; |
|
192 | - } |
|
193 | - } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
194 | - webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
195 | - } elseif ($passwordgenmethod == 'g') { |
|
196 | - $newpassword = generate_password(8); |
|
197 | - } else { |
|
198 | - webAlertAndQuit("No password generation method specified!", 88); |
|
199 | - } |
|
200 | - } |
|
201 | - if ($passwordnotifymethod == 'e') { |
|
202 | - sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
|
203 | - } |
|
204 | - |
|
205 | - // check if the username already exist |
|
206 | - if (EvolutionCMS\Models\WebUser::where('id', '!=', $id)->where('username', '=', $newusername)->first()) { |
|
207 | - webAlertAndQuit("User name is already in use!", 88); |
|
208 | - } |
|
209 | - |
|
210 | - // check if the email address already exists |
|
211 | - if ($modx->config['allow_multiple_emails'] != 1) { |
|
212 | - if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
213 | - webAlertAndQuit("Email is already in use!", 88); |
|
214 | - } |
|
215 | - } |
|
216 | - |
|
217 | - // invoke OnBeforeWUsrFormSave event |
|
218 | - $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
219 | - "mode" => "upd", |
|
220 | - "id" => $id |
|
221 | - )); |
|
222 | - |
|
223 | - // update user name and password |
|
224 | - $field = array(); |
|
225 | - $field['username'] = $newusername; |
|
226 | - if ($genpassword == 1) { |
|
227 | - $field['password'] = md5($newpassword); |
|
228 | - } |
|
229 | - $webUser = EvolutionCMS\Models\WebUser::find($id); |
|
230 | - $webUser->update($field); |
|
231 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', |
|
232 | - 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', |
|
233 | - 'blockedafter'); |
|
234 | - $webUser->attributes->update($field); |
|
235 | - |
|
236 | - // Save User Settings |
|
237 | - saveWebUserSettings($id); |
|
238 | - |
|
239 | - // Set the item name for logger |
|
240 | - $_SESSION['itemname'] = $newusername; |
|
241 | - |
|
242 | - /*******************************************************************************/ |
|
243 | - // put the user in the user_groups he/ she should be in |
|
244 | - // first, check that up_perms are switched on! |
|
245 | - if($modx->getConfig('use_udperms') == 1) { |
|
246 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
247 | - $webUser->memberGroups()->delete(); |
|
248 | - if (!empty($user_groups)) { |
|
249 | - for ($i = 0; $i < count($user_groups); $i++) { |
|
250 | - $field = array(); |
|
251 | - $field['webgroup'] = (int)$user_groups[$i]; |
|
252 | - $webUser->memberGroups()->create($field); |
|
253 | - } |
|
254 | - } |
|
255 | - } |
|
256 | - // end of user_groups stuff! |
|
257 | - /*******************************************************************************/ |
|
258 | - |
|
259 | - // invoke OnWebSaveUser event |
|
260 | - $modx->invokeEvent("OnWebSaveUser", array( |
|
261 | - "mode" => "upd", |
|
262 | - "userid" => $id, |
|
263 | - "username" => $newusername, |
|
264 | - "userpassword" => $newpassword, |
|
265 | - "useremail" => $email, |
|
266 | - "userfullname" => $fullname, |
|
267 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
268 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
269 | - )); |
|
270 | - |
|
271 | - // invoke OnWebChangePassword event |
|
272 | - if ($genpassword == 1) { |
|
273 | - $modx->invokeEvent("OnWebChangePassword", array( |
|
181 | + include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
182 | + } |
|
183 | + break; |
|
184 | + case '88' : // edit user |
|
185 | + // generate a new password for this user |
|
186 | + if ($genpassword == 1) { |
|
187 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
188 | + if (strlen($specifiedpassword) < 6) { |
|
189 | + webAlertAndQuit("Password is too short!", 88); |
|
190 | + } else { |
|
191 | + $newpassword = $specifiedpassword; |
|
192 | + } |
|
193 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
194 | + webAlertAndQuit("You didn't specify a password for this user!", 88); |
|
195 | + } elseif ($passwordgenmethod == 'g') { |
|
196 | + $newpassword = generate_password(8); |
|
197 | + } else { |
|
198 | + webAlertAndQuit("No password generation method specified!", 88); |
|
199 | + } |
|
200 | + } |
|
201 | + if ($passwordnotifymethod == 'e') { |
|
202 | + sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url); |
|
203 | + } |
|
204 | + |
|
205 | + // check if the username already exist |
|
206 | + if (EvolutionCMS\Models\WebUser::where('id', '!=', $id)->where('username', '=', $newusername)->first()) { |
|
207 | + webAlertAndQuit("User name is already in use!", 88); |
|
208 | + } |
|
209 | + |
|
210 | + // check if the email address already exists |
|
211 | + if ($modx->config['allow_multiple_emails'] != 1) { |
|
212 | + if (EvolutionCMS\Models\WebUserAttribute::where('internalKey', '!=', $id)->where('email', '=', $email)->first()) { |
|
213 | + webAlertAndQuit("Email is already in use!", 88); |
|
214 | + } |
|
215 | + } |
|
216 | + |
|
217 | + // invoke OnBeforeWUsrFormSave event |
|
218 | + $modx->invokeEvent("OnBeforeWUsrFormSave", array( |
|
219 | + "mode" => "upd", |
|
220 | + "id" => $id |
|
221 | + )); |
|
222 | + |
|
223 | + // update user name and password |
|
224 | + $field = array(); |
|
225 | + $field['username'] = $newusername; |
|
226 | + if ($genpassword == 1) { |
|
227 | + $field['password'] = md5($newpassword); |
|
228 | + } |
|
229 | + $webUser = EvolutionCMS\Models\WebUser::find($id); |
|
230 | + $webUser->update($field); |
|
231 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', |
|
232 | + 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', |
|
233 | + 'blockedafter'); |
|
234 | + $webUser->attributes->update($field); |
|
235 | + |
|
236 | + // Save User Settings |
|
237 | + saveWebUserSettings($id); |
|
238 | + |
|
239 | + // Set the item name for logger |
|
240 | + $_SESSION['itemname'] = $newusername; |
|
241 | + |
|
242 | + /*******************************************************************************/ |
|
243 | + // put the user in the user_groups he/ she should be in |
|
244 | + // first, check that up_perms are switched on! |
|
245 | + if($modx->getConfig('use_udperms') == 1) { |
|
246 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
247 | + $webUser->memberGroups()->delete(); |
|
248 | + if (!empty($user_groups)) { |
|
249 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
250 | + $field = array(); |
|
251 | + $field['webgroup'] = (int)$user_groups[$i]; |
|
252 | + $webUser->memberGroups()->create($field); |
|
253 | + } |
|
254 | + } |
|
255 | + } |
|
256 | + // end of user_groups stuff! |
|
257 | + /*******************************************************************************/ |
|
258 | + |
|
259 | + // invoke OnWebSaveUser event |
|
260 | + $modx->invokeEvent("OnWebSaveUser", array( |
|
261 | + "mode" => "upd", |
|
274 | 262 | "userid" => $id, |
275 | 263 | "username" => $newusername, |
276 | - "userpassword" => $newpassword |
|
264 | + "userpassword" => $newpassword, |
|
265 | + "useremail" => $email, |
|
266 | + "userfullname" => $fullname, |
|
267 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
268 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
277 | 269 | )); |
278 | - } |
|
279 | 270 | |
280 | - // invoke OnWUsrFormSave event |
|
281 | - $modx->invokeEvent("OnWUsrFormSave", array( |
|
282 | - "mode" => "upd", |
|
283 | - "id" => $id |
|
284 | - )); |
|
271 | + // invoke OnWebChangePassword event |
|
272 | + if ($genpassword == 1) { |
|
273 | + $modx->invokeEvent("OnWebChangePassword", array( |
|
274 | + "userid" => $id, |
|
275 | + "username" => $newusername, |
|
276 | + "userpassword" => $newpassword |
|
277 | + )); |
|
278 | + } |
|
279 | + |
|
280 | + // invoke OnWUsrFormSave event |
|
281 | + $modx->invokeEvent("OnWUsrFormSave", array( |
|
282 | + "mode" => "upd", |
|
283 | + "id" => $id |
|
284 | + )); |
|
285 | 285 | |
286 | - if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
287 | - if ($input['stay'] != '') { |
|
288 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
289 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
290 | - } else { |
|
291 | - $stayUrl = "index.php?a=99&r=2"; |
|
292 | - } |
|
286 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
287 | + if ($input['stay'] != '') { |
|
288 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
289 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
290 | + } else { |
|
291 | + $stayUrl = "index.php?a=99&r=2"; |
|
292 | + } |
|
293 | 293 | |
294 | - include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
295 | - ?> |
|
294 | + include_once MODX_MANAGER_PATH . "includes/header.inc.php"; |
|
295 | + ?> |
|
296 | 296 | |
297 | 297 | <h1><?php echo $_lang['web_user_title']; ?></h1> |
298 | 298 | |
@@ -312,18 +312,18 @@ discard block |
||
312 | 312 | </div> |
313 | 313 | <?php |
314 | 314 | |
315 | - include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
316 | - } else { |
|
317 | - if ($input['stay'] != '') { |
|
318 | - $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
319 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
320 | - header($header); |
|
321 | - } else { |
|
322 | - $header = "Location: index.php?a=99&r=2"; |
|
323 | - header($header); |
|
324 | - } |
|
325 | - } |
|
326 | - break; |
|
327 | - default : |
|
328 | - webAlertAndQuit("No operation set in request.", 88); |
|
315 | + include_once MODX_MANAGER_PATH . "includes/footer.inc.php"; |
|
316 | + } else { |
|
317 | + if ($input['stay'] != '') { |
|
318 | + $a = ($input['stay'] == '2') ? "88&id={$id}" : "87"; |
|
319 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
320 | + header($header); |
|
321 | + } else { |
|
322 | + $header = "Location: index.php?a=99&r=2"; |
|
323 | + header($header); |
|
324 | + } |
|
325 | + } |
|
326 | + break; |
|
327 | + default : |
|
328 | + webAlertAndQuit("No operation set in request.", 88); |
|
329 | 329 | } |
@@ -279,19 +279,19 @@ |
||
279 | 279 | // invoke OnBeforeDocFormSave event |
280 | 280 | switch($modx->config['docid_incrmnt_method']) |
281 | 281 | { |
282 | - case '1': |
|
283 | - $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
|
284 | - $where = "T1.id IS NULL"; |
|
285 | - $rs = $modx->getDatabase()->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
286 | - $id = $modx->getDatabase()->getValue($rs); |
|
282 | + case '1': |
|
283 | + $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id"; |
|
284 | + $where = "T1.id IS NULL"; |
|
285 | + $rs = $modx->getDatabase()->select('MIN(T0.id)+1', $from, "T1.id IS NULL"); |
|
286 | + $id = $modx->getDatabase()->getValue($rs); |
|
287 | + break; |
|
288 | + case '2': |
|
289 | + $rs = $modx->getDatabase()->select('MAX(id)+1', $tbl_site_content); |
|
290 | + $id = $modx->getDatabase()->getValue($rs); |
|
287 | 291 | break; |
288 | - case '2': |
|
289 | - $rs = $modx->getDatabase()->select('MAX(id)+1', $tbl_site_content); |
|
290 | - $id = $modx->getDatabase()->getValue($rs); |
|
291 | - break; |
|
292 | 292 | |
293 | - default: |
|
294 | - $id = ''; |
|
293 | + default: |
|
294 | + $id = ''; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | $modx->invokeEvent("OnBeforeDocFormSave", array ( |