@@ -1,21 +1,21 @@ 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 | |
6 | 6 | switch((int) $modx->manager->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')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
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: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $role = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | // check to see the snippet editor isn't locked |
26 | 26 | if($lockedEl = $modx->elementIsLocked(8, $role)) { |
27 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role'])); |
|
27 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role'])); |
|
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
@@ -32,15 +32,15 @@ discard block |
||
32 | 32 | $modx->lockElement(8, $role); |
33 | 33 | |
34 | 34 | if($modx->manager->action == '35') { |
35 | - $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'"); |
|
36 | - $roledata = $modx->db->getRow($rs); |
|
37 | - if(!$roledata) { |
|
38 | - $modx->webAlertAndQuit("No role returned!"); |
|
39 | - } |
|
40 | - $_SESSION['itemname'] = $roledata['name']; |
|
35 | + $rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'"); |
|
36 | + $roledata = $modx->db->getRow($rs); |
|
37 | + if(!$roledata) { |
|
38 | + $modx->webAlertAndQuit("No role returned!"); |
|
39 | + } |
|
40 | + $_SESSION['itemname'] = $roledata['name']; |
|
41 | 41 | } else { |
42 | - $roledata = 0; |
|
43 | - $_SESSION['itemname'] = $_lang["new_role"]; |
|
42 | + $roledata = 0; |
|
43 | + $_SESSION['itemname'] = $_lang["new_role"]; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | // Add lock-element JS-Script |
@@ -107,63 +107,63 @@ discard block |
||
107 | 107 | <div class="form-group"> |
108 | 108 | <h3><?= $_lang['page_data_general'] ?></h3> |
109 | 109 | <?php |
110 | - echo render_form('frames', $_lang['role_frames'], 'disabled'); |
|
111 | - echo render_form('home', $_lang['role_home'], 'disabled'); |
|
112 | - echo render_form('messages', $_lang['role_messages']); |
|
113 | - echo render_form('logout', $_lang['role_logout'], 'disabled'); |
|
114 | - echo render_form('help', $_lang['role_help']); |
|
115 | - echo render_form('action_ok', $_lang['role_actionok'], 'disabled'); |
|
116 | - echo render_form('error_dialog', $_lang['role_errors'], 'disabled'); |
|
117 | - echo render_form('about', $_lang['role_about'], 'disabled'); |
|
118 | - echo render_form('credits', $_lang['role_credits'], 'disabled'); |
|
119 | - echo render_form('change_password', $_lang['role_change_password']); |
|
120 | - echo render_form('save_password', $_lang['role_save_password']); |
|
121 | - ?> |
|
110 | + echo render_form('frames', $_lang['role_frames'], 'disabled'); |
|
111 | + echo render_form('home', $_lang['role_home'], 'disabled'); |
|
112 | + echo render_form('messages', $_lang['role_messages']); |
|
113 | + echo render_form('logout', $_lang['role_logout'], 'disabled'); |
|
114 | + echo render_form('help', $_lang['role_help']); |
|
115 | + echo render_form('action_ok', $_lang['role_actionok'], 'disabled'); |
|
116 | + echo render_form('error_dialog', $_lang['role_errors'], 'disabled'); |
|
117 | + echo render_form('about', $_lang['role_about'], 'disabled'); |
|
118 | + echo render_form('credits', $_lang['role_credits'], 'disabled'); |
|
119 | + echo render_form('change_password', $_lang['role_change_password']); |
|
120 | + echo render_form('save_password', $_lang['role_save_password']); |
|
121 | + ?> |
|
122 | 122 | </div> |
123 | 123 | </div> |
124 | 124 | <div class="col-sm-6 col-lg-3"> |
125 | 125 | <div class="form-group"> |
126 | 126 | <h3><?= $_lang['role_content_management'] ?></h3> |
127 | 127 | <?php |
128 | - echo render_form('view_document', $_lang['role_view_docdata'], 'disabled'); |
|
129 | - echo render_form('new_document', $_lang['role_create_doc']); |
|
130 | - echo render_form('edit_document', $_lang['role_edit_doc']); |
|
131 | - echo render_form('change_resourcetype', $_lang['role_change_resourcetype']); |
|
132 | - echo render_form('save_document', $_lang['role_save_doc']); |
|
133 | - echo render_form('publish_document', $_lang['role_publish_doc']); |
|
134 | - echo render_form('delete_document', $_lang['role_delete_doc']); |
|
135 | - echo render_form('empty_trash', $_lang['role_empty_trash']); |
|
136 | - echo render_form('empty_cache', $_lang['role_cache_refresh']); |
|
137 | - echo render_form('view_unpublished', $_lang['role_view_unpublished']); |
|
138 | - ?> |
|
128 | + echo render_form('view_document', $_lang['role_view_docdata'], 'disabled'); |
|
129 | + echo render_form('new_document', $_lang['role_create_doc']); |
|
130 | + echo render_form('edit_document', $_lang['role_edit_doc']); |
|
131 | + echo render_form('change_resourcetype', $_lang['role_change_resourcetype']); |
|
132 | + echo render_form('save_document', $_lang['role_save_doc']); |
|
133 | + echo render_form('publish_document', $_lang['role_publish_doc']); |
|
134 | + echo render_form('delete_document', $_lang['role_delete_doc']); |
|
135 | + echo render_form('empty_trash', $_lang['role_empty_trash']); |
|
136 | + echo render_form('empty_cache', $_lang['role_cache_refresh']); |
|
137 | + echo render_form('view_unpublished', $_lang['role_view_unpublished']); |
|
138 | + ?> |
|
139 | 139 | </div> |
140 | 140 | </div> |
141 | 141 | <div class="col-sm-6 col-lg-3 form-group"> |
142 | 142 | <div class="form-group"> |
143 | 143 | <h3><?= $_lang['role_file_management'] ?></h3> |
144 | 144 | <?php |
145 | - echo render_form('file_manager', $_lang['role_file_manager']); |
|
146 | - echo render_form('assets_files', $_lang['role_assets_files']); |
|
147 | - echo render_form('assets_images', $_lang['role_assets_images']); |
|
148 | - ?> |
|
145 | + echo render_form('file_manager', $_lang['role_file_manager']); |
|
146 | + echo render_form('assets_files', $_lang['role_assets_files']); |
|
147 | + echo render_form('assets_images', $_lang['role_assets_images']); |
|
148 | + ?> |
|
149 | 149 | </div> |
150 | 150 | <div class="form-group"> |
151 | 151 | <h3><?= $_lang['category_management'] ?></h3> |
152 | 152 | <?php |
153 | - echo render_form('category_manager', $_lang['role_category_manager']); |
|
154 | - ?> |
|
153 | + echo render_form('category_manager', $_lang['role_category_manager']); |
|
154 | + ?> |
|
155 | 155 | </div> |
156 | 156 | </div> |
157 | 157 | <div class="col-sm-6 col-lg-3"> |
158 | 158 | <div class="form-group"> |
159 | 159 | <h3><?= $_lang['role_module_management'] ?></h3> |
160 | 160 | <?php |
161 | - echo render_form('new_module', $_lang['role_new_module']); |
|
162 | - echo render_form('edit_module', $_lang['role_edit_module']); |
|
163 | - echo render_form('save_module', $_lang['role_save_module']); |
|
164 | - echo render_form('delete_module', $_lang['role_delete_module']); |
|
165 | - echo render_form('exec_module', $_lang['role_run_module']); |
|
166 | - ?> |
|
161 | + echo render_form('new_module', $_lang['role_new_module']); |
|
162 | + echo render_form('edit_module', $_lang['role_edit_module']); |
|
163 | + echo render_form('save_module', $_lang['role_save_module']); |
|
164 | + echo render_form('delete_module', $_lang['role_delete_module']); |
|
165 | + echo render_form('exec_module', $_lang['role_run_module']); |
|
166 | + ?> |
|
167 | 167 | </div> |
168 | 168 | </div> |
169 | 169 | </div> |
@@ -173,44 +173,44 @@ discard block |
||
173 | 173 | <div class="form-group"> |
174 | 174 | <h3><?= $_lang['role_template_management'] ?></h3> |
175 | 175 | <?php |
176 | - echo render_form('new_template', $_lang['role_create_template']); |
|
177 | - echo render_form('edit_template', $_lang['role_edit_template']); |
|
178 | - echo render_form('save_template', $_lang['role_save_template']); |
|
179 | - echo render_form('delete_template', $_lang['role_delete_template']); |
|
180 | - ?> |
|
176 | + echo render_form('new_template', $_lang['role_create_template']); |
|
177 | + echo render_form('edit_template', $_lang['role_edit_template']); |
|
178 | + echo render_form('save_template', $_lang['role_save_template']); |
|
179 | + echo render_form('delete_template', $_lang['role_delete_template']); |
|
180 | + ?> |
|
181 | 181 | </div> |
182 | 182 | </div> |
183 | 183 | <div class="col-sm-6 col-lg-3"> |
184 | 184 | <div class="form-group"> |
185 | 185 | <h3><?= $_lang['role_snippet_management'] ?></h3> |
186 | 186 | <?php |
187 | - echo render_form('new_snippet', $_lang['role_create_snippet']); |
|
188 | - echo render_form('edit_snippet', $_lang['role_edit_snippet']); |
|
189 | - echo render_form('save_snippet', $_lang['role_save_snippet']); |
|
190 | - echo render_form('delete_snippet', $_lang['role_delete_snippet']); |
|
191 | - ?> |
|
187 | + echo render_form('new_snippet', $_lang['role_create_snippet']); |
|
188 | + echo render_form('edit_snippet', $_lang['role_edit_snippet']); |
|
189 | + echo render_form('save_snippet', $_lang['role_save_snippet']); |
|
190 | + echo render_form('delete_snippet', $_lang['role_delete_snippet']); |
|
191 | + ?> |
|
192 | 192 | </div> |
193 | 193 | </div> |
194 | 194 | <div class="col-sm-6 col-lg-3"> |
195 | 195 | <div class="form-group"> |
196 | 196 | <h3><?= $_lang['role_chunk_management'] ?></h3> |
197 | 197 | <?php |
198 | - echo render_form('new_chunk', $_lang['role_create_chunk']); |
|
199 | - echo render_form('edit_chunk', $_lang['role_edit_chunk']); |
|
200 | - echo render_form('save_chunk', $_lang['role_save_chunk']); |
|
201 | - echo render_form('delete_chunk', $_lang['role_delete_chunk']); |
|
202 | - ?> |
|
198 | + echo render_form('new_chunk', $_lang['role_create_chunk']); |
|
199 | + echo render_form('edit_chunk', $_lang['role_edit_chunk']); |
|
200 | + echo render_form('save_chunk', $_lang['role_save_chunk']); |
|
201 | + echo render_form('delete_chunk', $_lang['role_delete_chunk']); |
|
202 | + ?> |
|
203 | 203 | </div> |
204 | 204 | </div> |
205 | 205 | <div class="col-sm-6 col-lg-3"> |
206 | 206 | <div class="form-group"> |
207 | 207 | <h3><?= $_lang['role_plugin_management'] ?></h3> |
208 | 208 | <?php |
209 | - echo render_form('new_plugin', $_lang['role_create_plugin']); |
|
210 | - echo render_form('edit_plugin', $_lang['role_edit_plugin']); |
|
211 | - echo render_form('save_plugin', $_lang['role_save_plugin']); |
|
212 | - echo render_form('delete_plugin', $_lang['role_delete_plugin']); |
|
213 | - ?> |
|
209 | + echo render_form('new_plugin', $_lang['role_create_plugin']); |
|
210 | + echo render_form('edit_plugin', $_lang['role_edit_plugin']); |
|
211 | + echo render_form('save_plugin', $_lang['role_save_plugin']); |
|
212 | + echo render_form('delete_plugin', $_lang['role_delete_plugin']); |
|
213 | + ?> |
|
214 | 214 | </div> |
215 | 215 | </div> |
216 | 216 | </div> |
@@ -220,42 +220,42 @@ discard block |
||
220 | 220 | <div class="form-group"> |
221 | 221 | <h3><?= $_lang['role_user_management'] ?></h3> |
222 | 222 | <?php |
223 | - echo render_form('new_user', $_lang['role_new_user']); |
|
224 | - echo render_form('edit_user', $_lang['role_edit_user']); |
|
225 | - echo render_form('save_user', $_lang['role_save_user']); |
|
226 | - echo render_form('delete_user', $_lang['role_delete_user']); |
|
227 | - ?> |
|
223 | + echo render_form('new_user', $_lang['role_new_user']); |
|
224 | + echo render_form('edit_user', $_lang['role_edit_user']); |
|
225 | + echo render_form('save_user', $_lang['role_save_user']); |
|
226 | + echo render_form('delete_user', $_lang['role_delete_user']); |
|
227 | + ?> |
|
228 | 228 | </div> |
229 | 229 | </div> |
230 | 230 | <div class="col-sm-6 col-lg-3"> |
231 | 231 | <div class="form-group"> |
232 | 232 | <h3><?= $_lang['role_web_user_management'] ?></h3> |
233 | 233 | <?php |
234 | - echo render_form('new_web_user', $_lang['role_new_web_user']); |
|
235 | - echo render_form('edit_web_user', $_lang['role_edit_web_user']); |
|
236 | - echo render_form('save_web_user', $_lang['role_save_web_user']); |
|
237 | - echo render_form('delete_web_user', $_lang['role_delete_web_user']); |
|
238 | - ?> |
|
234 | + echo render_form('new_web_user', $_lang['role_new_web_user']); |
|
235 | + echo render_form('edit_web_user', $_lang['role_edit_web_user']); |
|
236 | + echo render_form('save_web_user', $_lang['role_save_web_user']); |
|
237 | + echo render_form('delete_web_user', $_lang['role_delete_web_user']); |
|
238 | + ?> |
|
239 | 239 | </div> |
240 | 240 | </div> |
241 | 241 | <div class="col-sm-6 col-lg-3"> |
242 | 242 | <div class="form-group"> |
243 | 243 | <h3><?= $_lang['role_udperms'] ?></h3> |
244 | 244 | <?php |
245 | - echo render_form('access_permissions', $_lang['role_access_persmissions']); |
|
246 | - echo render_form('web_access_permissions', $_lang['role_web_access_persmissions']); |
|
247 | - ?> |
|
245 | + echo render_form('access_permissions', $_lang['role_access_persmissions']); |
|
246 | + echo render_form('web_access_permissions', $_lang['role_web_access_persmissions']); |
|
247 | + ?> |
|
248 | 248 | </div> |
249 | 249 | </div> |
250 | 250 | <div class="col-sm-6 col-lg-3"> |
251 | 251 | <div class="form-group"> |
252 | 252 | <h3><?= $_lang['role_role_management'] ?></h3> |
253 | 253 | <?php |
254 | - echo render_form('new_role', $_lang['role_new_role']); |
|
255 | - echo render_form('edit_role', $_lang['role_edit_role']); |
|
256 | - echo render_form('save_role', $_lang['role_save_role']); |
|
257 | - echo render_form('delete_role', $_lang['role_delete_role']); |
|
258 | - ?> |
|
254 | + echo render_form('new_role', $_lang['role_new_role']); |
|
255 | + echo render_form('edit_role', $_lang['role_edit_role']); |
|
256 | + echo render_form('save_role', $_lang['role_save_role']); |
|
257 | + echo render_form('delete_role', $_lang['role_delete_role']); |
|
258 | + ?> |
|
259 | 259 | </div> |
260 | 260 | </div> |
261 | 261 | </div> |
@@ -265,23 +265,23 @@ discard block |
||
265 | 265 | <div class="form-group"> |
266 | 266 | <h3><?= $_lang['role_eventlog_management'] ?></h3> |
267 | 267 | <?php |
268 | - echo render_form('view_eventlog', $_lang['role_view_eventlog']); |
|
269 | - echo render_form('delete_eventlog', $_lang['role_delete_eventlog']); |
|
270 | - ?> |
|
268 | + echo render_form('view_eventlog', $_lang['role_view_eventlog']); |
|
269 | + echo render_form('delete_eventlog', $_lang['role_delete_eventlog']); |
|
270 | + ?> |
|
271 | 271 | </div> |
272 | 272 | </div> |
273 | 273 | <div class="col-sm-6 col-lg-3"> |
274 | 274 | <div class="form-group"> |
275 | 275 | <h3><?= $_lang['role_config_management'] ?></h3> |
276 | 276 | <?php |
277 | - echo render_form('logs', $_lang['role_view_logs']); |
|
278 | - echo render_form('settings', $_lang['role_edit_settings']); |
|
279 | - echo render_form('bk_manager', $_lang['role_bk_manager']); |
|
280 | - echo render_form('import_static', $_lang['role_import_static']); |
|
281 | - echo render_form('export_static', $_lang['role_export_static']); |
|
282 | - echo render_form('remove_locks', $_lang['role_remove_locks']); |
|
283 | - echo render_form('display_locks', $_lang['role_display_locks']); |
|
284 | - ?> |
|
277 | + echo render_form('logs', $_lang['role_view_logs']); |
|
278 | + echo render_form('settings', $_lang['role_edit_settings']); |
|
279 | + echo render_form('bk_manager', $_lang['role_bk_manager']); |
|
280 | + echo render_form('import_static', $_lang['role_import_static']); |
|
281 | + echo render_form('export_static', $_lang['role_export_static']); |
|
282 | + echo render_form('remove_locks', $_lang['role_remove_locks']); |
|
283 | + echo render_form('display_locks', $_lang['role_display_locks']); |
|
284 | + ?> |
|
285 | 285 | </div> |
286 | 286 | </div> |
287 | 287 | </div> |
@@ -294,32 +294,32 @@ discard block |
||
294 | 294 | |
295 | 295 | <?php |
296 | 296 | function render_form($name, $label, $status = '') { |
297 | - global $modx, $roledata; |
|
297 | + global $modx, $roledata; |
|
298 | 298 | |
299 | - $tpl = '<label class="d-block" for="[+name+]check"> |
|
299 | + $tpl = '<label class="d-block" for="[+name+]check"> |
|
300 | 300 | <input name="[+name+]check" id="[+name+]check" class="click" type="checkbox" onchange="changestate(document.userform.[+name+])" [+checked+] [+status+]> |
301 | 301 | <input type="hidden" class="[+set+]" name="[+name+]" value="[+value+]"> |
302 | 302 | [+label+] |
303 | 303 | </label>'; |
304 | 304 | |
305 | - $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
|
306 | - $value = ($roledata[$name] == 1) ? 1 : 0; |
|
307 | - if($status == 'disabled') { |
|
308 | - $checked = 'checked'; |
|
309 | - $value = 1; |
|
310 | - $set = 'fix'; |
|
311 | - } else { |
|
312 | - $set = 'set'; |
|
313 | - } |
|
305 | + $checked = ($roledata[$name] == 1) ? 'checked' : ''; |
|
306 | + $value = ($roledata[$name] == 1) ? 1 : 0; |
|
307 | + if($status == 'disabled') { |
|
308 | + $checked = 'checked'; |
|
309 | + $value = 1; |
|
310 | + $set = 'fix'; |
|
311 | + } else { |
|
312 | + $set = 'set'; |
|
313 | + } |
|
314 | 314 | |
315 | - $ph = array( |
|
316 | - 'name' => $name, |
|
317 | - 'checked' => $checked, |
|
318 | - 'status' => $status, |
|
319 | - 'value' => $value, |
|
320 | - 'label' => $label, |
|
321 | - 'set' => $set |
|
322 | - ); |
|
315 | + $ph = array( |
|
316 | + 'name' => $name, |
|
317 | + 'checked' => $checked, |
|
318 | + 'status' => $status, |
|
319 | + 'value' => $value, |
|
320 | + 'label' => $label, |
|
321 | + 'set' => $set |
|
322 | + ); |
|
323 | 323 | |
324 | - return $modx->parseText($tpl, $ph); |
|
324 | + return $modx->parseText($tpl, $ph); |
|
325 | 325 | } |
@@ -4,38 +4,38 @@ |
||
4 | 4 | } |
5 | 5 | $logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">'; |
6 | 6 | $downloadLinks = array( |
7 | - 0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'), |
|
8 | - 1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | - 2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | - 3=>array('title'=>$_lang["extras"],'link'=>array( |
|
11 | - 'http://extras.evolution-cms.com/', |
|
12 | - 'https://github.com/extras-evolution' |
|
13 | - )), |
|
7 | + 0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'), |
|
8 | + 1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | + 2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | + 3=>array('title'=>$_lang["extras"],'link'=>array( |
|
11 | + 'http://extras.evolution-cms.com/', |
|
12 | + 'https://github.com/extras-evolution' |
|
13 | + )), |
|
14 | 14 | ); |
15 | 15 | |
16 | 16 | $translationLinks = array( |
17 | - 0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | - 1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
17 | + 0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | + 1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 | function createList($sectionHeader, $linkArr) { |
22 | - $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
|
23 | - $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
|
24 | - $links = ''; |
|
25 | - foreach($linkArr as $row) { |
|
26 | - if (!is_array($row['link'])) $row['link'] = array($row['link']); |
|
27 | - foreach ($row['link'] as $link) { |
|
28 | - $links .= $links != '' ? '<br/>' : ''; |
|
29 | - $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
|
30 | - } |
|
31 | - $output .= ' |
|
22 | + $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
|
23 | + $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
|
24 | + $links = ''; |
|
25 | + foreach($linkArr as $row) { |
|
26 | + if (!is_array($row['link'])) $row['link'] = array($row['link']); |
|
27 | + foreach ($row['link'] as $link) { |
|
28 | + $links .= $links != '' ? '<br/>' : ''; |
|
29 | + $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
|
30 | + } |
|
31 | + $output .= ' |
|
32 | 32 | <tr> |
33 | 33 | <td align="left"><strong>' . $row["title"] . '</strong></td> |
34 | 34 | <td align="left">' . $links . '</td> |
35 | 35 | </tr>'; |
36 | - $links = ''; |
|
37 | - } |
|
38 | - $output .= '</table></div>'."\n"; |
|
36 | + $links = ''; |
|
37 | + } |
|
38 | + $output .= '</table></div>'."\n"; |
|
39 | 39 | return $output; |
40 | 40 | } |
41 | 41 | echo $logo; |
@@ -7,8 +7,8 @@ |
||
7 | 7 | <div class="sectionHeader">Changelog</div> |
8 | 8 | <div class="sectionBody"> |
9 | 9 | <?php |
10 | - $changeLog = MODX_BASE_PATH . 'assets/docs/changelog.txt'; |
|
11 | - if(is_readable($changeLog)) |
|
12 | - echo str_replace("\n",'<br>',file_get_contents($changeLog)); |
|
10 | + $changeLog = MODX_BASE_PATH . 'assets/docs/changelog.txt'; |
|
11 | + if(is_readable($changeLog)) |
|
12 | + echo str_replace("\n",'<br>',file_get_contents($changeLog)); |
|
13 | 13 | ?> |
14 | 14 | </div> |
@@ -1,239 +1,239 @@ |
||
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 | |
6 | 6 | $tpl = array( |
7 | - 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
8 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
9 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
10 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
7 | + 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
8 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
9 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
10 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
12 | 12 | ); |
13 | 13 | |
14 | 14 | function parsePh($tpl, $ph) { |
15 | - global $modx, $_lang; |
|
16 | - $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
17 | - return $modx->parseText($tpl, $ph); |
|
15 | + global $modx, $_lang; |
|
16 | + $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
17 | + return $modx->parseText($tpl, $ph); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | function renderViewSwitchButtons($cssId) { |
21 | - global $modx, $_lang, $tpl; |
|
21 | + global $modx, $_lang, $tpl; |
|
22 | 22 | |
23 | - return parsePh($tpl['viewForm'], array( |
|
24 | - 'cssId' => $cssId |
|
25 | - )); |
|
23 | + return parsePh($tpl['viewForm'], array( |
|
24 | + 'cssId' => $cssId |
|
25 | + )); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | function createResourceList($resourceTable, $resources) { |
29 | - global $modx, $_lang, $_style, $modx_textdir, $tpl; |
|
30 | - |
|
31 | - $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
|
32 | - |
|
33 | - if( ! is_array($items) || empty($items)) { |
|
34 | - return $_lang['no_results']; |
|
35 | - } |
|
36 | - |
|
37 | - // Prepare elements- and categories-list |
|
38 | - $elements = array(); |
|
39 | - $categories = array(); |
|
40 | - foreach($items as $row) { |
|
41 | - $catid = $row['catid'] ? $row['catid'] : 0; |
|
42 | - $categories[$catid] = array('name' => stripslashes($row['category'])); |
|
43 | - $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
|
44 | - } |
|
45 | - |
|
46 | - // Now render categories / panel-collapse |
|
47 | - $panelGroup = ''; |
|
48 | - foreach($elements as $catid => $elList) { |
|
49 | - // Add panel-heading / category-collapse to output |
|
50 | - $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
51 | - 'tab' => $resourceTable, |
|
52 | - 'category' => $categories[$catid]['name'], |
|
53 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
54 | - 'catid' => $catid, |
|
55 | - )); |
|
56 | - |
|
57 | - // Prepare content for panel-collapse |
|
58 | - $panelCollapse = ''; |
|
59 | - foreach($elList as $el) { |
|
60 | - $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
|
61 | - } |
|
62 | - |
|
63 | - // Add panel-collapse with elements to output |
|
64 | - $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
65 | - 'tab' => $resourceTable, |
|
66 | - 'catid' => $catid, |
|
67 | - 'wrapper' => $panelCollapse, |
|
68 | - )); |
|
69 | - } |
|
70 | - |
|
71 | - return parsePh($tpl['panelGroup'], array( |
|
72 | - 'resourceTable' => $resourceTable, |
|
73 | - 'wrapper' => $panelGroup |
|
74 | - )); |
|
29 | + global $modx, $_lang, $_style, $modx_textdir, $tpl; |
|
30 | + |
|
31 | + $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
|
32 | + |
|
33 | + if( ! is_array($items) || empty($items)) { |
|
34 | + return $_lang['no_results']; |
|
35 | + } |
|
36 | + |
|
37 | + // Prepare elements- and categories-list |
|
38 | + $elements = array(); |
|
39 | + $categories = array(); |
|
40 | + foreach($items as $row) { |
|
41 | + $catid = $row['catid'] ? $row['catid'] : 0; |
|
42 | + $categories[$catid] = array('name' => stripslashes($row['category'])); |
|
43 | + $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
|
44 | + } |
|
45 | + |
|
46 | + // Now render categories / panel-collapse |
|
47 | + $panelGroup = ''; |
|
48 | + foreach($elements as $catid => $elList) { |
|
49 | + // Add panel-heading / category-collapse to output |
|
50 | + $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
51 | + 'tab' => $resourceTable, |
|
52 | + 'category' => $categories[$catid]['name'], |
|
53 | + 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
54 | + 'catid' => $catid, |
|
55 | + )); |
|
56 | + |
|
57 | + // Prepare content for panel-collapse |
|
58 | + $panelCollapse = ''; |
|
59 | + foreach($elList as $el) { |
|
60 | + $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
|
61 | + } |
|
62 | + |
|
63 | + // Add panel-collapse with elements to output |
|
64 | + $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
65 | + 'tab' => $resourceTable, |
|
66 | + 'catid' => $catid, |
|
67 | + 'wrapper' => $panelCollapse, |
|
68 | + )); |
|
69 | + } |
|
70 | + |
|
71 | + return parsePh($tpl['panelGroup'], array( |
|
72 | + 'resourceTable' => $resourceTable, |
|
73 | + 'wrapper' => $panelGroup |
|
74 | + )); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | function createCombinedView($resources) { |
78 | - global $modx, $_lang, $_style, $modx_textdir; |
|
79 | - |
|
80 | - $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
|
81 | - $types = isset($resources->types) ? $resources->types : false; |
|
82 | - $categories = isset($resources->categories) ? $resources->categories : false; |
|
83 | - |
|
84 | - if(!$itemsPerCategory) { |
|
85 | - return $_lang['no_results']; |
|
86 | - } |
|
87 | - |
|
88 | - $tpl = array( |
|
89 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
90 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
91 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
92 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
93 | - ); |
|
94 | - |
|
95 | - // Easily loop through $itemsPerCategory-Array |
|
96 | - $panelGroup = ''; |
|
97 | - foreach($categories as $catid => $category) { |
|
98 | - // Prepare collapse content / elements-list |
|
99 | - $panelCollapse = ''; |
|
100 | - foreach($itemsPerCategory[$catid] as $el) { |
|
101 | - $resourceTable = $el['type']; |
|
102 | - $ph = prepareElementRowPh($el, $resourceTable, $resources); |
|
103 | - $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
|
104 | - } |
|
105 | - |
|
106 | - // Add panel-heading / button |
|
107 | - $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
108 | - 'tab' => 'categories_list', |
|
109 | - 'category' => $categories[$catid], |
|
110 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
111 | - 'catid' => $catid, |
|
112 | - )); |
|
113 | - |
|
114 | - // Add panel |
|
115 | - $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
116 | - 'tab' => 'categories_list', |
|
117 | - 'catid' => $catid, |
|
118 | - 'wrapper' => $panelCollapse, |
|
119 | - )); |
|
120 | - } |
|
121 | - |
|
122 | - return parsePh($tpl['panelGroup'], array( |
|
123 | - 'resourceTable' => 'categories_list', |
|
124 | - 'wrapper' => $panelGroup |
|
125 | - )); |
|
78 | + global $modx, $_lang, $_style, $modx_textdir; |
|
79 | + |
|
80 | + $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
|
81 | + $types = isset($resources->types) ? $resources->types : false; |
|
82 | + $categories = isset($resources->categories) ? $resources->categories : false; |
|
83 | + |
|
84 | + if(!$itemsPerCategory) { |
|
85 | + return $_lang['no_results']; |
|
86 | + } |
|
87 | + |
|
88 | + $tpl = array( |
|
89 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
90 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
91 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
92 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
93 | + ); |
|
94 | + |
|
95 | + // Easily loop through $itemsPerCategory-Array |
|
96 | + $panelGroup = ''; |
|
97 | + foreach($categories as $catid => $category) { |
|
98 | + // Prepare collapse content / elements-list |
|
99 | + $panelCollapse = ''; |
|
100 | + foreach($itemsPerCategory[$catid] as $el) { |
|
101 | + $resourceTable = $el['type']; |
|
102 | + $ph = prepareElementRowPh($el, $resourceTable, $resources); |
|
103 | + $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
|
104 | + } |
|
105 | + |
|
106 | + // Add panel-heading / button |
|
107 | + $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
108 | + 'tab' => 'categories_list', |
|
109 | + 'category' => $categories[$catid], |
|
110 | + 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
111 | + 'catid' => $catid, |
|
112 | + )); |
|
113 | + |
|
114 | + // Add panel |
|
115 | + $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
116 | + 'tab' => 'categories_list', |
|
117 | + 'catid' => $catid, |
|
118 | + 'wrapper' => $panelCollapse, |
|
119 | + )); |
|
120 | + } |
|
121 | + |
|
122 | + return parsePh($tpl['panelGroup'], array( |
|
123 | + 'resourceTable' => 'categories_list', |
|
124 | + 'wrapper' => $panelGroup |
|
125 | + )); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | function prepareElementRowPh($row, $resourceTable, $resources) { |
129 | - global $modx, $modx_textdir, $_style, $_lang; |
|
130 | - |
|
131 | - $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
132 | - |
|
133 | - $class = ''; |
|
134 | - $_lang["confirm_delete"] = $_lang["delete"]; |
|
135 | - |
|
136 | - if($resourceTable == 'site_templates') { |
|
137 | - $class = $row['selectable'] ? '' : 'disabledPlugin'; |
|
138 | - $lockElementType = 1; |
|
139 | - $_lang["confirm_delete"] = $_lang["confirm_delete_template"]; |
|
140 | - } |
|
141 | - if($resourceTable == 'site_tmplvars') { |
|
142 | - $class = $row['reltpl'] ? '' : 'disabledPlugin'; |
|
143 | - $lockElementType = 2; |
|
144 | - $_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"]; |
|
145 | - } |
|
146 | - if($resourceTable == 'site_htmlsnippets') { |
|
129 | + global $modx, $modx_textdir, $_style, $_lang; |
|
130 | + |
|
131 | + $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
132 | + |
|
133 | + $class = ''; |
|
134 | + $_lang["confirm_delete"] = $_lang["delete"]; |
|
135 | + |
|
136 | + if($resourceTable == 'site_templates') { |
|
137 | + $class = $row['selectable'] ? '' : 'disabledPlugin'; |
|
138 | + $lockElementType = 1; |
|
139 | + $_lang["confirm_delete"] = $_lang["confirm_delete_template"]; |
|
140 | + } |
|
141 | + if($resourceTable == 'site_tmplvars') { |
|
142 | + $class = $row['reltpl'] ? '' : 'disabledPlugin'; |
|
143 | + $lockElementType = 2; |
|
144 | + $_lang["confirm_delete"] = $_lang["confirm_delete_tmplvars"]; |
|
145 | + } |
|
146 | + if($resourceTable == 'site_htmlsnippets') { |
|
147 | 147 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
148 | - $lockElementType = 3; |
|
149 | - $_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"]; |
|
150 | - } |
|
151 | - if($resourceTable == 'site_snippets') { |
|
148 | + $lockElementType = 3; |
|
149 | + $_lang["confirm_delete"] = $_lang["confirm_delete_htmlsnippet"]; |
|
150 | + } |
|
151 | + if($resourceTable == 'site_snippets') { |
|
152 | 152 | $class = $row['disabled'] ? 'disabledPlugin' : ''; |
153 | - $lockElementType = 4; |
|
154 | - $_lang["confirm_delete"] = $_lang["confirm_delete_snippet"]; |
|
155 | - } |
|
156 | - if($resourceTable == 'site_plugins') { |
|
157 | - $class = $row['disabled'] ? 'disabledPlugin' : ''; |
|
158 | - $lockElementType = 5; |
|
159 | - $_lang["confirm_delete"] = $_lang["confirm_delete_plugin"]; |
|
160 | - } |
|
161 | - if($resourceTable == 'site_modules') { |
|
153 | + $lockElementType = 4; |
|
154 | + $_lang["confirm_delete"] = $_lang["confirm_delete_snippet"]; |
|
155 | + } |
|
156 | + if($resourceTable == 'site_plugins') { |
|
157 | + $class = $row['disabled'] ? 'disabledPlugin' : ''; |
|
158 | + $lockElementType = 5; |
|
159 | + $_lang["confirm_delete"] = $_lang["confirm_delete_plugin"]; |
|
160 | + } |
|
161 | + if($resourceTable == 'site_modules') { |
|
162 | 162 | $class = $row['disabled'] ? '' : 'disabledPlugin'; |
163 | - $_lang["confirm_delete"] = $_lang["confirm_delete_module"]; |
|
164 | - } |
|
165 | - |
|
166 | - // Prepare displaying user-locks |
|
167 | - $lockedByUser = ''; |
|
168 | - $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
169 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
170 | - if($rowLock['sid'] == $modx->sid) { |
|
171 | - $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
172 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
173 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
174 | - )); |
|
175 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
176 | - } else { |
|
177 | - $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
178 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
179 | - 'username' => $rowLock['username'], |
|
180 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
181 | - )); |
|
182 | - if($modx->hasPermission('remove_locks')) { |
|
183 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
184 | - } else { |
|
185 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
186 | - } |
|
187 | - } |
|
188 | - } |
|
189 | - if($lockedByUser) { |
|
190 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
191 | - } |
|
192 | - |
|
193 | - // Caption |
|
194 | - if($resourceTable == 'site_tmplvars') { |
|
195 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
196 | - } else { |
|
197 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
198 | - } |
|
199 | - |
|
200 | - // Special marks |
|
201 | - $tplInfo = array(); |
|
202 | - if($row['locked']) { |
|
203 | - $tplInfo[] = $_lang['locked']; |
|
204 | - } |
|
205 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
206 | - $tplInfo[] = $_lang['defaulttemplate_title']; |
|
207 | - } |
|
208 | - $marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : ''; |
|
209 | - |
|
210 | - /* row buttons */ |
|
211 | - $buttons = ''; |
|
212 | - if($modx->hasPermission($types['actions']['edit'][1])) { |
|
213 | - $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
214 | - } |
|
215 | - if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
216 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
217 | - } |
|
218 | - if($modx->hasPermission($types['actions']['remove'][1])) { |
|
219 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
220 | - } |
|
221 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
222 | - |
|
223 | - $catid = $row['catid'] ? $row['catid'] : 0; |
|
224 | - |
|
225 | - // Placeholders for elements-row |
|
226 | - return array( |
|
227 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
228 | - 'lockedByUser' => $lockedByUser, |
|
229 | - 'name' => $row['name'], |
|
230 | - 'caption' => $caption, |
|
231 | - 'buttons' => $buttons, |
|
232 | - 'marks' => $marks, |
|
233 | - 'id' => $row['id'], |
|
234 | - 'resourceTable' => $resourceTable, |
|
235 | - 'actionEdit' => $types['actions']['edit'][0], |
|
236 | - 'catid' => $catid, |
|
237 | - 'textdir' => $modx_textdir ? '‏' : '', |
|
238 | - ); |
|
163 | + $_lang["confirm_delete"] = $_lang["confirm_delete_module"]; |
|
164 | + } |
|
165 | + |
|
166 | + // Prepare displaying user-locks |
|
167 | + $lockedByUser = ''; |
|
168 | + $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
169 | + if($rowLock && $modx->hasPermission('display_locks')) { |
|
170 | + if($rowLock['sid'] == $modx->sid) { |
|
171 | + $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
172 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
173 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
174 | + )); |
|
175 | + $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
176 | + } else { |
|
177 | + $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
178 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
179 | + 'username' => $rowLock['username'], |
|
180 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
181 | + )); |
|
182 | + if($modx->hasPermission('remove_locks')) { |
|
183 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
184 | + } else { |
|
185 | + $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
186 | + } |
|
187 | + } |
|
188 | + } |
|
189 | + if($lockedByUser) { |
|
190 | + $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
191 | + } |
|
192 | + |
|
193 | + // Caption |
|
194 | + if($resourceTable == 'site_tmplvars') { |
|
195 | + $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
196 | + } else { |
|
197 | + $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
198 | + } |
|
199 | + |
|
200 | + // Special marks |
|
201 | + $tplInfo = array(); |
|
202 | + if($row['locked']) { |
|
203 | + $tplInfo[] = $_lang['locked']; |
|
204 | + } |
|
205 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
206 | + $tplInfo[] = $_lang['defaulttemplate_title']; |
|
207 | + } |
|
208 | + $marks = !empty($tplInfo) ? ' <em>(' . join(', ', $tplInfo) . ')</em>' : ''; |
|
209 | + |
|
210 | + /* row buttons */ |
|
211 | + $buttons = ''; |
|
212 | + if($modx->hasPermission($types['actions']['edit'][1])) { |
|
213 | + $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
214 | + } |
|
215 | + if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
216 | + $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
217 | + } |
|
218 | + if($modx->hasPermission($types['actions']['remove'][1])) { |
|
219 | + $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
220 | + } |
|
221 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
222 | + |
|
223 | + $catid = $row['catid'] ? $row['catid'] : 0; |
|
224 | + |
|
225 | + // Placeholders for elements-row |
|
226 | + return array( |
|
227 | + 'class' => $class ? ' class="' . $class . '"' : '', |
|
228 | + 'lockedByUser' => $lockedByUser, |
|
229 | + 'name' => $row['name'], |
|
230 | + 'caption' => $caption, |
|
231 | + 'buttons' => $buttons, |
|
232 | + 'marks' => $marks, |
|
233 | + 'id' => $row['id'], |
|
234 | + 'resourceTable' => $resourceTable, |
|
235 | + 'actionEdit' => $types['actions']['edit'][0], |
|
236 | + 'catid' => $catid, |
|
237 | + 'textdir' => $modx_textdir ? '‏' : '', |
|
238 | + ); |
|
239 | 239 | } |
@@ -4,123 +4,123 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | class mgrResources { |
7 | - var $types = array(); |
|
8 | - var $items = array(); |
|
9 | - var $categories = array(); |
|
10 | - var $itemsPerCategory = array(); |
|
11 | - |
|
12 | - function __construct() { |
|
13 | - $this->setTypes(); |
|
14 | - $this->queryItemsFromDB(); |
|
15 | - $this->prepareCategoryArrays(); |
|
16 | - } |
|
17 | - |
|
18 | - function setTypes() { |
|
19 | - global $_lang; |
|
20 | - $this->types['site_templates'] = array( |
|
21 | - 'title'=>$_lang["manage_templates"], |
|
22 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
23 | - 'permissions'=>array('new_template','edit_template'), |
|
24 | - 'name'=>'templatename' |
|
25 | - ); |
|
26 | - $this->types['site_tmplvars'] = array( |
|
27 | - 'title'=>$_lang["tmplvars"], |
|
28 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
29 | - 'permissions'=>array('new_template','edit_template'), |
|
30 | - ); |
|
31 | - $this->types['site_htmlsnippets'] = array( |
|
32 | - 'title'=>$_lang["manage_htmlsnippets"], |
|
33 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
34 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
35 | - ); |
|
36 | - $this->types['site_snippets'] = array( |
|
37 | - 'title'=>$_lang["manage_snippets"], |
|
38 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
39 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
40 | - ); |
|
41 | - $this->types['site_plugins'] = array( |
|
42 | - 'title'=>$_lang["manage_plugins"], |
|
43 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
44 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
45 | - ); |
|
46 | - $this->types['site_modules'] = array( |
|
47 | - 'title'=>$_lang["manage_modules"], |
|
48 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
49 | - 'permissions'=>array('new_module','edit_module'), |
|
50 | - ); |
|
51 | - } |
|
52 | - |
|
53 | - function queryItemsFromDB() { |
|
54 | - foreach($this->types as $resourceTable=>$type) { |
|
55 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
56 | - $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
57 | - $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
58 | - } |
|
59 | - } |
|
60 | - } |
|
61 | - |
|
62 | - function hasAnyPermissions($permissions) { |
|
63 | - global $modx; |
|
64 | - |
|
65 | - foreach($permissions as $p) |
|
66 | - if($modx->hasPermission($p)) return true; |
|
67 | - |
|
68 | - return false; |
|
69 | - } |
|
70 | - |
|
71 | - function queryResources($resourceTable, $nameField = 'name') { |
|
72 | - global $modx, $_lang; |
|
73 | - |
|
74 | - $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : ''; |
|
75 | - |
|
76 | - $tvsql = ''; |
|
77 | - $tvjoin = ''; |
|
78 | - if ($resourceTable == 'site_tmplvars') { |
|
79 | - $tvsql = 'site_tmplvars.caption, '; |
|
80 | - $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
81 | - $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
82 | - } |
|
83 | - else $sttfield = ''; |
|
84 | - |
|
85 | - $selectableTemplates = $resourceTable == 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
86 | - |
|
87 | - $rs = $modx->db->select( |
|
88 | - "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
|
89 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
7 | + var $types = array(); |
|
8 | + var $items = array(); |
|
9 | + var $categories = array(); |
|
10 | + var $itemsPerCategory = array(); |
|
11 | + |
|
12 | + function __construct() { |
|
13 | + $this->setTypes(); |
|
14 | + $this->queryItemsFromDB(); |
|
15 | + $this->prepareCategoryArrays(); |
|
16 | + } |
|
17 | + |
|
18 | + function setTypes() { |
|
19 | + global $_lang; |
|
20 | + $this->types['site_templates'] = array( |
|
21 | + 'title'=>$_lang["manage_templates"], |
|
22 | + 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
23 | + 'permissions'=>array('new_template','edit_template'), |
|
24 | + 'name'=>'templatename' |
|
25 | + ); |
|
26 | + $this->types['site_tmplvars'] = array( |
|
27 | + 'title'=>$_lang["tmplvars"], |
|
28 | + 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
29 | + 'permissions'=>array('new_template','edit_template'), |
|
30 | + ); |
|
31 | + $this->types['site_htmlsnippets'] = array( |
|
32 | + 'title'=>$_lang["manage_htmlsnippets"], |
|
33 | + 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
34 | + 'permissions'=>array('new_chunk','edit_chunk'), |
|
35 | + ); |
|
36 | + $this->types['site_snippets'] = array( |
|
37 | + 'title'=>$_lang["manage_snippets"], |
|
38 | + 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
39 | + 'permissions'=>array('new_snippet','edit_snippet'), |
|
40 | + ); |
|
41 | + $this->types['site_plugins'] = array( |
|
42 | + 'title'=>$_lang["manage_plugins"], |
|
43 | + 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
44 | + 'permissions'=>array('new_plugin','edit_plugin'), |
|
45 | + ); |
|
46 | + $this->types['site_modules'] = array( |
|
47 | + 'title'=>$_lang["manage_modules"], |
|
48 | + 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
49 | + 'permissions'=>array('new_module','edit_module'), |
|
50 | + ); |
|
51 | + } |
|
52 | + |
|
53 | + function queryItemsFromDB() { |
|
54 | + foreach($this->types as $resourceTable=>$type) { |
|
55 | + if($this->hasAnyPermissions($type['permissions'])) { |
|
56 | + $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
57 | + $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
58 | + } |
|
59 | + } |
|
60 | + } |
|
61 | + |
|
62 | + function hasAnyPermissions($permissions) { |
|
63 | + global $modx; |
|
64 | + |
|
65 | + foreach($permissions as $p) |
|
66 | + if($modx->hasPermission($p)) return true; |
|
67 | + |
|
68 | + return false; |
|
69 | + } |
|
70 | + |
|
71 | + function queryResources($resourceTable, $nameField = 'name') { |
|
72 | + global $modx, $_lang; |
|
73 | + |
|
74 | + $pluginsql = ($resourceTable == 'site_htmlsnippets' || $resourceTable == 'site_snippets' || $resourceTable == 'site_plugins' || $resourceTable == 'site_modules') ? $resourceTable . '.disabled, ' : ''; |
|
75 | + |
|
76 | + $tvsql = ''; |
|
77 | + $tvjoin = ''; |
|
78 | + if ($resourceTable == 'site_tmplvars') { |
|
79 | + $tvsql = 'site_tmplvars.caption, '; |
|
80 | + $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
81 | + $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
82 | + } |
|
83 | + else $sttfield = ''; |
|
84 | + |
|
85 | + $selectableTemplates = $resourceTable == 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
86 | + |
|
87 | + $rs = $modx->db->select( |
|
88 | + "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
|
89 | + $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
90 | 90 | LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
91 | - "", |
|
92 | - "category,name" |
|
93 | - ); |
|
94 | - $limit = $modx->db->getRecordCount($rs); |
|
95 | - |
|
96 | - if($limit < 1) return false; |
|
97 | - |
|
98 | - $result = array(); |
|
99 | - while ($row = $modx->db->getRow($rs)) { |
|
100 | - $result[] = $row; |
|
101 | - } |
|
102 | - return $result; |
|
103 | - } |
|
104 | - |
|
105 | - function prepareCategoryArrays() { |
|
106 | - foreach($this->items as $type=>$items) { |
|
107 | - foreach((array)$items as $item) { |
|
108 | - $catid = $item['catid'] ? $item['catid'] : 0; |
|
109 | - $this->categories[$catid] = $item['category']; |
|
110 | - |
|
111 | - $item['type'] = $type; |
|
112 | - $this->itemsPerCategory[$catid][] = $item; |
|
113 | - } |
|
114 | - } |
|
115 | - |
|
116 | - // Sort categories by name |
|
117 | - natcasesort($this->categories); |
|
118 | - |
|
119 | - // Now sort by name |
|
120 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
121 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
122 | - return strcasecmp($a['name'], $b['name']); |
|
123 | - }); |
|
124 | - } |
|
125 | - } |
|
91 | + "", |
|
92 | + "category,name" |
|
93 | + ); |
|
94 | + $limit = $modx->db->getRecordCount($rs); |
|
95 | + |
|
96 | + if($limit < 1) return false; |
|
97 | + |
|
98 | + $result = array(); |
|
99 | + while ($row = $modx->db->getRow($rs)) { |
|
100 | + $result[] = $row; |
|
101 | + } |
|
102 | + return $result; |
|
103 | + } |
|
104 | + |
|
105 | + function prepareCategoryArrays() { |
|
106 | + foreach($this->items as $type=>$items) { |
|
107 | + foreach((array)$items as $item) { |
|
108 | + $catid = $item['catid'] ? $item['catid'] : 0; |
|
109 | + $this->categories[$catid] = $item['category']; |
|
110 | + |
|
111 | + $item['type'] = $type; |
|
112 | + $this->itemsPerCategory[$catid][] = $item; |
|
113 | + } |
|
114 | + } |
|
115 | + |
|
116 | + // Sort categories by name |
|
117 | + natcasesort($this->categories); |
|
118 | + |
|
119 | + // Now sort by name |
|
120 | + foreach($this->itemsPerCategory as $catid=>$items) { |
|
121 | + usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
122 | + return strcasecmp($a['name'], $b['name']); |
|
123 | + }); |
|
124 | + } |
|
125 | + } |
|
126 | 126 | } |
@@ -1,20 +1,20 @@ 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 | switch($modx->manager->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']) ? intval($_REQUEST['id']) : 0; |
20 | 20 | // Get table names (alphabetical) |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
31 | 31 | // create globally unique identifiers (guid) |
32 | 32 | function createGUID() { |
33 | - srand((double) microtime() * 1000000); |
|
34 | - $r = rand(); |
|
35 | - $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
|
36 | - $m = md5($u); |
|
37 | - return $m; |
|
33 | + srand((double) microtime() * 1000000); |
|
34 | + $r = rand(); |
|
35 | + $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
|
36 | + $m = md5($u); |
|
37 | + return $m; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | // check to see the module editor isn't locked |
41 | 41 | if($lockedEl = $modx->elementIsLocked(6, $id)) { |
42 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
|
42 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
|
43 | 43 | } |
44 | 44 | // end check for lock |
45 | 45 | |
@@ -47,22 +47,22 @@ discard block |
||
47 | 47 | $modx->lockElement(6, $id); |
48 | 48 | |
49 | 49 | if(isset($_GET['id'])) { |
50 | - $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'"); |
|
51 | - $content = $modx->db->getRow($rs); |
|
52 | - if(!$content) { |
|
53 | - $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
54 | - } |
|
55 | - $content['properties'] = str_replace("&", "&", $content['properties']); |
|
56 | - $_SESSION['itemname'] = $content['name']; |
|
57 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
58 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
59 | - } |
|
50 | + $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'"); |
|
51 | + $content = $modx->db->getRow($rs); |
|
52 | + if(!$content) { |
|
53 | + $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
54 | + } |
|
55 | + $content['properties'] = str_replace("&", "&", $content['properties']); |
|
56 | + $_SESSION['itemname'] = $content['name']; |
|
57 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
58 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
59 | + } |
|
60 | 60 | } else { |
61 | - $_SESSION['itemname'] = $_lang["new_module"]; |
|
62 | - $content['wrap'] = '1'; |
|
61 | + $_SESSION['itemname'] = $_lang["new_module"]; |
|
62 | + $content['wrap'] = '1'; |
|
63 | 63 | } |
64 | 64 | if($modx->manager->hasFormValues()) { |
65 | - $modx->manager->loadFormValues(); |
|
65 | + $modx->manager->loadFormValues(); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // Add lock-element JS-Script |
@@ -433,18 +433,18 @@ discard block |
||
433 | 433 | |
434 | 434 | <form name="mutate" id="mutate" class="module" method="post" action="index.php?a=109"> |
435 | 435 | <?php |
436 | - // invoke OnModFormPrerender event |
|
437 | - $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
|
438 | - if(is_array($evtOut)) { |
|
439 | - echo implode('', $evtOut); |
|
440 | - } |
|
441 | - |
|
442 | - // Prepare internal params & info-tab via parseDocBlock |
|
443 | - $modulecode = isset($content['modulecode']) ? $modx->db->escape($content['modulecode']) : ''; |
|
444 | - $docBlock = $modx->parseDocBlockFromString($modulecode); |
|
445 | - $docBlockList = $modx->convertDocBlockIntoList($docBlock); |
|
446 | - $internal = array(); |
|
447 | - ?> |
|
436 | + // invoke OnModFormPrerender event |
|
437 | + $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
|
438 | + if(is_array($evtOut)) { |
|
439 | + echo implode('', $evtOut); |
|
440 | + } |
|
441 | + |
|
442 | + // Prepare internal params & info-tab via parseDocBlock |
|
443 | + $modulecode = isset($content['modulecode']) ? $modx->db->escape($content['modulecode']) : ''; |
|
444 | + $docBlock = $modx->parseDocBlockFromString($modulecode); |
|
445 | + $docBlockList = $modx->convertDocBlockIntoList($docBlock); |
|
446 | + $internal = array(); |
|
447 | + ?> |
|
448 | 448 | <input type="hidden" name="id" value="<?= $content['id'] ?>"> |
449 | 449 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
450 | 450 | |
@@ -497,11 +497,11 @@ discard block |
||
497 | 497 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
498 | 498 | <option> </option> |
499 | 499 | <?php |
500 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
501 | - foreach(getCategories() as $n => $v) { |
|
502 | - echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
503 | - } |
|
504 | - ?> |
|
500 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
501 | + foreach(getCategories() as $n => $v) { |
|
502 | + echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
|
503 | + } |
|
504 | + ?> |
|
505 | 505 | </select> |
506 | 506 | </div> |
507 | 507 | </div> |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | <i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang['manage_depends'] ?></a> |
609 | 609 | </div> |
610 | 610 | <?php |
611 | - $ds = $modx->db->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name, |
|
611 | + $ds = $modx->db->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name, |
|
612 | 612 | CASE smd.type |
613 | 613 | WHEN 10 THEN 'Chunk' |
614 | 614 | WHEN 20 THEN 'Document' |
@@ -624,17 +624,17 @@ discard block |
||
624 | 624 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = 50 |
625 | 625 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = 60", "smd.module='{$id}'", 'smd.type,name'); |
626 | 626 | |
627 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
628 | - $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
629 | - $grd->noRecordMsg = $_lang['no_records_found']; |
|
630 | - $grd->cssClass = 'grid'; |
|
631 | - $grd->columnHeaderClass = 'gridHeader'; |
|
632 | - $grd->itemClass = 'gridItem'; |
|
633 | - $grd->altItemClass = 'gridAltItem'; |
|
634 | - $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
635 | - $grd->fields = "name,type"; |
|
636 | - echo $grd->render(); |
|
637 | - ?> |
|
627 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
628 | + $grd = new DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
629 | + $grd->noRecordMsg = $_lang['no_records_found']; |
|
630 | + $grd->cssClass = 'grid'; |
|
631 | + $grd->columnHeaderClass = 'gridHeader'; |
|
632 | + $grd->itemClass = 'gridItem'; |
|
633 | + $grd->altItemClass = 'gridAltItem'; |
|
634 | + $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
635 | + $grd->fields = "name,type"; |
|
636 | + echo $grd->render(); |
|
637 | + ?> |
|
638 | 638 | </div> |
639 | 639 | </div> |
640 | 640 | <?php endif; ?> |
@@ -646,12 +646,12 @@ discard block |
||
646 | 646 | <div class="container container-body"> |
647 | 647 | <?php if($use_udperms == 1) : ?> |
648 | 648 | <?php |
649 | - // fetch user access permissions for the module |
|
650 | - $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
|
651 | - $groupsarray = $modx->db->getColumn('usergroup', $rs); |
|
649 | + // fetch user access permissions for the module |
|
650 | + $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
|
651 | + $groupsarray = $modx->db->getColumn('usergroup', $rs); |
|
652 | 652 | |
653 | - if($modx->hasPermission('access_permissions')) { |
|
654 | - ?> |
|
653 | + if($modx->hasPermission('access_permissions')) { |
|
654 | + ?> |
|
655 | 655 | <!-- User Group Access Permissions --> |
656 | 656 | <script type="text/javascript"> |
657 | 657 | function makePublic(b) { |
@@ -675,28 +675,28 @@ discard block |
||
675 | 675 | </script> |
676 | 676 | <p><?= $_lang['module_group_access_msg'] ?></p> |
677 | 677 | <?php |
678 | - } |
|
679 | - $chk = ''; |
|
680 | - $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name'); |
|
681 | - while($row = $modx->db->getRow($rs)) { |
|
682 | - $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
|
683 | - $checked = in_array($row['id'], $groupsarray); |
|
684 | - if($modx->hasPermission('access_permissions')) { |
|
685 | - if($checked) { |
|
686 | - $notPublic = true; |
|
687 | - } |
|
688 | - $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
689 | - } else { |
|
690 | - if($checked) { |
|
691 | - $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
692 | - } |
|
693 | - } |
|
694 | - } |
|
695 | - if($modx->hasPermission('access_permissions')) { |
|
696 | - $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
697 | - } |
|
698 | - echo $chks; |
|
699 | - ?> |
|
678 | + } |
|
679 | + $chk = ''; |
|
680 | + $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name'); |
|
681 | + while($row = $modx->db->getRow($rs)) { |
|
682 | + $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
|
683 | + $checked = in_array($row['id'], $groupsarray); |
|
684 | + if($modx->hasPermission('access_permissions')) { |
|
685 | + if($checked) { |
|
686 | + $notPublic = true; |
|
687 | + } |
|
688 | + $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
689 | + } else { |
|
690 | + if($checked) { |
|
691 | + $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
692 | + } |
|
693 | + } |
|
694 | + } |
|
695 | + if($modx->hasPermission('access_permissions')) { |
|
696 | + $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
697 | + } |
|
698 | + echo $chks; |
|
699 | + ?> |
|
700 | 700 | <?php endif; ?> |
701 | 701 | </div> |
702 | 702 | </div> |
@@ -712,11 +712,11 @@ discard block |
||
712 | 712 | |
713 | 713 | <input type="submit" name="save" style="display:none;"> |
714 | 714 | <?php |
715 | - // invoke OnModFormRender event |
|
716 | - $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
|
717 | - if(is_array($evtOut)) { |
|
718 | - echo implode('', $evtOut); |
|
719 | - } |
|
720 | - ?> |
|
715 | + // invoke OnModFormRender event |
|
716 | + $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
|
717 | + if(is_array($evtOut)) { |
|
718 | + echo implode('', $evtOut); |
|
719 | + } |
|
720 | + ?> |
|
721 | 721 | </form> |
722 | 722 | <script type="text/javascript">setTimeout('showParameters();', 10);</script> |
@@ -1,21 +1,21 @@ 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 | |
6 | 6 | switch($modx->manager->action) { |
7 | - case 16: |
|
8 | - if(!$modx->hasPermission('edit_template')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 19: |
|
13 | - if(!$modx->hasPermission('new_template')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 16: |
|
8 | + if(!$modx->hasPermission('edit_template')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 19: |
|
13 | + if(!$modx->hasPermission('new_template')) { |
|
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 | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | // check to see the snippet editor isn't locked |
26 | 26 | if($lockedEl = $modx->elementIsLocked(1, $id)) { |
27 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
27 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template'])); |
|
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
@@ -33,23 +33,23 @@ discard block |
||
33 | 33 | |
34 | 34 | $content = array(); |
35 | 35 | if(!empty($id)) { |
36 | - $rs = $modx->db->select('*', $tbl_site_templates, "id='{$id}'"); |
|
37 | - $content = $modx->db->getRow($rs); |
|
38 | - if(!$content) { |
|
39 | - $modx->webAlertAndQuit("No database record has been found for this template."); |
|
40 | - } |
|
41 | - |
|
42 | - $_SESSION['itemname'] = $content['templatename']; |
|
43 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
44 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
45 | - } |
|
36 | + $rs = $modx->db->select('*', $tbl_site_templates, "id='{$id}'"); |
|
37 | + $content = $modx->db->getRow($rs); |
|
38 | + if(!$content) { |
|
39 | + $modx->webAlertAndQuit("No database record has been found for this template."); |
|
40 | + } |
|
41 | + |
|
42 | + $_SESSION['itemname'] = $content['templatename']; |
|
43 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
44 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
45 | + } |
|
46 | 46 | } else { |
47 | - $_SESSION['itemname'] = $_lang["new_template"]; |
|
48 | - $content['category'] = intval($_REQUEST['catid']); |
|
47 | + $_SESSION['itemname'] = $_lang["new_template"]; |
|
48 | + $content['category'] = intval($_REQUEST['catid']); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if($modx->manager->hasFormValues()) { |
52 | - $modx->manager->loadFormValues(); |
|
52 | + $modx->manager->loadFormValues(); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $content = array_merge($content, $_POST); |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | |
99 | 99 | <form name="mutate" method="post" action="index.php"> |
100 | 100 | <?php |
101 | - // invoke OnTempFormPrerender event |
|
102 | - $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
103 | - if(is_array($evtOut)) { |
|
104 | - echo implode("", $evtOut); |
|
105 | - } |
|
106 | - ?> |
|
101 | + // invoke OnTempFormPrerender event |
|
102 | + $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id)); |
|
103 | + if(is_array($evtOut)) { |
|
104 | + echo implode("", $evtOut); |
|
105 | + } |
|
106 | + ?> |
|
107 | 107 | <input type="hidden" name="a" value="20"> |
108 | 108 | <input type="hidden" name="id" value="<?= $_REQUEST['id'] ?>"> |
109 | 109 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>"> |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | <label class="col-md-3 col-lg-2"> |
134 | 134 | <?= $_lang['template_name'] ?> |
135 | 135 | <?php if($id == $modx->config['default_template']) { |
136 | - echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
137 | - } ?> |
|
136 | + echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>'; |
|
137 | + } ?> |
|
138 | 138 | </label> |
139 | 139 | <div class="col-md-9 col-lg-10"> |
140 | 140 | <div class="form-control-name clearfix"> |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
163 | 163 | <option> </option> |
164 | 164 | <?php |
165 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
166 | - foreach(getCategories() as $n => $v) { |
|
167 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
168 | - } |
|
169 | - ?> |
|
165 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
166 | + foreach(getCategories() as $n => $v) { |
|
167 | + echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
168 | + } |
|
169 | + ?> |
|
170 | 170 | </select> |
171 | 171 | </div> |
172 | 172 | </div> |
@@ -197,38 +197,38 @@ discard block |
||
197 | 197 | <input type="submit" name="save" style="display:none"> |
198 | 198 | |
199 | 199 | <?php |
200 | - $selectedTvs = array(); |
|
201 | - if(!isset($_POST['assignedTv'])) { |
|
202 | - $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
200 | + $selectedTvs = array(); |
|
201 | + if(!isset($_POST['assignedTv'])) { |
|
202 | + $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv |
|
203 | 203 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
204 | 204 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getFullTableName('site_tmplvars'), $modx->getFullTableName('site_tmplvar_templates'), $modx->getFullTableName('categories')), "templateid='{$id}'", "tr.rank DESC, tv.rank DESC, tvcaption DESC, tvid DESC" // workaround for correct sort of none-existing ranks |
205 | - ); |
|
206 | - while($row = $modx->db->getRow($rs)) { |
|
207 | - $selectedTvs[$row['tvid']] = $row; |
|
208 | - } |
|
209 | - $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
210 | - } |
|
211 | - |
|
212 | - $unselectedTvs = array(); |
|
213 | - $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
205 | + ); |
|
206 | + while($row = $modx->db->getRow($rs)) { |
|
207 | + $selectedTvs[$row['tvid']] = $row; |
|
208 | + } |
|
209 | + $selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC |
|
210 | + } |
|
211 | + |
|
212 | + $unselectedTvs = array(); |
|
213 | + $rs = $modx->db->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv |
|
214 | 214 | LEFT JOIN %s tr ON tv.id=tr.tmplvarid |
215 | 215 | LEFT JOIN %s cat ON tv.category=cat.id", $modx->getFullTableName('site_tmplvars'), $modx->getFullTableName('site_tmplvar_templates'), $modx->getFullTableName('categories')), "", "category, tvcaption"); |
216 | - while($row = $modx->db->getRow($rs)) { |
|
217 | - $unselectedTvs[$row['tvid']] = $row; |
|
218 | - } |
|
219 | - |
|
220 | - // Catch checkboxes if form not validated |
|
221 | - if(isset($_POST['assignedTv'])) { |
|
222 | - $selectedTvs = array(); |
|
223 | - foreach($_POST['assignedTv'] as $tvid) { |
|
224 | - if(isset($unselectedTvs[$tvid])) { |
|
225 | - $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
226 | - } |
|
227 | - }; |
|
228 | - } |
|
229 | - |
|
230 | - $total = count($selectedTvs); |
|
231 | - ?> |
|
216 | + while($row = $modx->db->getRow($rs)) { |
|
217 | + $unselectedTvs[$row['tvid']] = $row; |
|
218 | + } |
|
219 | + |
|
220 | + // Catch checkboxes if form not validated |
|
221 | + if(isset($_POST['assignedTv'])) { |
|
222 | + $selectedTvs = array(); |
|
223 | + foreach($_POST['assignedTv'] as $tvid) { |
|
224 | + if(isset($unselectedTvs[$tvid])) { |
|
225 | + $selectedTvs[$tvid] = $unselectedTvs[$tvid]; |
|
226 | + } |
|
227 | + }; |
|
228 | + } |
|
229 | + |
|
230 | + $total = count($selectedTvs); |
|
231 | + ?> |
|
232 | 232 | </div> |
233 | 233 | |
234 | 234 | <div class="tab-page" id="tabAssignedTVs"> |
@@ -238,65 +238,65 @@ discard block |
||
238 | 238 | |
239 | 239 | <div class="container container-body"> |
240 | 240 | <?php |
241 | - if($total > 0) { |
|
242 | - echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
243 | - } |
|
244 | - if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
245 | - echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
246 | - } |
|
247 | - |
|
248 | - // Selected TVs |
|
249 | - $tvList = ''; |
|
250 | - if($total > 0) { |
|
251 | - $tvList .= '<ul>'; |
|
252 | - foreach($selectedTvs as $row) { |
|
253 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
254 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
255 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
256 | - } |
|
257 | - $tvList .= '</ul>'; |
|
258 | - |
|
259 | - } else { |
|
260 | - echo $_lang['template_no_tv']; |
|
261 | - } |
|
262 | - echo $tvList; |
|
263 | - |
|
264 | - // Unselected TVs |
|
265 | - $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
266 | - $preCat = ''; |
|
267 | - $insideUl = 0; |
|
268 | - while($row = array_shift($unselectedTvs)) { |
|
269 | - if(isset($selectedTvs[$row['tvid']])) { |
|
270 | - continue; |
|
271 | - } // Skip selected |
|
272 | - $row['category'] = stripslashes($row['category']); //pixelchutes |
|
273 | - if($preCat !== $row['category']) { |
|
274 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
275 | - $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
276 | - $insideUl = 1; |
|
277 | - } |
|
278 | - |
|
279 | - $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
280 | - $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
281 | - $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
282 | - $tvList .= '</li>'; |
|
283 | - |
|
284 | - $preCat = $row['category']; |
|
285 | - } |
|
286 | - $tvList .= $insideUl ? '</ul>' : ''; |
|
287 | - $tvList .= '</ul>'; |
|
288 | - echo $tvList; |
|
289 | - |
|
290 | - ?> |
|
241 | + if($total > 0) { |
|
242 | + echo '<p>' . $_lang['template_tv_msg'] . '</p>'; |
|
243 | + } |
|
244 | + if($modx->hasPermission('save_template') && $total > 1 && $id) { |
|
245 | + echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&id=%s">%s</a></div>', $id, $_lang['template_tv_edit']); |
|
246 | + } |
|
247 | + |
|
248 | + // Selected TVs |
|
249 | + $tvList = ''; |
|
250 | + if($total > 0) { |
|
251 | + $tvList .= '<ul>'; |
|
252 | + foreach($selectedTvs as $row) { |
|
253 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
254 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
255 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
256 | + } |
|
257 | + $tvList .= '</ul>'; |
|
258 | + |
|
259 | + } else { |
|
260 | + echo $_lang['template_no_tv']; |
|
261 | + } |
|
262 | + echo $tvList; |
|
263 | + |
|
264 | + // Unselected TVs |
|
265 | + $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>'; |
|
266 | + $preCat = ''; |
|
267 | + $insideUl = 0; |
|
268 | + while($row = array_shift($unselectedTvs)) { |
|
269 | + if(isset($selectedTvs[$row['tvid']])) { |
|
270 | + continue; |
|
271 | + } // Skip selected |
|
272 | + $row['category'] = stripslashes($row['category']); //pixelchutes |
|
273 | + if($preCat !== $row['category']) { |
|
274 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
275 | + $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
276 | + $insideUl = 1; |
|
277 | + } |
|
278 | + |
|
279 | + $desc = !empty($row['tvdescription']) ? ' <small>(' . $row['tvdescription'] . ')</small>' : ''; |
|
280 | + $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : ""; |
|
281 | + $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->manager->action, $id, $_lang['edit']); |
|
282 | + $tvList .= '</li>'; |
|
283 | + |
|
284 | + $preCat = $row['category']; |
|
285 | + } |
|
286 | + $tvList .= $insideUl ? '</ul>' : ''; |
|
287 | + $tvList .= '</ul>'; |
|
288 | + echo $tvList; |
|
289 | + |
|
290 | + ?> |
|
291 | 291 | </div> |
292 | 292 | </div> |
293 | 293 | |
294 | 294 | <?php |
295 | - // invoke OnTempFormRender event |
|
296 | - $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
297 | - if(is_array($evtOut)) { |
|
298 | - echo implode("", $evtOut); |
|
299 | - } |
|
300 | - ?> |
|
295 | + // invoke OnTempFormRender event |
|
296 | + $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id)); |
|
297 | + if(is_array($evtOut)) { |
|
298 | + echo implode("", $evtOut); |
|
299 | + } |
|
300 | + ?> |
|
301 | 301 | </div> |
302 | 302 | </form> |
@@ -1,32 +1,32 @@ 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('web_access_permissions')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | // find all document groups, for the select :) |
10 | 10 | $rs = $modx->db->select('*', $modx->getFullTableName('documentgroup_names'), '', 'name'); |
11 | 11 | if($modx->db->getRecordCount($rs) < 1) { |
12 | - $docgroupselector = "[no groups to add]"; |
|
12 | + $docgroupselector = "[no groups to add]"; |
|
13 | 13 | } else { |
14 | - $docgroupselector = '<select name="docgroup">' . "\n"; |
|
15 | - while($row = $modx->db->getRow($rs)) { |
|
16 | - $docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
17 | - } |
|
18 | - $docgroupselector .= "</select>\n"; |
|
14 | + $docgroupselector = '<select name="docgroup">' . "\n"; |
|
15 | + while($row = $modx->db->getRow($rs)) { |
|
16 | + $docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
17 | + } |
|
18 | + $docgroupselector .= "</select>\n"; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $rs = $modx->db->select('*', $modx->getFullTableName('webgroup_names'), '', 'name'); |
22 | 22 | if($modx->db->getRecordCount($rs) < 1) { |
23 | - $usrgroupselector = '[no user groups]'; |
|
23 | + $usrgroupselector = '[no user groups]'; |
|
24 | 24 | } else { |
25 | - $usrgroupselector = '<select name="usergroup">' . "\n"; |
|
26 | - while($row = $modx->db->getRow($rs)) { |
|
27 | - $usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
28 | - } |
|
29 | - $usrgroupselector .= "</select>\n"; |
|
25 | + $usrgroupselector = '<select name="usergroup">' . "\n"; |
|
26 | + while($row = $modx->db->getRow($rs)) { |
|
27 | + $usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n"; |
|
28 | + } |
|
29 | + $usrgroupselector .= "</select>\n"; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | ?> |
@@ -88,24 +88,24 @@ discard block |
||
88 | 88 | </form> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - $rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name ', $modx->getFullTableName('webgroup_names') . " AS groupnames |
|
91 | + $rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name ', $modx->getFullTableName('webgroup_names') . " AS groupnames |
|
92 | 92 | LEFT JOIN " . $modx->getFullTableName('web_groups') . " AS groups ON groups.webgroup = groupnames.id |
93 | 93 | LEFT JOIN " . $modx->getFullTableName('web_users') . " AS users ON users.id = groups.webuser", '', 'groupnames.name, user_name'); |
94 | - if($modx->db->getRecordCount($rs) < 1) { |
|
95 | - ?> |
|
94 | + if($modx->db->getRecordCount($rs) < 1) { |
|
95 | + ?> |
|
96 | 96 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
97 | 97 | <?php |
98 | - } else { |
|
99 | - ?> |
|
98 | + } else { |
|
99 | + ?> |
|
100 | 100 | <div class="form-group"> |
101 | 101 | <?php |
102 | - $pid = ''; |
|
103 | - while($row = $modx->db->getRow($rs)) { |
|
104 | - if($pid != $row['id']) { |
|
105 | - if($pid != '') { |
|
106 | - echo '</div><div class="form-group">'; |
|
107 | - } |
|
108 | - ?> |
|
102 | + $pid = ''; |
|
103 | + while($row = $modx->db->getRow($rs)) { |
|
104 | + if($pid != $row['id']) { |
|
105 | + if($pid != '') { |
|
106 | + echo '</div><div class="form-group">'; |
|
107 | + } |
|
108 | + ?> |
|
109 | 109 | <form method="post" action="index.php" name="accesspermissions"> |
110 | 110 | <input type="hidden" name="a" value="92" /> |
111 | 111 | <input type="hidden" name="groupid" value="<?= $row['id'] ?>" /> |
@@ -120,21 +120,21 @@ discard block |
||
120 | 120 | </form> |
121 | 121 | <?= $_lang['web_access_permissions_users_in_group'] ?> |
122 | 122 | <?php |
123 | - } |
|
124 | - if(!$row['user_id']) { |
|
125 | - ?> |
|
123 | + } |
|
124 | + if(!$row['user_id']) { |
|
125 | + ?> |
|
126 | 126 | <i><?= $_lang['access_permissions_no_users_in_group'] ?></i> |
127 | 127 | <?php |
128 | - $pid = $row['id']; |
|
129 | - continue; |
|
130 | - } |
|
131 | - ?> |
|
128 | + $pid = $row['id']; |
|
129 | + continue; |
|
130 | + } |
|
131 | + ?> |
|
132 | 132 | <?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=88&id=<?= $row['user_id'] ?>"><?= $row['user_name'] ?></a> |
133 | 133 | <?php |
134 | - $pid = $row['id']; |
|
135 | - } |
|
136 | - } |
|
137 | - ?> |
|
134 | + $pid = $row['id']; |
|
135 | + } |
|
136 | + } |
|
137 | + ?> |
|
138 | 138 | </div> |
139 | 139 | </div> |
140 | 140 | </div> |
@@ -159,24 +159,24 @@ discard block |
||
159 | 159 | </form> |
160 | 160 | </div> |
161 | 161 | <?php |
162 | - $rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $modx->getFullTableName('documentgroup_names') . " AS dgnames |
|
162 | + $rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $modx->getFullTableName('documentgroup_names') . " AS dgnames |
|
163 | 163 | LEFT JOIN " . $modx->getFullTableName('document_groups') . " AS dg ON dg.document_group = dgnames.id |
164 | 164 | LEFT JOIN " . $modx->getFullTableName('site_content') . " AS sc ON sc.id = dg.document", '', 'dgnames.name, sc.id'); |
165 | - if($modx->db->getRecordCount($rs) < 1) { |
|
166 | - ?> |
|
165 | + if($modx->db->getRecordCount($rs) < 1) { |
|
166 | + ?> |
|
167 | 167 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
168 | 168 | <?php |
169 | - } else { |
|
170 | - ?> |
|
169 | + } else { |
|
170 | + ?> |
|
171 | 171 | <div class="form-group"> |
172 | 172 | <?php |
173 | - $pid = ''; |
|
174 | - while($row = $modx->db->getRow($rs)) { |
|
175 | - if($pid != $row['id']) { |
|
176 | - if($pid != '') { |
|
177 | - echo '</div><div class="form-group">'; |
|
178 | - } |
|
179 | - ?> |
|
173 | + $pid = ''; |
|
174 | + while($row = $modx->db->getRow($rs)) { |
|
175 | + if($pid != $row['id']) { |
|
176 | + if($pid != '') { |
|
177 | + echo '</div><div class="form-group">'; |
|
178 | + } |
|
179 | + ?> |
|
180 | 180 | <form method="post" action="index.php" name="accesspermissions"> |
181 | 181 | <input type="hidden" name="a" value="92" /> |
182 | 182 | <input type="hidden" name="groupid" value="<?= $row['id'] ?>" /> |
@@ -191,21 +191,21 @@ discard block |
||
191 | 191 | </form> |
192 | 192 | <?= $_lang['access_permissions_resources_in_group'] ?> |
193 | 193 | <?php |
194 | - } |
|
195 | - if(!$row['doc_id']) { |
|
196 | - ?> |
|
194 | + } |
|
195 | + if(!$row['doc_id']) { |
|
196 | + ?> |
|
197 | 197 | <i><?= $_lang['access_permissions_no_resources_in_group'] ?></i> |
198 | 198 | <?php |
199 | - $pid = $row['id']; |
|
200 | - continue; |
|
201 | - } |
|
202 | - ?> |
|
199 | + $pid = $row['id']; |
|
200 | + continue; |
|
201 | + } |
|
202 | + ?> |
|
203 | 203 | <?= ($pid == $row['id'] ? ', ' : '') ?><a href="index.php?a=3&id=<?= $row['doc_id'] ?>" title="<?= $modx->htmlspecialchars($row['doc_title']) ?>"><?= $row['doc_id'] ?></a> |
204 | 204 | <?php |
205 | - $pid = $row['id']; |
|
206 | - } |
|
207 | - } |
|
208 | - ?> |
|
205 | + $pid = $row['id']; |
|
206 | + } |
|
207 | + } |
|
208 | + ?> |
|
209 | 209 | </div> |
210 | 210 | </div> |
211 | 211 | </div> |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | <div class="container container-body"> |
218 | 218 | <p class="element-edit-message-tab alert alert-warning"><?= $_lang['access_permissions_links_tab'] ?></p> |
219 | 219 | <?php |
220 | - $rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $modx->getFullTableName('webgroup_names') . " AS groupnames |
|
220 | + $rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $modx->getFullTableName('webgroup_names') . " AS groupnames |
|
221 | 221 | LEFT JOIN " . $modx->getFullTableName('webgroup_access') . " AS groupacc ON groupacc.webgroup = groupnames.id |
222 | 222 | LEFT JOIN " . $modx->getFullTableName('documentgroup_names') . " AS dgnames ON dgnames.id = groupacc.documentgroup", '', 'name, dg_name'); |
223 | - if($modx->db->getRecordCount($rs) < 1) { |
|
224 | - ?> |
|
223 | + if($modx->db->getRecordCount($rs) < 1) { |
|
224 | + ?> |
|
225 | 225 | <div class="text-danger"><?= $_lang['no_groups_found'] ?></div> |
226 | 226 | <?php |
227 | - } else { |
|
228 | - ?> |
|
227 | + } else { |
|
228 | + ?> |
|
229 | 229 | <div class="form-group"> |
230 | 230 | <b><?= $_lang["access_permissions_group_link"] ?></b> |
231 | 231 | <form method="post" action="index.php" name="accesspermissions"> |
@@ -241,38 +241,38 @@ discard block |
||
241 | 241 | <hr> |
242 | 242 | <ul> |
243 | 243 | <?php |
244 | - $pid = ''; |
|
245 | - while($row = $modx->db->getRow($rs)) { |
|
246 | - if($row['id'] != $pid) { |
|
247 | - if($pid != '') { |
|
248 | - echo '</ul></li>'; |
|
249 | - } // close previous one |
|
250 | - ?> |
|
244 | + $pid = ''; |
|
245 | + while($row = $modx->db->getRow($rs)) { |
|
246 | + if($row['id'] != $pid) { |
|
247 | + if($pid != '') { |
|
248 | + echo '</ul></li>'; |
|
249 | + } // close previous one |
|
250 | + ?> |
|
251 | 251 | <li><b><?= $row['name'] ?></b></li> |
252 | 252 | <?php |
253 | - if(!$row['dg_id']) { |
|
254 | - echo '<i>' . $_lang['no_groups_found'] . '</i></li>'; |
|
255 | - $pid = ''; |
|
256 | - continue; |
|
257 | - } else { |
|
258 | - echo '<ul>'; |
|
259 | - } |
|
260 | - } |
|
261 | - if(!$row['dg_id']) { |
|
262 | - continue; |
|
263 | - } |
|
264 | - ?> |
|
253 | + if(!$row['dg_id']) { |
|
254 | + echo '<i>' . $_lang['no_groups_found'] . '</i></li>'; |
|
255 | + $pid = ''; |
|
256 | + continue; |
|
257 | + } else { |
|
258 | + echo '<ul>'; |
|
259 | + } |
|
260 | + } |
|
261 | + if(!$row['dg_id']) { |
|
262 | + continue; |
|
263 | + } |
|
264 | + ?> |
|
265 | 265 | <li><?= $row['dg_name'] ?> |
266 | 266 | <small><i>(<a class="text-danger" href="index.php?a=92&coupling=<?= $row['link_id'] ?>&operation=remove_document_group_from_user_group"><?= $_lang['remove'] ?></a>)</i></small> |
267 | 267 | </li> |
268 | 268 | <?php |
269 | - $pid = $row['id']; |
|
270 | - } |
|
271 | - ?> |
|
269 | + $pid = $row['id']; |
|
270 | + } |
|
271 | + ?> |
|
272 | 272 | </ul> |
273 | 273 | <?php |
274 | - } |
|
275 | - ?> |
|
274 | + } |
|
275 | + ?> |
|
276 | 276 | </div> |
277 | 277 | </div> |
278 | 278 |
@@ -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('edit_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | ?> |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | <div class="form-group"><?= $_lang['role_management_msg'] ?> <a class="btn btn-secondary btn-sm" href="index.php?a=38"><i class="<?= $_style["actions_new"] ?> hide4desktop"></i> <?= $_lang['new_role'] ?></a></div> |
19 | 19 | <div class="form-group"> |
20 | 20 | <?php |
21 | - $rs = $modx->db->select('name, id, description', $modx->getFullTableName('user_roles'), '', 'name'); |
|
22 | - $limit = $modx->db->getRecordCount($rs); |
|
23 | - if($limit < 1) { |
|
24 | - ?> |
|
21 | + $rs = $modx->db->select('name, id, description', $modx->getFullTableName('user_roles'), '', 'name'); |
|
22 | + $limit = $modx->db->getRecordCount($rs); |
|
23 | + if($limit < 1) { |
|
24 | + ?> |
|
25 | 25 | <p><?= $_lang["no_records_found"] ?></p> |
26 | 26 | <?php |
27 | - } else { |
|
28 | - ?> |
|
27 | + } else { |
|
28 | + ?> |
|
29 | 29 | <div class="row"> |
30 | 30 | <div class="table-responsive"> |
31 | 31 | <table class="table data"> |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | </thead> |
38 | 38 | <tbody> |
39 | 39 | <?php |
40 | - while($row = $modx->db->getRow($rs)) { |
|
41 | - if($row['id'] == 1) { |
|
42 | - ?> |
|
40 | + while($row = $modx->db->getRow($rs)) { |
|
41 | + if($row['id'] == 1) { |
|
42 | + ?> |
|
43 | 43 | <tr class="text-muted disabled"> |
44 | 44 | <td><b><?= $row['name'] ?></b></td> |
45 | 45 | <td><span><?= $_lang['administrator_role_message'] ?></span></td> |
46 | 46 | </tr> |
47 | 47 | <?php |
48 | - } else { |
|
49 | - ?> |
|
48 | + } else { |
|
49 | + ?> |
|
50 | 50 | <tr> |
51 | 51 | <td><a class="text-primary" href="index.php?id=<?= $row['id'] ?>&a=35"><?= $row['name'] ?></a></td> |
52 | 52 | <td><?= $row['description'] ?></td> |
53 | 53 | </tr> |
54 | 54 | <?php |
55 | - } |
|
56 | - } |
|
57 | - ?> |
|
55 | + } |
|
56 | + } |
|
57 | + ?> |
|
58 | 58 | </tbody> |
59 | 59 | </table> |
60 | 60 | </div> |