@@ -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> |
@@ -4,24 +4,24 @@ discard block |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | if(!$modx->hasPermission('category_manager')) { |
7 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | $_module_params = array( |
11 | - 'module_version' => '1.0.0', |
|
12 | - 'module_params' => '', |
|
13 | - 'module_id' => $_GET['id'], |
|
14 | - 'package_name' => 'Module_Categories_Manager', |
|
15 | - 'native_language' => 'de', |
|
16 | - 'name' => 'Categories Manager', |
|
17 | - 'dirname' => $site_manager_url, |
|
18 | - 'url' => 'index.php?a=120&id=' . $_GET['id'], |
|
19 | - 'path' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR, |
|
20 | - 'inc_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR, |
|
21 | - 'languages_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR, |
|
22 | - 'views_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'skin' . DIRECTORY_SEPARATOR, |
|
23 | - 'request_key' => 'module_categories_manager', |
|
24 | - 'messages' => array() |
|
11 | + 'module_version' => '1.0.0', |
|
12 | + 'module_params' => '', |
|
13 | + 'module_id' => $_GET['id'], |
|
14 | + 'package_name' => 'Module_Categories_Manager', |
|
15 | + 'native_language' => 'de', |
|
16 | + 'name' => 'Categories Manager', |
|
17 | + 'dirname' => $site_manager_url, |
|
18 | + 'url' => 'index.php?a=120&id=' . $_GET['id'], |
|
19 | + 'path' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR, |
|
20 | + 'inc_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR, |
|
21 | + 'languages_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR, |
|
22 | + 'views_dir' => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'skin' . DIRECTORY_SEPARATOR, |
|
23 | + 'request_key' => 'module_categories_manager', |
|
24 | + 'messages' => array() |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | require_once $_module_params['inc_dir'] . 'Module_Categories_Manager.php'; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | // assign module_params to internal params |
31 | 31 | foreach( $_module_params as $param => $value ) |
32 | 32 | { |
33 | - $cm->set( $param, $value ); |
|
33 | + $cm->set( $param, $value ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | // catch the request actions |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | |
39 | 39 | if( !$categories = $cm->getCategories() ) |
40 | 40 | { |
41 | - setcookie('webfxtab_manage-categories-pane', 0 ); |
|
42 | - $cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' ); |
|
41 | + setcookie('webfxtab_manage-categories-pane', 0 ); |
|
42 | + $cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $cm->renderView('main', $categories ); |
@@ -1,6 +1,6 @@ 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 | /********************/ |
@@ -12,30 +12,30 @@ discard block |
||
12 | 12 | |
13 | 13 | // check permissions |
14 | 14 | switch($modx->manager->action) { |
15 | - case 27: |
|
16 | - if(!$modx->hasPermission('edit_document')) { |
|
17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | - } |
|
19 | - break; |
|
20 | - case 85: |
|
21 | - case 72: |
|
22 | - case 4: |
|
23 | - if(!$modx->hasPermission('new_document')) { |
|
24 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | - // check user has permissions for parent |
|
27 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
28 | - $udperms = new udperms(); |
|
29 | - $udperms->user = $modx->getLoginUserID(); |
|
30 | - $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
31 | - $udperms->role = $_SESSION['mgrRole']; |
|
32 | - if(!$udperms->checkPermissions()) { |
|
33 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
34 | - } |
|
35 | - } |
|
36 | - break; |
|
37 | - default: |
|
38 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + case 27: |
|
16 | + if(!$modx->hasPermission('edit_document')) { |
|
17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | + } |
|
19 | + break; |
|
20 | + case 85: |
|
21 | + case 72: |
|
22 | + case 4: |
|
23 | + if(!$modx->hasPermission('new_document')) { |
|
24 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
25 | + } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | + // check user has permissions for parent |
|
27 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
28 | + $udperms = new udperms(); |
|
29 | + $udperms->user = $modx->getLoginUserID(); |
|
30 | + $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
31 | + $udperms->role = $_SESSION['mgrRole']; |
|
32 | + if(!$udperms->checkPermissions()) { |
|
33 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
34 | + } |
|
35 | + } |
|
36 | + break; |
|
37 | + default: |
|
38 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
@@ -54,22 +54,22 @@ discard block |
||
54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
55 | 55 | |
56 | 56 | if($modx->manager->action == 27) { |
57 | - //editing an existing document |
|
58 | - // check permissions on the document |
|
59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
60 | - $udperms = new udperms(); |
|
61 | - $udperms->user = $modx->getLoginUserID(); |
|
62 | - $udperms->document = $id; |
|
63 | - $udperms->role = $_SESSION['mgrRole']; |
|
64 | - |
|
65 | - if(!$udperms->checkPermissions()) { |
|
66 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
67 | - } |
|
57 | + //editing an existing document |
|
58 | + // check permissions on the document |
|
59 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
60 | + $udperms = new udperms(); |
|
61 | + $udperms->user = $modx->getLoginUserID(); |
|
62 | + $udperms->document = $id; |
|
63 | + $udperms->role = $_SESSION['mgrRole']; |
|
64 | + |
|
65 | + if(!$udperms->checkPermissions()) { |
|
66 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // check to see if resource isn't locked |
71 | 71 | if($lockedEl = $modx->elementIsLocked(7, $id)) { |
72 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
72 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
73 | 73 | } |
74 | 74 | // end check for lock |
75 | 75 | |
@@ -78,74 +78,74 @@ discard block |
||
78 | 78 | |
79 | 79 | // get document groups for current user |
80 | 80 | if($_SESSION['mgrDocgroups']) { |
81 | - $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
81 | + $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | if(!empty ($id)) { |
85 | - $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
86 | - if($docgrp) { |
|
87 | - $access .= " OR dg.document_group IN ({$docgrp})"; |
|
88 | - } |
|
89 | - $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
90 | - $content = array(); |
|
91 | - $content = $modx->db->getRow($rs); |
|
92 | - $modx->documentObject = &$content; |
|
93 | - if(!$content) { |
|
94 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
95 | - } |
|
96 | - $_SESSION['itemname'] = $content['pagetitle']; |
|
85 | + $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
86 | + if($docgrp) { |
|
87 | + $access .= " OR dg.document_group IN ({$docgrp})"; |
|
88 | + } |
|
89 | + $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
90 | + $content = array(); |
|
91 | + $content = $modx->db->getRow($rs); |
|
92 | + $modx->documentObject = &$content; |
|
93 | + if(!$content) { |
|
94 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
95 | + } |
|
96 | + $_SESSION['itemname'] = $content['pagetitle']; |
|
97 | 97 | } else { |
98 | - $content = array(); |
|
98 | + $content = array(); |
|
99 | 99 | |
100 | - if(isset($_REQUEST['newtemplate'])) { |
|
101 | - $content['template'] = $_REQUEST['newtemplate']; |
|
102 | - } else { |
|
103 | - $content['template'] = getDefaultTemplate(); |
|
104 | - } |
|
100 | + if(isset($_REQUEST['newtemplate'])) { |
|
101 | + $content['template'] = $_REQUEST['newtemplate']; |
|
102 | + } else { |
|
103 | + $content['template'] = getDefaultTemplate(); |
|
104 | + } |
|
105 | 105 | |
106 | - $_SESSION['itemname'] = $_lang["new_resource"]; |
|
106 | + $_SESSION['itemname'] = $_lang["new_resource"]; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // restore saved form |
110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
111 | 111 | if(isset($_REQUEST['newtemplate'])) { |
112 | - $formRestored = true; |
|
112 | + $formRestored = true; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // retain form values if template was changed |
116 | 116 | // edited to convert pub_date and unpub_date |
117 | 117 | // sottwell 02-09-2006 |
118 | 118 | if($formRestored == true) { |
119 | - $content = array_merge($content, $_POST); |
|
120 | - $content['content'] = $_POST['ta']; |
|
121 | - if(empty ($content['pub_date'])) { |
|
122 | - unset ($content['pub_date']); |
|
123 | - } else { |
|
124 | - $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
125 | - } |
|
126 | - if(empty ($content['unpub_date'])) { |
|
127 | - unset ($content['unpub_date']); |
|
128 | - } else { |
|
129 | - $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
130 | - } |
|
119 | + $content = array_merge($content, $_POST); |
|
120 | + $content['content'] = $_POST['ta']; |
|
121 | + if(empty ($content['pub_date'])) { |
|
122 | + unset ($content['pub_date']); |
|
123 | + } else { |
|
124 | + $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
125 | + } |
|
126 | + if(empty ($content['unpub_date'])) { |
|
127 | + unset ($content['unpub_date']); |
|
128 | + } else { |
|
129 | + $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
130 | + } |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | // increase menu index if this is a new document |
134 | 134 | if(!isset ($_REQUEST['id'])) { |
135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
136 | - $modx->config['auto_menuindex'] = 1; |
|
137 | - } |
|
138 | - if($modx->config['auto_menuindex']) { |
|
139 | - $pid = intval($_REQUEST['pid']); |
|
140 | - $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
141 | - $content['menuindex'] = $modx->db->getValue($rs); |
|
142 | - } else { |
|
143 | - $content['menuindex'] = 0; |
|
144 | - } |
|
135 | + if(!isset ($modx->config['auto_menuindex'])) { |
|
136 | + $modx->config['auto_menuindex'] = 1; |
|
137 | + } |
|
138 | + if($modx->config['auto_menuindex']) { |
|
139 | + $pid = intval($_REQUEST['pid']); |
|
140 | + $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
141 | + $content['menuindex'] = $modx->db->getValue($rs); |
|
142 | + } else { |
|
143 | + $content['menuindex'] = 0; |
|
144 | + } |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | if(isset ($_POST['which_editor'])) { |
148 | - $modx->config['which_editor'] = $_POST['which_editor']; |
|
148 | + $modx->config['which_editor'] = $_POST['which_editor']; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // Add lock-element JS-Script |
@@ -545,23 +545,23 @@ discard block |
||
545 | 545 | |
546 | 546 | <form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;"> |
547 | 547 | <?php |
548 | - // invoke OnDocFormPrerender event |
|
549 | - $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
550 | - 'id' => $id, |
|
551 | - 'template' => $content['template'] |
|
552 | - )); |
|
553 | - |
|
554 | - if(is_array($evtOut)) { |
|
555 | - echo implode('', $evtOut); |
|
556 | - } |
|
557 | - |
|
558 | - /*************************/ |
|
559 | - $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
560 | - $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
561 | - $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
562 | - /*************************/ |
|
563 | - |
|
564 | - ?> |
|
548 | + // invoke OnDocFormPrerender event |
|
549 | + $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
550 | + 'id' => $id, |
|
551 | + 'template' => $content['template'] |
|
552 | + )); |
|
553 | + |
|
554 | + if(is_array($evtOut)) { |
|
555 | + echo implode('', $evtOut); |
|
556 | + } |
|
557 | + |
|
558 | + /*************************/ |
|
559 | + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
560 | + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
561 | + $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
562 | + /*************************/ |
|
563 | + |
|
564 | + ?> |
|
565 | 565 | <input type="hidden" name="a" value="5" /> |
566 | 566 | <input type="hidden" name="id" value="<?= $content['id'] ?>" /> |
567 | 567 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>" /> |
@@ -576,54 +576,54 @@ discard block |
||
576 | 576 | |
577 | 577 | <h1> |
578 | 578 | <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
579 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
580 | - } else { |
|
581 | - if ($modx->manager->action == '4') { |
|
579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
580 | + } else { |
|
581 | + if ($modx->manager->action == '4') { |
|
582 | 582 | echo $_lang['add_resource']; |
583 | 583 | } else if ($modx->manager->action == '72') { |
584 | 584 | echo $_lang['add_weblink']; |
585 | 585 | } else { |
586 | 586 | echo $_lang['create_resource_title']; |
587 | 587 | } |
588 | - } ?> |
|
588 | + } ?> |
|
589 | 589 | </h1> |
590 | 590 | |
591 | 591 | <?= $_style['actionbuttons']['dynamic']['document'] ?> |
592 | 592 | |
593 | 593 | <?php |
594 | - // breadcrumbs |
|
595 | - if($modx->config['use_breadcrumbs']) { |
|
596 | - $temp = array(); |
|
597 | - $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
598 | - |
|
599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
600 | - $bID = (int) $_REQUEST['id']; |
|
601 | - $temp = $modx->getParentIds($bID); |
|
602 | - } else if(isset($_REQUEST['pid'])) { |
|
603 | - $bID = (int) $_REQUEST['pid']; |
|
604 | - $temp = $modx->getParentIds($bID); |
|
605 | - array_unshift($temp, $bID); |
|
606 | - } |
|
607 | - |
|
608 | - if($temp) { |
|
609 | - $parents = implode(',', $temp); |
|
610 | - |
|
611 | - if(!empty($parents)) { |
|
612 | - $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
613 | - $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
614 | - while($row = $modx->db->getRow($rs)) { |
|
615 | - $out .= '<li class="breadcrumbs__li"> |
|
594 | + // breadcrumbs |
|
595 | + if($modx->config['use_breadcrumbs']) { |
|
596 | + $temp = array(); |
|
597 | + $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
598 | + |
|
599 | + if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
600 | + $bID = (int) $_REQUEST['id']; |
|
601 | + $temp = $modx->getParentIds($bID); |
|
602 | + } else if(isset($_REQUEST['pid'])) { |
|
603 | + $bID = (int) $_REQUEST['pid']; |
|
604 | + $temp = $modx->getParentIds($bID); |
|
605 | + array_unshift($temp, $bID); |
|
606 | + } |
|
607 | + |
|
608 | + if($temp) { |
|
609 | + $parents = implode(',', $temp); |
|
610 | + |
|
611 | + if(!empty($parents)) { |
|
612 | + $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
613 | + $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
614 | + while($row = $modx->db->getRow($rs)) { |
|
615 | + $out .= '<li class="breadcrumbs__li"> |
|
616 | 616 | <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
617 | 617 | <span class="breadcrumbs__sep">></span> |
618 | 618 | </li>'; |
619 | - } |
|
620 | - } |
|
621 | - } |
|
619 | + } |
|
620 | + } |
|
621 | + } |
|
622 | 622 | |
623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
625 | - } |
|
626 | - ?> |
|
623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
624 | + echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
625 | + } |
|
626 | + ?> |
|
627 | 627 | |
628 | 628 | <!-- start main wrapper --> |
629 | 629 | <div class="sectionBody"> |
@@ -635,13 +635,13 @@ discard block |
||
635 | 635 | |
636 | 636 | <!-- General --> |
637 | 637 | <?php |
638 | - $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
639 | - 'id' => $id |
|
640 | - )); |
|
641 | - if(is_array($evtOut)) { |
|
642 | - echo implode('', $evtOut); |
|
643 | - } else { |
|
644 | - ?> |
|
638 | + $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
639 | + 'id' => $id |
|
640 | + )); |
|
641 | + if(is_array($evtOut)) { |
|
642 | + echo implode('', $evtOut); |
|
643 | + } else { |
|
644 | + ?> |
|
645 | 645 | <div class="tab-page" id="tabGeneral"> |
646 | 646 | <h2 class="tab"><?= $_lang['settings_general'] ?></h2> |
647 | 647 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script> |
@@ -726,36 +726,36 @@ discard block |
||
726 | 726 | <select id="template" name="template" class="inputBox" onchange="templateWarning();"> |
727 | 727 | <option value="0">(blank)</option> |
728 | 728 | <?php |
729 | - $field = "t.templatename, t.selectable, t.id, c.category"; |
|
730 | - $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
731 | - $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
732 | - $currentCategory = ''; |
|
733 | - while($row = $modx->db->getRow($rs)) { |
|
734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
735 | - continue; |
|
736 | - }; |
|
737 | - // Skip if not selectable but show if selected! |
|
738 | - $thisCategory = $row['category']; |
|
739 | - if($thisCategory == null) { |
|
740 | - $thisCategory = $_lang["no_category"]; |
|
741 | - } |
|
742 | - if($thisCategory != $currentCategory) { |
|
743 | - if($closeOptGroup) { |
|
744 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
745 | - } |
|
746 | - echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
747 | - $closeOptGroup = true; |
|
748 | - } |
|
729 | + $field = "t.templatename, t.selectable, t.id, c.category"; |
|
730 | + $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
731 | + $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
732 | + $currentCategory = ''; |
|
733 | + while($row = $modx->db->getRow($rs)) { |
|
734 | + if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
735 | + continue; |
|
736 | + }; |
|
737 | + // Skip if not selectable but show if selected! |
|
738 | + $thisCategory = $row['category']; |
|
739 | + if($thisCategory == null) { |
|
740 | + $thisCategory = $_lang["no_category"]; |
|
741 | + } |
|
742 | + if($thisCategory != $currentCategory) { |
|
743 | + if($closeOptGroup) { |
|
744 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
745 | + } |
|
746 | + echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
747 | + $closeOptGroup = true; |
|
748 | + } |
|
749 | 749 | |
750 | - $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
750 | + $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
751 | 751 | |
752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
753 | - $currentCategory = $thisCategory; |
|
754 | - } |
|
755 | - if($thisCategory != '') { |
|
756 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
757 | - } |
|
758 | - ?> |
|
752 | + echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
753 | + $currentCategory = $thisCategory; |
|
754 | + } |
|
755 | + if($thisCategory != '') { |
|
756 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
757 | + } |
|
758 | + ?> |
|
759 | 759 | </select> |
760 | 760 | </td> |
761 | 761 | </tr> |
@@ -795,37 +795,37 @@ discard block |
||
795 | 795 | </td> |
796 | 796 | <td valign="top"> |
797 | 797 | <?php |
798 | - $parentlookup = false; |
|
799 | - if(isset ($_REQUEST['id'])) { |
|
800 | - if($content['parent'] == 0) { |
|
801 | - $parentname = $site_name; |
|
802 | - } else { |
|
803 | - $parentlookup = $content['parent']; |
|
804 | - } |
|
805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
806 | - if($_REQUEST['pid'] == 0) { |
|
807 | - $parentname = $site_name; |
|
808 | - } else { |
|
809 | - $parentlookup = $_REQUEST['pid']; |
|
810 | - } |
|
811 | - } elseif(isset($_POST['parent'])) { |
|
812 | - if($_POST['parent'] == 0) { |
|
813 | - $parentname = $site_name; |
|
814 | - } else { |
|
815 | - $parentlookup = $_POST['parent']; |
|
816 | - } |
|
817 | - } else { |
|
818 | - $parentname = $site_name; |
|
819 | - $content['parent'] = 0; |
|
820 | - } |
|
821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
822 | - $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
823 | - $parentname = $modx->db->getValue($rs); |
|
824 | - if(!$parentname) { |
|
825 | - $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
826 | - } |
|
827 | - } |
|
828 | - ?> |
|
798 | + $parentlookup = false; |
|
799 | + if(isset ($_REQUEST['id'])) { |
|
800 | + if($content['parent'] == 0) { |
|
801 | + $parentname = $site_name; |
|
802 | + } else { |
|
803 | + $parentlookup = $content['parent']; |
|
804 | + } |
|
805 | + } elseif(isset ($_REQUEST['pid'])) { |
|
806 | + if($_REQUEST['pid'] == 0) { |
|
807 | + $parentname = $site_name; |
|
808 | + } else { |
|
809 | + $parentlookup = $_REQUEST['pid']; |
|
810 | + } |
|
811 | + } elseif(isset($_POST['parent'])) { |
|
812 | + if($_POST['parent'] == 0) { |
|
813 | + $parentname = $site_name; |
|
814 | + } else { |
|
815 | + $parentlookup = $_POST['parent']; |
|
816 | + } |
|
817 | + } else { |
|
818 | + $parentname = $site_name; |
|
819 | + $content['parent'] = 0; |
|
820 | + } |
|
821 | + if($parentlookup !== false && is_numeric($parentlookup)) { |
|
822 | + $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
823 | + $parentname = $modx->db->getValue($rs); |
|
824 | + if(!$parentname) { |
|
825 | + $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
826 | + } |
|
827 | + } |
|
828 | + ?> |
|
829 | 829 | <i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i> |
830 | 830 | <b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $parentname ?>)</span></b> |
831 | 831 | <input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" /> |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | </tr> |
834 | 834 | <tr></tr> |
835 | 835 | <?php |
836 | - /* |
|
836 | + /* |
|
837 | 837 | if($content['type'] == 'reference' || $modx->manager->action == '72') { |
838 | 838 | ?> |
839 | 839 | <tr> |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | </tr> |
862 | 862 | <?php |
863 | 863 | }*/ |
864 | - ?> |
|
864 | + ?> |
|
865 | 865 | |
866 | 866 | <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
867 | 867 | <tr> |
@@ -874,36 +874,36 @@ discard block |
||
874 | 874 | <select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();"> |
875 | 875 | <option value="none"><?= $_lang['none'] ?></option> |
876 | 876 | <?php |
877 | - // invoke OnRichTextEditorRegister event |
|
878 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
879 | - if(is_array($evtOut)) { |
|
880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
881 | - $editor = $evtOut[$i]; |
|
882 | - echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
883 | - } |
|
884 | - } |
|
885 | - ?> |
|
877 | + // invoke OnRichTextEditorRegister event |
|
878 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
879 | + if(is_array($evtOut)) { |
|
880 | + for($i = 0; $i < count($evtOut); $i++) { |
|
881 | + $editor = $evtOut[$i]; |
|
882 | + echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
883 | + } |
|
884 | + } |
|
885 | + ?> |
|
886 | 886 | </select> |
887 | 887 | </label> |
888 | 888 | </div> |
889 | 889 | <div id="content_body"> |
890 | 890 | <?php |
891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
892 | - $htmlContent = $content['content']; |
|
893 | - ?> |
|
891 | + if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
892 | + $htmlContent = $content['content']; |
|
893 | + ?> |
|
894 | 894 | <div class="section-editor clearfix"> |
895 | 895 | <textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->htmlspecialchars($htmlContent) ?></textarea> |
896 | 896 | </div> |
897 | 897 | <?php |
898 | - // Richtext-[*content*] |
|
899 | - $richtexteditorIds = array(); |
|
900 | - $richtexteditorOptions = array(); |
|
901 | - $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
902 | - $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
903 | - } else { |
|
904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
905 | - } |
|
906 | - ?> |
|
898 | + // Richtext-[*content*] |
|
899 | + $richtexteditorIds = array(); |
|
900 | + $richtexteditorOptions = array(); |
|
901 | + $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
902 | + $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
903 | + } else { |
|
904 | + echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
905 | + } |
|
906 | + ?> |
|
907 | 907 | </div> |
908 | 908 | </td> |
909 | 909 | </tr> |
@@ -1190,8 +1190,8 @@ discard block |
||
1190 | 1190 | |
1191 | 1191 | <?php |
1192 | 1192 | |
1193 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1194 | - ?> |
|
1193 | + if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1194 | + ?> |
|
1195 | 1195 | <tr> |
1196 | 1196 | <td> |
1197 | 1197 | <span class="warning"><?= $_lang['resource_type'] ?></span> |
@@ -1213,15 +1213,15 @@ discard block |
||
1213 | 1213 | <td> |
1214 | 1214 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1215 | 1215 | <?php |
1216 | - if(!$content['contentType']) { |
|
1217 | - $content['contentType'] = 'text/html'; |
|
1218 | - } |
|
1219 | - $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1220 | - $ct = explode(",", $custom_contenttype); |
|
1221 | - for($i = 0; $i < count($ct); $i++) { |
|
1222 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1223 | - } |
|
1224 | - ?> |
|
1216 | + if(!$content['contentType']) { |
|
1217 | + $content['contentType'] = 'text/html'; |
|
1218 | + } |
|
1219 | + $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1220 | + $ct = explode(",", $custom_contenttype); |
|
1221 | + for($i = 0; $i < count($ct); $i++) { |
|
1222 | + echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1223 | + } |
|
1224 | + ?> |
|
1225 | 1225 | </select> |
1226 | 1226 | </td> |
1227 | 1227 | </tr> |
@@ -1244,23 +1244,23 @@ discard block |
||
1244 | 1244 | </td> |
1245 | 1245 | </tr> |
1246 | 1246 | <?php |
1247 | - } else { |
|
1248 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1249 | - // non-admin managers creating or editing a document resource |
|
1250 | - ?> |
|
1247 | + } else { |
|
1248 | + if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1249 | + // non-admin managers creating or editing a document resource |
|
1250 | + ?> |
|
1251 | 1251 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
1252 | 1252 | <input type="hidden" name="type" value="document" /> |
1253 | 1253 | <input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" /> |
1254 | 1254 | <?php |
1255 | - } else { |
|
1256 | - // non-admin managers creating or editing a reference (weblink) resource |
|
1257 | - ?> |
|
1255 | + } else { |
|
1256 | + // non-admin managers creating or editing a reference (weblink) resource |
|
1257 | + ?> |
|
1258 | 1258 | <input type="hidden" name="type" value="reference" /> |
1259 | 1259 | <input type="hidden" name="contentType" value="text/html" /> |
1260 | 1260 | <?php |
1261 | - } |
|
1262 | - }//if mgrRole |
|
1263 | - ?> |
|
1261 | + } |
|
1262 | + }//if mgrRole |
|
1263 | + ?> |
|
1264 | 1264 | |
1265 | 1265 | <tr> |
1266 | 1266 | <td> |
@@ -1343,112 +1343,112 @@ discard block |
||
1343 | 1343 | ?> |
1344 | 1344 | |
1345 | 1345 | <?php |
1346 | - /******************************* |
|
1346 | + /******************************* |
|
1347 | 1347 | * Document Access Permissions */ |
1348 | - if($use_udperms == 1) { |
|
1349 | - $groupsarray = array(); |
|
1350 | - $sql = ''; |
|
1351 | - |
|
1352 | - $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1353 | - if($documentId > 0) { |
|
1354 | - // Load up, the permissions from the parent (if new document) or existing document |
|
1355 | - $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1357 | - |
|
1358 | - // Load up the current permissions and names |
|
1359 | - $vs = array( |
|
1360 | - $tbl_document_group_names, |
|
1361 | - $tbl_document_groups, |
|
1362 | - $documentId |
|
1363 | - ); |
|
1364 | - $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1365 | - $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1366 | - } else { |
|
1367 | - // Just load up the names, we're starting clean |
|
1368 | - $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1369 | - } |
|
1370 | - |
|
1371 | - // retain selected doc groups between post |
|
1372 | - if(isset($_POST['docgroups'])) { |
|
1373 | - $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1374 | - } |
|
1348 | + if($use_udperms == 1) { |
|
1349 | + $groupsarray = array(); |
|
1350 | + $sql = ''; |
|
1351 | + |
|
1352 | + $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1353 | + if($documentId > 0) { |
|
1354 | + // Load up, the permissions from the parent (if new document) or existing document |
|
1355 | + $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1356 | + while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1357 | + |
|
1358 | + // Load up the current permissions and names |
|
1359 | + $vs = array( |
|
1360 | + $tbl_document_group_names, |
|
1361 | + $tbl_document_groups, |
|
1362 | + $documentId |
|
1363 | + ); |
|
1364 | + $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1365 | + $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1366 | + } else { |
|
1367 | + // Just load up the names, we're starting clean |
|
1368 | + $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1369 | + } |
|
1370 | + |
|
1371 | + // retain selected doc groups between post |
|
1372 | + if(isset($_POST['docgroups'])) { |
|
1373 | + $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1374 | + } |
|
1375 | + |
|
1376 | + $isManager = $modx->hasPermission('access_permissions'); |
|
1377 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1378 | + |
|
1379 | + // Setup Basic attributes for each Input box |
|
1380 | + $inputAttributes = array( |
|
1381 | + 'type' => 'checkbox', |
|
1382 | + 'class' => 'checkbox', |
|
1383 | + 'name' => 'docgroups[]', |
|
1384 | + 'onclick' => 'makePublic(false);', |
|
1385 | + ); |
|
1386 | + $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1387 | + $permissions_yes = 0; // count permissions the current mgr user has |
|
1388 | + $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1389 | + |
|
1390 | + // Loop through the permissions list |
|
1391 | + while($row = $modx->db->getRow($rs)) { |
|
1392 | + |
|
1393 | + // Create an inputValue pair (group ID and group link (if it exists)) |
|
1394 | + $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | + $inputId = 'group-' . $row['id']; |
|
1396 | + |
|
1397 | + $checked = in_array($inputValue, $groupsarray); |
|
1398 | + if($checked) { |
|
1399 | + $notPublic = true; |
|
1400 | + } // Mark as private access (either web or manager) |
|
1401 | + |
|
1402 | + // Skip the access permission if the user doesn't have access... |
|
1403 | + if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1404 | + continue; |
|
1405 | + } |
|
1375 | 1406 | |
1376 | - $isManager = $modx->hasPermission('access_permissions'); |
|
1377 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1378 | - |
|
1379 | - // Setup Basic attributes for each Input box |
|
1380 | - $inputAttributes = array( |
|
1381 | - 'type' => 'checkbox', |
|
1382 | - 'class' => 'checkbox', |
|
1383 | - 'name' => 'docgroups[]', |
|
1384 | - 'onclick' => 'makePublic(false);', |
|
1385 | - ); |
|
1386 | - $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1387 | - $permissions_yes = 0; // count permissions the current mgr user has |
|
1388 | - $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1389 | - |
|
1390 | - // Loop through the permissions list |
|
1391 | - while($row = $modx->db->getRow($rs)) { |
|
1392 | - |
|
1393 | - // Create an inputValue pair (group ID and group link (if it exists)) |
|
1394 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | - $inputId = 'group-' . $row['id']; |
|
1396 | - |
|
1397 | - $checked = in_array($inputValue, $groupsarray); |
|
1398 | - if($checked) { |
|
1399 | - $notPublic = true; |
|
1400 | - } // Mark as private access (either web or manager) |
|
1401 | - |
|
1402 | - // Skip the access permission if the user doesn't have access... |
|
1403 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1404 | - continue; |
|
1405 | - } |
|
1406 | - |
|
1407 | - // Setup attributes for this Input box |
|
1408 | - $inputAttributes['id'] = $inputId; |
|
1409 | - $inputAttributes['value'] = $inputValue; |
|
1410 | - if($checked) { |
|
1411 | - $inputAttributes['checked'] = 'checked'; |
|
1412 | - } else { |
|
1413 | - unset($inputAttributes['checked']); |
|
1414 | - } |
|
1415 | - |
|
1416 | - // Create attribute string list |
|
1417 | - $inputString = array(); |
|
1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1419 | - |
|
1420 | - // Make the <input> HTML |
|
1421 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1422 | - |
|
1423 | - // does user have this permission? |
|
1424 | - $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1425 | - $vs = array( |
|
1426 | - $row['id'], |
|
1427 | - $_SESSION['mgrInternalKey'] |
|
1428 | - ); |
|
1429 | - $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1430 | - $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
1431 | - $count = $modx->db->getValue($rsp); |
|
1432 | - if($count > 0) { |
|
1433 | - ++$permissions_yes; |
|
1434 | - } else { |
|
1435 | - ++$permissions_no; |
|
1436 | - } |
|
1437 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1438 | - } |
|
1439 | - // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1440 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1441 | - $permissions = array(); |
|
1442 | - } |
|
1407 | + // Setup attributes for this Input box |
|
1408 | + $inputAttributes['id'] = $inputId; |
|
1409 | + $inputAttributes['value'] = $inputValue; |
|
1410 | + if($checked) { |
|
1411 | + $inputAttributes['checked'] = 'checked'; |
|
1412 | + } else { |
|
1413 | + unset($inputAttributes['checked']); |
|
1414 | + } |
|
1443 | 1415 | |
1444 | - // See if the Access Permissions section is worth displaying... |
|
1445 | - if(!empty($permissions)) { |
|
1446 | - // Add the "All Document Groups" item if we have rights in both contexts |
|
1447 | - if($isManager && $isWeb) { |
|
1448 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1449 | - } |
|
1450 | - // Output the permissions list... |
|
1451 | - ?> |
|
1416 | + // Create attribute string list |
|
1417 | + $inputString = array(); |
|
1418 | + foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1419 | + |
|
1420 | + // Make the <input> HTML |
|
1421 | + $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1422 | + |
|
1423 | + // does user have this permission? |
|
1424 | + $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1425 | + $vs = array( |
|
1426 | + $row['id'], |
|
1427 | + $_SESSION['mgrInternalKey'] |
|
1428 | + ); |
|
1429 | + $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1430 | + $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
1431 | + $count = $modx->db->getValue($rsp); |
|
1432 | + if($count > 0) { |
|
1433 | + ++$permissions_yes; |
|
1434 | + } else { |
|
1435 | + ++$permissions_no; |
|
1436 | + } |
|
1437 | + $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1438 | + } |
|
1439 | + // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1440 | + if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1441 | + $permissions = array(); |
|
1442 | + } |
|
1443 | + |
|
1444 | + // See if the Access Permissions section is worth displaying... |
|
1445 | + if(!empty($permissions)) { |
|
1446 | + // Add the "All Document Groups" item if we have rights in both contexts |
|
1447 | + if($isManager && $isWeb) { |
|
1448 | + array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1449 | + } |
|
1450 | + // Output the permissions list... |
|
1451 | + ?> |
|
1452 | 1452 | <!-- Access Permissions --> |
1453 | 1453 | <div class="tab-page" id="tabAccess"> |
1454 | 1454 | <h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2> |
@@ -1482,31 +1482,31 @@ discard block |
||
1482 | 1482 | </ul> |
1483 | 1483 | </div><!--div class="tab-page" id="tabAccess"--> |
1484 | 1484 | <?php |
1485 | - } // !empty($permissions) |
|
1486 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1487 | - ?> |
|
1485 | + } // !empty($permissions) |
|
1486 | + elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1487 | + ?> |
|
1488 | 1488 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1489 | 1489 | <?php |
1490 | 1490 | |
1491 | - } |
|
1492 | - } |
|
1493 | - /* End Document Access Permissions * |
|
1491 | + } |
|
1492 | + } |
|
1493 | + /* End Document Access Permissions * |
|
1494 | 1494 | ***********************************/ |
1495 | - ?> |
|
1495 | + ?> |
|
1496 | 1496 | |
1497 | 1497 | <input type="submit" name="save" style="display:none" /> |
1498 | 1498 | <?php |
1499 | 1499 | |
1500 | - // invoke OnDocFormRender event |
|
1501 | - $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1502 | - 'id' => $id, |
|
1503 | - 'template' => $content['template'] |
|
1504 | - )); |
|
1500 | + // invoke OnDocFormRender event |
|
1501 | + $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1502 | + 'id' => $id, |
|
1503 | + 'template' => $content['template'] |
|
1504 | + )); |
|
1505 | 1505 | |
1506 | - if(is_array($evtOut)) { |
|
1507 | - echo implode('', $evtOut); |
|
1508 | - } |
|
1509 | - ?> |
|
1506 | + if(is_array($evtOut)) { |
|
1507 | + echo implode('', $evtOut); |
|
1508 | + } |
|
1509 | + ?> |
|
1510 | 1510 | </div><!--div class="tab-pane" id="documentPane"--> |
1511 | 1511 | </div><!--div class="sectionBody"--> |
1512 | 1512 | </fieldset> |
@@ -1517,62 +1517,62 @@ discard block |
||
1517 | 1517 | </script> |
1518 | 1518 | <?php |
1519 | 1519 | if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
1520 | - if(is_array($richtexteditorIds)) { |
|
1521 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1522 | - // invoke OnRichTextEditorInit event |
|
1523 | - $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1524 | - 'editor' => $editor, |
|
1525 | - 'elements' => $elements, |
|
1526 | - 'options' => $richtexteditorOptions[$editor] |
|
1527 | - )); |
|
1528 | - if(is_array($evtOut)) { |
|
1529 | - echo implode('', $evtOut); |
|
1530 | - } |
|
1531 | - } |
|
1532 | - } |
|
1520 | + if(is_array($richtexteditorIds)) { |
|
1521 | + foreach($richtexteditorIds as $editor => $elements) { |
|
1522 | + // invoke OnRichTextEditorInit event |
|
1523 | + $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1524 | + 'editor' => $editor, |
|
1525 | + 'elements' => $elements, |
|
1526 | + 'options' => $richtexteditorOptions[$editor] |
|
1527 | + )); |
|
1528 | + if(is_array($evtOut)) { |
|
1529 | + echo implode('', $evtOut); |
|
1530 | + } |
|
1531 | + } |
|
1532 | + } |
|
1533 | 1533 | } |
1534 | 1534 | |
1535 | 1535 | function getDefaultTemplate() { |
1536 | - global $modx; |
|
1537 | - |
|
1538 | - switch($modx->config['auto_template_logic']) { |
|
1539 | - case 'sibling': |
|
1540 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1541 | - $site_start = $modx->config['site_start']; |
|
1542 | - $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
1543 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
1544 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1545 | - $default_template = $sibl[0]['template']; |
|
1546 | - } |
|
1547 | - } else { |
|
1548 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1549 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1550 | - $default_template = $sibl[0]['template']; |
|
1551 | - } else { |
|
1552 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1553 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1554 | - $default_template = $sibl[0]['template']; |
|
1555 | - } |
|
1556 | - } |
|
1557 | - } |
|
1558 | - if(isset($default_template)) { |
|
1559 | - break; |
|
1560 | - } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
1561 | - case 'parent': |
|
1562 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1563 | - $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
1564 | - if(isset($parent['template'])) { |
|
1565 | - $default_template = $parent['template']; |
|
1566 | - } |
|
1567 | - } |
|
1568 | - break; |
|
1569 | - case 'system': |
|
1570 | - default: // default_template is already set |
|
1571 | - $default_template = $modx->config['default_template']; |
|
1572 | - } |
|
1573 | - if(!isset($default_template)) { |
|
1574 | - $default_template = $modx->config['default_template']; |
|
1575 | - } // default_template is already set |
|
1576 | - |
|
1577 | - return $default_template; |
|
1536 | + global $modx; |
|
1537 | + |
|
1538 | + switch($modx->config['auto_template_logic']) { |
|
1539 | + case 'sibling': |
|
1540 | + if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1541 | + $site_start = $modx->config['site_start']; |
|
1542 | + $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
1543 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
1544 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1545 | + $default_template = $sibl[0]['template']; |
|
1546 | + } |
|
1547 | + } else { |
|
1548 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1549 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1550 | + $default_template = $sibl[0]['template']; |
|
1551 | + } else { |
|
1552 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1553 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1554 | + $default_template = $sibl[0]['template']; |
|
1555 | + } |
|
1556 | + } |
|
1557 | + } |
|
1558 | + if(isset($default_template)) { |
|
1559 | + break; |
|
1560 | + } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
1561 | + case 'parent': |
|
1562 | + if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1563 | + $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
1564 | + if(isset($parent['template'])) { |
|
1565 | + $default_template = $parent['template']; |
|
1566 | + } |
|
1567 | + } |
|
1568 | + break; |
|
1569 | + case 'system': |
|
1570 | + default: // default_template is already set |
|
1571 | + $default_template = $modx->config['default_template']; |
|
1572 | + } |
|
1573 | + if(!isset($default_template)) { |
|
1574 | + $default_template = $modx->config['default_template']; |
|
1575 | + } // default_template is already set |
|
1576 | + |
|
1577 | + return $default_template; |
|
1578 | 1578 | } |
@@ -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 | // initialize page view state - the $_PAGE object |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | |
12 | 12 | // get and save search string |
13 | 13 | if($_REQUEST['op'] == 'reset') { |
14 | - $query = ''; |
|
15 | - $_PAGE['vs']['search'] = ''; |
|
14 | + $query = ''; |
|
15 | + $_PAGE['vs']['search'] = ''; |
|
16 | 16 | } else { |
17 | - $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
|
18 | - $sqlQuery = $modx->db->escape($query); |
|
19 | - $_PAGE['vs']['search'] = $query; |
|
17 | + $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search']; |
|
18 | + $sqlQuery = $modx->db->escape($query); |
|
19 | + $_PAGE['vs']['search'] = $query; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | // get & save listmode |
@@ -120,55 +120,55 @@ discard block |
||
120 | 120 | <div class="row"> |
121 | 121 | <div class="table-responsive"> |
122 | 122 | <?php |
123 | - $where = ""; |
|
124 | - if(!$modx->hasPermission('save_role')) { |
|
125 | - $where .= (empty($where) ? "" : " AND ") . "mua.role != 1"; |
|
126 | - } |
|
127 | - if(!empty($sqlQuery)) { |
|
128 | - $where .= (empty($where) ? "" : " AND ") . "((mu.username LIKE '{$sqlQuery}%') OR (mua.fullname LIKE '%{$sqlQuery}%') OR (mua.email LIKE '{$sqlQuery}%'))"; |
|
129 | - } |
|
130 | - $ds = $modx->db->select("mu.id, mu.username, rname.name AS role, mua.fullname, mua.email, ELT(mua.gender, '{$_lang['user_male']}', '{$_lang['user_female']}', '{$_lang['user_other']}') AS gender, IF(mua.blocked,'{$_lang['yes']}','-') as blocked, mua.thislogin", $modx->getFullTableName('manager_users') . " AS mu |
|
123 | + $where = ""; |
|
124 | + if(!$modx->hasPermission('save_role')) { |
|
125 | + $where .= (empty($where) ? "" : " AND ") . "mua.role != 1"; |
|
126 | + } |
|
127 | + if(!empty($sqlQuery)) { |
|
128 | + $where .= (empty($where) ? "" : " AND ") . "((mu.username LIKE '{$sqlQuery}%') OR (mua.fullname LIKE '%{$sqlQuery}%') OR (mua.email LIKE '{$sqlQuery}%'))"; |
|
129 | + } |
|
130 | + $ds = $modx->db->select("mu.id, mu.username, rname.name AS role, mua.fullname, mua.email, ELT(mua.gender, '{$_lang['user_male']}', '{$_lang['user_female']}', '{$_lang['user_other']}') AS gender, IF(mua.blocked,'{$_lang['yes']}','-') as blocked, mua.thislogin", $modx->getFullTableName('manager_users') . " AS mu |
|
131 | 131 | INNER JOIN " . $modx->getFullTableName('user_attributes') . " AS mua ON mua.internalKey=mu.id |
132 | 132 | LEFT JOIN " . $modx->getFullTableName('user_roles') . " AS rname ON mua.role=rname.id", $where, 'mua.blocked ASC, mua.thislogin DESC'); |
133 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
134 | - $grd = new DataGrid('', $ds, $modx->config['number_of_results']); // set page size to 0 t show all items |
|
135 | - $grd->noRecordMsg = $_lang["no_records_found"]; |
|
136 | - $grd->cssClass = "table data"; |
|
137 | - $grd->columnHeaderClass = "tableHeader"; |
|
138 | - $grd->itemClass = "tableItem"; |
|
139 | - $grd->altItemClass = "tableAltItem"; |
|
140 | - $grd->fields = "id,username,fullname,role,email,gender,blocked,thislogin"; |
|
141 | - $grd->columns = implode(',', array( |
|
142 | - $_lang["icon"], |
|
143 | - $_lang["name"], |
|
144 | - $_lang["user_full_name"], |
|
145 | - $_lang['role'], |
|
146 | - $_lang["email"], |
|
147 | - $_lang["user_gender"], |
|
148 | - $_lang["user_block"], |
|
149 | - $_lang["login_button"] |
|
150 | - )); |
|
151 | - $grd->colWidths = "1%,,,,,,1%,1%"; |
|
152 | - $grd->colAligns = "center,,,,,center,center,right' nowrap='nowrap"; |
|
153 | - $grd->colTypes = implode('||', array( |
|
154 | - 'template:<a class="gridRowIcon" href="javascript:;" onclick="return showContentMenu([+id+],event);" title="' . $_lang['click_to_context'] . '"><i class="' . $_style['icons_user'] . '"></i></a>', |
|
155 | - 'template:<a href="index.php?a=12&id=[+id+]" title="' . $_lang['click_to_edit_title'] . '">[+value+]</a>', |
|
156 | - 'template:[+fullname+]', |
|
157 | - 'template:[+role+]', |
|
158 | - 'template:[+email+]', |
|
159 | - 'template:[+gender+]', |
|
160 | - 'template:[+blocked+]', |
|
161 | - 'date: ' . $modx->toDateFormat('[+thislogin+]', 'formatOnly') . ' %H:%M' |
|
162 | - )); |
|
163 | - if($listmode == '1') { |
|
164 | - $grd->pageSize = 0; |
|
165 | - } |
|
166 | - if($_REQUEST['op'] == 'reset') { |
|
167 | - $grd->pageNumber = 1; |
|
168 | - } |
|
169 | - // render grid |
|
170 | - echo $grd->render(); |
|
171 | - ?> |
|
133 | + include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
134 | + $grd = new DataGrid('', $ds, $modx->config['number_of_results']); // set page size to 0 t show all items |
|
135 | + $grd->noRecordMsg = $_lang["no_records_found"]; |
|
136 | + $grd->cssClass = "table data"; |
|
137 | + $grd->columnHeaderClass = "tableHeader"; |
|
138 | + $grd->itemClass = "tableItem"; |
|
139 | + $grd->altItemClass = "tableAltItem"; |
|
140 | + $grd->fields = "id,username,fullname,role,email,gender,blocked,thislogin"; |
|
141 | + $grd->columns = implode(',', array( |
|
142 | + $_lang["icon"], |
|
143 | + $_lang["name"], |
|
144 | + $_lang["user_full_name"], |
|
145 | + $_lang['role'], |
|
146 | + $_lang["email"], |
|
147 | + $_lang["user_gender"], |
|
148 | + $_lang["user_block"], |
|
149 | + $_lang["login_button"] |
|
150 | + )); |
|
151 | + $grd->colWidths = "1%,,,,,,1%,1%"; |
|
152 | + $grd->colAligns = "center,,,,,center,center,right' nowrap='nowrap"; |
|
153 | + $grd->colTypes = implode('||', array( |
|
154 | + 'template:<a class="gridRowIcon" href="javascript:;" onclick="return showContentMenu([+id+],event);" title="' . $_lang['click_to_context'] . '"><i class="' . $_style['icons_user'] . '"></i></a>', |
|
155 | + 'template:<a href="index.php?a=12&id=[+id+]" title="' . $_lang['click_to_edit_title'] . '">[+value+]</a>', |
|
156 | + 'template:[+fullname+]', |
|
157 | + 'template:[+role+]', |
|
158 | + 'template:[+email+]', |
|
159 | + 'template:[+gender+]', |
|
160 | + 'template:[+blocked+]', |
|
161 | + 'date: ' . $modx->toDateFormat('[+thislogin+]', 'formatOnly') . ' %H:%M' |
|
162 | + )); |
|
163 | + if($listmode == '1') { |
|
164 | + $grd->pageSize = 0; |
|
165 | + } |
|
166 | + if($_REQUEST['op'] == 'reset') { |
|
167 | + $grd->pageNumber = 1; |
|
168 | + } |
|
169 | + // render grid |
|
170 | + echo $grd->render(); |
|
171 | + ?> |
|
172 | 172 | </div> |
173 | 173 | </div> |
174 | 174 | </div> |