@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if(!$modx->hasPermission('delete_module')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Set the item name for logger |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeModFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeModFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the module. |
25 | 25 | $modx->db->delete($modx->getFullTableName('site_modules'), "id='{$id}'"); |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | // invoke OnModFormDelete event |
34 | 34 | $modx->invokeEvent("OnModFormDelete", |
35 | - array( |
|
36 | - "id" => $id |
|
37 | - )); |
|
35 | + array( |
|
36 | + "id" => $id |
|
37 | + )); |
|
38 | 38 | |
39 | 39 | // empty cache |
40 | 40 | $modx->clearCache('full'); |
@@ -170,70 +170,70 @@ |
||
170 | 170 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
171 | 171 | ); |
172 | 172 | } |
173 | - if ((int)$params['shareparams'] || !empty($params['dependencies'])) { |
|
174 | - $dependencies = explode(',', $params['dependencies']); |
|
175 | - foreach ($dependencies as $dependency) { |
|
176 | - $dependency = explode(':', $dependency); |
|
177 | - switch (trim($dependency[0])) { |
|
178 | - case 'template': |
|
179 | - $mdp[] = array( |
|
180 | - 'module' => $params['name'], |
|
181 | - 'table' => 'templates', |
|
182 | - 'column' => 'templatename', |
|
183 | - 'type' => 50, |
|
184 | - 'name' => trim($dependency[1]) |
|
185 | - ); |
|
186 | - break; |
|
187 | - case 'tv': |
|
188 | - case 'tmplvar': |
|
189 | - $mdp[] = array( |
|
190 | - 'module' => $params['name'], |
|
191 | - 'table' => 'tmplvars', |
|
192 | - 'column' => 'name', |
|
193 | - 'type' => 60, |
|
194 | - 'name' => trim($dependency[1]) |
|
195 | - ); |
|
196 | - break; |
|
197 | - case 'chunk': |
|
198 | - case 'htmlsnippet': |
|
199 | - $mdp[] = array( |
|
200 | - 'module' => $params['name'], |
|
201 | - 'table' => 'htmlsnippets', |
|
202 | - 'column' => 'name', |
|
203 | - 'type' => 10, |
|
204 | - 'name' => trim($dependency[1]) |
|
205 | - ); |
|
206 | - break; |
|
207 | - case 'snippet': |
|
208 | - $mdp[] = array( |
|
209 | - 'module' => $params['name'], |
|
210 | - 'table' => 'snippets', |
|
211 | - 'column' => 'name', |
|
212 | - 'type' => 40, |
|
213 | - 'name' => trim($dependency[1]) |
|
214 | - ); |
|
215 | - break; |
|
216 | - case 'plugin': |
|
217 | - $mdp[] = array( |
|
218 | - 'module' => $params['name'], |
|
219 | - 'table' => 'plugins', |
|
220 | - 'column' => 'name', |
|
221 | - 'type' => 30, |
|
222 | - 'name' => trim($dependency[1]) |
|
223 | - ); |
|
224 | - break; |
|
225 | - case 'resource': |
|
226 | - $mdp[] = array( |
|
227 | - 'module' => $params['name'], |
|
228 | - 'table' => 'content', |
|
229 | - 'column' => 'pagetitle', |
|
230 | - 'type' => 20, |
|
231 | - 'name' => trim($dependency[1]) |
|
232 | - ); |
|
233 | - break; |
|
234 | - } |
|
235 | - } |
|
236 | - } |
|
173 | + if ((int)$params['shareparams'] || !empty($params['dependencies'])) { |
|
174 | + $dependencies = explode(',', $params['dependencies']); |
|
175 | + foreach ($dependencies as $dependency) { |
|
176 | + $dependency = explode(':', $dependency); |
|
177 | + switch (trim($dependency[0])) { |
|
178 | + case 'template': |
|
179 | + $mdp[] = array( |
|
180 | + 'module' => $params['name'], |
|
181 | + 'table' => 'templates', |
|
182 | + 'column' => 'templatename', |
|
183 | + 'type' => 50, |
|
184 | + 'name' => trim($dependency[1]) |
|
185 | + ); |
|
186 | + break; |
|
187 | + case 'tv': |
|
188 | + case 'tmplvar': |
|
189 | + $mdp[] = array( |
|
190 | + 'module' => $params['name'], |
|
191 | + 'table' => 'tmplvars', |
|
192 | + 'column' => 'name', |
|
193 | + 'type' => 60, |
|
194 | + 'name' => trim($dependency[1]) |
|
195 | + ); |
|
196 | + break; |
|
197 | + case 'chunk': |
|
198 | + case 'htmlsnippet': |
|
199 | + $mdp[] = array( |
|
200 | + 'module' => $params['name'], |
|
201 | + 'table' => 'htmlsnippets', |
|
202 | + 'column' => 'name', |
|
203 | + 'type' => 10, |
|
204 | + 'name' => trim($dependency[1]) |
|
205 | + ); |
|
206 | + break; |
|
207 | + case 'snippet': |
|
208 | + $mdp[] = array( |
|
209 | + 'module' => $params['name'], |
|
210 | + 'table' => 'snippets', |
|
211 | + 'column' => 'name', |
|
212 | + 'type' => 40, |
|
213 | + 'name' => trim($dependency[1]) |
|
214 | + ); |
|
215 | + break; |
|
216 | + case 'plugin': |
|
217 | + $mdp[] = array( |
|
218 | + 'module' => $params['name'], |
|
219 | + 'table' => 'plugins', |
|
220 | + 'column' => 'name', |
|
221 | + 'type' => 30, |
|
222 | + 'name' => trim($dependency[1]) |
|
223 | + ); |
|
224 | + break; |
|
225 | + case 'resource': |
|
226 | + $mdp[] = array( |
|
227 | + 'module' => $params['name'], |
|
228 | + 'table' => 'content', |
|
229 | + 'column' => 'pagetitle', |
|
230 | + 'type' => 20, |
|
231 | + 'name' => trim($dependency[1]) |
|
232 | + ); |
|
233 | + break; |
|
234 | + } |
|
235 | + } |
|
236 | + } |
|
237 | 237 | } |
238 | 238 | $d->close(); |
239 | 239 | } |
@@ -1,128 +1,128 @@ 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 | $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 | /** |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | * @return array |
133 | 133 | */ |
134 | 134 | function prepareElementRowPh($row, $resourceTable, $resources) { |
135 | - global $modx, $modx_textdir, $_style, $_lang; |
|
135 | + global $modx, $modx_textdir, $_style, $_lang; |
|
136 | 136 | |
137 | - $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
137 | + $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
138 | 138 | |
139 | - $_lang["confirm_delete"] = $_lang["delete"]; |
|
139 | + $_lang["confirm_delete"] = $_lang["delete"]; |
|
140 | 140 | |
141 | - switch($resourceTable){ |
|
141 | + switch($resourceTable){ |
|
142 | 142 | case 'site_templates': |
143 | 143 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
144 | 144 | $lockElementType = 1; |
@@ -172,77 +172,77 @@ discard block |
||
172 | 172 | return array(); |
173 | 173 | } |
174 | 174 | |
175 | - // Prepare displaying user-locks |
|
176 | - $lockedByUser = ''; |
|
177 | - $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
178 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
179 | - if($rowLock['sid'] == $modx->sid) { |
|
180 | - $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
181 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
182 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
183 | - )); |
|
184 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
185 | - } else { |
|
186 | - $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
187 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
188 | - 'username' => $rowLock['username'], |
|
189 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
190 | - )); |
|
191 | - if($modx->hasPermission('remove_locks')) { |
|
192 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
193 | - } else { |
|
194 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
195 | - } |
|
196 | - } |
|
197 | - } |
|
198 | - if($lockedByUser) { |
|
199 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
200 | - } |
|
201 | - |
|
202 | - // Caption |
|
203 | - if($resourceTable == 'site_tmplvars') { |
|
204 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
205 | - } else { |
|
206 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
207 | - } |
|
208 | - |
|
209 | - // Special marks |
|
210 | - $tplInfo = array(); |
|
211 | - if($row['locked']) { |
|
212 | - $tplInfo[] = $_lang['locked']; |
|
213 | - } |
|
214 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
215 | - $tplInfo[] = $_lang['defaulttemplate_title']; |
|
216 | - } |
|
217 | - $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
218 | - |
|
219 | - /* row buttons */ |
|
220 | - $buttons = ''; |
|
221 | - if($modx->hasPermission($types['actions']['edit'][1])) { |
|
222 | - $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>'; |
|
223 | - } |
|
224 | - if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
225 | - $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>'; |
|
226 | - } |
|
227 | - if($modx->hasPermission($types['actions']['remove'][1])) { |
|
228 | - $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>'; |
|
229 | - } |
|
230 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
231 | - |
|
232 | - $catid = $row['catid'] ? $row['catid'] : 0; |
|
233 | - |
|
234 | - // Placeholders for elements-row |
|
235 | - return array( |
|
236 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
237 | - 'lockedByUser' => $lockedByUser, |
|
238 | - 'name' => $row['name'], |
|
239 | - 'caption' => $caption, |
|
240 | - 'buttons' => $buttons, |
|
241 | - 'marks' => $marks, |
|
242 | - 'id' => $row['id'], |
|
243 | - 'resourceTable' => $resourceTable, |
|
244 | - 'actionEdit' => $types['actions']['edit'][0], |
|
245 | - 'catid' => $catid, |
|
246 | - 'textdir' => $modx_textdir ? '‏' : '', |
|
247 | - ); |
|
175 | + // Prepare displaying user-locks |
|
176 | + $lockedByUser = ''; |
|
177 | + $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
178 | + if($rowLock && $modx->hasPermission('display_locks')) { |
|
179 | + if($rowLock['sid'] == $modx->sid) { |
|
180 | + $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
181 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
182 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
183 | + )); |
|
184 | + $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
185 | + } else { |
|
186 | + $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
187 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
188 | + 'username' => $rowLock['username'], |
|
189 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
190 | + )); |
|
191 | + if($modx->hasPermission('remove_locks')) { |
|
192 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
193 | + } else { |
|
194 | + $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
195 | + } |
|
196 | + } |
|
197 | + } |
|
198 | + if($lockedByUser) { |
|
199 | + $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
200 | + } |
|
201 | + |
|
202 | + // Caption |
|
203 | + if($resourceTable == 'site_tmplvars') { |
|
204 | + $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
205 | + } else { |
|
206 | + $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
207 | + } |
|
208 | + |
|
209 | + // Special marks |
|
210 | + $tplInfo = array(); |
|
211 | + if($row['locked']) { |
|
212 | + $tplInfo[] = $_lang['locked']; |
|
213 | + } |
|
214 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
215 | + $tplInfo[] = $_lang['defaulttemplate_title']; |
|
216 | + } |
|
217 | + $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
218 | + |
|
219 | + /* row buttons */ |
|
220 | + $buttons = ''; |
|
221 | + if($modx->hasPermission($types['actions']['edit'][1])) { |
|
222 | + $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>'; |
|
223 | + } |
|
224 | + if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
225 | + $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>'; |
|
226 | + } |
|
227 | + if($modx->hasPermission($types['actions']['remove'][1])) { |
|
228 | + $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>'; |
|
229 | + } |
|
230 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
231 | + |
|
232 | + $catid = $row['catid'] ? $row['catid'] : 0; |
|
233 | + |
|
234 | + // Placeholders for elements-row |
|
235 | + return array( |
|
236 | + 'class' => $class ? ' class="' . $class . '"' : '', |
|
237 | + 'lockedByUser' => $lockedByUser, |
|
238 | + 'name' => $row['name'], |
|
239 | + 'caption' => $caption, |
|
240 | + 'buttons' => $buttons, |
|
241 | + 'marks' => $marks, |
|
242 | + 'id' => $row['id'], |
|
243 | + 'resourceTable' => $resourceTable, |
|
244 | + 'actionEdit' => $types['actions']['edit'][0], |
|
245 | + 'catid' => $catid, |
|
246 | + 'textdir' => $modx_textdir ? '‏' : '', |
|
247 | + ); |
|
248 | 248 | } |
@@ -1,13 +1,13 @@ 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 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
7 | 7 | |
8 | 8 | if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
9 | - // seems to be a new install - send the user to the configuration page |
|
10 | - exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
|
9 | + // seems to be a new install - send the user to the configuration page |
|
10 | + exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | // set placeholders |
@@ -17,70 +17,70 @@ discard block |
||
17 | 17 | |
18 | 18 | // setup message info |
19 | 19 | if($modx->hasPermission('messages')) { |
20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
21 | - $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
22 | - $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
23 | - |
|
24 | - $msg = array(); |
|
25 | - $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']); |
|
26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
27 | - $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages); |
|
28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
29 | - $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
30 | - $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages); |
|
31 | - $ph['MessageInfo'] = implode("\n", $msg); |
|
20 | + include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
21 | + $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
22 | + $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
23 | + |
|
24 | + $msg = array(); |
|
25 | + $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']); |
|
26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
27 | + $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages); |
|
28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
29 | + $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
30 | + $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages); |
|
31 | + $ph['MessageInfo'] = implode("\n", $msg); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | // setup icons |
35 | 35 | if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
36 | - $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
37 | - $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
36 | + $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
37 | + $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
38 | 38 | } |
39 | 39 | if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
40 | - $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
41 | - $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
40 | + $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
41 | + $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
42 | 42 | } |
43 | 43 | if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
44 | - $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
45 | - $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
44 | + $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
45 | + $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
46 | 46 | } |
47 | 47 | if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
48 | - $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
49 | - $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
48 | + $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
49 | + $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
50 | 50 | } |
51 | 51 | if($modx->hasPermission('bk_manager')) { |
52 | - $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
53 | - $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
52 | + $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
53 | + $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
54 | 54 | } |
55 | 55 | if($modx->hasPermission('help')) { |
56 | - $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
57 | - $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
56 | + $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
57 | + $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
58 | 58 | } |
59 | 59 | // do some config checks |
60 | 60 | if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
61 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
62 | - if($config_check_results != $_lang['configcheck_ok']) { |
|
63 | - $ph['config_check_results'] = $config_check_results; |
|
64 | - $ph['config_display'] = 'block'; |
|
65 | - } else { |
|
66 | - $ph['config_display'] = 'none'; |
|
67 | - } |
|
61 | + include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
62 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
63 | + $ph['config_check_results'] = $config_check_results; |
|
64 | + $ph['config_display'] = 'block'; |
|
65 | + } else { |
|
66 | + $ph['config_display'] = 'none'; |
|
67 | + } |
|
68 | 68 | } else { |
69 | - $ph['config_display'] = 'none'; |
|
69 | + $ph['config_display'] = 'none'; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // Check logout-reminder |
73 | 73 | if(isset($_SESSION['show_logout_reminder'])) { |
74 | - switch($_SESSION['show_logout_reminder']['type']) { |
|
75 | - case 'logout_reminder': |
|
76 | - $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
77 | - $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
|
78 | - break; |
|
79 | - } |
|
80 | - $ph['show_logout_reminder'] = 'block'; |
|
81 | - unset($_SESSION['show_logout_reminder']); |
|
74 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
75 | + case 'logout_reminder': |
|
76 | + $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
77 | + $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
|
78 | + break; |
|
79 | + } |
|
80 | + $ph['show_logout_reminder'] = 'block'; |
|
81 | + unset($_SESSION['show_logout_reminder']); |
|
82 | 82 | } else { |
83 | - $ph['show_logout_reminder'] = 'none'; |
|
83 | + $ph['show_logout_reminder'] = 'none'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // Check multiple sessions |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
129 | 129 | |
130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
131 | - 'username' => $modx->getLoginUserName(), |
|
132 | - 'role' => $_SESSION['mgrPermissions']['name'], |
|
133 | - 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
134 | - 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
135 | - 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
131 | + 'username' => $modx->getLoginUserName(), |
|
132 | + 'role' => $_SESSION['mgrPermissions']['name'], |
|
133 | + 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
134 | + 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
135 | + 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
136 | 136 | )); |
137 | 137 | |
138 | 138 | $from = array(); |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC'); |
142 | 142 | |
143 | 143 | if($modx->db->getRecordCount($rs) < 1) { |
144 | - $html = '<p>[%no_active_users_found%]</p>'; |
|
144 | + $html = '<p>[%no_active_users_found%]</p>'; |
|
145 | 145 | } else { |
146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
147 | - $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
148 | - $ph['now'] = strftime('%H:%M:%S', $now); |
|
149 | - $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
150 | - $html = ' |
|
146 | + include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
147 | + $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
148 | + $ph['now'] = strftime('%H:%M:%S', $now); |
|
149 | + $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
150 | + $html = ' |
|
151 | 151 | <div class="card-body"> |
152 | 152 | [%onlineusers_message%] |
153 | 153 | <b>[+now+]</b>): |
@@ -165,33 +165,33 @@ discard block |
||
165 | 165 | </thead> |
166 | 166 | <tbody>'; |
167 | 167 | |
168 | - $userList = array(); |
|
169 | - $userCount = array(); |
|
170 | - // Create userlist with session-count first before output |
|
171 | - while($activeusers = $modx->db->getRow($rs)) { |
|
172 | - $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
173 | - |
|
174 | - $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
175 | - $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
176 | - $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
177 | - $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
178 | - $userList[] = array( |
|
179 | - $idle, |
|
180 | - '', |
|
181 | - $activeusers['username'], |
|
182 | - $webicon, |
|
183 | - abs($activeusers['internalKey']), |
|
184 | - $ip, |
|
185 | - strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time), |
|
186 | - $currentaction |
|
187 | - ); |
|
188 | - } |
|
189 | - foreach($userList as $params) { |
|
190 | - $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
191 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
192 | - } |
|
193 | - |
|
194 | - $html .= ' |
|
168 | + $userList = array(); |
|
169 | + $userCount = array(); |
|
170 | + // Create userlist with session-count first before output |
|
171 | + while($activeusers = $modx->db->getRow($rs)) { |
|
172 | + $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
173 | + |
|
174 | + $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
175 | + $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
176 | + $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
177 | + $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
178 | + $userList[] = array( |
|
179 | + $idle, |
|
180 | + '', |
|
181 | + $activeusers['username'], |
|
182 | + $webicon, |
|
183 | + abs($activeusers['internalKey']), |
|
184 | + $ip, |
|
185 | + strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time), |
|
186 | + $currentaction |
|
187 | + ); |
|
188 | + } |
|
189 | + foreach($userList as $params) { |
|
190 | + $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
191 | + $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
192 | + } |
|
193 | + |
|
194 | + $html .= ' |
|
195 | 195 | </tbody> |
196 | 196 | </table> |
197 | 197 | </div> |
@@ -232,17 +232,17 @@ discard block |
||
232 | 232 | // invoke event OnManagerWelcomePrerender |
233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender'); |
234 | 234 | if(is_array($evtOut)) { |
235 | - $output = implode('', $evtOut); |
|
236 | - $ph['OnManagerWelcomePrerender'] = $output; |
|
235 | + $output = implode('', $evtOut); |
|
236 | + $ph['OnManagerWelcomePrerender'] = $output; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | $widgets['welcome'] = array( |
240 | - 'menuindex' => '10', |
|
241 | - 'id' => 'welcome', |
|
242 | - 'cols' => 'col-sm-6', |
|
243 | - 'icon' => 'fa-home', |
|
244 | - 'title' => '[%welcome_title%]', |
|
245 | - 'body' => ' |
|
240 | + 'menuindex' => '10', |
|
241 | + 'id' => 'welcome', |
|
242 | + 'cols' => 'col-sm-6', |
|
243 | + 'icon' => 'fa-home', |
|
244 | + 'title' => '[%welcome_title%]', |
|
245 | + 'body' => ' |
|
246 | 246 | <div class="wm_buttons card-body"> |
247 | 247 | <!--@IF:[[#hasPermission?key=new_user]] OR [[#hasPermission?key=edit_user]]--> |
248 | 248 | <span class="wm_button"> |
@@ -320,25 +320,25 @@ discard block |
||
320 | 320 | </table> |
321 | 321 | </div> |
322 | 322 | ', |
323 | - 'hide'=>'0' |
|
323 | + 'hide'=>'0' |
|
324 | 324 | ); |
325 | 325 | $widgets['onlineinfo'] = array( |
326 | - 'menuindex' => '20', |
|
327 | - 'id' => 'onlineinfo', |
|
328 | - 'cols' => 'col-sm-6', |
|
329 | - 'icon' => 'fa-user', |
|
330 | - 'title' => '[%onlineusers_title%]', |
|
331 | - 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
332 | - 'hide'=>'0' |
|
326 | + 'menuindex' => '20', |
|
327 | + 'id' => 'onlineinfo', |
|
328 | + 'cols' => 'col-sm-6', |
|
329 | + 'icon' => 'fa-user', |
|
330 | + 'title' => '[%onlineusers_title%]', |
|
331 | + 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
332 | + 'hide'=>'0' |
|
333 | 333 | ); |
334 | 334 | $widgets['recentinfo'] = array( |
335 | - 'menuindex' => '30', |
|
336 | - 'id' => 'modxrecent_widget', |
|
337 | - 'cols' => 'col-sm-12', |
|
338 | - 'icon' => 'fa-pencil-square-o', |
|
339 | - 'title' => '[%activity_title%]', |
|
340 | - 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
341 | - 'hide'=>'0' |
|
335 | + 'menuindex' => '30', |
|
336 | + 'id' => 'modxrecent_widget', |
|
337 | + 'cols' => 'col-sm-12', |
|
338 | + 'icon' => 'fa-pencil-square-o', |
|
339 | + 'title' => '[%activity_title%]', |
|
340 | + 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
341 | + 'hide'=>'0' |
|
342 | 342 | ); |
343 | 343 | if ($modx->config['rss_url_news']) { |
344 | 344 | $widgets['news'] = array( |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | // invoke OnManagerWelcomeHome event |
367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets)); |
368 | 368 | if(is_array($sitewidgets)) { |
369 | - $newwidgets = array(); |
|
369 | + $newwidgets = array(); |
|
370 | 370 | foreach($sitewidgets as $widget){ |
371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
372 | 372 | } |
@@ -374,21 +374,21 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | usort($widgets, function ($a, $b) { |
377 | - return $a['menuindex'] - $b['menuindex']; |
|
377 | + return $a['menuindex'] - $b['menuindex']; |
|
378 | 378 | }); |
379 | 379 | |
380 | 380 | $tpl = getTplWidget(); |
381 | 381 | $output = ''; |
382 | 382 | foreach($widgets as $widget) { |
383 | - if ($widget['hide'] != '1'){ |
|
384 | - $output .= $modx->parseText($tpl, $widget); |
|
385 | - } |
|
383 | + if ($widget['hide'] != '1'){ |
|
384 | + $output .= $modx->parseText($tpl, $widget); |
|
385 | + } |
|
386 | 386 | } |
387 | 387 | $ph['widgets'] = $output; |
388 | 388 | |
389 | 389 | // load template |
390 | 390 | if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
391 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
391 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
@@ -396,27 +396,27 @@ discard block |
||
396 | 396 | $target = $modx->mergeSettingsContent($target); |
397 | 397 | |
398 | 398 | if(substr($target, 0, 1) === '@') { |
399 | - if(substr($target, 0, 6) === '@CHUNK') { |
|
400 | - $content = $modx->getChunk(trim(substr($target, 7))); |
|
401 | - } elseif(substr($target, 0, 5) === '@FILE') { |
|
402 | - $content = file_get_contents(trim(substr($target, 6))); |
|
403 | - } else { |
|
404 | - $content = ''; |
|
405 | - } |
|
399 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
400 | + $content = $modx->getChunk(trim(substr($target, 7))); |
|
401 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
402 | + $content = file_get_contents(trim(substr($target, 6))); |
|
403 | + } else { |
|
404 | + $content = ''; |
|
405 | + } |
|
406 | 406 | } else { |
407 | - $chunk = $modx->getChunk($target); |
|
408 | - if($chunk !== false && !empty($chunk)) { |
|
409 | - $content = $chunk; |
|
410 | - } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
411 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
413 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
415 | - { |
|
416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
417 | - } else { |
|
418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
419 | - } |
|
407 | + $chunk = $modx->getChunk($target); |
|
408 | + if($chunk !== false && !empty($chunk)) { |
|
409 | + $content = $chunk; |
|
410 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
411 | + $content = file_get_contents(MODX_BASE_PATH . $target); |
|
412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
413 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
415 | + { |
|
416 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
417 | + } else { |
|
418 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
419 | + } |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | // merge placeholders |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | $content = $modx->mergeSettingsContent($content); |
425 | 425 | $content = $modx->parseText($content, $ph); |
426 | 426 | if(strpos($content, '[+') !== false) { |
427 | - $modx->toPlaceholders($ph); |
|
428 | - $content = $modx->mergePlaceholderContent($content); |
|
427 | + $modx->toPlaceholders($ph); |
|
428 | + $content = $modx->mergePlaceholderContent($content); |
|
429 | 429 | } |
430 | 430 | $content = $modx->parseDocumentSource($content); |
431 | 431 | $content = $modx->parseText($content, $_lang, '[%', '%]'); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
434 | 434 | |
435 | 435 | if($js = $modx->getRegisteredClientScripts()) { |
436 | - $content .= $js; |
|
436 | + $content .= $js; |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | echo $content; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
444 | 444 | //</span> |
445 | 445 | function getTplWidget() { // recent document info |
446 | - return ' |
|
446 | + return ' |
|
447 | 447 | <div class="[+cols+]" id="[+id+]"> |
448 | 448 | <div class="card"[+cardAttr+]> |
449 | 449 | <div class="card-header"[+headAttr+]> <i class="fa [+icon+]"></i> [+title+] </div> |
@@ -454,11 +454,11 @@ discard block |
||
454 | 454 | } |
455 | 455 | |
456 | 456 | function getRecentInfo() { // recent document info |
457 | - global $modx; |
|
457 | + global $modx; |
|
458 | 458 | |
459 | - $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
|
459 | + $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
|
460 | 460 | |
461 | - $html = ' |
|
461 | + $html = ' |
|
462 | 462 | <div class="table-responsive"> |
463 | 463 | <table class="table data"> |
464 | 464 | <thead> |
@@ -476,96 +476,96 @@ discard block |
||
476 | 476 | </table> |
477 | 477 | </div> |
478 | 478 | '; |
479 | - return $html; |
|
479 | + return $html; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | function getRecentInfoList() { |
483 | - global $modx; |
|
484 | - |
|
485 | - $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
|
486 | - |
|
487 | - if($modx->db->getRecordCount($rs) < 1) { |
|
488 | - return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
489 | - } |
|
490 | - |
|
491 | - $tpl = getRecentInfoRowTpl(); |
|
492 | - |
|
493 | - $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
494 | - $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
495 | - |
|
496 | - $output = array(); |
|
497 | - while($ph = $modx->db->getRow($rs)) { |
|
498 | - $docid = $ph['id']; |
|
499 | - $_ = $modx->getUserInfo($ph['editedby']); |
|
500 | - $ph['username'] = $_['username']; |
|
501 | - |
|
502 | - if($ph['deleted'] == 1) { |
|
503 | - $ph['status'] = 'deleted text-danger'; |
|
504 | - } elseif($ph['published'] == 0) { |
|
505 | - $ph['status'] = 'unpublished font-italic text-muted'; |
|
506 | - } else { |
|
507 | - $ph['status'] = 'published'; |
|
508 | - } |
|
509 | - |
|
510 | - if($modx->hasPermission('edit_document')) { |
|
511 | - $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
|
512 | - } else { |
|
513 | - $ph['edit_btn'] = ''; |
|
514 | - } |
|
515 | - |
|
516 | - $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
517 | - $ph['preview_btn'] = str_replace(array( |
|
518 | - '[+id+]', |
|
519 | - '[+preview_disabled+]' |
|
520 | - ), array( |
|
521 | - $docid, |
|
522 | - $preview_disabled |
|
523 | - ), $btntpl['preview_btn']); |
|
524 | - |
|
525 | - if($modx->hasPermission('delete_document')) { |
|
526 | - if($ph['deleted'] == 0) { |
|
527 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
528 | - } else { |
|
529 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
530 | - } |
|
531 | - $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn); |
|
532 | - } else { |
|
533 | - $ph['delete_btn'] = ''; |
|
534 | - } |
|
535 | - |
|
536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | - $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
542 | - } else { |
|
543 | - $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
544 | - } |
|
545 | - $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn); |
|
546 | - |
|
547 | - $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>'); |
|
548 | - |
|
549 | - if($ph['longtitle'] == '') { |
|
550 | - $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
551 | - } |
|
552 | - if($ph['description'] == '') { |
|
553 | - $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
554 | - } |
|
555 | - if($ph['introtext'] == '') { |
|
556 | - $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
557 | - } |
|
558 | - if($ph['alias'] == '') { |
|
559 | - $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
560 | - } |
|
561 | - |
|
562 | - $output[] = $modx->parseText($tpl, $ph); |
|
563 | - } |
|
564 | - return implode("\n", $output); |
|
483 | + global $modx; |
|
484 | + |
|
485 | + $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
|
486 | + |
|
487 | + if($modx->db->getRecordCount($rs) < 1) { |
|
488 | + return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
489 | + } |
|
490 | + |
|
491 | + $tpl = getRecentInfoRowTpl(); |
|
492 | + |
|
493 | + $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
494 | + $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
495 | + |
|
496 | + $output = array(); |
|
497 | + while($ph = $modx->db->getRow($rs)) { |
|
498 | + $docid = $ph['id']; |
|
499 | + $_ = $modx->getUserInfo($ph['editedby']); |
|
500 | + $ph['username'] = $_['username']; |
|
501 | + |
|
502 | + if($ph['deleted'] == 1) { |
|
503 | + $ph['status'] = 'deleted text-danger'; |
|
504 | + } elseif($ph['published'] == 0) { |
|
505 | + $ph['status'] = 'unpublished font-italic text-muted'; |
|
506 | + } else { |
|
507 | + $ph['status'] = 'published'; |
|
508 | + } |
|
509 | + |
|
510 | + if($modx->hasPermission('edit_document')) { |
|
511 | + $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
|
512 | + } else { |
|
513 | + $ph['edit_btn'] = ''; |
|
514 | + } |
|
515 | + |
|
516 | + $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
517 | + $ph['preview_btn'] = str_replace(array( |
|
518 | + '[+id+]', |
|
519 | + '[+preview_disabled+]' |
|
520 | + ), array( |
|
521 | + $docid, |
|
522 | + $preview_disabled |
|
523 | + ), $btntpl['preview_btn']); |
|
524 | + |
|
525 | + if($modx->hasPermission('delete_document')) { |
|
526 | + if($ph['deleted'] == 0) { |
|
527 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
528 | + } else { |
|
529 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
530 | + } |
|
531 | + $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn); |
|
532 | + } else { |
|
533 | + $ph['delete_btn'] = ''; |
|
534 | + } |
|
535 | + |
|
536 | + if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
538 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
540 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | + $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
542 | + } else { |
|
543 | + $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
544 | + } |
|
545 | + $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn); |
|
546 | + |
|
547 | + $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>'); |
|
548 | + |
|
549 | + if($ph['longtitle'] == '') { |
|
550 | + $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
551 | + } |
|
552 | + if($ph['description'] == '') { |
|
553 | + $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
554 | + } |
|
555 | + if($ph['introtext'] == '') { |
|
556 | + $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
557 | + } |
|
558 | + if($ph['alias'] == '') { |
|
559 | + $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
560 | + } |
|
561 | + |
|
562 | + $output[] = $modx->parseText($tpl, $ph); |
|
563 | + } |
|
564 | + return implode("\n", $output); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | function getRecentInfoRowTpl() { |
568 | - $tpl = ' |
|
568 | + $tpl = ' |
|
569 | 569 | <tr> |
570 | 570 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
571 | 571 | <td data-toggle="collapse" data-target=".collapse[+id+]"><a class="[+status+]" title="[%edit_resource%]" href="index.php?a=3&id=[+id+]" target="main">[+pagetitle+]</a></td> |
@@ -589,16 +589,16 @@ discard block |
||
589 | 589 | </div> |
590 | 590 | </td> |
591 | 591 | </tr>'; |
592 | - return $tpl; |
|
592 | + return $tpl; |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | // setup icons |
596 | 596 | function wrapIcon($i, $action) { |
597 | - return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i); |
|
597 | + return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | function getStartUpScript() { |
601 | - $script = ' |
|
601 | + $script = ' |
|
602 | 602 | <script type="text/javascript"> |
603 | 603 | function hideConfigCheckWarning(key) { |
604 | 604 | var xhr = new XMLHttpRequest(); |
@@ -622,5 +622,5 @@ discard block |
||
622 | 622 | })(jQuery); |
623 | 623 | </script> |
624 | 624 | '; |
625 | - return $script; |
|
625 | + return $script; |
|
626 | 626 | } |
@@ -1,12 +1,12 @@ 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_template') && $modx->manager->action == '301') { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | if(!$modx->hasPermission('new_template') && $modx->manager->action == '300') { |
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | // check to see the snippet editor isn't locked |
22 | 22 | if($lockedEl = $modx->elementIsLocked(2, $id)) { |
23 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['tmplvar'])); |
|
23 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['tmplvar'])); |
|
24 | 24 | } |
25 | 25 | // end check for lock |
26 | 26 | |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | global $content; |
31 | 31 | $content = array(); |
32 | 32 | if(isset($_GET['id'])) { |
33 | - $rs = $modx->db->select('*', $tbl_site_tmplvars, "id='{$id}'"); |
|
34 | - $content = $modx->db->getRow($rs); |
|
35 | - if(!$content) { |
|
36 | - header("Location: " . MODX_SITE_URL . "index.php?id={$site_start}"); |
|
37 | - } |
|
38 | - |
|
39 | - $_SESSION['itemname'] = $content['caption']; |
|
40 | - if($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
41 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
42 | - } |
|
33 | + $rs = $modx->db->select('*', $tbl_site_tmplvars, "id='{$id}'"); |
|
34 | + $content = $modx->db->getRow($rs); |
|
35 | + if(!$content) { |
|
36 | + header("Location: " . MODX_SITE_URL . "index.php?id={$site_start}"); |
|
37 | + } |
|
38 | + |
|
39 | + $_SESSION['itemname'] = $content['caption']; |
|
40 | + if($content['locked'] == 1 && $modx->hasPermission('save_role') != 1) { |
|
41 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
42 | + } |
|
43 | 43 | } else if(isset($_REQUEST['itemname'])) { |
44 | - $content['name'] = $_REQUEST['itemname']; |
|
44 | + $content['name'] = $_REQUEST['itemname']; |
|
45 | 45 | } else { |
46 | - $_SESSION['itemname'] = $_lang["new_tmplvars"]; |
|
47 | - $content['category'] = (int)$_REQUEST['catid']; |
|
46 | + $_SESSION['itemname'] = $_lang["new_tmplvars"]; |
|
47 | + $content['category'] = (int)$_REQUEST['catid']; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | if($modx->manager->hasFormValues()) { |
51 | - $modx->manager->loadFormValues(); |
|
51 | + $modx->manager->loadFormValues(); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $content = array_merge($content, $_POST); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $RTEditors = ''; |
63 | 63 | $evtOut = $modx->invokeEvent('OnRichTextEditorRegister', array('forfrontend' => 1)); |
64 | 64 | if(is_array($evtOut)) { |
65 | - $RTEditors = implode(',', $evtOut); |
|
65 | + $RTEditors = implode(',', $evtOut); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | ?> |
@@ -277,12 +277,12 @@ discard block |
||
277 | 277 | |
278 | 278 | <form name="mutate" method="post" action="index.php" enctype="multipart/form-data"> |
279 | 279 | <?php |
280 | - // invoke OnTVFormPrerender event |
|
281 | - $evtOut = $modx->invokeEvent('OnTVFormPrerender', array('id' => $id)); |
|
282 | - if(is_array($evtOut)) { |
|
283 | - echo implode("", $evtOut); |
|
284 | - } |
|
285 | - ?> |
|
280 | + // invoke OnTVFormPrerender event |
|
281 | + $evtOut = $modx->invokeEvent('OnTVFormPrerender', array('id' => $id)); |
|
282 | + if(is_array($evtOut)) { |
|
283 | + echo implode("", $evtOut); |
|
284 | + } |
|
285 | + ?> |
|
286 | 286 | <input type="hidden" name="id" value="<?= $content['id'] ?>"> |
287 | 287 | <input type="hidden" name="a" value="302"> |
288 | 288 | <input type="hidden" name="or" value="<?= $origin ?>"> |
@@ -343,11 +343,11 @@ discard block |
||
343 | 343 | <select name="categoryid" class="form-control" onChange="documentDirty=true;"> |
344 | 344 | <option> </option> |
345 | 345 | <?php |
346 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
347 | - foreach(getCategories() as $n => $v) { |
|
348 | - echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
349 | - } |
|
350 | - ?> |
|
346 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
347 | + foreach(getCategories() as $n => $v) { |
|
348 | + echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($v["category"]) . "</option>"; |
|
349 | + } |
|
350 | + ?> |
|
351 | 351 | </select> |
352 | 352 | </div> |
353 | 353 | </div> |
@@ -383,14 +383,14 @@ discard block |
||
383 | 383 | <optgroup label="Custom Type"> |
384 | 384 | <option value="custom_tv" <?= ($content['type'] == 'custom_tv' ? "selected='selected'" : "") ?>>Custom Input</option> |
385 | 385 | <?php |
386 | - $custom_tvs = scandir(MODX_BASE_PATH . 'assets/tvs'); |
|
387 | - foreach($custom_tvs as $ctv) { |
|
388 | - if(strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
389 | - $selected = ($content['type'] == 'custom_tv:' . $ctv ? "selected='selected'" : ""); |
|
390 | - echo '<option value="custom_tv:' . $ctv . '" ' . $selected . '>' . $ctv . '</option>'; |
|
391 | - } |
|
392 | - } |
|
393 | - ?> |
|
386 | + $custom_tvs = scandir(MODX_BASE_PATH . 'assets/tvs'); |
|
387 | + foreach($custom_tvs as $ctv) { |
|
388 | + if(strpos($ctv, '.') !== 0 && $ctv != 'index.html') { |
|
389 | + $selected = ($content['type'] == 'custom_tv:' . $ctv ? "selected='selected'" : ""); |
|
390 | + echo '<option value="custom_tv:' . $ctv . '" ' . $selected . '>' . $ctv . '</option>'; |
|
391 | + } |
|
392 | + } |
|
393 | + ?> |
|
394 | 394 | </optgroup> |
395 | 395 | </select> |
396 | 396 | </div> |
@@ -455,63 +455,63 @@ discard block |
||
455 | 455 | <a class="btn btn-secondary btn-sm" href="javascript:;" onClick="check_toggle(); return false;"><?= $_lang['check_toggle'] ?></a> |
456 | 456 | </div> |
457 | 457 | <?php |
458 | - $rs = $modx->db->select(sprintf("tpl.id AS id, templatename, tpl.description AS tpldescription, tpl.locked AS tpllocked, tpl.selectable AS selectable, tmplvarid, if(isnull(cat.category),'%s',cat.category) AS category, cat.id AS catid", $_lang['no_category']), sprintf("%s as tpl |
|
458 | + $rs = $modx->db->select(sprintf("tpl.id AS id, templatename, tpl.description AS tpldescription, tpl.locked AS tpllocked, tpl.selectable AS selectable, tmplvarid, if(isnull(cat.category),'%s',cat.category) AS category, cat.id AS catid", $_lang['no_category']), sprintf("%s as tpl |
|
459 | 459 | LEFT JOIN %s as stt ON stt.templateid=tpl.id AND stt.tmplvarid='%s' |
460 | 460 | LEFT JOIN %s as cat ON tpl.category=cat.id", $modx->getFullTableName('site_templates'), $modx->getFullTableName('site_tmplvar_templates'), $id, $modx->getFullTableName('categories')), '', "category, templatename"); |
461 | 461 | |
462 | - $tplList = '<ul>'; |
|
463 | - $preCat = ''; |
|
464 | - $insideUl = 0; |
|
465 | - while($row = $modx->db->getRow($rs)) { |
|
466 | - $row['category'] = stripslashes($row['category']); //pixelchutes |
|
467 | - if($preCat !== $row['category']) { |
|
468 | - $tplList .= $insideUl ? '</ul>' : ''; |
|
469 | - $tplList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
470 | - $insideUl = 1; |
|
471 | - } |
|
472 | - |
|
473 | - if($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
474 | - $checked = true; |
|
475 | - } elseif(isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
476 | - $checked = true; |
|
477 | - } elseif($id == 0 && is_array($_POST['template'])) { |
|
478 | - $checked = in_array($row['id'], $_POST['template']); |
|
479 | - } else { |
|
480 | - $checked = $row['tmplvarid']; |
|
481 | - } |
|
482 | - $selectable = !$row['selectable'] ? ' class="disabled"' : ''; |
|
483 | - $checked = $checked ? ' checked="checked"' : ''; |
|
484 | - $tplId = ' <small>(' . $row['id'] . ')</small>'; |
|
485 | - $desc = !empty($row['tpldescription']) ? ' - ' . $row['tpldescription'] : ''; |
|
486 | - |
|
487 | - $tplInfo = array(); |
|
488 | - if($row['tpllocked']) { |
|
489 | - $tplInfo[] = $_lang['locked']; |
|
490 | - } |
|
491 | - if($row['id'] == $modx->config['default_template']) { |
|
492 | - $tplInfo[] = $_lang['defaulttemplate_title']; |
|
493 | - } |
|
494 | - $tplInfo = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
495 | - |
|
496 | - $tplList .= sprintf('<li><label%s><input name="template[]" value="%s" type="checkbox" %s onchange="documentDirty=true;"> %s%s%s%s</label></li>', $selectable, $row['id'], $checked, $row['templatename'], $tplId, $desc, $tplInfo); |
|
497 | - $tplList .= '</li>'; |
|
498 | - |
|
499 | - $preCat = $row['category']; |
|
500 | - } |
|
501 | - $tplList .= $insideUl ? '</ul>' : ''; |
|
502 | - $tplList .= '</ul>'; |
|
503 | - echo $tplList; |
|
504 | - |
|
505 | - ?> |
|
462 | + $tplList = '<ul>'; |
|
463 | + $preCat = ''; |
|
464 | + $insideUl = 0; |
|
465 | + while($row = $modx->db->getRow($rs)) { |
|
466 | + $row['category'] = stripslashes($row['category']); //pixelchutes |
|
467 | + if($preCat !== $row['category']) { |
|
468 | + $tplList .= $insideUl ? '</ul>' : ''; |
|
469 | + $tplList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>'; |
|
470 | + $insideUl = 1; |
|
471 | + } |
|
472 | + |
|
473 | + if($modx->manager->action == '300' && $modx->config['default_template'] == $row['id']) { |
|
474 | + $checked = true; |
|
475 | + } elseif(isset($_GET['tpl']) && $_GET['tpl'] == $row['id']) { |
|
476 | + $checked = true; |
|
477 | + } elseif($id == 0 && is_array($_POST['template'])) { |
|
478 | + $checked = in_array($row['id'], $_POST['template']); |
|
479 | + } else { |
|
480 | + $checked = $row['tmplvarid']; |
|
481 | + } |
|
482 | + $selectable = !$row['selectable'] ? ' class="disabled"' : ''; |
|
483 | + $checked = $checked ? ' checked="checked"' : ''; |
|
484 | + $tplId = ' <small>(' . $row['id'] . ')</small>'; |
|
485 | + $desc = !empty($row['tpldescription']) ? ' - ' . $row['tpldescription'] : ''; |
|
486 | + |
|
487 | + $tplInfo = array(); |
|
488 | + if($row['tpllocked']) { |
|
489 | + $tplInfo[] = $_lang['locked']; |
|
490 | + } |
|
491 | + if($row['id'] == $modx->config['default_template']) { |
|
492 | + $tplInfo[] = $_lang['defaulttemplate_title']; |
|
493 | + } |
|
494 | + $tplInfo = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
495 | + |
|
496 | + $tplList .= sprintf('<li><label%s><input name="template[]" value="%s" type="checkbox" %s onchange="documentDirty=true;"> %s%s%s%s</label></li>', $selectable, $row['id'], $checked, $row['templatename'], $tplId, $desc, $tplInfo); |
|
497 | + $tplList .= '</li>'; |
|
498 | + |
|
499 | + $preCat = $row['category']; |
|
500 | + } |
|
501 | + $tplList .= $insideUl ? '</ul>' : ''; |
|
502 | + $tplList .= '</ul>'; |
|
503 | + echo $tplList; |
|
504 | + |
|
505 | + ?> |
|
506 | 506 | |
507 | 507 | <!-- Access Permissions --> |
508 | 508 | <?php |
509 | - if($use_udperms == 1) { |
|
510 | - // fetch permissions for the variable |
|
511 | - $rs = $modx->db->select('documentgroup', $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); |
|
512 | - $groupsarray = $modx->db->getColumn('documentgroup', $rs); |
|
509 | + if($use_udperms == 1) { |
|
510 | + // fetch permissions for the variable |
|
511 | + $rs = $modx->db->select('documentgroup', $modx->getFullTableName('site_tmplvar_access'), "tmplvarid='{$id}'"); |
|
512 | + $groupsarray = $modx->db->getColumn('documentgroup', $rs); |
|
513 | 513 | |
514 | - ?> |
|
514 | + ?> |
|
515 | 515 | <?php if($modx->hasPermission('access_permissions')) { ?> |
516 | 516 | <script type="text/javascript"> |
517 | 517 | function makePublic(b) { |
@@ -539,29 +539,29 @@ discard block |
||
539 | 539 | <!--<b><?php /*echo $_lang['access_permissions']; */ ?></b>--> |
540 | 540 | <p><?= $_lang['tmplvar_access_msg'] ?></p> |
541 | 541 | <?php |
542 | - $chk = ''; |
|
543 | - $rs = $modx->db->select('name, id', $tbl_documentgroup_names); |
|
544 | - if(empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
545 | - $groupsarray = $_POST['docgroups']; |
|
546 | - } |
|
547 | - while($row = $modx->db->getRow($rs)) { |
|
548 | - $checked = in_array($row['id'], $groupsarray); |
|
549 | - if($modx->hasPermission('access_permissions')) { |
|
550 | - if($checked) { |
|
551 | - $notPublic = true; |
|
552 | - } |
|
553 | - $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='" . $row['id'] . "' " . ($checked ? "checked='checked'" : '') . " onclick=\"makePublic(false)\" /> " . $row['name'] . "</label></li>"; |
|
554 | - } else { |
|
555 | - if($checked) { |
|
556 | - echo "<input type='hidden' name='docgroups[]' value='" . $row['id'] . "' />"; |
|
557 | - } |
|
558 | - } |
|
559 | - } |
|
560 | - if($modx->hasPermission('access_permissions')) { |
|
561 | - $chks = "<li><label><input type='checkbox' name='chkalldocs' " . (!$notPublic ? "checked='checked'" : '') . " onclick=\"makePublic(true)\" /> <span class='warning'>" . $_lang['all_doc_groups'] . "</span></label></li>" . $chks; |
|
562 | - } |
|
563 | - echo '<ul>' . $chks . '</ul>'; |
|
564 | - ?> |
|
542 | + $chk = ''; |
|
543 | + $rs = $modx->db->select('name, id', $tbl_documentgroup_names); |
|
544 | + if(empty($groupsarray) && is_array($_POST['docgroups']) && empty($_POST['id'])) { |
|
545 | + $groupsarray = $_POST['docgroups']; |
|
546 | + } |
|
547 | + while($row = $modx->db->getRow($rs)) { |
|
548 | + $checked = in_array($row['id'], $groupsarray); |
|
549 | + if($modx->hasPermission('access_permissions')) { |
|
550 | + if($checked) { |
|
551 | + $notPublic = true; |
|
552 | + } |
|
553 | + $chks .= "<li><label><input type='checkbox' name='docgroups[]' value='" . $row['id'] . "' " . ($checked ? "checked='checked'" : '') . " onclick=\"makePublic(false)\" /> " . $row['name'] . "</label></li>"; |
|
554 | + } else { |
|
555 | + if($checked) { |
|
556 | + echo "<input type='hidden' name='docgroups[]' value='" . $row['id'] . "' />"; |
|
557 | + } |
|
558 | + } |
|
559 | + } |
|
560 | + if($modx->hasPermission('access_permissions')) { |
|
561 | + $chks = "<li><label><input type='checkbox' name='chkalldocs' " . (!$notPublic ? "checked='checked'" : '') . " onclick=\"makePublic(true)\" /> <span class='warning'>" . $_lang['all_doc_groups'] . "</span></label></li>" . $chks; |
|
562 | + } |
|
563 | + echo '<ul>' . $chks . '</ul>'; |
|
564 | + ?> |
|
565 | 565 | <?php } ?> |
566 | 566 | <?php } ?> |
567 | 567 | |
@@ -571,12 +571,12 @@ discard block |
||
571 | 571 | <input type="submit" name="save" style="display:none"> |
572 | 572 | |
573 | 573 | <?php |
574 | - // invoke OnTVFormRender event |
|
575 | - $evtOut = $modx->invokeEvent('OnTVFormRender', array('id' => $id)); |
|
576 | - if(is_array($evtOut)) { |
|
577 | - echo implode('', $evtOut); |
|
578 | - } |
|
579 | - ?> |
|
574 | + // invoke OnTVFormRender event |
|
575 | + $evtOut = $modx->invokeEvent('OnTVFormRender', array('id' => $id)); |
|
576 | + if(is_array($evtOut)) { |
|
577 | + echo implode('', $evtOut); |
|
578 | + } |
|
579 | + ?> |
|
580 | 580 | </div> |
581 | 581 | </form> |
582 | 582 | <script type="text/javascript">setTimeout('showParameters()', 10);</script> |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | |
6 | 6 | // PROCESSOR FIRST |
7 | 7 | if($_SESSION['mgrRole'] == 1) { |
8 | - if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
9 | - $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
10 | - if(!empty($current)) { |
|
11 | - $modx->manager->setSystemChecksum($current); |
|
12 | - $modx->clearCache('full'); |
|
13 | - $modx->config['sys_files_checksum'] = $current; |
|
14 | - }; |
|
15 | - } |
|
8 | + if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
9 | + $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
10 | + if(!empty($current)) { |
|
11 | + $modx->manager->setSystemChecksum($current); |
|
12 | + $modx->clearCache('full'); |
|
13 | + $modx->config['sys_files_checksum'] = $current; |
|
14 | + }; |
|
15 | + } |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | // NOW CHECK CONFIG |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | |
21 | 21 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
22 | 22 | if ($sysfiles_check!=='0'){ |
23 | - $warningspresent = 1; |
|
24 | - $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
23 | + $warningspresent = 1; |
|
24 | + $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | if (is_writable("includes/config.inc.php")){ |
28 | 28 | // Warn if world writable |
29 | 29 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
30 | - $warningspresent = 1; |
|
31 | - $warnings[] = array($_lang['configcheck_configinc']); |
|
30 | + $warningspresent = 1; |
|
31 | + $warnings[] = array($_lang['configcheck_configinc']); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | break; |
180 | 180 | case $_lang['configcheck_sysfiles_mod']: |
181 | 181 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
182 | - $warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
183 | - if($modx->hasPermission('settings')) { |
|
184 | - $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
185 | - } |
|
182 | + $warnings[$i][2] = '<ul><li>'. implode('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
183 | + if($modx->hasPermission('settings')) { |
|
184 | + $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
185 | + } |
|
186 | 186 | if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".implode(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
187 | 187 | break; |
188 | 188 | case $_lang['configcheck_lang_difference'] : |
@@ -1,159 +1,159 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // DISPLAY FORM ELEMENTS |
3 | 3 | function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
4 | - global $modx; |
|
5 | - global $_style; |
|
6 | - global $_lang; |
|
7 | - global $content; |
|
8 | - global $which_browser; |
|
4 | + global $modx; |
|
5 | + global $_style; |
|
6 | + global $_lang; |
|
7 | + global $content; |
|
8 | + global $which_browser; |
|
9 | 9 | |
10 | - if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
11 | - $eval_str = trim(substr($default_text, 7)); |
|
12 | - $default_text = eval($eval_str); |
|
13 | - $field_value = $default_text; |
|
14 | - } |
|
10 | + if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
11 | + $eval_str = trim(substr($default_text, 7)); |
|
12 | + $default_text = eval($eval_str); |
|
13 | + $field_value = $default_text; |
|
14 | + } |
|
15 | 15 | |
16 | - $field_html = ''; |
|
17 | - $cimode = strpos($field_type, ':'); |
|
18 | - if($cimode === false) { |
|
19 | - switch($field_type) { |
|
16 | + $field_html = ''; |
|
17 | + $cimode = strpos($field_type, ':'); |
|
18 | + if($cimode === false) { |
|
19 | + switch($field_type) { |
|
20 | 20 | |
21 | - case "text": // handler for regular text boxes |
|
22 | - case "rawtext"; // non-htmlentity converted text boxes |
|
23 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
24 | - break; |
|
25 | - case "email": // handles email input fields |
|
26 | - $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
27 | - break; |
|
28 | - case "number": // handles the input of numbers |
|
29 | - $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
30 | - break; |
|
31 | - case "textareamini": // handler for textarea mini boxes |
|
32 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
33 | - break; |
|
34 | - case "textarea": // handler for textarea boxes |
|
35 | - case "rawtextarea": // non-htmlentity convertex textarea boxes |
|
36 | - case "htmlarea": // handler for textarea boxes (deprecated) |
|
37 | - case "richtext": // handler for textarea boxes |
|
38 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
39 | - break; |
|
40 | - case "date": |
|
41 | - $field_id = str_replace(array( |
|
42 | - '-', |
|
43 | - '.' |
|
44 | - ), '_', urldecode($field_id)); |
|
45 | - if($field_value == '') { |
|
46 | - $field_value = 0; |
|
47 | - } |
|
48 | - $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
49 | - $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
21 | + case "text": // handler for regular text boxes |
|
22 | + case "rawtext"; // non-htmlentity converted text boxes |
|
23 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
24 | + break; |
|
25 | + case "email": // handles email input fields |
|
26 | + $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
27 | + break; |
|
28 | + case "number": // handles the input of numbers |
|
29 | + $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
30 | + break; |
|
31 | + case "textareamini": // handler for textarea mini boxes |
|
32 | + $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
33 | + break; |
|
34 | + case "textarea": // handler for textarea boxes |
|
35 | + case "rawtextarea": // non-htmlentity convertex textarea boxes |
|
36 | + case "htmlarea": // handler for textarea boxes (deprecated) |
|
37 | + case "richtext": // handler for textarea boxes |
|
38 | + $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>'; |
|
39 | + break; |
|
40 | + case "date": |
|
41 | + $field_id = str_replace(array( |
|
42 | + '-', |
|
43 | + '.' |
|
44 | + ), '_', urldecode($field_id)); |
|
45 | + if($field_value == '') { |
|
46 | + $field_value = 0; |
|
47 | + } |
|
48 | + $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />'; |
|
49 | + $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>'; |
|
50 | 50 | |
51 | - break; |
|
52 | - case "dropdown": // handler for select boxes |
|
53 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
54 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
55 | - while(list($item, $itemvalue) = each($index_list)) { |
|
56 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
57 | - if(strlen($itemvalue) == 0) { |
|
58 | - $itemvalue = $item; |
|
59 | - } |
|
60 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
61 | - } |
|
62 | - $field_html .= "</select>"; |
|
63 | - break; |
|
64 | - case "listbox": // handler for select boxes |
|
65 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
66 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
67 | - while(list($item, $itemvalue) = each($index_list)) { |
|
68 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
69 | - if(strlen($itemvalue) == 0) { |
|
70 | - $itemvalue = $item; |
|
71 | - } |
|
72 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
73 | - } |
|
74 | - $field_html .= "</select>"; |
|
75 | - break; |
|
76 | - case "listbox-multiple": // handler for select boxes where you can choose multiple items |
|
77 | - $field_value = explode("||", $field_value); |
|
78 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
79 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
80 | - while(list($item, $itemvalue) = each($index_list)) { |
|
81 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
82 | - if(strlen($itemvalue) == 0) { |
|
83 | - $itemvalue = $item; |
|
84 | - } |
|
85 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
86 | - } |
|
87 | - $field_html .= "</select>"; |
|
88 | - break; |
|
89 | - case "url": // handles url input fields |
|
90 | - $urls = array( |
|
91 | - '' => '--', |
|
92 | - 'http://' => 'http://', |
|
93 | - 'https://' => 'https://', |
|
94 | - 'ftp://' => 'ftp://', |
|
95 | - 'mailto:' => 'mailto:' |
|
96 | - ); |
|
97 | - $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
98 | - foreach($urls as $k => $v) { |
|
99 | - if(strpos($field_value, $v) === false) { |
|
100 | - $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
101 | - } else { |
|
102 | - $field_value = str_replace($v, '', $field_value); |
|
103 | - $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
104 | - } |
|
105 | - } |
|
106 | - $field_html .= '</select></td><td>'; |
|
107 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
108 | - break; |
|
109 | - case 'checkbox': // handles check boxes |
|
110 | - $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
|
111 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
112 | - $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
|
113 | - static $i = 0; |
|
114 | - $_ = array(); |
|
115 | - foreach($index_list as $c => $item) { |
|
116 | - if(is_array($item)) { |
|
117 | - $name = trim($item[0]); |
|
118 | - $value = isset($item[1]) ? $item[1] : $name; |
|
119 | - } else { |
|
120 | - $item = trim($item); |
|
121 | - list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array( |
|
122 | - $item, |
|
123 | - $item |
|
124 | - ); |
|
125 | - } |
|
126 | - $checked = in_array($value, $values) ? ' checked="checked"' : ''; |
|
127 | - $param = array( |
|
128 | - $modx->htmlspecialchars($value), |
|
129 | - $i, |
|
130 | - $field_id, |
|
131 | - $checked, |
|
132 | - $modx->htmlspecialchars($name) |
|
133 | - ); |
|
134 | - $_[] = vsprintf($tpl, $param); |
|
135 | - $i++; |
|
136 | - } |
|
137 | - $field_html = implode("\n", $_); |
|
138 | - break; |
|
139 | - case "option": // handles radio buttons |
|
140 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
141 | - static $i = 0; |
|
142 | - while(list($item, $itemvalue) = each($index_list)) { |
|
143 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
144 | - if(strlen($itemvalue) == 0) { |
|
145 | - $itemvalue = $item; |
|
146 | - } |
|
147 | - $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
148 | - $i++; |
|
149 | - } |
|
150 | - break; |
|
151 | - case "image": // handles image fields using htmlarea image manager |
|
152 | - global $_lang; |
|
153 | - global $ResourceManagerLoaded; |
|
154 | - global $content, $use_editor, $which_editor; |
|
155 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
156 | - $field_html .= " |
|
51 | + break; |
|
52 | + case "dropdown": // handler for select boxes |
|
53 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
54 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
55 | + while(list($item, $itemvalue) = each($index_list)) { |
|
56 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
57 | + if(strlen($itemvalue) == 0) { |
|
58 | + $itemvalue = $item; |
|
59 | + } |
|
60 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
61 | + } |
|
62 | + $field_html .= "</select>"; |
|
63 | + break; |
|
64 | + case "listbox": // handler for select boxes |
|
65 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
66 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
67 | + while(list($item, $itemvalue) = each($index_list)) { |
|
68 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
69 | + if(strlen($itemvalue) == 0) { |
|
70 | + $itemvalue = $item; |
|
71 | + } |
|
72 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
73 | + } |
|
74 | + $field_html .= "</select>"; |
|
75 | + break; |
|
76 | + case "listbox-multiple": // handler for select boxes where you can choose multiple items |
|
77 | + $field_value = explode("||", $field_value); |
|
78 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
79 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
80 | + while(list($item, $itemvalue) = each($index_list)) { |
|
81 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
82 | + if(strlen($itemvalue) == 0) { |
|
83 | + $itemvalue = $item; |
|
84 | + } |
|
85 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
86 | + } |
|
87 | + $field_html .= "</select>"; |
|
88 | + break; |
|
89 | + case "url": // handles url input fields |
|
90 | + $urls = array( |
|
91 | + '' => '--', |
|
92 | + 'http://' => 'http://', |
|
93 | + 'https://' => 'https://', |
|
94 | + 'ftp://' => 'ftp://', |
|
95 | + 'mailto:' => 'mailto:' |
|
96 | + ); |
|
97 | + $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">'; |
|
98 | + foreach($urls as $k => $v) { |
|
99 | + if(strpos($field_value, $v) === false) { |
|
100 | + $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
101 | + } else { |
|
102 | + $field_value = str_replace($v, '', $field_value); |
|
103 | + $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
104 | + } |
|
105 | + } |
|
106 | + $field_html .= '</select></td><td>'; |
|
107 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
108 | + break; |
|
109 | + case 'checkbox': // handles check boxes |
|
110 | + $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
|
111 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
112 | + $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
|
113 | + static $i = 0; |
|
114 | + $_ = array(); |
|
115 | + foreach($index_list as $c => $item) { |
|
116 | + if(is_array($item)) { |
|
117 | + $name = trim($item[0]); |
|
118 | + $value = isset($item[1]) ? $item[1] : $name; |
|
119 | + } else { |
|
120 | + $item = trim($item); |
|
121 | + list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array( |
|
122 | + $item, |
|
123 | + $item |
|
124 | + ); |
|
125 | + } |
|
126 | + $checked = in_array($value, $values) ? ' checked="checked"' : ''; |
|
127 | + $param = array( |
|
128 | + $modx->htmlspecialchars($value), |
|
129 | + $i, |
|
130 | + $field_id, |
|
131 | + $checked, |
|
132 | + $modx->htmlspecialchars($name) |
|
133 | + ); |
|
134 | + $_[] = vsprintf($tpl, $param); |
|
135 | + $i++; |
|
136 | + } |
|
137 | + $field_html = implode("\n", $_); |
|
138 | + break; |
|
139 | + case "option": // handles radio buttons |
|
140 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
141 | + static $i = 0; |
|
142 | + while(list($item, $itemvalue) = each($index_list)) { |
|
143 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
144 | + if(strlen($itemvalue) == 0) { |
|
145 | + $itemvalue = $item; |
|
146 | + } |
|
147 | + $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />'; |
|
148 | + $i++; |
|
149 | + } |
|
150 | + break; |
|
151 | + case "image": // handles image fields using htmlarea image manager |
|
152 | + global $_lang; |
|
153 | + global $ResourceManagerLoaded; |
|
154 | + global $content, $use_editor, $which_editor; |
|
155 | + if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
156 | + $field_html .= " |
|
157 | 157 | <script type=\"text/javascript\"> |
158 | 158 | /* <![CDATA[ */ |
159 | 159 | var lastImageCtrl; |
@@ -212,18 +212,18 @@ discard block |
||
212 | 212 | } |
213 | 213 | /* ]]> */ |
214 | 214 | </script>"; |
215 | - $ResourceManagerLoaded = true; |
|
216 | - } |
|
217 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
218 | - break; |
|
219 | - case "file": // handles the input of file uploads |
|
220 | - /* Modified by Timon for use with resource browser */ |
|
221 | - global $_lang; |
|
222 | - global $ResourceManagerLoaded; |
|
223 | - global $content, $use_editor, $which_editor; |
|
224 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
225 | - /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
|
226 | - $field_html .= " |
|
215 | + $ResourceManagerLoaded = true; |
|
216 | + } |
|
217 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />'; |
|
218 | + break; |
|
219 | + case "file": // handles the input of file uploads |
|
220 | + /* Modified by Timon for use with resource browser */ |
|
221 | + global $_lang; |
|
222 | + global $ResourceManagerLoaded; |
|
223 | + global $content, $use_editor, $which_editor; |
|
224 | + if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
225 | + /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
|
226 | + $field_html .= " |
|
227 | 227 | <script type=\"text/javascript\"> |
228 | 228 | /* <![CDATA[ */ |
229 | 229 | var lastImageCtrl; |
@@ -282,101 +282,101 @@ discard block |
||
282 | 282 | } |
283 | 283 | /* ]]> */ |
284 | 284 | </script>"; |
285 | - $ResourceManagerLoaded = true; |
|
286 | - } |
|
287 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
285 | + $ResourceManagerLoaded = true; |
|
286 | + } |
|
287 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />'; |
|
288 | 288 | |
289 | - break; |
|
289 | + break; |
|
290 | 290 | |
291 | - case 'custom_tv': |
|
292 | - $custom_output = ''; |
|
293 | - /* If we are loading a file */ |
|
294 | - if(substr($field_elements, 0, 5) == "@FILE") { |
|
295 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
296 | - if(!file_exists($file_name)) { |
|
297 | - $custom_output = $file_name . ' does not exist'; |
|
298 | - } else { |
|
299 | - $custom_output = file_get_contents($file_name); |
|
300 | - } |
|
301 | - } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
302 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
303 | - if(!file_exists($file_name)) { |
|
304 | - $custom_output = $file_name . ' does not exist'; |
|
305 | - } else { |
|
306 | - ob_start(); |
|
307 | - include $file_name; |
|
308 | - $custom_output = ob_get_contents(); |
|
309 | - ob_end_clean(); |
|
310 | - } |
|
311 | - } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
312 | - $chunk_name = trim(substr($field_elements, 7)); |
|
313 | - $chunk_body = $modx->getChunk($chunk_name); |
|
314 | - if($chunk_body == false) { |
|
315 | - $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
316 | - } else { |
|
317 | - $custom_output = $chunk_body; |
|
318 | - } |
|
319 | - } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
320 | - $eval_str = trim(substr($field_elements, 6)); |
|
321 | - $custom_output = eval($eval_str); |
|
322 | - } else { |
|
323 | - $custom_output = $field_elements; |
|
324 | - } |
|
325 | - $replacements = array( |
|
326 | - '[+field_type+]' => $field_type, |
|
327 | - '[+field_id+]' => $field_id, |
|
328 | - '[+default_text+]' => $default_text, |
|
329 | - '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
330 | - '[+field_style+]' => $field_style, |
|
331 | - ); |
|
332 | - $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
333 | - $modx->documentObject = $content; |
|
334 | - $modx->documentIdentifier = $content['id']; |
|
335 | - $custom_output = $modx->parseDocumentSource($custom_output); |
|
336 | - $field_html .= $custom_output; |
|
337 | - break; |
|
291 | + case 'custom_tv': |
|
292 | + $custom_output = ''; |
|
293 | + /* If we are loading a file */ |
|
294 | + if(substr($field_elements, 0, 5) == "@FILE") { |
|
295 | + $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
296 | + if(!file_exists($file_name)) { |
|
297 | + $custom_output = $file_name . ' does not exist'; |
|
298 | + } else { |
|
299 | + $custom_output = file_get_contents($file_name); |
|
300 | + } |
|
301 | + } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
302 | + $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
303 | + if(!file_exists($file_name)) { |
|
304 | + $custom_output = $file_name . ' does not exist'; |
|
305 | + } else { |
|
306 | + ob_start(); |
|
307 | + include $file_name; |
|
308 | + $custom_output = ob_get_contents(); |
|
309 | + ob_end_clean(); |
|
310 | + } |
|
311 | + } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
312 | + $chunk_name = trim(substr($field_elements, 7)); |
|
313 | + $chunk_body = $modx->getChunk($chunk_name); |
|
314 | + if($chunk_body == false) { |
|
315 | + $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
316 | + } else { |
|
317 | + $custom_output = $chunk_body; |
|
318 | + } |
|
319 | + } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
320 | + $eval_str = trim(substr($field_elements, 6)); |
|
321 | + $custom_output = eval($eval_str); |
|
322 | + } else { |
|
323 | + $custom_output = $field_elements; |
|
324 | + } |
|
325 | + $replacements = array( |
|
326 | + '[+field_type+]' => $field_type, |
|
327 | + '[+field_id+]' => $field_id, |
|
328 | + '[+default_text+]' => $default_text, |
|
329 | + '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
330 | + '[+field_style+]' => $field_style, |
|
331 | + ); |
|
332 | + $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
333 | + $modx->documentObject = $content; |
|
334 | + $modx->documentIdentifier = $content['id']; |
|
335 | + $custom_output = $modx->parseDocumentSource($custom_output); |
|
336 | + $field_html .= $custom_output; |
|
337 | + break; |
|
338 | 338 | |
339 | - default: // the default handler -- for errors, mostly |
|
340 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
339 | + default: // the default handler -- for errors, mostly |
|
340 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
341 | 341 | |
342 | - } // end switch statement |
|
343 | - } else { |
|
344 | - $custom = explode(":", $field_type); |
|
345 | - $custom_output = ''; |
|
346 | - $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
347 | - if(!file_exists($file_name)) { |
|
348 | - $custom_output = $file_name . ' does not exist'; |
|
349 | - } else { |
|
350 | - ob_start(); |
|
351 | - include $file_name; |
|
352 | - $custom_output = ob_get_contents(); |
|
353 | - ob_end_clean(); |
|
354 | - } |
|
355 | - $replacements = array( |
|
356 | - '[+field_type+]' => $field_type, |
|
357 | - '[+field_id+]' => $field_id, |
|
358 | - '[+default_text+]' => $default_text, |
|
359 | - '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
360 | - '[+field_style+]' => $field_style, |
|
361 | - ); |
|
362 | - $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
363 | - $modx->documentObject = $content; |
|
364 | - $custom_output = $modx->parseDocumentSource($custom_output); |
|
365 | - $field_html .= $custom_output; |
|
366 | - } |
|
342 | + } // end switch statement |
|
343 | + } else { |
|
344 | + $custom = explode(":", $field_type); |
|
345 | + $custom_output = ''; |
|
346 | + $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
347 | + if(!file_exists($file_name)) { |
|
348 | + $custom_output = $file_name . ' does not exist'; |
|
349 | + } else { |
|
350 | + ob_start(); |
|
351 | + include $file_name; |
|
352 | + $custom_output = ob_get_contents(); |
|
353 | + ob_end_clean(); |
|
354 | + } |
|
355 | + $replacements = array( |
|
356 | + '[+field_type+]' => $field_type, |
|
357 | + '[+field_id+]' => $field_id, |
|
358 | + '[+default_text+]' => $default_text, |
|
359 | + '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
360 | + '[+field_style+]' => $field_style, |
|
361 | + ); |
|
362 | + $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
363 | + $modx->documentObject = $content; |
|
364 | + $custom_output = $modx->parseDocumentSource($custom_output); |
|
365 | + $field_html .= $custom_output; |
|
366 | + } |
|
367 | 367 | |
368 | - return $field_html; |
|
368 | + return $field_html; |
|
369 | 369 | } // end renderFormElement function |
370 | 370 | |
371 | 371 | function ParseIntputOptions($v) { |
372 | - global $modx; |
|
373 | - $a = array(); |
|
374 | - if(is_array($v)) { |
|
375 | - return $v; |
|
376 | - } else if($modx->db->isResult($v)) { |
|
377 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
378 | - } else { |
|
379 | - $a = explode("||", $v); |
|
380 | - } |
|
381 | - return $a; |
|
372 | + global $modx; |
|
373 | + $a = array(); |
|
374 | + if(is_array($v)) { |
|
375 | + return $v; |
|
376 | + } else if($modx->db->isResult($v)) { |
|
377 | + while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
378 | + } else { |
|
379 | + $a = explode("||", $v); |
|
380 | + } |
|
381 | + return $a; |
|
382 | 382 | } |