@@ -381,7 +381,7 @@ |
||
381 | 381 | } // end renderFormElement function |
382 | 382 | |
383 | 383 | /** |
384 | - * @param string|array|mysqli_result $v |
|
384 | + * @param string $v |
|
385 | 385 | * @return array |
386 | 386 | */ |
387 | 387 | function ParseIntputOptions($v) { |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | * @param array $tvsArray |
13 | 13 | * @return string |
14 | 14 | */ |
15 | -function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
|
15 | +function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()){ |
|
16 | 16 | global $modx; |
17 | 17 | global $_style; |
18 | 18 | global $_lang; |
19 | 19 | global $content; |
20 | 20 | global $which_browser; |
21 | 21 | |
22 | - if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
22 | + if (substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
23 | 23 | $eval_str = trim(substr($default_text, 7)); |
24 | 24 | $default_text = eval($eval_str); |
25 | 25 | $field_value = $default_text; |
@@ -27,74 +27,74 @@ discard block |
||
27 | 27 | |
28 | 28 | $field_html = ''; |
29 | 29 | $cimode = strpos($field_type, ':'); |
30 | - if($cimode === false) { |
|
31 | - switch($field_type) { |
|
30 | + if ($cimode === false) { |
|
31 | + switch ($field_type) { |
|
32 | 32 | |
33 | 33 | case "text": // handler for regular text boxes |
34 | 34 | case "rawtext"; // non-htmlentity converted text boxes |
35 | - $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%" />'; |
|
35 | + $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%" />'; |
|
36 | 36 | break; |
37 | 37 | case "email": // handles email input fields |
38 | - $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%"/>'; |
|
38 | + $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%"/>'; |
|
39 | 39 | break; |
40 | 40 | case "number": // handles the input of numbers |
41 | - $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-,.+]/,\'\')"/>'; |
|
41 | + $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-,.+]/,\'\')"/>'; |
|
42 | 42 | break; |
43 | 43 | case "textareamini": // handler for textarea mini boxes |
44 | - $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>'; |
|
44 | + $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>'; |
|
45 | 45 | break; |
46 | 46 | case "textarea": // handler for textarea boxes |
47 | 47 | case "rawtextarea": // non-htmlentity convertex textarea boxes |
48 | 48 | case "htmlarea": // handler for textarea boxes (deprecated) |
49 | 49 | case "richtext": // handler for textarea boxes |
50 | - $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>'; |
|
50 | + $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>'; |
|
51 | 51 | break; |
52 | 52 | case "date": |
53 | 53 | $field_id = str_replace(array( |
54 | 54 | '-', |
55 | 55 | '.' |
56 | 56 | ), '_', urldecode($field_id)); |
57 | - if($field_value == '') { |
|
57 | + if ($field_value == '') { |
|
58 | 58 | $field_value = 0; |
59 | 59 | } |
60 | - $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;" />'; |
|
61 | - $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>'; |
|
60 | + $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;" />'; |
|
61 | + $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>'; |
|
62 | 62 | |
63 | 63 | break; |
64 | 64 | case "dropdown": // handler for select boxes |
65 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
65 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">'; |
|
66 | 66 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
67 | - while(list($item, $itemvalue) = each($index_list)) { |
|
67 | + while (list($item, $itemvalue) = each($index_list)) { |
|
68 | 68 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
69 | - if(strlen($itemvalue) == 0) { |
|
69 | + if (strlen($itemvalue) == 0) { |
|
70 | 70 | $itemvalue = $item; |
71 | 71 | } |
72 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
72 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
73 | 73 | } |
74 | 74 | $field_html .= "</select>"; |
75 | 75 | break; |
76 | 76 | case "listbox": // handler for select boxes |
77 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
77 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">'; |
|
78 | 78 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
79 | - while(list($item, $itemvalue) = each($index_list)) { |
|
79 | + while (list($item, $itemvalue) = each($index_list)) { |
|
80 | 80 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
81 | - if(strlen($itemvalue) == 0) { |
|
81 | + if (strlen($itemvalue) == 0) { |
|
82 | 82 | $itemvalue = $item; |
83 | 83 | } |
84 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
84 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
85 | 85 | } |
86 | 86 | $field_html .= "</select>"; |
87 | 87 | break; |
88 | 88 | case "listbox-multiple": // handler for select boxes where you can choose multiple items |
89 | 89 | $field_value = explode("||", $field_value); |
90 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
90 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
91 | 91 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
92 | - while(list($item, $itemvalue) = each($index_list)) { |
|
92 | + while (list($item, $itemvalue) = each($index_list)) { |
|
93 | 93 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
94 | - if(strlen($itemvalue) == 0) { |
|
94 | + if (strlen($itemvalue) == 0) { |
|
95 | 95 | $itemvalue = $item; |
96 | 96 | } |
97 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
97 | + $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue, $field_value) ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>'; |
|
98 | 98 | } |
99 | 99 | $field_html .= "</select>"; |
100 | 100 | break; |
@@ -106,17 +106,17 @@ discard block |
||
106 | 106 | 'ftp://' => 'ftp://', |
107 | 107 | 'mailto:' => 'mailto:' |
108 | 108 | ); |
109 | - $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;">'; |
|
110 | - foreach($urls as $k => $v) { |
|
111 | - if(strpos($field_value, $v) === false) { |
|
112 | - $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
109 | + $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;">'; |
|
110 | + foreach ($urls as $k => $v) { |
|
111 | + if (strpos($field_value, $v) === false) { |
|
112 | + $field_html .= '<option value="'.$v.'">'.$k.'</option>'; |
|
113 | 113 | } else { |
114 | 114 | $field_value = str_replace($v, '', $field_value); |
115 | - $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
115 | + $field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>'; |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | $field_html .= '</select></td><td>'; |
119 | - $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>'; |
|
119 | + $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>'; |
|
120 | 120 | break; |
121 | 121 | case 'checkbox': // handles check boxes |
122 | 122 | $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
125 | 125 | static $i = 0; |
126 | 126 | $_ = array(); |
127 | - foreach($index_list as $c => $item) { |
|
128 | - if(is_array($item)) { |
|
127 | + foreach ($index_list as $c => $item) { |
|
128 | + if (is_array($item)) { |
|
129 | 129 | $name = trim($item[0]); |
130 | 130 | $value = isset($item[1]) ? $item[1] : $name; |
131 | 131 | } else { |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | case "option": // handles radio buttons |
152 | 152 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
153 | 153 | static $i = 0; |
154 | - while(list($item, $itemvalue) = each($index_list)) { |
|
154 | + while (list($item, $itemvalue) = each($index_list)) { |
|
155 | 155 | list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
156 | - if(strlen($itemvalue) == 0) { |
|
156 | + if (strlen($itemvalue) == 0) { |
|
157 | 157 | $itemvalue = $item; |
158 | 158 | } |
159 | - $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 />'; |
|
159 | + $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 />'; |
|
160 | 160 | $i++; |
161 | 161 | } |
162 | 162 | break; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | global $_lang; |
165 | 165 | global $ResourceManagerLoaded; |
166 | 166 | global $content, $use_editor, $which_editor; |
167 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
167 | + if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
168 | 168 | $field_html .= " |
169 | 169 | <script type=\"text/javascript\"> |
170 | 170 | /* <![CDATA[ */ |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | lastImageCtrl = ctrl; |
187 | 187 | var w = screen.width * 0.5; |
188 | 188 | var h = screen.height * 0.5; |
189 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
189 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
190 | 190 | } |
191 | 191 | function BrowseFileServer(ctrl) { |
192 | 192 | lastFileCtrl = ctrl; |
193 | 193 | var w = screen.width * 0.5; |
194 | 194 | var h = screen.height * 0.5; |
195 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
195 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
196 | 196 | } |
197 | 197 | function SetUrlChange(el) { |
198 | 198 | if ('createEvent' in document) { |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | </script>"; |
227 | 227 | $ResourceManagerLoaded = true; |
228 | 228 | } |
229 | - $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 . '\')" />'; |
|
229 | + $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.'\')" />'; |
|
230 | 230 | break; |
231 | 231 | case "file": // handles the input of file uploads |
232 | 232 | /* Modified by Timon for use with resource browser */ |
233 | 233 | global $_lang; |
234 | 234 | global $ResourceManagerLoaded; |
235 | 235 | global $content, $use_editor, $which_editor; |
236 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
236 | + if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
237 | 237 | /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
238 | 238 | $field_html .= " |
239 | 239 | <script type=\"text/javascript\"> |
@@ -256,13 +256,13 @@ discard block |
||
256 | 256 | lastImageCtrl = ctrl; |
257 | 257 | var w = screen.width * 0.5; |
258 | 258 | var h = screen.height * 0.5; |
259 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
259 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
260 | 260 | } |
261 | 261 | function BrowseFileServer(ctrl) { |
262 | 262 | lastFileCtrl = ctrl; |
263 | 263 | var w = screen.width * 0.5; |
264 | 264 | var h = screen.height * 0.5; |
265 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
265 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
266 | 266 | } |
267 | 267 | function SetUrlChange(el) { |
268 | 268 | if ('createEvent' in document) { |
@@ -296,39 +296,39 @@ discard block |
||
296 | 296 | </script>"; |
297 | 297 | $ResourceManagerLoaded = true; |
298 | 298 | } |
299 | - $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 . '\')" />'; |
|
299 | + $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.'\')" />'; |
|
300 | 300 | |
301 | 301 | break; |
302 | 302 | |
303 | 303 | case 'custom_tv': |
304 | 304 | $custom_output = ''; |
305 | 305 | /* If we are loading a file */ |
306 | - if(substr($field_elements, 0, 5) == "@FILE") { |
|
307 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
308 | - if(!file_exists($file_name)) { |
|
309 | - $custom_output = $file_name . ' does not exist'; |
|
306 | + if (substr($field_elements, 0, 5) == "@FILE") { |
|
307 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 6)); |
|
308 | + if (!file_exists($file_name)) { |
|
309 | + $custom_output = $file_name.' does not exist'; |
|
310 | 310 | } else { |
311 | 311 | $custom_output = file_get_contents($file_name); |
312 | 312 | } |
313 | - } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
314 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
315 | - if(!file_exists($file_name)) { |
|
316 | - $custom_output = $file_name . ' does not exist'; |
|
313 | + } elseif (substr($field_elements, 0, 8) == '@INCLUDE') { |
|
314 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 9)); |
|
315 | + if (!file_exists($file_name)) { |
|
316 | + $custom_output = $file_name.' does not exist'; |
|
317 | 317 | } else { |
318 | 318 | ob_start(); |
319 | 319 | include $file_name; |
320 | 320 | $custom_output = ob_get_contents(); |
321 | 321 | ob_end_clean(); |
322 | 322 | } |
323 | - } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
323 | + } elseif (substr($field_elements, 0, 6) == "@CHUNK") { |
|
324 | 324 | $chunk_name = trim(substr($field_elements, 7)); |
325 | 325 | $chunk_body = $modx->getChunk($chunk_name); |
326 | - if($chunk_body == false) { |
|
327 | - $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
326 | + if ($chunk_body == false) { |
|
327 | + $custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')'; |
|
328 | 328 | } else { |
329 | 329 | $custom_output = $chunk_body; |
330 | 330 | } |
331 | - } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
331 | + } elseif (substr($field_elements, 0, 5) == "@EVAL") { |
|
332 | 332 | $eval_str = trim(substr($field_elements, 6)); |
333 | 333 | $custom_output = eval($eval_str); |
334 | 334 | } else { |
@@ -349,15 +349,15 @@ discard block |
||
349 | 349 | break; |
350 | 350 | |
351 | 351 | default: // the default handler -- for errors, mostly |
352 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
352 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />'; |
|
353 | 353 | |
354 | 354 | } // end switch statement |
355 | 355 | } else { |
356 | 356 | $custom = explode(":", $field_type); |
357 | 357 | $custom_output = ''; |
358 | - $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
359 | - if(!file_exists($file_name)) { |
|
360 | - $custom_output = $file_name . ' does not exist'; |
|
358 | + $file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php'; |
|
359 | + if (!file_exists($file_name)) { |
|
360 | + $custom_output = $file_name.' does not exist'; |
|
361 | 361 | } else { |
362 | 362 | ob_start(); |
363 | 363 | include $file_name; |
@@ -384,13 +384,13 @@ discard block |
||
384 | 384 | * @param string|array|mysqli_result $v |
385 | 385 | * @return array |
386 | 386 | */ |
387 | -function ParseIntputOptions($v) { |
|
387 | +function ParseIntputOptions($v){ |
|
388 | 388 | global $modx; |
389 | 389 | $a = array(); |
390 | - if(is_array($v)) { |
|
390 | + if (is_array($v)) { |
|
391 | 391 | return $v; |
392 | - } else if($modx->db->isResult($v)) { |
|
393 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
392 | + } else if ($modx->db->isResult($v)) { |
|
393 | + while ($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
394 | 394 | } else { |
395 | 395 | $a = explode("||", $v); |
396 | 396 | } |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | * @param array $tvsArray |
13 | 13 | * @return string |
14 | 14 | */ |
15 | -function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
|
15 | +function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) |
|
16 | +{ |
|
16 | 17 | global $modx; |
17 | 18 | global $_style; |
18 | 19 | global $_lang; |
@@ -384,13 +385,16 @@ discard block |
||
384 | 385 | * @param string|array|mysqli_result $v |
385 | 386 | * @return array |
386 | 387 | */ |
387 | -function ParseIntputOptions($v) { |
|
388 | +function ParseIntputOptions($v) |
|
389 | +{ |
|
388 | 390 | global $modx; |
389 | 391 | $a = array(); |
390 | 392 | if(is_array($v)) { |
391 | 393 | return $v; |
392 | 394 | } else if($modx->db->isResult($v)) { |
393 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
395 | + while($cols = $modx->db->getRow($v, 'num')) { |
|
396 | + $a[] = $cols; |
|
397 | + } |
|
394 | 398 | } else { |
395 | 399 | $a = explode("||", $v); |
396 | 400 | } |
@@ -13,159 +13,159 @@ discard block |
||
13 | 13 | * @return string |
14 | 14 | */ |
15 | 15 | function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
16 | - global $modx; |
|
17 | - global $_style; |
|
18 | - global $_lang; |
|
19 | - global $content; |
|
20 | - global $which_browser; |
|
16 | + global $modx; |
|
17 | + global $_style; |
|
18 | + global $_lang; |
|
19 | + global $content; |
|
20 | + global $which_browser; |
|
21 | 21 | |
22 | - if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
23 | - $eval_str = trim(substr($default_text, 7)); |
|
24 | - $default_text = eval($eval_str); |
|
25 | - $field_value = $default_text; |
|
26 | - } |
|
22 | + if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) { |
|
23 | + $eval_str = trim(substr($default_text, 7)); |
|
24 | + $default_text = eval($eval_str); |
|
25 | + $field_value = $default_text; |
|
26 | + } |
|
27 | 27 | |
28 | - $field_html = ''; |
|
29 | - $cimode = strpos($field_type, ':'); |
|
30 | - if($cimode === false) { |
|
31 | - switch($field_type) { |
|
28 | + $field_html = ''; |
|
29 | + $cimode = strpos($field_type, ':'); |
|
30 | + if($cimode === false) { |
|
31 | + switch($field_type) { |
|
32 | 32 | |
33 | - case "text": // handler for regular text boxes |
|
34 | - case "rawtext"; // non-htmlentity converted text boxes |
|
35 | - $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%" />'; |
|
36 | - break; |
|
37 | - case "email": // handles email input fields |
|
38 | - $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%"/>'; |
|
39 | - break; |
|
40 | - case "number": // handles the input of numbers |
|
41 | - $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-,.+]/,\'\')"/>'; |
|
42 | - break; |
|
43 | - case "textareamini": // handler for textarea mini boxes |
|
44 | - $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>'; |
|
45 | - break; |
|
46 | - case "textarea": // handler for textarea boxes |
|
47 | - case "rawtextarea": // non-htmlentity convertex textarea boxes |
|
48 | - case "htmlarea": // handler for textarea boxes (deprecated) |
|
49 | - case "richtext": // handler for textarea boxes |
|
50 | - $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>'; |
|
51 | - break; |
|
52 | - case "date": |
|
53 | - $field_id = str_replace(array( |
|
54 | - '-', |
|
55 | - '.' |
|
56 | - ), '_', urldecode($field_id)); |
|
57 | - if($field_value == '') { |
|
58 | - $field_value = 0; |
|
59 | - } |
|
60 | - $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;" />'; |
|
61 | - $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>'; |
|
33 | + case "text": // handler for regular text boxes |
|
34 | + case "rawtext"; // non-htmlentity converted text boxes |
|
35 | + $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%" />'; |
|
36 | + break; |
|
37 | + case "email": // handles email input fields |
|
38 | + $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%"/>'; |
|
39 | + break; |
|
40 | + case "number": // handles the input of numbers |
|
41 | + $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-,.+]/,\'\')"/>'; |
|
42 | + break; |
|
43 | + case "textareamini": // handler for textarea mini boxes |
|
44 | + $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>'; |
|
45 | + break; |
|
46 | + case "textarea": // handler for textarea boxes |
|
47 | + case "rawtextarea": // non-htmlentity convertex textarea boxes |
|
48 | + case "htmlarea": // handler for textarea boxes (deprecated) |
|
49 | + case "richtext": // handler for textarea boxes |
|
50 | + $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>'; |
|
51 | + break; |
|
52 | + case "date": |
|
53 | + $field_id = str_replace(array( |
|
54 | + '-', |
|
55 | + '.' |
|
56 | + ), '_', urldecode($field_id)); |
|
57 | + if($field_value == '') { |
|
58 | + $field_value = 0; |
|
59 | + } |
|
60 | + $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;" />'; |
|
61 | + $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>'; |
|
62 | 62 | |
63 | - break; |
|
64 | - case "dropdown": // handler for select boxes |
|
65 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
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": // handler for select boxes |
|
77 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
78 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
79 | - while(list($item, $itemvalue) = each($index_list)) { |
|
80 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
81 | - if(strlen($itemvalue) == 0) { |
|
82 | - $itemvalue = $item; |
|
83 | - } |
|
84 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
85 | - } |
|
86 | - $field_html .= "</select>"; |
|
87 | - break; |
|
88 | - case "listbox-multiple": // handler for select boxes where you can choose multiple items |
|
89 | - $field_value = explode("||", $field_value); |
|
90 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
91 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
92 | - while(list($item, $itemvalue) = each($index_list)) { |
|
93 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
94 | - if(strlen($itemvalue) == 0) { |
|
95 | - $itemvalue = $item; |
|
96 | - } |
|
97 | - $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
98 | - } |
|
99 | - $field_html .= "</select>"; |
|
100 | - break; |
|
101 | - case "url": // handles url input fields |
|
102 | - $urls = array( |
|
103 | - '' => '--', |
|
104 | - 'http://' => 'http://', |
|
105 | - 'https://' => 'https://', |
|
106 | - 'ftp://' => 'ftp://', |
|
107 | - 'mailto:' => 'mailto:' |
|
108 | - ); |
|
109 | - $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;">'; |
|
110 | - foreach($urls as $k => $v) { |
|
111 | - if(strpos($field_value, $v) === false) { |
|
112 | - $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
113 | - } else { |
|
114 | - $field_value = str_replace($v, '', $field_value); |
|
115 | - $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
116 | - } |
|
117 | - } |
|
118 | - $field_html .= '</select></td><td>'; |
|
119 | - $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>'; |
|
120 | - break; |
|
121 | - case 'checkbox': // handles check boxes |
|
122 | - $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
|
123 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
124 | - $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
|
125 | - static $i = 0; |
|
126 | - $_ = array(); |
|
127 | - foreach($index_list as $c => $item) { |
|
128 | - if(is_array($item)) { |
|
129 | - $name = trim($item[0]); |
|
130 | - $value = isset($item[1]) ? $item[1] : $name; |
|
131 | - } else { |
|
132 | - $item = trim($item); |
|
133 | - list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array( |
|
134 | - $item, |
|
135 | - $item |
|
136 | - ); |
|
137 | - } |
|
138 | - $checked = in_array($value, $values) ? ' checked="checked"' : ''; |
|
139 | - $param = array( |
|
140 | - $modx->htmlspecialchars($value), |
|
141 | - $i, |
|
142 | - $field_id, |
|
143 | - $checked, |
|
144 | - $name |
|
145 | - ); |
|
146 | - $_[] = vsprintf($tpl, $param); |
|
147 | - $i++; |
|
148 | - } |
|
149 | - $field_html = implode("\n", $_); |
|
150 | - break; |
|
151 | - case "option": // handles radio buttons |
|
152 | - $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
153 | - static $i = 0; |
|
154 | - while(list($item, $itemvalue) = each($index_list)) { |
|
155 | - list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
156 | - if(strlen($itemvalue) == 0) { |
|
157 | - $itemvalue = $item; |
|
158 | - } |
|
159 | - $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 />'; |
|
160 | - $i++; |
|
161 | - } |
|
162 | - break; |
|
163 | - case "image": // handles image fields using htmlarea image manager |
|
164 | - global $_lang; |
|
165 | - global $ResourceManagerLoaded; |
|
166 | - global $content, $use_editor, $which_editor; |
|
167 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
168 | - $field_html .= " |
|
63 | + break; |
|
64 | + case "dropdown": // handler for select boxes |
|
65 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
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": // handler for select boxes |
|
77 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
78 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
79 | + while(list($item, $itemvalue) = each($index_list)) { |
|
80 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
81 | + if(strlen($itemvalue) == 0) { |
|
82 | + $itemvalue = $item; |
|
83 | + } |
|
84 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
85 | + } |
|
86 | + $field_html .= "</select>"; |
|
87 | + break; |
|
88 | + case "listbox-multiple": // handler for select boxes where you can choose multiple items |
|
89 | + $field_value = explode("||", $field_value); |
|
90 | + $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
91 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
92 | + while(list($item, $itemvalue) = each($index_list)) { |
|
93 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
94 | + if(strlen($itemvalue) == 0) { |
|
95 | + $itemvalue = $item; |
|
96 | + } |
|
97 | + $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>'; |
|
98 | + } |
|
99 | + $field_html .= "</select>"; |
|
100 | + break; |
|
101 | + case "url": // handles url input fields |
|
102 | + $urls = array( |
|
103 | + '' => '--', |
|
104 | + 'http://' => 'http://', |
|
105 | + 'https://' => 'https://', |
|
106 | + 'ftp://' => 'ftp://', |
|
107 | + 'mailto:' => 'mailto:' |
|
108 | + ); |
|
109 | + $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;">'; |
|
110 | + foreach($urls as $k => $v) { |
|
111 | + if(strpos($field_value, $v) === false) { |
|
112 | + $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
113 | + } else { |
|
114 | + $field_value = str_replace($v, '', $field_value); |
|
115 | + $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
116 | + } |
|
117 | + } |
|
118 | + $field_html .= '</select></td><td>'; |
|
119 | + $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>'; |
|
120 | + break; |
|
121 | + case 'checkbox': // handles check boxes |
|
122 | + $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
|
123 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
124 | + $tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />'; |
|
125 | + static $i = 0; |
|
126 | + $_ = array(); |
|
127 | + foreach($index_list as $c => $item) { |
|
128 | + if(is_array($item)) { |
|
129 | + $name = trim($item[0]); |
|
130 | + $value = isset($item[1]) ? $item[1] : $name; |
|
131 | + } else { |
|
132 | + $item = trim($item); |
|
133 | + list($name, $value) = (strpos($item, '==') !== false) ? explode('==', $item, 2) : array( |
|
134 | + $item, |
|
135 | + $item |
|
136 | + ); |
|
137 | + } |
|
138 | + $checked = in_array($value, $values) ? ' checked="checked"' : ''; |
|
139 | + $param = array( |
|
140 | + $modx->htmlspecialchars($value), |
|
141 | + $i, |
|
142 | + $field_id, |
|
143 | + $checked, |
|
144 | + $name |
|
145 | + ); |
|
146 | + $_[] = vsprintf($tpl, $param); |
|
147 | + $i++; |
|
148 | + } |
|
149 | + $field_html = implode("\n", $_); |
|
150 | + break; |
|
151 | + case "option": // handles radio buttons |
|
152 | + $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray)); |
|
153 | + static $i = 0; |
|
154 | + while(list($item, $itemvalue) = each($index_list)) { |
|
155 | + list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue); |
|
156 | + if(strlen($itemvalue) == 0) { |
|
157 | + $itemvalue = $item; |
|
158 | + } |
|
159 | + $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 />'; |
|
160 | + $i++; |
|
161 | + } |
|
162 | + break; |
|
163 | + case "image": // handles image fields using htmlarea image manager |
|
164 | + global $_lang; |
|
165 | + global $ResourceManagerLoaded; |
|
166 | + global $content, $use_editor, $which_editor; |
|
167 | + if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
168 | + $field_html .= " |
|
169 | 169 | <script type=\"text/javascript\"> |
170 | 170 | /* <![CDATA[ */ |
171 | 171 | var lastImageCtrl; |
@@ -224,18 +224,18 @@ discard block |
||
224 | 224 | } |
225 | 225 | /* ]]> */ |
226 | 226 | </script>"; |
227 | - $ResourceManagerLoaded = true; |
|
228 | - } |
|
229 | - $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 . '\')" />'; |
|
230 | - break; |
|
231 | - case "file": // handles the input of file uploads |
|
232 | - /* Modified by Timon for use with resource browser */ |
|
233 | - global $_lang; |
|
234 | - global $ResourceManagerLoaded; |
|
235 | - global $content, $use_editor, $which_editor; |
|
236 | - if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
237 | - /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
|
238 | - $field_html .= " |
|
227 | + $ResourceManagerLoaded = true; |
|
228 | + } |
|
229 | + $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 . '\')" />'; |
|
230 | + break; |
|
231 | + case "file": // handles the input of file uploads |
|
232 | + /* Modified by Timon for use with resource browser */ |
|
233 | + global $_lang; |
|
234 | + global $ResourceManagerLoaded; |
|
235 | + global $content, $use_editor, $which_editor; |
|
236 | + if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) { |
|
237 | + /* I didn't understand the meaning of the condition above, so I left it untouched ;-) */ |
|
238 | + $field_html .= " |
|
239 | 239 | <script type=\"text/javascript\"> |
240 | 240 | /* <![CDATA[ */ |
241 | 241 | var lastImageCtrl; |
@@ -294,90 +294,90 @@ discard block |
||
294 | 294 | } |
295 | 295 | /* ]]> */ |
296 | 296 | </script>"; |
297 | - $ResourceManagerLoaded = true; |
|
298 | - } |
|
299 | - $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 . '\')" />'; |
|
297 | + $ResourceManagerLoaded = true; |
|
298 | + } |
|
299 | + $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 . '\')" />'; |
|
300 | 300 | |
301 | - break; |
|
301 | + break; |
|
302 | 302 | |
303 | - case 'custom_tv': |
|
304 | - $custom_output = ''; |
|
305 | - /* If we are loading a file */ |
|
306 | - if(substr($field_elements, 0, 5) == "@FILE") { |
|
307 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
308 | - if(!file_exists($file_name)) { |
|
309 | - $custom_output = $file_name . ' does not exist'; |
|
310 | - } else { |
|
311 | - $custom_output = file_get_contents($file_name); |
|
312 | - } |
|
313 | - } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
314 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
315 | - if(!file_exists($file_name)) { |
|
316 | - $custom_output = $file_name . ' does not exist'; |
|
317 | - } else { |
|
318 | - ob_start(); |
|
319 | - include $file_name; |
|
320 | - $custom_output = ob_get_contents(); |
|
321 | - ob_end_clean(); |
|
322 | - } |
|
323 | - } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
324 | - $chunk_name = trim(substr($field_elements, 7)); |
|
325 | - $chunk_body = $modx->getChunk($chunk_name); |
|
326 | - if($chunk_body == false) { |
|
327 | - $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
328 | - } else { |
|
329 | - $custom_output = $chunk_body; |
|
330 | - } |
|
331 | - } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
332 | - $eval_str = trim(substr($field_elements, 6)); |
|
333 | - $custom_output = eval($eval_str); |
|
334 | - } else { |
|
335 | - $custom_output = $field_elements; |
|
336 | - } |
|
337 | - $replacements = array( |
|
338 | - '[+field_type+]' => $field_type, |
|
339 | - '[+field_id+]' => $field_id, |
|
340 | - '[+default_text+]' => $default_text, |
|
341 | - '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
342 | - '[+field_style+]' => $field_style, |
|
343 | - ); |
|
344 | - $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
345 | - $modx->documentObject = $content; |
|
346 | - $modx->documentIdentifier = $content['id']; |
|
347 | - $custom_output = $modx->parseDocumentSource($custom_output); |
|
348 | - $field_html .= $custom_output; |
|
349 | - break; |
|
303 | + case 'custom_tv': |
|
304 | + $custom_output = ''; |
|
305 | + /* If we are loading a file */ |
|
306 | + if(substr($field_elements, 0, 5) == "@FILE") { |
|
307 | + $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
308 | + if(!file_exists($file_name)) { |
|
309 | + $custom_output = $file_name . ' does not exist'; |
|
310 | + } else { |
|
311 | + $custom_output = file_get_contents($file_name); |
|
312 | + } |
|
313 | + } elseif(substr($field_elements, 0, 8) == '@INCLUDE') { |
|
314 | + $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
315 | + if(!file_exists($file_name)) { |
|
316 | + $custom_output = $file_name . ' does not exist'; |
|
317 | + } else { |
|
318 | + ob_start(); |
|
319 | + include $file_name; |
|
320 | + $custom_output = ob_get_contents(); |
|
321 | + ob_end_clean(); |
|
322 | + } |
|
323 | + } elseif(substr($field_elements, 0, 6) == "@CHUNK") { |
|
324 | + $chunk_name = trim(substr($field_elements, 7)); |
|
325 | + $chunk_body = $modx->getChunk($chunk_name); |
|
326 | + if($chunk_body == false) { |
|
327 | + $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
328 | + } else { |
|
329 | + $custom_output = $chunk_body; |
|
330 | + } |
|
331 | + } elseif(substr($field_elements, 0, 5) == "@EVAL") { |
|
332 | + $eval_str = trim(substr($field_elements, 6)); |
|
333 | + $custom_output = eval($eval_str); |
|
334 | + } else { |
|
335 | + $custom_output = $field_elements; |
|
336 | + } |
|
337 | + $replacements = array( |
|
338 | + '[+field_type+]' => $field_type, |
|
339 | + '[+field_id+]' => $field_id, |
|
340 | + '[+default_text+]' => $default_text, |
|
341 | + '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
342 | + '[+field_style+]' => $field_style, |
|
343 | + ); |
|
344 | + $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
345 | + $modx->documentObject = $content; |
|
346 | + $modx->documentIdentifier = $content['id']; |
|
347 | + $custom_output = $modx->parseDocumentSource($custom_output); |
|
348 | + $field_html .= $custom_output; |
|
349 | + break; |
|
350 | 350 | |
351 | - default: // the default handler -- for errors, mostly |
|
352 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
351 | + default: // the default handler -- for errors, mostly |
|
352 | + $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
353 | 353 | |
354 | - } // end switch statement |
|
355 | - } else { |
|
356 | - $custom = explode(":", $field_type); |
|
357 | - $custom_output = ''; |
|
358 | - $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
359 | - if(!file_exists($file_name)) { |
|
360 | - $custom_output = $file_name . ' does not exist'; |
|
361 | - } else { |
|
362 | - ob_start(); |
|
363 | - include $file_name; |
|
364 | - $custom_output = ob_get_contents(); |
|
365 | - ob_end_clean(); |
|
366 | - } |
|
367 | - $replacements = array( |
|
368 | - '[+field_type+]' => $field_type, |
|
369 | - '[+field_id+]' => $field_id, |
|
370 | - '[+default_text+]' => $default_text, |
|
371 | - '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
372 | - '[+field_style+]' => $field_style, |
|
373 | - ); |
|
374 | - $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
375 | - $modx->documentObject = $content; |
|
376 | - $custom_output = $modx->parseDocumentSource($custom_output); |
|
377 | - $field_html .= $custom_output; |
|
378 | - } |
|
354 | + } // end switch statement |
|
355 | + } else { |
|
356 | + $custom = explode(":", $field_type); |
|
357 | + $custom_output = ''; |
|
358 | + $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
359 | + if(!file_exists($file_name)) { |
|
360 | + $custom_output = $file_name . ' does not exist'; |
|
361 | + } else { |
|
362 | + ob_start(); |
|
363 | + include $file_name; |
|
364 | + $custom_output = ob_get_contents(); |
|
365 | + ob_end_clean(); |
|
366 | + } |
|
367 | + $replacements = array( |
|
368 | + '[+field_type+]' => $field_type, |
|
369 | + '[+field_id+]' => $field_id, |
|
370 | + '[+default_text+]' => $default_text, |
|
371 | + '[+field_value+]' => $modx->htmlspecialchars($field_value), |
|
372 | + '[+field_style+]' => $field_style, |
|
373 | + ); |
|
374 | + $custom_output = str_replace(array_keys($replacements), $replacements, $custom_output); |
|
375 | + $modx->documentObject = $content; |
|
376 | + $custom_output = $modx->parseDocumentSource($custom_output); |
|
377 | + $field_html .= $custom_output; |
|
378 | + } |
|
379 | 379 | |
380 | - return $field_html; |
|
380 | + return $field_html; |
|
381 | 381 | } // end renderFormElement function |
382 | 382 | |
383 | 383 | /** |
@@ -385,14 +385,14 @@ discard block |
||
385 | 385 | * @return array |
386 | 386 | */ |
387 | 387 | function ParseIntputOptions($v) { |
388 | - global $modx; |
|
389 | - $a = array(); |
|
390 | - if(is_array($v)) { |
|
391 | - return $v; |
|
392 | - } else if($modx->db->isResult($v)) { |
|
393 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
394 | - } else { |
|
395 | - $a = explode("||", $v); |
|
396 | - } |
|
397 | - return $a; |
|
388 | + global $modx; |
|
389 | + $a = array(); |
|
390 | + if(is_array($v)) { |
|
391 | + return $v; |
|
392 | + } else if($modx->db->isResult($v)) { |
|
393 | + while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
394 | + } else { |
|
395 | + $a = explode("||", $v); |
|
396 | + } |
|
397 | + return $a; |
|
398 | 398 | } |
@@ -237,7 +237,7 @@ |
||
237 | 237 | /** |
238 | 238 | * build siteCache file |
239 | 239 | * @param DocumentParser $modx |
240 | - * @return boolean success |
|
240 | + * @return null|boolean success |
|
241 | 241 | */ |
242 | 242 | public function buildCache($modx) |
243 | 243 | { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | if (isset($this->aliases[$id])) { |
95 | 95 | if ($this->aliasVisible[$id] == 1) { |
96 | 96 | if ($path != '') { |
97 | - $path = $this->aliases[$id] . '/' . $path; |
|
97 | + $path = $this->aliases[$id].'/'.$path; |
|
98 | 98 | } else { |
99 | 99 | $path = $this->aliases[$id]; |
100 | 100 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $modx->messageQuit("Cache path not set."); |
119 | 119 | } |
120 | 120 | |
121 | - $files = glob(realpath($this->cachePath) . '/*.pageCache.php'); |
|
121 | + $files = glob(realpath($this->cachePath).'/*.pageCache.php'); |
|
122 | 122 | $filesincache = count($files); |
123 | 123 | $deletedfiles = array(); |
124 | 124 | while ($file = array_shift($files)) { |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | if (isset($opcache)) { |
152 | 152 | echo '<p>Opcache empty.</p>'; |
153 | 153 | } |
154 | - echo '<p>' . $_lang['cache_files_deleted'] . '</p><ul>'; |
|
154 | + echo '<p>'.$_lang['cache_files_deleted'].'</p><ul>'; |
|
155 | 155 | foreach ($deletedfiles as $deletedfile) { |
156 | - echo '<li>' . $deletedfile . '</li>'; |
|
156 | + echo '<li>'.$deletedfile.'</li>'; |
|
157 | 157 | } |
158 | 158 | echo '</ul>'; |
159 | 159 | } |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | |
173 | 173 | |
174 | 174 | // write the file |
175 | - $content = '<?php' . "\n"; |
|
176 | - $content .= '$recent_update=\'' . $this->request_time . '\';' . "\n"; |
|
177 | - $content .= '$cacheRefreshTime=\'' . $cacheRefreshTime . '\';' . "\n"; |
|
175 | + $content = '<?php'."\n"; |
|
176 | + $content .= '$recent_update=\''.$this->request_time.'\';'."\n"; |
|
177 | + $content .= '$cacheRefreshTime=\''.$cacheRefreshTime.'\';'."\n"; |
|
178 | 178 | |
179 | - $filename = $this->cachePath . '/sitePublishing.idx.php'; |
|
179 | + $filename = $this->cachePath.'/sitePublishing.idx.php'; |
|
180 | 180 | if (!$handle = fopen($filename, 'w')) { |
181 | 181 | exit("Cannot open file ({$filename}"); |
182 | 182 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $timesArr = array(); |
201 | 201 | |
202 | 202 | $result = $modx->db->select('MIN(pub_date) AS minpub', '[+prefix+]site_content', |
203 | - 'pub_date>' . $this->request_time); |
|
203 | + 'pub_date>'.$this->request_time); |
|
204 | 204 | if (!$result) { |
205 | 205 | echo "Couldn't determine next publish event!"; |
206 | 206 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | $result = $modx->db->select('MIN(unpub_date) AS minunpub', '[+prefix+]site_content', |
214 | - 'unpub_date>' . $this->request_time); |
|
214 | + 'unpub_date>'.$this->request_time); |
|
215 | 215 | if (!$result) { |
216 | 216 | echo "Couldn't determine next unpublish event!"; |
217 | 217 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $config = array(); |
251 | 251 | $content .= '$c=&$this->config;'; |
252 | 252 | while (list($key, $value) = $modx->db->getRow($rs, 'num')) { |
253 | - $content .= '$c[\'' . $key . '\']="' . $this->escapeDoubleQuotes($value) . '";'; |
|
253 | + $content .= '$c[\''.$key.'\']="'.$this->escapeDoubleQuotes($value).'";'; |
|
254 | 254 | $config[$key] = $value; |
255 | 255 | } |
256 | 256 | |
@@ -288,23 +288,23 @@ discard block |
||
288 | 288 | $docid = $doc['id']; |
289 | 289 | if ($use_alias_path) { |
290 | 290 | $tmpPath = $this->getParents($doc['parent']); |
291 | - $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '') . $doc['alias']; |
|
291 | + $alias = (strlen($tmpPath) > 0 ? "$tmpPath/" : '').$doc['alias']; |
|
292 | 292 | $key = $alias; |
293 | 293 | } else { |
294 | 294 | $key = $doc['alias']; |
295 | 295 | } |
296 | 296 | |
297 | 297 | $doc['path'] = $tmpPath; |
298 | - $content .= '$a[' . $docid . ']=array(\'id\'=>' . $docid . ',\'alias\'=>\'' . $doc['alias'] . '\',\'path\'=>\'' . $doc['path'] . '\',\'parent\'=>' . $doc['parent'] . ',\'isfolder\'=>' . $doc['isfolder'] . ',\'alias_visible\'=>' . $doc['alias_visible'] . ');'; |
|
299 | - $content .= '$d[\'' . $key . '\']=' . $docid . ';'; |
|
300 | - $content .= '$m[]=array(' . $doc['parent'] . '=>' . $docid . ');'; |
|
298 | + $content .= '$a['.$docid.']=array(\'id\'=>'.$docid.',\'alias\'=>\''.$doc['alias'].'\',\'path\'=>\''.$doc['path'].'\',\'parent\'=>'.$doc['parent'].',\'isfolder\'=>'.$doc['isfolder'].',\'alias_visible\'=>'.$doc['alias_visible'].');'; |
|
299 | + $content .= '$d[\''.$key.'\']='.$docid.';'; |
|
300 | + $content .= '$m[]=array('.$doc['parent'].'=>'.$docid.');'; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | // get content types |
304 | 304 | $rs = $modx->db->select('id, contentType', '[+prefix+]site_content', "contentType!='text/html'"); |
305 | 305 | $content .= '$c=&$this->contentTypes;'; |
306 | 306 | while ($doc = $modx->db->getRow($rs)) { |
307 | - $content .= '$c[\'' . $doc['id'] . '\']=\'' . $doc['contentType'] . '\';'; |
|
307 | + $content .= '$c[\''.$doc['id'].'\']=\''.$doc['contentType'].'\';'; |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | // WRITE Chunks to cache file |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | if ($modx->config['minifyphp_incache']) { |
315 | 315 | $doc['snippet'] = $this->php_strip_whitespace($doc['snippet']); |
316 | 316 | } |
317 | - $content .= '$c[\'' . $doc['name'] . '\']=\'' . ($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])) . '\';'; |
|
317 | + $content .= '$c[\''.$doc['name'].'\']=\''.($doc['disabled'] ? '' : $this->escapeSingleQuotes($doc['snippet'])).'\';'; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | // WRITE snippets to cache file |
@@ -325,18 +325,18 @@ discard block |
||
325 | 325 | while ($row = $modx->db->getRow($rs)) { |
326 | 326 | $key = $row['name']; |
327 | 327 | if ($row['disabled']) { |
328 | - $content .= '$s[\'' . $key . '\']=\'return false;\';'; |
|
328 | + $content .= '$s[\''.$key.'\']=\'return false;\';'; |
|
329 | 329 | } else { |
330 | 330 | $value = trim($row['snippet']); |
331 | 331 | if ($modx->config['minifyphp_incache']) { |
332 | 332 | $value = $this->php_strip_whitespace($value); |
333 | 333 | } |
334 | - $content .= '$s[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
334 | + $content .= '$s[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
335 | 335 | $properties = $modx->parseProperties($row['properties']); |
336 | 336 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
337 | 337 | $properties = array_merge($sharedproperties, $properties); |
338 | 338 | if (0 < count($properties)) { |
339 | - $content .= '$s[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
339 | + $content .= '$s[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | } |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | if ($modx->config['minifyphp_incache']) { |
355 | 355 | $value = $this->php_strip_whitespace($value); |
356 | 356 | } |
357 | - $content .= '$p[\'' . $key . '\']=\'' . $this->escapeSingleQuotes($value) . '\';'; |
|
357 | + $content .= '$p[\''.$key.'\']=\''.$this->escapeSingleQuotes($value).'\';'; |
|
358 | 358 | if ($row['properties'] != '' || $row['sharedproperties'] != '') { |
359 | 359 | $properties = $modx->parseProperties($row['properties']); |
360 | 360 | $sharedproperties = $modx->parseProperties($row['sharedproperties']); |
361 | 361 | $properties = array_merge($sharedproperties, $properties); |
362 | 362 | if (0 < count($properties)) { |
363 | - $content .= '$p[\'' . $key . 'Props\']=\'' . $this->escapeSingleQuotes(json_encode($properties)) . '\';'; |
|
363 | + $content .= '$p[\''.$key.'Props\']=\''.$this->escapeSingleQuotes(json_encode($properties)).'\';'; |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | } |
@@ -383,14 +383,14 @@ discard block |
||
383 | 383 | } |
384 | 384 | foreach ($events as $evtname => $pluginnames) { |
385 | 385 | $events[$evtname] = $pluginnames; |
386 | - $content .= '$e[\'' . $evtname . '\']=array(\'' . implode('\',\'', |
|
387 | - $this->escapeSingleQuotes($pluginnames)) . '\');'; |
|
386 | + $content .= '$e[\''.$evtname.'\']=array(\''.implode('\',\'', |
|
387 | + $this->escapeSingleQuotes($pluginnames)).'\');'; |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | $content .= "\n"; |
391 | 391 | |
392 | 392 | // close and write the file |
393 | - $filename = $this->cachePath . 'siteCache.idx.php'; |
|
393 | + $filename = $this->cachePath.'siteCache.idx.php'; |
|
394 | 394 | |
395 | 395 | // invoke OnBeforeCacheUpdate event |
396 | 396 | if ($modx) { |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | exit("Cannot write main MODX cache file! Make sure the assets/cache directory is writable!"); |
402 | 402 | } |
403 | 403 | |
404 | - if (!is_file($this->cachePath . '/.htaccess')) { |
|
405 | - file_put_contents($this->cachePath . '/.htaccess', "order deny,allow\ndeny from all\n"); |
|
404 | + if (!is_file($this->cachePath.'/.htaccess')) { |
|
405 | + file_put_contents($this->cachePath.'/.htaccess', "order deny,allow\ndeny from all\n"); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | // invoke OnCacheUpdate event |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | |
425 | 425 | $source = trim($source); |
426 | 426 | if (substr($source, 0, 5) !== '<?php') { |
427 | - $source = '<?php ' . $source; |
|
427 | + $source = '<?php '.$source; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | $tokens = token_get_all($source); |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | } |
483 | 483 | } |
484 | 484 | $source = preg_replace(array('@^<\?php@i', '|\s+|', '|<!--|', '|-->|', '|-->\s+<!--|'), |
485 | - array('', ' ', "\n" . '<!--', '-->' . "\n", '-->' . "\n" . '<!--'), $_); |
|
485 | + array('', ' ', "\n".'<!--', '-->'."\n", '-->'."\n".'<!--'), $_); |
|
486 | 486 | $source = trim($source); |
487 | 487 | |
488 | 488 | return $source; |
@@ -79,7 +79,8 @@ discard block |
||
79 | 79 | * @return string |
80 | 80 | */ |
81 | 81 | public function getParents($id, $path = '') |
82 | - { // modx:returns child's parent |
|
82 | + { |
|
83 | +// modx:returns child's parent |
|
83 | 84 | global $modx; |
84 | 85 | if (empty($this->aliases)) { |
85 | 86 | $f = "id, IF(alias='', id, alias) AS alias, parent, alias_visible"; |
@@ -456,7 +457,8 @@ discard block |
||
456 | 457 | $_ = trim($_); |
457 | 458 | } |
458 | 459 | $lastChar = substr($_, -1); |
459 | - if (!in_array($lastChar, $chars)) {// ,320,327,288,284,289 |
|
460 | + if (!in_array($lastChar, $chars)) { |
|
461 | +// ,320,327,288,284,289 |
|
460 | 462 | if (!in_array($prev_token, |
461 | 463 | array(T_FOREACH, T_WHILE, T_FOR, T_BOOLEAN_AND, T_BOOLEAN_OR, T_DOUBLE_ARROW))) { |
462 | 464 | $_ .= ' '; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! function_exists('install_sessionCheck')) { |
|
2 | +if (!function_exists('install_sessionCheck')) { |
|
3 | 3 | function install_sessionCheck() |
4 | 4 | { |
5 | 5 | global $_lang; |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | </head> |
22 | 22 | <body> |
23 | 23 | <div class="install"> |
24 | - <p>' . $_lang["session_problem"] . '</p> |
|
25 | - <p><a href="./">' . $_lang["session_problem_try_again"] . '</a></p> |
|
24 | + <p>' . $_lang["session_problem"].'</p> |
|
25 | + <p><a href="./">' . $_lang["session_problem_try_again"].'</a></p> |
|
26 | 26 | </div> |
27 | 27 | </body> |
28 | 28 | </html>'; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -if( ! function_exists('parse')) { |
|
35 | +if (!function_exists('parse')) { |
|
36 | 36 | /** |
37 | 37 | * @param string $src |
38 | 38 | * @param array $ph |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | function parse($src, $ph, $left = '[+', $right = '+]') |
44 | 44 | { |
45 | 45 | foreach ($ph as $k => $v) { |
46 | - $k = $left . $k . $right; |
|
46 | + $k = $left.$k.$right; |
|
47 | 47 | $src = str_replace($k, $v, $src); |
48 | 48 | } |
49 | 49 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | -if( ! function_exists('ph')) { |
|
54 | +if (!function_exists('ph')) { |
|
55 | 55 | /** |
56 | 56 | * @return array |
57 | 57 | */ |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $ph['textdir'] = $modx_textdir ? ' id="rtl"' : ''; |
71 | 71 | $ph['help_link'] = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd']; |
72 | 72 | $ph['version'] = $moduleVersion; |
73 | - $ph['release_date'] = ($modx_textdir ? '‏' : '') . $modx_release_date; |
|
73 | + $ph['release_date'] = ($modx_textdir ? '‏' : '').$modx_release_date; |
|
74 | 74 | $ph['footer1'] = $_lang['modx_footer1']; |
75 | 75 | $ph['footer2'] = $_lang['modx_footer2']; |
76 | 76 | $ph['current_year'] = date('Y'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | -if( ! function_exists('get_installmode')) { |
|
82 | +if (!function_exists('get_installmode')) { |
|
83 | 83 | /** |
84 | 84 | * @return int |
85 | 85 | */ |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | -if( ! function_exists('getLangs')) { |
|
144 | +if (!function_exists('getLangs')) { |
|
145 | 145 | /** |
146 | 146 | * @param string $install_language |
147 | 147 | * @return string |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | $langs = array(); |
158 | - if ($handle = opendir("../" . MGR_DIR . "/includes/lang")) { |
|
158 | + if ($handle = opendir("../".MGR_DIR."/includes/lang")) { |
|
159 | 159 | while (false !== ($file = readdir($handle))) { |
160 | 160 | if (strpos($file, '.inc.') !== false) { |
161 | 161 | $langs[] = $file; |
@@ -1,14 +1,14 @@ 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 | /** |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | * @return string |
18 | 18 | */ |
19 | 19 | function parsePh($tpl, $ph) { |
20 | - global $modx, $_lang; |
|
21 | - $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
22 | - return $modx->parseText($tpl, $ph); |
|
20 | + global $modx, $_lang; |
|
21 | + $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
22 | + return $modx->parseText($tpl, $ph); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | * @return string |
28 | 28 | */ |
29 | 29 | function renderViewSwitchButtons($cssId) { |
30 | - global $modx, $_lang, $tpl; |
|
30 | + global $modx, $_lang, $tpl; |
|
31 | 31 | |
32 | - return parsePh($tpl['viewForm'], array( |
|
33 | - 'cssId' => $cssId |
|
34 | - )); |
|
32 | + return parsePh($tpl['viewForm'], array( |
|
33 | + 'cssId' => $cssId |
|
34 | + )); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -40,52 +40,52 @@ discard block |
||
40 | 40 | * @return string |
41 | 41 | */ |
42 | 42 | function createResourceList($resourceTable, $resources) { |
43 | - global $modx, $_lang, $_style, $modx_textdir, $tpl; |
|
43 | + global $modx, $_lang, $_style, $modx_textdir, $tpl; |
|
44 | 44 | |
45 | - $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
|
45 | + $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
|
46 | 46 | |
47 | - if( ! is_array($items) || empty($items)) { |
|
48 | - return $_lang['no_results']; |
|
49 | - } |
|
47 | + if( ! is_array($items) || empty($items)) { |
|
48 | + return $_lang['no_results']; |
|
49 | + } |
|
50 | 50 | |
51 | - // Prepare elements- and categories-list |
|
52 | - $elements = array(); |
|
53 | - $categories = array(); |
|
54 | - foreach($items as $row) { |
|
55 | - $catid = $row['catid'] ? $row['catid'] : 0; |
|
56 | - $categories[$catid] = array('name' => stripslashes($row['category'])); |
|
57 | - $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
|
58 | - } |
|
51 | + // Prepare elements- and categories-list |
|
52 | + $elements = array(); |
|
53 | + $categories = array(); |
|
54 | + foreach($items as $row) { |
|
55 | + $catid = $row['catid'] ? $row['catid'] : 0; |
|
56 | + $categories[$catid] = array('name' => stripslashes($row['category'])); |
|
57 | + $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
|
58 | + } |
|
59 | 59 | |
60 | - // Now render categories / panel-collapse |
|
61 | - $panelGroup = ''; |
|
62 | - foreach($elements as $catid => $elList) { |
|
63 | - // Add panel-heading / category-collapse to output |
|
64 | - $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
65 | - 'tab' => $resourceTable, |
|
66 | - 'category' => $categories[$catid]['name'], |
|
67 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
68 | - 'catid' => $catid, |
|
69 | - )); |
|
60 | + // Now render categories / panel-collapse |
|
61 | + $panelGroup = ''; |
|
62 | + foreach($elements as $catid => $elList) { |
|
63 | + // Add panel-heading / category-collapse to output |
|
64 | + $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
65 | + 'tab' => $resourceTable, |
|
66 | + 'category' => $categories[$catid]['name'], |
|
67 | + 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
68 | + 'catid' => $catid, |
|
69 | + )); |
|
70 | 70 | |
71 | - // Prepare content for panel-collapse |
|
72 | - $panelCollapse = ''; |
|
73 | - foreach($elList as $el) { |
|
74 | - $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
|
75 | - } |
|
71 | + // Prepare content for panel-collapse |
|
72 | + $panelCollapse = ''; |
|
73 | + foreach($elList as $el) { |
|
74 | + $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
|
75 | + } |
|
76 | 76 | |
77 | - // Add panel-collapse with elements to output |
|
78 | - $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
79 | - 'tab' => $resourceTable, |
|
80 | - 'catid' => $catid, |
|
81 | - 'wrapper' => $panelCollapse, |
|
82 | - )); |
|
83 | - } |
|
77 | + // Add panel-collapse with elements to output |
|
78 | + $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
79 | + 'tab' => $resourceTable, |
|
80 | + 'catid' => $catid, |
|
81 | + 'wrapper' => $panelCollapse, |
|
82 | + )); |
|
83 | + } |
|
84 | 84 | |
85 | - return parsePh($tpl['panelGroup'], array( |
|
86 | - 'resourceTable' => $resourceTable, |
|
87 | - 'wrapper' => $panelGroup |
|
88 | - )); |
|
85 | + return parsePh($tpl['panelGroup'], array( |
|
86 | + 'resourceTable' => $resourceTable, |
|
87 | + 'wrapper' => $panelGroup |
|
88 | + )); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -93,54 +93,54 @@ discard block |
||
93 | 93 | * @return string |
94 | 94 | */ |
95 | 95 | function createCombinedView($resources) { |
96 | - global $modx, $_lang, $_style, $modx_textdir; |
|
96 | + global $modx, $_lang, $_style, $modx_textdir; |
|
97 | 97 | |
98 | - $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
|
99 | - $types = isset($resources->types) ? $resources->types : false; |
|
100 | - $categories = isset($resources->categories) ? $resources->categories : false; |
|
98 | + $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
|
99 | + $types = isset($resources->types) ? $resources->types : false; |
|
100 | + $categories = isset($resources->categories) ? $resources->categories : false; |
|
101 | 101 | |
102 | - if(!$itemsPerCategory) { |
|
103 | - return $_lang['no_results']; |
|
104 | - } |
|
102 | + if(!$itemsPerCategory) { |
|
103 | + return $_lang['no_results']; |
|
104 | + } |
|
105 | 105 | |
106 | - $tpl = array( |
|
107 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
108 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
109 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
110 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
111 | - ); |
|
106 | + $tpl = array( |
|
107 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
108 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
109 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
110 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
111 | + ); |
|
112 | 112 | |
113 | - // Easily loop through $itemsPerCategory-Array |
|
114 | - $panelGroup = ''; |
|
115 | - foreach($categories as $catid => $category) { |
|
116 | - // Prepare collapse content / elements-list |
|
117 | - $panelCollapse = ''; |
|
118 | - foreach($itemsPerCategory[$catid] as $el) { |
|
119 | - $resourceTable = $el['type']; |
|
120 | - $ph = prepareElementRowPh($el, $resourceTable, $resources); |
|
121 | - $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
|
122 | - } |
|
113 | + // Easily loop through $itemsPerCategory-Array |
|
114 | + $panelGroup = ''; |
|
115 | + foreach($categories as $catid => $category) { |
|
116 | + // Prepare collapse content / elements-list |
|
117 | + $panelCollapse = ''; |
|
118 | + foreach($itemsPerCategory[$catid] as $el) { |
|
119 | + $resourceTable = $el['type']; |
|
120 | + $ph = prepareElementRowPh($el, $resourceTable, $resources); |
|
121 | + $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
|
122 | + } |
|
123 | 123 | |
124 | - // Add panel-heading / button |
|
125 | - $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
126 | - 'tab' => 'categories_list', |
|
127 | - 'category' => $categories[$catid], |
|
128 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
129 | - 'catid' => $catid, |
|
130 | - )); |
|
124 | + // Add panel-heading / button |
|
125 | + $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
126 | + 'tab' => 'categories_list', |
|
127 | + 'category' => $categories[$catid], |
|
128 | + 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
129 | + 'catid' => $catid, |
|
130 | + )); |
|
131 | 131 | |
132 | - // Add panel |
|
133 | - $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
134 | - 'tab' => 'categories_list', |
|
135 | - 'catid' => $catid, |
|
136 | - 'wrapper' => $panelCollapse, |
|
137 | - )); |
|
138 | - } |
|
132 | + // Add panel |
|
133 | + $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
134 | + 'tab' => 'categories_list', |
|
135 | + 'catid' => $catid, |
|
136 | + 'wrapper' => $panelCollapse, |
|
137 | + )); |
|
138 | + } |
|
139 | 139 | |
140 | - return parsePh($tpl['panelGroup'], array( |
|
141 | - 'resourceTable' => 'categories_list', |
|
142 | - 'wrapper' => $panelGroup |
|
143 | - )); |
|
140 | + return parsePh($tpl['panelGroup'], array( |
|
141 | + 'resourceTable' => 'categories_list', |
|
142 | + 'wrapper' => $panelGroup |
|
143 | + )); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -150,13 +150,13 @@ discard block |
||
150 | 150 | * @return array |
151 | 151 | */ |
152 | 152 | function prepareElementRowPh($row, $resourceTable, $resources) { |
153 | - global $modx, $modx_textdir, $_style, $_lang; |
|
153 | + global $modx, $modx_textdir, $_style, $_lang; |
|
154 | 154 | |
155 | - $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
155 | + $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
156 | 156 | |
157 | - $_lang["confirm_delete"] = $_lang["delete"]; |
|
157 | + $_lang["confirm_delete"] = $_lang["delete"]; |
|
158 | 158 | |
159 | - switch($resourceTable){ |
|
159 | + switch($resourceTable){ |
|
160 | 160 | case 'site_templates': |
161 | 161 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
162 | 162 | $lockElementType = 1; |
@@ -190,77 +190,77 @@ discard block |
||
190 | 190 | return array(); |
191 | 191 | } |
192 | 192 | |
193 | - // Prepare displaying user-locks |
|
194 | - $lockedByUser = ''; |
|
195 | - $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
196 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
197 | - if($rowLock['sid'] == $modx->sid) { |
|
198 | - $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
199 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
200 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
201 | - )); |
|
202 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
203 | - } else { |
|
204 | - $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
205 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
206 | - 'username' => $rowLock['username'], |
|
207 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
208 | - )); |
|
209 | - if($modx->hasPermission('remove_locks')) { |
|
210 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
211 | - } else { |
|
212 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
213 | - } |
|
214 | - } |
|
215 | - } |
|
216 | - if($lockedByUser) { |
|
217 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
218 | - } |
|
193 | + // Prepare displaying user-locks |
|
194 | + $lockedByUser = ''; |
|
195 | + $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
196 | + if($rowLock && $modx->hasPermission('display_locks')) { |
|
197 | + if($rowLock['sid'] == $modx->sid) { |
|
198 | + $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
199 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
200 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
201 | + )); |
|
202 | + $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
203 | + } else { |
|
204 | + $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
205 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
206 | + 'username' => $rowLock['username'], |
|
207 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
208 | + )); |
|
209 | + if($modx->hasPermission('remove_locks')) { |
|
210 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
211 | + } else { |
|
212 | + $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
213 | + } |
|
214 | + } |
|
215 | + } |
|
216 | + if($lockedByUser) { |
|
217 | + $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
218 | + } |
|
219 | 219 | |
220 | - // Caption |
|
221 | - if($resourceTable == 'site_tmplvars') { |
|
222 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
223 | - } else { |
|
224 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
225 | - } |
|
220 | + // Caption |
|
221 | + if($resourceTable == 'site_tmplvars') { |
|
222 | + $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
223 | + } else { |
|
224 | + $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
225 | + } |
|
226 | 226 | |
227 | - // Special marks |
|
228 | - $tplInfo = array(); |
|
229 | - if($row['locked']) { |
|
230 | - $tplInfo[] = $_lang['locked']; |
|
231 | - } |
|
232 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
233 | - $tplInfo[] = $_lang['defaulttemplate_title']; |
|
234 | - } |
|
235 | - $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
227 | + // Special marks |
|
228 | + $tplInfo = array(); |
|
229 | + if($row['locked']) { |
|
230 | + $tplInfo[] = $_lang['locked']; |
|
231 | + } |
|
232 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
233 | + $tplInfo[] = $_lang['defaulttemplate_title']; |
|
234 | + } |
|
235 | + $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
236 | 236 | |
237 | - /* row buttons */ |
|
238 | - $buttons = ''; |
|
239 | - if($modx->hasPermission($types['actions']['edit'][1])) { |
|
240 | - $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>'; |
|
241 | - } |
|
242 | - if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
243 | - $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>'; |
|
244 | - } |
|
245 | - if($modx->hasPermission($types['actions']['remove'][1])) { |
|
246 | - $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>'; |
|
247 | - } |
|
248 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
237 | + /* row buttons */ |
|
238 | + $buttons = ''; |
|
239 | + if($modx->hasPermission($types['actions']['edit'][1])) { |
|
240 | + $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>'; |
|
241 | + } |
|
242 | + if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
243 | + $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>'; |
|
244 | + } |
|
245 | + if($modx->hasPermission($types['actions']['remove'][1])) { |
|
246 | + $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>'; |
|
247 | + } |
|
248 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
249 | 249 | |
250 | - $catid = $row['catid'] ? $row['catid'] : 0; |
|
250 | + $catid = $row['catid'] ? $row['catid'] : 0; |
|
251 | 251 | |
252 | - // Placeholders for elements-row |
|
253 | - return array( |
|
254 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
255 | - 'lockedByUser' => $lockedByUser, |
|
256 | - 'name' => $row['name'], |
|
257 | - 'caption' => $caption, |
|
258 | - 'buttons' => $buttons, |
|
259 | - 'marks' => $marks, |
|
260 | - 'id' => $row['id'], |
|
261 | - 'resourceTable' => $resourceTable, |
|
262 | - 'actionEdit' => $types['actions']['edit'][0], |
|
263 | - 'catid' => $catid, |
|
264 | - 'textdir' => $modx_textdir ? '‏' : '', |
|
265 | - ); |
|
252 | + // Placeholders for elements-row |
|
253 | + return array( |
|
254 | + 'class' => $class ? ' class="' . $class . '"' : '', |
|
255 | + 'lockedByUser' => $lockedByUser, |
|
256 | + 'name' => $row['name'], |
|
257 | + 'caption' => $caption, |
|
258 | + 'buttons' => $buttons, |
|
259 | + 'marks' => $marks, |
|
260 | + 'id' => $row['id'], |
|
261 | + 'resourceTable' => $resourceTable, |
|
262 | + 'actionEdit' => $types['actions']['edit'][0], |
|
263 | + 'catid' => $catid, |
|
264 | + 'textdir' => $modx_textdir ? '‏' : '', |
|
265 | + ); |
|
266 | 266 | } |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | |
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 | /** |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @param array $ph |
17 | 17 | * @return string |
18 | 18 | */ |
19 | -function parsePh($tpl, $ph) { |
|
19 | +function parsePh($tpl, $ph){ |
|
20 | 20 | global $modx, $_lang; |
21 | 21 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
22 | 22 | return $modx->parseText($tpl, $ph); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param string|int $cssId |
27 | 27 | * @return string |
28 | 28 | */ |
29 | -function renderViewSwitchButtons($cssId) { |
|
29 | +function renderViewSwitchButtons($cssId){ |
|
30 | 30 | global $modx, $_lang, $tpl; |
31 | 31 | |
32 | 32 | return parsePh($tpl['viewForm'], array( |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | * @param mgrResources $resources |
40 | 40 | * @return string |
41 | 41 | */ |
42 | -function createResourceList($resourceTable, $resources) { |
|
42 | +function createResourceList($resourceTable, $resources){ |
|
43 | 43 | global $modx, $_lang, $_style, $modx_textdir, $tpl; |
44 | 44 | |
45 | 45 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
46 | 46 | |
47 | - if( ! is_array($items) || empty($items)) { |
|
47 | + if (!is_array($items) || empty($items)) { |
|
48 | 48 | return $_lang['no_results']; |
49 | 49 | } |
50 | 50 | |
51 | 51 | // Prepare elements- and categories-list |
52 | 52 | $elements = array(); |
53 | 53 | $categories = array(); |
54 | - foreach($items as $row) { |
|
54 | + foreach ($items as $row) { |
|
55 | 55 | $catid = $row['catid'] ? $row['catid'] : 0; |
56 | 56 | $categories[$catid] = array('name' => stripslashes($row['category'])); |
57 | 57 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -59,18 +59,18 @@ discard block |
||
59 | 59 | |
60 | 60 | // Now render categories / panel-collapse |
61 | 61 | $panelGroup = ''; |
62 | - foreach($elements as $catid => $elList) { |
|
62 | + foreach ($elements as $catid => $elList) { |
|
63 | 63 | // Add panel-heading / category-collapse to output |
64 | 64 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
65 | 65 | 'tab' => $resourceTable, |
66 | 66 | 'category' => $categories[$catid]['name'], |
67 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
67 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '', |
|
68 | 68 | 'catid' => $catid, |
69 | 69 | )); |
70 | 70 | |
71 | 71 | // Prepare content for panel-collapse |
72 | 72 | $panelCollapse = ''; |
73 | - foreach($elList as $el) { |
|
73 | + foreach ($elList as $el) { |
|
74 | 74 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
75 | 75 | } |
76 | 76 | |
@@ -92,30 +92,30 @@ discard block |
||
92 | 92 | * @param mgrResources $resources |
93 | 93 | * @return string |
94 | 94 | */ |
95 | -function createCombinedView($resources) { |
|
95 | +function createCombinedView($resources){ |
|
96 | 96 | global $modx, $_lang, $_style, $modx_textdir; |
97 | 97 | |
98 | 98 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
99 | 99 | $types = isset($resources->types) ? $resources->types : false; |
100 | 100 | $categories = isset($resources->categories) ? $resources->categories : false; |
101 | 101 | |
102 | - if(!$itemsPerCategory) { |
|
102 | + if (!$itemsPerCategory) { |
|
103 | 103 | return $_lang['no_results']; |
104 | 104 | } |
105 | 105 | |
106 | 106 | $tpl = array( |
107 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
108 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
109 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
110 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
107 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
108 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
109 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
110 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl'), |
|
111 | 111 | ); |
112 | 112 | |
113 | 113 | // Easily loop through $itemsPerCategory-Array |
114 | 114 | $panelGroup = ''; |
115 | - foreach($categories as $catid => $category) { |
|
115 | + foreach ($categories as $catid => $category) { |
|
116 | 116 | // Prepare collapse content / elements-list |
117 | 117 | $panelCollapse = ''; |
118 | - foreach($itemsPerCategory[$catid] as $el) { |
|
118 | + foreach ($itemsPerCategory[$catid] as $el) { |
|
119 | 119 | $resourceTable = $el['type']; |
120 | 120 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
121 | 121 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
126 | 126 | 'tab' => 'categories_list', |
127 | 127 | 'category' => $categories[$catid], |
128 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
128 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '', |
|
129 | 129 | 'catid' => $catid, |
130 | 130 | )); |
131 | 131 | |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | * @param mgrResources $resources |
150 | 150 | * @return array |
151 | 151 | */ |
152 | -function prepareElementRowPh($row, $resourceTable, $resources) { |
|
152 | +function prepareElementRowPh($row, $resourceTable, $resources){ |
|
153 | 153 | global $modx, $modx_textdir, $_style, $_lang; |
154 | 154 | |
155 | 155 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
156 | 156 | |
157 | 157 | $_lang["confirm_delete"] = $_lang["delete"]; |
158 | 158 | |
159 | - switch($resourceTable){ |
|
159 | + switch ($resourceTable) { |
|
160 | 160 | case 'site_templates': |
161 | 161 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
162 | 162 | $lockElementType = 1; |
@@ -193,65 +193,65 @@ discard block |
||
193 | 193 | // Prepare displaying user-locks |
194 | 194 | $lockedByUser = ''; |
195 | 195 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
196 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
197 | - if($rowLock['sid'] == $modx->sid) { |
|
196 | + if ($rowLock && $modx->hasPermission('display_locks')) { |
|
197 | + if ($rowLock['sid'] == $modx->sid) { |
|
198 | 198 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
199 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
199 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
200 | 200 | 'lasthit_df' => $rowLock['lasthit_df'] |
201 | 201 | )); |
202 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
202 | + $lockedByUser = '<span title="'.$title.'" class="editResource" style="cursor:context-menu;">'.$_style['tree_preview_resource'].'</span> '; |
|
203 | 203 | } else { |
204 | 204 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
205 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
205 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
206 | 206 | 'username' => $rowLock['username'], |
207 | 207 | 'lasthit_df' => $rowLock['lasthit_df'] |
208 | 208 | )); |
209 | - if($modx->hasPermission('remove_locks')) { |
|
210 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
209 | + if ($modx->hasPermission('remove_locks')) { |
|
210 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement('.$lockElementType.', '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource"><i class="'.$_style['icons_secured'].'"></i></a>'; |
|
211 | 211 | } else { |
212 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
212 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource" style="cursor:context-menu;"><i class="'.$_style['icons_secured'].'"></i></span>'; |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
216 | - if($lockedByUser) { |
|
217 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
216 | + if ($lockedByUser) { |
|
217 | + $lockedByUser = '<div class="lockCell">'.$lockedByUser.'</div>'; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | // Caption |
221 | - if($resourceTable == 'site_tmplvars') { |
|
222 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
221 | + if ($resourceTable == 'site_tmplvars') { |
|
222 | + $caption = !empty($row['description']) ? ' '.$row['caption'].' <small>('.$row['description'].')</small>' : ' '.$row['caption']; |
|
223 | 223 | } else { |
224 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
224 | + $caption = !empty($row['description']) ? ' '.$row['description'] : ''; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // Special marks |
228 | 228 | $tplInfo = array(); |
229 | - if($row['locked']) { |
|
229 | + if ($row['locked']) { |
|
230 | 230 | $tplInfo[] = $_lang['locked']; |
231 | 231 | } |
232 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
232 | + if ($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
233 | 233 | $tplInfo[] = $_lang['defaulttemplate_title']; |
234 | 234 | } |
235 | - $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
235 | + $marks = !empty($tplInfo) ? ' <em>('.implode(', ', $tplInfo).')</em>' : ''; |
|
236 | 236 | |
237 | 237 | /* row buttons */ |
238 | 238 | $buttons = ''; |
239 | - if($modx->hasPermission($types['actions']['edit'][1])) { |
|
240 | - $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>'; |
|
239 | + if ($modx->hasPermission($types['actions']['edit'][1])) { |
|
240 | + $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>'; |
|
241 | 241 | } |
242 | - if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
243 | - $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>'; |
|
242 | + if ($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
243 | + $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>'; |
|
244 | 244 | } |
245 | - if($modx->hasPermission($types['actions']['remove'][1])) { |
|
246 | - $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>'; |
|
245 | + if ($modx->hasPermission($types['actions']['remove'][1])) { |
|
246 | + $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>'; |
|
247 | 247 | } |
248 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
248 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">'.$buttons.'</ul></div>' : ''; |
|
249 | 249 | |
250 | 250 | $catid = $row['catid'] ? $row['catid'] : 0; |
251 | 251 | |
252 | 252 | // Placeholders for elements-row |
253 | 253 | return array( |
254 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
254 | + 'class' => $class ? ' class="'.$class.'"' : '', |
|
255 | 255 | 'lockedByUser' => $lockedByUser, |
256 | 256 | 'name' => $row['name'], |
257 | 257 | 'caption' => $caption, |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | |
@@ -16,7 +16,8 @@ discard block |
||
16 | 16 | * @param array $ph |
17 | 17 | * @return string |
18 | 18 | */ |
19 | -function parsePh($tpl, $ph) { |
|
19 | +function parsePh($tpl, $ph) |
|
20 | +{ |
|
20 | 21 | global $modx, $_lang; |
21 | 22 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
22 | 23 | return $modx->parseText($tpl, $ph); |
@@ -26,7 +27,8 @@ discard block |
||
26 | 27 | * @param string|int $cssId |
27 | 28 | * @return string |
28 | 29 | */ |
29 | -function renderViewSwitchButtons($cssId) { |
|
30 | +function renderViewSwitchButtons($cssId) |
|
31 | +{ |
|
30 | 32 | global $modx, $_lang, $tpl; |
31 | 33 | |
32 | 34 | return parsePh($tpl['viewForm'], array( |
@@ -39,19 +41,20 @@ discard block |
||
39 | 41 | * @param mgrResources $resources |
40 | 42 | * @return string |
41 | 43 | */ |
42 | -function createResourceList($resourceTable, $resources) { |
|
44 | +function createResourceList($resourceTable, $resources) |
|
45 | +{ |
|
43 | 46 | global $modx, $_lang, $_style, $modx_textdir, $tpl; |
44 | 47 | |
45 | 48 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
46 | 49 | |
47 | - if( ! is_array($items) || empty($items)) { |
|
50 | + if( ! is_array($items) || empty($items)) { |
|
48 | 51 | return $_lang['no_results']; |
49 | 52 | } |
50 | 53 | |
51 | 54 | // Prepare elements- and categories-list |
52 | 55 | $elements = array(); |
53 | 56 | $categories = array(); |
54 | - foreach($items as $row) { |
|
57 | + foreach($items as $row) { |
|
55 | 58 | $catid = $row['catid'] ? $row['catid'] : 0; |
56 | 59 | $categories[$catid] = array('name' => stripslashes($row['category'])); |
57 | 60 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -59,7 +62,7 @@ discard block |
||
59 | 62 | |
60 | 63 | // Now render categories / panel-collapse |
61 | 64 | $panelGroup = ''; |
62 | - foreach($elements as $catid => $elList) { |
|
65 | + foreach($elements as $catid => $elList) { |
|
63 | 66 | // Add panel-heading / category-collapse to output |
64 | 67 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
65 | 68 | 'tab' => $resourceTable, |
@@ -70,7 +73,7 @@ discard block |
||
70 | 73 | |
71 | 74 | // Prepare content for panel-collapse |
72 | 75 | $panelCollapse = ''; |
73 | - foreach($elList as $el) { |
|
76 | + foreach($elList as $el) { |
|
74 | 77 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
75 | 78 | } |
76 | 79 | |
@@ -92,14 +95,15 @@ discard block |
||
92 | 95 | * @param mgrResources $resources |
93 | 96 | * @return string |
94 | 97 | */ |
95 | -function createCombinedView($resources) { |
|
98 | +function createCombinedView($resources) |
|
99 | +{ |
|
96 | 100 | global $modx, $_lang, $_style, $modx_textdir; |
97 | 101 | |
98 | 102 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
99 | 103 | $types = isset($resources->types) ? $resources->types : false; |
100 | 104 | $categories = isset($resources->categories) ? $resources->categories : false; |
101 | 105 | |
102 | - if(!$itemsPerCategory) { |
|
106 | + if(!$itemsPerCategory) { |
|
103 | 107 | return $_lang['no_results']; |
104 | 108 | } |
105 | 109 | |
@@ -112,10 +116,10 @@ discard block |
||
112 | 116 | |
113 | 117 | // Easily loop through $itemsPerCategory-Array |
114 | 118 | $panelGroup = ''; |
115 | - foreach($categories as $catid => $category) { |
|
119 | + foreach($categories as $catid => $category) { |
|
116 | 120 | // Prepare collapse content / elements-list |
117 | 121 | $panelCollapse = ''; |
118 | - foreach($itemsPerCategory[$catid] as $el) { |
|
122 | + foreach($itemsPerCategory[$catid] as $el) { |
|
119 | 123 | $resourceTable = $el['type']; |
120 | 124 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
121 | 125 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -149,14 +153,15 @@ discard block |
||
149 | 153 | * @param mgrResources $resources |
150 | 154 | * @return array |
151 | 155 | */ |
152 | -function prepareElementRowPh($row, $resourceTable, $resources) { |
|
156 | +function prepareElementRowPh($row, $resourceTable, $resources) |
|
157 | +{ |
|
153 | 158 | global $modx, $modx_textdir, $_style, $_lang; |
154 | 159 | |
155 | 160 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
156 | 161 | |
157 | 162 | $_lang["confirm_delete"] = $_lang["delete"]; |
158 | 163 | |
159 | - switch($resourceTable){ |
|
164 | + switch($resourceTable) { |
|
160 | 165 | case 'site_templates': |
161 | 166 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
162 | 167 | $lockElementType = 1; |
@@ -193,56 +198,56 @@ discard block |
||
193 | 198 | // Prepare displaying user-locks |
194 | 199 | $lockedByUser = ''; |
195 | 200 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
196 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
197 | - if($rowLock['sid'] == $modx->sid) { |
|
201 | + if($rowLock && $modx->hasPermission('display_locks')) { |
|
202 | + if($rowLock['sid'] == $modx->sid) { |
|
198 | 203 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
199 | 204 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
200 | 205 | 'lasthit_df' => $rowLock['lasthit_df'] |
201 | 206 | )); |
202 | 207 | $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
203 | - } else { |
|
208 | + } else { |
|
204 | 209 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
205 | 210 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
206 | 211 | 'username' => $rowLock['username'], |
207 | 212 | 'lasthit_df' => $rowLock['lasthit_df'] |
208 | 213 | )); |
209 | - if($modx->hasPermission('remove_locks')) { |
|
214 | + if($modx->hasPermission('remove_locks')) { |
|
210 | 215 | $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
211 | - } else { |
|
216 | + } else { |
|
212 | 217 | $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
213 | 218 | } |
214 | 219 | } |
215 | 220 | } |
216 | - if($lockedByUser) { |
|
221 | + if($lockedByUser) { |
|
217 | 222 | $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
218 | 223 | } |
219 | 224 | |
220 | 225 | // Caption |
221 | - if($resourceTable == 'site_tmplvars') { |
|
226 | + if($resourceTable == 'site_tmplvars') { |
|
222 | 227 | $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
223 | - } else { |
|
228 | + } else { |
|
224 | 229 | $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
225 | 230 | } |
226 | 231 | |
227 | 232 | // Special marks |
228 | 233 | $tplInfo = array(); |
229 | - if($row['locked']) { |
|
234 | + if($row['locked']) { |
|
230 | 235 | $tplInfo[] = $_lang['locked']; |
231 | 236 | } |
232 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
237 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
233 | 238 | $tplInfo[] = $_lang['defaulttemplate_title']; |
234 | 239 | } |
235 | 240 | $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
236 | 241 | |
237 | 242 | /* row buttons */ |
238 | 243 | $buttons = ''; |
239 | - if($modx->hasPermission($types['actions']['edit'][1])) { |
|
244 | + if($modx->hasPermission($types['actions']['edit'][1])) { |
|
240 | 245 | $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>'; |
241 | 246 | } |
242 | - if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
247 | + if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
243 | 248 | $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>'; |
244 | 249 | } |
245 | - if($modx->hasPermission($types['actions']['remove'][1])) { |
|
250 | + if($modx->hasPermission($types['actions']['remove'][1])) { |
|
246 | 251 | $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>'; |
247 | 252 | } |
248 | 253 | $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * @var array |
9 | 9 | */ |
10 | - public $types = array(); |
|
10 | + public $types = array(); |
|
11 | 11 | /** |
12 | 12 | * @var array |
13 | 13 | */ |
@@ -25,73 +25,73 @@ discard block |
||
25 | 25 | * mgrResources constructor. |
26 | 26 | */ |
27 | 27 | public function __construct() { |
28 | - $this->setTypes(); |
|
29 | - $this->queryItemsFromDB(); |
|
30 | - $this->prepareCategoryArrays(); |
|
31 | - } |
|
28 | + $this->setTypes(); |
|
29 | + $this->queryItemsFromDB(); |
|
30 | + $this->prepareCategoryArrays(); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @return void |
35 | 35 | */ |
36 | 36 | public function setTypes() { |
37 | - global $_lang; |
|
38 | - $this->types['site_templates'] = array( |
|
39 | - 'title'=>$_lang["manage_templates"], |
|
40 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
41 | - 'permissions'=>array('new_template','edit_template'), |
|
42 | - 'name'=>'templatename' |
|
43 | - ); |
|
44 | - $this->types['site_tmplvars'] = array( |
|
45 | - 'title'=>$_lang["tmplvars"], |
|
46 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
47 | - 'permissions'=>array('new_template','edit_template'), |
|
48 | - ); |
|
49 | - $this->types['site_htmlsnippets'] = array( |
|
50 | - 'title'=>$_lang["manage_htmlsnippets"], |
|
51 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
52 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
53 | - ); |
|
54 | - $this->types['site_snippets'] = array( |
|
55 | - 'title'=>$_lang["manage_snippets"], |
|
56 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
57 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
58 | - ); |
|
59 | - $this->types['site_plugins'] = array( |
|
60 | - 'title'=>$_lang["manage_plugins"], |
|
61 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
62 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
63 | - ); |
|
64 | - $this->types['site_modules'] = array( |
|
65 | - 'title'=>$_lang["manage_modules"], |
|
66 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
67 | - 'permissions'=>array('new_module','edit_module'), |
|
68 | - ); |
|
69 | - } |
|
37 | + global $_lang; |
|
38 | + $this->types['site_templates'] = array( |
|
39 | + 'title'=>$_lang["manage_templates"], |
|
40 | + 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
41 | + 'permissions'=>array('new_template','edit_template'), |
|
42 | + 'name'=>'templatename' |
|
43 | + ); |
|
44 | + $this->types['site_tmplvars'] = array( |
|
45 | + 'title'=>$_lang["tmplvars"], |
|
46 | + 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
47 | + 'permissions'=>array('new_template','edit_template'), |
|
48 | + ); |
|
49 | + $this->types['site_htmlsnippets'] = array( |
|
50 | + 'title'=>$_lang["manage_htmlsnippets"], |
|
51 | + 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
52 | + 'permissions'=>array('new_chunk','edit_chunk'), |
|
53 | + ); |
|
54 | + $this->types['site_snippets'] = array( |
|
55 | + 'title'=>$_lang["manage_snippets"], |
|
56 | + 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
57 | + 'permissions'=>array('new_snippet','edit_snippet'), |
|
58 | + ); |
|
59 | + $this->types['site_plugins'] = array( |
|
60 | + 'title'=>$_lang["manage_plugins"], |
|
61 | + 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
62 | + 'permissions'=>array('new_plugin','edit_plugin'), |
|
63 | + ); |
|
64 | + $this->types['site_modules'] = array( |
|
65 | + 'title'=>$_lang["manage_modules"], |
|
66 | + 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
67 | + 'permissions'=>array('new_module','edit_module'), |
|
68 | + ); |
|
69 | + } |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | public function queryItemsFromDB() { |
75 | - foreach($this->types as $resourceTable=>$type) { |
|
76 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
77 | - $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
78 | - $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
79 | - } |
|
80 | - } |
|
81 | - } |
|
75 | + foreach($this->types as $resourceTable=>$type) { |
|
76 | + if($this->hasAnyPermissions($type['permissions'])) { |
|
77 | + $nameField = isset($type['name']) ? $type['name'] : 'name'; |
|
78 | + $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
|
79 | + } |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | 83 | /** |
84 | 84 | * @param array $permissions |
85 | 85 | * @return bool |
86 | 86 | */ |
87 | 87 | public function hasAnyPermissions($permissions) { |
88 | - global $modx; |
|
88 | + global $modx; |
|
89 | 89 | |
90 | - foreach($permissions as $p) |
|
91 | - if($modx->hasPermission($p)) return true; |
|
90 | + foreach($permissions as $p) |
|
91 | + if($modx->hasPermission($p)) return true; |
|
92 | 92 | |
93 | - return false; |
|
94 | - } |
|
93 | + return false; |
|
94 | + } |
|
95 | 95 | |
96 | 96 | /** |
97 | 97 | * @param string $resourceTable |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return array|bool |
100 | 100 | */ |
101 | 101 | public function queryResources($resourceTable, $nameField = 'name') { |
102 | - global $modx, $_lang; |
|
102 | + global $modx, $_lang; |
|
103 | 103 | |
104 | 104 | $allowed = array( |
105 | 105 | 'site_htmlsnippets', |
@@ -107,59 +107,59 @@ discard block |
||
107 | 107 | 'site_plugins', |
108 | 108 | 'site_modules' |
109 | 109 | ); |
110 | - $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
111 | - |
|
112 | - $tvsql = ''; |
|
113 | - $tvjoin = ''; |
|
114 | - if ($resourceTable === 'site_tmplvars') { |
|
115 | - $tvsql = 'site_tmplvars.caption, '; |
|
116 | - $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
117 | - $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
118 | - } |
|
119 | - else $sttfield = ''; |
|
120 | - |
|
121 | - $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
122 | - |
|
123 | - $rs = $modx->db->select( |
|
124 | - "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
|
125 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
110 | + $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
111 | + |
|
112 | + $tvsql = ''; |
|
113 | + $tvjoin = ''; |
|
114 | + if ($resourceTable === 'site_tmplvars') { |
|
115 | + $tvsql = 'site_tmplvars.caption, '; |
|
116 | + $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
|
117 | + $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
|
118 | + } |
|
119 | + else $sttfield = ''; |
|
120 | + |
|
121 | + $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
|
122 | + |
|
123 | + $rs = $modx->db->select( |
|
124 | + "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
|
125 | + $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
126 | 126 | LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
127 | - "", |
|
128 | - "category,name" |
|
129 | - ); |
|
130 | - $limit = $modx->db->getRecordCount($rs); |
|
127 | + "", |
|
128 | + "category,name" |
|
129 | + ); |
|
130 | + $limit = $modx->db->getRecordCount($rs); |
|
131 | 131 | |
132 | - if($limit < 1) return false; |
|
132 | + if($limit < 1) return false; |
|
133 | 133 | |
134 | - $result = array(); |
|
135 | - while ($row = $modx->db->getRow($rs)) { |
|
136 | - $result[] = $row; |
|
137 | - } |
|
138 | - return $result; |
|
139 | - } |
|
134 | + $result = array(); |
|
135 | + while ($row = $modx->db->getRow($rs)) { |
|
136 | + $result[] = $row; |
|
137 | + } |
|
138 | + return $result; |
|
139 | + } |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | * @return void |
143 | 143 | */ |
144 | 144 | public function prepareCategoryArrays() { |
145 | - foreach($this->items as $type=>$items) { |
|
146 | - foreach((array)$items as $item) { |
|
147 | - $catid = $item['catid'] ? $item['catid'] : 0; |
|
148 | - $this->categories[$catid] = $item['category']; |
|
149 | - |
|
150 | - $item['type'] = $type; |
|
151 | - $this->itemsPerCategory[$catid][] = $item; |
|
152 | - } |
|
153 | - } |
|
154 | - |
|
155 | - // Sort categories by name |
|
156 | - natcasesort($this->categories); |
|
157 | - |
|
158 | - // Now sort by name |
|
159 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
161 | - return strcasecmp($a['name'], $b['name']); |
|
162 | - }); |
|
163 | - } |
|
164 | - } |
|
145 | + foreach($this->items as $type=>$items) { |
|
146 | + foreach((array)$items as $item) { |
|
147 | + $catid = $item['catid'] ? $item['catid'] : 0; |
|
148 | + $this->categories[$catid] = $item['category']; |
|
149 | + |
|
150 | + $item['type'] = $type; |
|
151 | + $this->itemsPerCategory[$catid][] = $item; |
|
152 | + } |
|
153 | + } |
|
154 | + |
|
155 | + // Sort categories by name |
|
156 | + natcasesort($this->categories); |
|
157 | + |
|
158 | + // Now sort by name |
|
159 | + foreach($this->itemsPerCategory as $catid=>$items) { |
|
160 | + usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
161 | + return strcasecmp($a['name'], $b['name']); |
|
162 | + }); |
|
163 | + } |
|
164 | + } |
|
165 | 165 | } |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | |
6 | -class mgrResources { |
|
6 | +class mgrResources{ |
|
7 | 7 | /** |
8 | 8 | * @var array |
9 | 9 | */ |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * mgrResources constructor. |
26 | 26 | */ |
27 | - public function __construct() { |
|
27 | + public function __construct(){ |
|
28 | 28 | $this->setTypes(); |
29 | 29 | $this->queryItemsFromDB(); |
30 | 30 | $this->prepareCategoryArrays(); |
@@ -33,47 +33,47 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @return void |
35 | 35 | */ |
36 | - public function setTypes() { |
|
36 | + public function setTypes(){ |
|
37 | 37 | global $_lang; |
38 | - $this->types['site_templates'] = array( |
|
38 | + $this->types['site_templates'] = array( |
|
39 | 39 | 'title'=>$_lang["manage_templates"], |
40 | - 'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ), |
|
41 | - 'permissions'=>array('new_template','edit_template'), |
|
40 | + 'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')), |
|
41 | + 'permissions'=>array('new_template', 'edit_template'), |
|
42 | 42 | 'name'=>'templatename' |
43 | 43 | ); |
44 | - $this->types['site_tmplvars'] = array( |
|
44 | + $this->types['site_tmplvars'] = array( |
|
45 | 45 | 'title'=>$_lang["tmplvars"], |
46 | - 'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')), |
|
47 | - 'permissions'=>array('new_template','edit_template'), |
|
46 | + 'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')), |
|
47 | + 'permissions'=>array('new_template', 'edit_template'), |
|
48 | 48 | ); |
49 | 49 | $this->types['site_htmlsnippets'] = array( |
50 | 50 | 'title'=>$_lang["manage_htmlsnippets"], |
51 | - 'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')), |
|
52 | - 'permissions'=>array('new_chunk','edit_chunk'), |
|
51 | + 'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')), |
|
52 | + 'permissions'=>array('new_chunk', 'edit_chunk'), |
|
53 | 53 | ); |
54 | - $this->types['site_snippets'] = array( |
|
54 | + $this->types['site_snippets'] = array( |
|
55 | 55 | 'title'=>$_lang["manage_snippets"], |
56 | - 'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')), |
|
57 | - 'permissions'=>array('new_snippet','edit_snippet'), |
|
56 | + 'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')), |
|
57 | + 'permissions'=>array('new_snippet', 'edit_snippet'), |
|
58 | 58 | ); |
59 | - $this->types['site_plugins'] = array( |
|
59 | + $this->types['site_plugins'] = array( |
|
60 | 60 | 'title'=>$_lang["manage_plugins"], |
61 | - 'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')), |
|
62 | - 'permissions'=>array('new_plugin','edit_plugin'), |
|
61 | + 'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')), |
|
62 | + 'permissions'=>array('new_plugin', 'edit_plugin'), |
|
63 | 63 | ); |
64 | - $this->types['site_modules'] = array( |
|
64 | + $this->types['site_modules'] = array( |
|
65 | 65 | 'title'=>$_lang["manage_modules"], |
66 | - 'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')), |
|
67 | - 'permissions'=>array('new_module','edit_module'), |
|
66 | + 'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')), |
|
67 | + 'permissions'=>array('new_module', 'edit_module'), |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @return void |
73 | 73 | */ |
74 | - public function queryItemsFromDB() { |
|
75 | - foreach($this->types as $resourceTable=>$type) { |
|
76 | - if($this->hasAnyPermissions($type['permissions'])) { |
|
74 | + public function queryItemsFromDB(){ |
|
75 | + foreach ($this->types as $resourceTable=>$type) { |
|
76 | + if ($this->hasAnyPermissions($type['permissions'])) { |
|
77 | 77 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
78 | 78 | $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField); |
79 | 79 | } |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | * @param array $permissions |
85 | 85 | * @return bool |
86 | 86 | */ |
87 | - public function hasAnyPermissions($permissions) { |
|
87 | + public function hasAnyPermissions($permissions){ |
|
88 | 88 | global $modx; |
89 | 89 | |
90 | - foreach($permissions as $p) |
|
91 | - if($modx->hasPermission($p)) return true; |
|
90 | + foreach ($permissions as $p) |
|
91 | + if ($modx->hasPermission($p)) return true; |
|
92 | 92 | |
93 | 93 | return false; |
94 | 94 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $nameField |
99 | 99 | * @return array|bool |
100 | 100 | */ |
101 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
101 | + public function queryResources($resourceTable, $nameField = 'name'){ |
|
102 | 102 | global $modx, $_lang; |
103 | 103 | |
104 | 104 | $allowed = array( |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | 'site_plugins', |
108 | 108 | 'site_modules' |
109 | 109 | ); |
110 | - $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : ''; |
|
110 | + $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable.'.disabled, ' : ''; |
|
111 | 111 | |
112 | 112 | $tvsql = ''; |
113 | 113 | $tvjoin = ''; |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | |
123 | 123 | $rs = $modx->db->select( |
124 | 124 | "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid", |
125 | - $modx->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
126 | - LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
125 | + $modx->getFullTableName($resourceTable)." AS {$resourceTable} |
|
126 | + LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
127 | 127 | "", |
128 | 128 | "category,name" |
129 | 129 | ); |
130 | 130 | $limit = $modx->db->getRecordCount($rs); |
131 | 131 | |
132 | - if($limit < 1) return false; |
|
132 | + if ($limit < 1) return false; |
|
133 | 133 | |
134 | 134 | $result = array(); |
135 | 135 | while ($row = $modx->db->getRow($rs)) { |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | /** |
142 | 142 | * @return void |
143 | 143 | */ |
144 | - public function prepareCategoryArrays() { |
|
145 | - foreach($this->items as $type=>$items) { |
|
146 | - foreach((array)$items as $item) { |
|
144 | + public function prepareCategoryArrays(){ |
|
145 | + foreach ($this->items as $type=>$items) { |
|
146 | + foreach ((array) $items as $item) { |
|
147 | 147 | $catid = $item['catid'] ? $item['catid'] : 0; |
148 | 148 | $this->categories[$catid] = $item['category']; |
149 | 149 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | natcasesort($this->categories); |
157 | 157 | |
158 | 158 | // Now sort by name |
159 | - foreach($this->itemsPerCategory as $catid=>$items) { |
|
160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
159 | + foreach ($this->itemsPerCategory as $catid=>$items) { |
|
160 | + usort($this->itemsPerCategory[$catid], function($a, $b){ |
|
161 | 161 | return strcasecmp($a['name'], $b['name']); |
162 | 162 | }); |
163 | 163 | } |
@@ -3,7 +3,8 @@ 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 | |
6 | -class mgrResources { |
|
6 | +class mgrResources |
|
7 | +{ |
|
7 | 8 | /** |
8 | 9 | * @var array |
9 | 10 | */ |
@@ -24,7 +25,8 @@ discard block |
||
24 | 25 | /** |
25 | 26 | * mgrResources constructor. |
26 | 27 | */ |
27 | - public function __construct() { |
|
28 | + public function __construct() |
|
29 | + { |
|
28 | 30 | $this->setTypes(); |
29 | 31 | $this->queryItemsFromDB(); |
30 | 32 | $this->prepareCategoryArrays(); |
@@ -33,7 +35,8 @@ discard block |
||
33 | 35 | /** |
34 | 36 | * @return void |
35 | 37 | */ |
36 | - public function setTypes() { |
|
38 | + public function setTypes() |
|
39 | + { |
|
37 | 40 | global $_lang; |
38 | 41 | $this->types['site_templates'] = array( |
39 | 42 | 'title'=>$_lang["manage_templates"], |
@@ -71,7 +74,8 @@ discard block |
||
71 | 74 | /** |
72 | 75 | * @return void |
73 | 76 | */ |
74 | - public function queryItemsFromDB() { |
|
77 | + public function queryItemsFromDB() |
|
78 | + { |
|
75 | 79 | foreach($this->types as $resourceTable=>$type) { |
76 | 80 | if($this->hasAnyPermissions($type['permissions'])) { |
77 | 81 | $nameField = isset($type['name']) ? $type['name'] : 'name'; |
@@ -84,11 +88,13 @@ discard block |
||
84 | 88 | * @param array $permissions |
85 | 89 | * @return bool |
86 | 90 | */ |
87 | - public function hasAnyPermissions($permissions) { |
|
91 | + public function hasAnyPermissions($permissions) |
|
92 | + { |
|
88 | 93 | global $modx; |
89 | 94 | |
90 | - foreach($permissions as $p) |
|
91 | - if($modx->hasPermission($p)) return true; |
|
95 | + foreach($permissions as $p) { |
|
96 | + if($modx->hasPermission($p)) return true; |
|
97 | + } |
|
92 | 98 | |
93 | 99 | return false; |
94 | 100 | } |
@@ -98,7 +104,8 @@ discard block |
||
98 | 104 | * @param string $nameField |
99 | 105 | * @return array|bool |
100 | 106 | */ |
101 | - public function queryResources($resourceTable, $nameField = 'name') { |
|
107 | + public function queryResources($resourceTable, $nameField = 'name') |
|
108 | + { |
|
102 | 109 | global $modx, $_lang; |
103 | 110 | |
104 | 111 | $allowed = array( |
@@ -115,8 +122,9 @@ discard block |
||
115 | 122 | $tvsql = 'site_tmplvars.caption, '; |
116 | 123 | $tvjoin = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates')); |
117 | 124 | $sttfield = 'IF(stt.templateid,1,0) AS reltpl,'; |
125 | + } else { |
|
126 | + $sttfield = ''; |
|
118 | 127 | } |
119 | - else $sttfield = ''; |
|
120 | 128 | |
121 | 129 | $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : ""; |
122 | 130 | |
@@ -129,7 +137,9 @@ discard block |
||
129 | 137 | ); |
130 | 138 | $limit = $modx->db->getRecordCount($rs); |
131 | 139 | |
132 | - if($limit < 1) return false; |
|
140 | + if($limit < 1) { |
|
141 | + return false; |
|
142 | + } |
|
133 | 143 | |
134 | 144 | $result = array(); |
135 | 145 | while ($row = $modx->db->getRow($rs)) { |
@@ -141,7 +151,8 @@ discard block |
||
141 | 151 | /** |
142 | 152 | * @return void |
143 | 153 | */ |
144 | - public function prepareCategoryArrays() { |
|
154 | + public function prepareCategoryArrays() |
|
155 | + { |
|
145 | 156 | foreach($this->items as $type=>$items) { |
146 | 157 | foreach((array)$items as $item) { |
147 | 158 | $catid = $item['catid'] ? $item['catid'] : 0; |
@@ -157,7 +168,7 @@ discard block |
||
157 | 168 | |
158 | 169 | // Now sort by name |
159 | 170 | foreach($this->itemsPerCategory as $catid=>$items) { |
160 | - usort($this->itemsPerCategory[$catid], function ($a, $b) { |
|
171 | + usort($this->itemsPerCategory[$catid], function ($a, $b){ |
|
161 | 172 | return strcasecmp($a['name'], $b['name']); |
162 | 173 | }); |
163 | 174 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | function get_lang_keys($filename) |
9 | 9 | { |
10 | - $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
|
10 | + $file = MODX_MANAGER_PATH.'includes/lang'.DIRECTORY_SEPARATOR.$filename; |
|
11 | 11 | if (is_file($file) && is_readable($file)) { |
12 | 12 | include($file); |
13 | 13 | $out = isset($_lang) ? array_keys($_lang) : array(); |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | if (!empty($key)) { |
54 | 54 | $languages = get_langs_by_key($key); |
55 | 55 | sort($languages); |
56 | - $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>'; |
|
56 | + $lang_options .= '<option value="">'.$_lang['language_title'].'</option>'; |
|
57 | 57 | |
58 | 58 | foreach ($languages as $language_name) { |
59 | 59 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
60 | - $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>'; |
|
60 | + $lang_options .= '<option value="'.$language_name.'">'.$uclanguage_name.'</option>'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $lang_options; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | foreach ($languages as $language_name) { |
68 | 68 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
69 | 69 | $sel = $language_name === $selected_lang ? ' selected="selected"' : ''; |
70 | - $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>'; |
|
70 | + $lang_options .= '<option value="'.$language_name.'" '.$sel.'>'.$uclanguage_name.'</option>'; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return $lang_options; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $disabled = ''; |
93 | 93 | } |
94 | 94 | if ($add) { |
95 | - $add = ' ' . $add; |
|
95 | + $add = ' '.$add; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return sprintf('<input onchange="documentDirty=true;" type="radio" name="%s" value="%s" %s %s %s />', $name, $value, |
@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | * @param string $filename |
6 | 6 | * @return array of keys from a language file |
7 | 7 | */ |
8 | -function get_lang_keys($filename) |
|
9 | -{ |
|
8 | +function get_lang_keys($filename) |
|
9 | +{ |
|
10 | 10 | $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
11 | - if (is_file($file) && is_readable($file)) { |
|
11 | + if (is_file($file) && is_readable($file)) { |
|
12 | 12 | include($file); |
13 | 13 | $out = isset($_lang) ? array_keys($_lang) : array(); |
14 | - } else { |
|
14 | + } else { |
|
15 | 15 | $out = array(); |
16 | 16 | } |
17 | 17 | |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @param string $key |
25 | 25 | * @return array of languages that define the key in their file |
26 | 26 | */ |
27 | -function get_langs_by_key($key) |
|
28 | -{ |
|
27 | +function get_langs_by_key($key) |
|
28 | +{ |
|
29 | 29 | global $lang_keys; |
30 | 30 | $lang_return = array(); |
31 | - foreach ($lang_keys as $lang => $keys) { |
|
32 | - if (in_array($key, $keys)) { |
|
31 | + foreach ($lang_keys as $lang => $keys) { |
|
32 | + if (in_array($key, $keys)) { |
|
33 | 33 | $lang_return[] = $lang; |
34 | 34 | } |
35 | 35 | } |
@@ -46,25 +46,25 @@ discard block |
||
46 | 46 | * @param string $selected_lang specify language to select in option list, default none |
47 | 47 | * @return string html option list |
48 | 48 | */ |
49 | -function get_lang_options($key = '', $selected_lang = '') |
|
50 | -{ |
|
49 | +function get_lang_options($key = '', $selected_lang = '') |
|
50 | +{ |
|
51 | 51 | global $lang_keys, $_lang; |
52 | 52 | $lang_options = ''; |
53 | - if (!empty($key)) { |
|
53 | + if (!empty($key)) { |
|
54 | 54 | $languages = get_langs_by_key($key); |
55 | 55 | sort($languages); |
56 | 56 | $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>'; |
57 | 57 | |
58 | - foreach ($languages as $language_name) { |
|
58 | + foreach ($languages as $language_name) { |
|
59 | 59 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
60 | 60 | $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>'; |
61 | 61 | } |
62 | 62 | |
63 | 63 | return $lang_options; |
64 | - } else { |
|
64 | + } else { |
|
65 | 65 | $languages = array_keys($lang_keys); |
66 | 66 | sort($languages); |
67 | - foreach ($languages as $language_name) { |
|
67 | + foreach ($languages as $language_name) { |
|
68 | 68 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
69 | 69 | $sel = $language_name === $selected_lang ? ' selected="selected"' : ''; |
70 | 70 | $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>'; |
@@ -81,17 +81,17 @@ discard block |
||
81 | 81 | * @param bool $disabled |
82 | 82 | * @return string |
83 | 83 | */ |
84 | -function form_radio($name, $value, $add = '', $disabled = false) |
|
85 | -{ |
|
84 | +function form_radio($name, $value, $add = '', $disabled = false) |
|
85 | +{ |
|
86 | 86 | global ${$name}; |
87 | 87 | $var = ${$name}; |
88 | 88 | $checked = ($var == $value) ? ' checked="checked"' : ''; |
89 | - if ($disabled) { |
|
89 | + if ($disabled) { |
|
90 | 90 | $disabled = ' disabled'; |
91 | - } else { |
|
91 | + } else { |
|
92 | 92 | $disabled = ''; |
93 | 93 | } |
94 | - if ($add) { |
|
94 | + if ($add) { |
|
95 | 95 | $add = ' ' . $add; |
96 | 96 | } |
97 | 97 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param string $object |
105 | 105 | * @return string |
106 | 106 | */ |
107 | -function wrap_label($str = '', $object) |
|
108 | -{ |
|
107 | +function wrap_label($str = '', $object) |
|
108 | +{ |
|
109 | 109 | return "<label>{$object}\n{$str}</label>"; |
110 | 110 | } |
111 | 111 | |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | * @param array $ph |
115 | 115 | * @return string |
116 | 116 | */ |
117 | -function parseText($tpl = '', $ph = array()) |
|
118 | -{ |
|
119 | - if (empty($ph) || empty($tpl)) { |
|
117 | +function parseText($tpl = '', $ph = array()) |
|
118 | +{ |
|
119 | + if (empty($ph) || empty($tpl)) { |
|
120 | 120 | return $tpl; |
121 | 121 | } |
122 | 122 | |
123 | - foreach ($ph as $k => $v) { |
|
123 | + foreach ($ph as $k => $v) { |
|
124 | 124 | $k = "[+{$k}+]"; |
125 | 125 | $tpl = str_replace($k, $v, $tpl); |
126 | 126 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param bool $cond |
133 | 133 | * @return string |
134 | 134 | */ |
135 | -function showHide($cond = true) |
|
136 | -{ |
|
135 | +function showHide($cond = true) |
|
136 | +{ |
|
137 | 137 | global $displayStyle; |
138 | 138 | $showHide = $cond ? $displayStyle : 'none'; |
139 | 139 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /********************/ |
@@ -12,30 +12,30 @@ discard block |
||
12 | 12 | |
13 | 13 | // check permissions |
14 | 14 | switch($modx->manager->action) { |
15 | - case 27: |
|
16 | - if(!$modx->hasPermission('edit_document')) { |
|
17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | - } |
|
19 | - break; |
|
20 | - case 85: |
|
21 | - case 72: |
|
22 | - case 4: |
|
23 | - if(!$modx->hasPermission('new_document')) { |
|
24 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | - // check user has permissions for parent |
|
27 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
28 | - $udperms = new udperms(); |
|
29 | - $udperms->user = $modx->getLoginUserID(); |
|
30 | - $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
31 | - $udperms->role = $_SESSION['mgrRole']; |
|
32 | - if(!$udperms->checkPermissions()) { |
|
33 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
34 | - } |
|
35 | - } |
|
36 | - break; |
|
37 | - default: |
|
38 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + case 27: |
|
16 | + if(!$modx->hasPermission('edit_document')) { |
|
17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | + } |
|
19 | + break; |
|
20 | + case 85: |
|
21 | + case 72: |
|
22 | + case 4: |
|
23 | + if(!$modx->hasPermission('new_document')) { |
|
24 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
25 | + } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | + // check user has permissions for parent |
|
27 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
28 | + $udperms = new udperms(); |
|
29 | + $udperms->user = $modx->getLoginUserID(); |
|
30 | + $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
31 | + $udperms->role = $_SESSION['mgrRole']; |
|
32 | + if(!$udperms->checkPermissions()) { |
|
33 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
34 | + } |
|
35 | + } |
|
36 | + break; |
|
37 | + default: |
|
38 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -54,22 +54,22 @@ discard block |
||
54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
55 | 55 | |
56 | 56 | if($modx->manager->action == 27) { |
57 | - //editing an existing document |
|
58 | - // check permissions on the document |
|
59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
60 | - $udperms = new udperms(); |
|
61 | - $udperms->user = $modx->getLoginUserID(); |
|
62 | - $udperms->document = $id; |
|
63 | - $udperms->role = $_SESSION['mgrRole']; |
|
64 | - |
|
65 | - if(!$udperms->checkPermissions()) { |
|
66 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
67 | - } |
|
57 | + //editing an existing document |
|
58 | + // check permissions on the document |
|
59 | + include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
60 | + $udperms = new udperms(); |
|
61 | + $udperms->user = $modx->getLoginUserID(); |
|
62 | + $udperms->document = $id; |
|
63 | + $udperms->role = $_SESSION['mgrRole']; |
|
64 | + |
|
65 | + if(!$udperms->checkPermissions()) { |
|
66 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // check to see if resource isn't locked |
71 | 71 | if($lockedEl = $modx->elementIsLocked(7, $id)) { |
72 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
72 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
73 | 73 | } |
74 | 74 | // end check for lock |
75 | 75 | |
@@ -78,74 +78,74 @@ discard block |
||
78 | 78 | |
79 | 79 | // get document groups for current user |
80 | 80 | if($_SESSION['mgrDocgroups']) { |
81 | - $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
81 | + $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | if(!empty ($id)) { |
85 | - $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
86 | - if($docgrp) { |
|
87 | - $access .= " OR dg.document_group IN ({$docgrp})"; |
|
88 | - } |
|
89 | - $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
90 | - $content = array(); |
|
91 | - $content = $modx->db->getRow($rs); |
|
92 | - $modx->documentObject = &$content; |
|
93 | - if(!$content) { |
|
94 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
95 | - } |
|
96 | - $_SESSION['itemname'] = $content['pagetitle']; |
|
85 | + $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
86 | + if($docgrp) { |
|
87 | + $access .= " OR dg.document_group IN ({$docgrp})"; |
|
88 | + } |
|
89 | + $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
90 | + $content = array(); |
|
91 | + $content = $modx->db->getRow($rs); |
|
92 | + $modx->documentObject = &$content; |
|
93 | + if(!$content) { |
|
94 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
95 | + } |
|
96 | + $_SESSION['itemname'] = $content['pagetitle']; |
|
97 | 97 | } else { |
98 | - $content = array(); |
|
98 | + $content = array(); |
|
99 | 99 | |
100 | - if(isset($_REQUEST['newtemplate'])) { |
|
101 | - $content['template'] = $_REQUEST['newtemplate']; |
|
102 | - } else { |
|
103 | - $content['template'] = getDefaultTemplate(); |
|
104 | - } |
|
100 | + if(isset($_REQUEST['newtemplate'])) { |
|
101 | + $content['template'] = $_REQUEST['newtemplate']; |
|
102 | + } else { |
|
103 | + $content['template'] = getDefaultTemplate(); |
|
104 | + } |
|
105 | 105 | |
106 | - $_SESSION['itemname'] = $_lang["new_resource"]; |
|
106 | + $_SESSION['itemname'] = $_lang["new_resource"]; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // restore saved form |
110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
111 | 111 | if(isset($_REQUEST['newtemplate'])) { |
112 | - $formRestored = true; |
|
112 | + $formRestored = true; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // retain form values if template was changed |
116 | 116 | // edited to convert pub_date and unpub_date |
117 | 117 | // sottwell 02-09-2006 |
118 | 118 | if($formRestored == true) { |
119 | - $content = array_merge($content, $_POST); |
|
120 | - $content['content'] = $_POST['ta']; |
|
121 | - if(empty ($content['pub_date'])) { |
|
122 | - unset ($content['pub_date']); |
|
123 | - } else { |
|
124 | - $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
125 | - } |
|
126 | - if(empty ($content['unpub_date'])) { |
|
127 | - unset ($content['unpub_date']); |
|
128 | - } else { |
|
129 | - $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
130 | - } |
|
119 | + $content = array_merge($content, $_POST); |
|
120 | + $content['content'] = $_POST['ta']; |
|
121 | + if(empty ($content['pub_date'])) { |
|
122 | + unset ($content['pub_date']); |
|
123 | + } else { |
|
124 | + $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
125 | + } |
|
126 | + if(empty ($content['unpub_date'])) { |
|
127 | + unset ($content['unpub_date']); |
|
128 | + } else { |
|
129 | + $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
130 | + } |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | // increase menu index if this is a new document |
134 | 134 | if(!isset ($_REQUEST['id'])) { |
135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
136 | - $modx->config['auto_menuindex'] = 1; |
|
137 | - } |
|
138 | - if($modx->config['auto_menuindex']) { |
|
139 | - $pid = (int)$_REQUEST['pid']; |
|
140 | - $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
141 | - $content['menuindex'] = $modx->db->getValue($rs); |
|
142 | - } else { |
|
143 | - $content['menuindex'] = 0; |
|
144 | - } |
|
135 | + if(!isset ($modx->config['auto_menuindex'])) { |
|
136 | + $modx->config['auto_menuindex'] = 1; |
|
137 | + } |
|
138 | + if($modx->config['auto_menuindex']) { |
|
139 | + $pid = (int)$_REQUEST['pid']; |
|
140 | + $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
141 | + $content['menuindex'] = $modx->db->getValue($rs); |
|
142 | + } else { |
|
143 | + $content['menuindex'] = 0; |
|
144 | + } |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | if(isset ($_POST['which_editor'])) { |
148 | - $modx->config['which_editor'] = $_POST['which_editor']; |
|
148 | + $modx->config['which_editor'] = $_POST['which_editor']; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // Add lock-element JS-Script |
@@ -545,23 +545,23 @@ discard block |
||
545 | 545 | |
546 | 546 | <form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;"> |
547 | 547 | <?php |
548 | - // invoke OnDocFormPrerender event |
|
549 | - $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
550 | - 'id' => $id, |
|
551 | - 'template' => $content['template'] |
|
552 | - )); |
|
553 | - |
|
554 | - if(is_array($evtOut)) { |
|
555 | - echo implode('', $evtOut); |
|
556 | - } |
|
557 | - |
|
558 | - /*************************/ |
|
559 | - $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
560 | - $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
561 | - $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
562 | - /*************************/ |
|
563 | - |
|
564 | - ?> |
|
548 | + // invoke OnDocFormPrerender event |
|
549 | + $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
550 | + 'id' => $id, |
|
551 | + 'template' => $content['template'] |
|
552 | + )); |
|
553 | + |
|
554 | + if(is_array($evtOut)) { |
|
555 | + echo implode('', $evtOut); |
|
556 | + } |
|
557 | + |
|
558 | + /*************************/ |
|
559 | + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
560 | + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
561 | + $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
562 | + /*************************/ |
|
563 | + |
|
564 | + ?> |
|
565 | 565 | <input type="hidden" name="a" value="5" /> |
566 | 566 | <input type="hidden" name="id" value="<?= $content['id'] ?>" /> |
567 | 567 | <input type="hidden" name="mode" value="<?= $modx->manager->action ?>" /> |
@@ -576,54 +576,54 @@ discard block |
||
576 | 576 | |
577 | 577 | <h1> |
578 | 578 | <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
579 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
580 | - } else { |
|
581 | - if ($modx->manager->action == '4') { |
|
579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
580 | + } else { |
|
581 | + if ($modx->manager->action == '4') { |
|
582 | 582 | echo $_lang['add_resource']; |
583 | 583 | } else if ($modx->manager->action == '72') { |
584 | 584 | echo $_lang['add_weblink']; |
585 | 585 | } else { |
586 | 586 | echo $_lang['create_resource_title']; |
587 | 587 | } |
588 | - } ?> |
|
588 | + } ?> |
|
589 | 589 | </h1> |
590 | 590 | |
591 | 591 | <?= $_style['actionbuttons']['dynamic']['document'] ?> |
592 | 592 | |
593 | 593 | <?php |
594 | - // breadcrumbs |
|
595 | - if($modx->config['use_breadcrumbs']) { |
|
596 | - $temp = array(); |
|
597 | - $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
598 | - |
|
599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
600 | - $bID = (int) $_REQUEST['id']; |
|
601 | - $temp = $modx->getParentIds($bID); |
|
602 | - } else if(isset($_REQUEST['pid'])) { |
|
603 | - $bID = (int) $_REQUEST['pid']; |
|
604 | - $temp = $modx->getParentIds($bID); |
|
605 | - array_unshift($temp, $bID); |
|
606 | - } |
|
607 | - |
|
608 | - if($temp) { |
|
609 | - $parents = implode(',', $temp); |
|
610 | - |
|
611 | - if(!empty($parents)) { |
|
612 | - $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
613 | - $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
614 | - while($row = $modx->db->getRow($rs)) { |
|
615 | - $out .= '<li class="breadcrumbs__li"> |
|
594 | + // breadcrumbs |
|
595 | + if($modx->config['use_breadcrumbs']) { |
|
596 | + $temp = array(); |
|
597 | + $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
598 | + |
|
599 | + if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
600 | + $bID = (int) $_REQUEST['id']; |
|
601 | + $temp = $modx->getParentIds($bID); |
|
602 | + } else if(isset($_REQUEST['pid'])) { |
|
603 | + $bID = (int) $_REQUEST['pid']; |
|
604 | + $temp = $modx->getParentIds($bID); |
|
605 | + array_unshift($temp, $bID); |
|
606 | + } |
|
607 | + |
|
608 | + if($temp) { |
|
609 | + $parents = implode(',', $temp); |
|
610 | + |
|
611 | + if(!empty($parents)) { |
|
612 | + $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
613 | + $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
614 | + while($row = $modx->db->getRow($rs)) { |
|
615 | + $out .= '<li class="breadcrumbs__li"> |
|
616 | 616 | <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
617 | 617 | <span class="breadcrumbs__sep">></span> |
618 | 618 | </li>'; |
619 | - } |
|
620 | - } |
|
621 | - } |
|
619 | + } |
|
620 | + } |
|
621 | + } |
|
622 | 622 | |
623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
625 | - } |
|
626 | - ?> |
|
623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
624 | + echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
625 | + } |
|
626 | + ?> |
|
627 | 627 | |
628 | 628 | <!-- start main wrapper --> |
629 | 629 | <div class="sectionBody"> |
@@ -635,13 +635,13 @@ discard block |
||
635 | 635 | |
636 | 636 | <!-- General --> |
637 | 637 | <?php |
638 | - $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
639 | - 'id' => $id |
|
640 | - )); |
|
641 | - if(is_array($evtOut)) { |
|
642 | - echo implode('', $evtOut); |
|
643 | - } else { |
|
644 | - ?> |
|
638 | + $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
639 | + 'id' => $id |
|
640 | + )); |
|
641 | + if(is_array($evtOut)) { |
|
642 | + echo implode('', $evtOut); |
|
643 | + } else { |
|
644 | + ?> |
|
645 | 645 | <div class="tab-page" id="tabGeneral"> |
646 | 646 | <h2 class="tab"><?= $_lang['settings_general'] ?></h2> |
647 | 647 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script> |
@@ -726,36 +726,36 @@ discard block |
||
726 | 726 | <select id="template" name="template" class="inputBox" onchange="templateWarning();"> |
727 | 727 | <option value="0">(blank)</option> |
728 | 728 | <?php |
729 | - $field = "t.templatename, t.selectable, t.id, c.category"; |
|
730 | - $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
731 | - $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
732 | - $currentCategory = ''; |
|
733 | - while($row = $modx->db->getRow($rs)) { |
|
734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
735 | - continue; |
|
736 | - }; |
|
737 | - // Skip if not selectable but show if selected! |
|
738 | - $thisCategory = $row['category']; |
|
739 | - if($thisCategory == null) { |
|
740 | - $thisCategory = $_lang["no_category"]; |
|
741 | - } |
|
742 | - if($thisCategory != $currentCategory) { |
|
743 | - if($closeOptGroup) { |
|
744 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
745 | - } |
|
746 | - echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
747 | - $closeOptGroup = true; |
|
748 | - } |
|
729 | + $field = "t.templatename, t.selectable, t.id, c.category"; |
|
730 | + $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
731 | + $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
732 | + $currentCategory = ''; |
|
733 | + while($row = $modx->db->getRow($rs)) { |
|
734 | + if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
735 | + continue; |
|
736 | + }; |
|
737 | + // Skip if not selectable but show if selected! |
|
738 | + $thisCategory = $row['category']; |
|
739 | + if($thisCategory == null) { |
|
740 | + $thisCategory = $_lang["no_category"]; |
|
741 | + } |
|
742 | + if($thisCategory != $currentCategory) { |
|
743 | + if($closeOptGroup) { |
|
744 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
745 | + } |
|
746 | + echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
747 | + $closeOptGroup = true; |
|
748 | + } |
|
749 | 749 | |
750 | - $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
750 | + $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
751 | 751 | |
752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
753 | - $currentCategory = $thisCategory; |
|
754 | - } |
|
755 | - if($thisCategory != '') { |
|
756 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
757 | - } |
|
758 | - ?> |
|
752 | + echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
753 | + $currentCategory = $thisCategory; |
|
754 | + } |
|
755 | + if($thisCategory != '') { |
|
756 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
757 | + } |
|
758 | + ?> |
|
759 | 759 | </select> |
760 | 760 | </td> |
761 | 761 | </tr> |
@@ -795,37 +795,37 @@ discard block |
||
795 | 795 | </td> |
796 | 796 | <td valign="top"> |
797 | 797 | <?php |
798 | - $parentlookup = false; |
|
799 | - if(isset ($_REQUEST['id'])) { |
|
800 | - if($content['parent'] == 0) { |
|
801 | - $parentname = $site_name; |
|
802 | - } else { |
|
803 | - $parentlookup = $content['parent']; |
|
804 | - } |
|
805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
806 | - if($_REQUEST['pid'] == 0) { |
|
807 | - $parentname = $site_name; |
|
808 | - } else { |
|
809 | - $parentlookup = $_REQUEST['pid']; |
|
810 | - } |
|
811 | - } elseif(isset($_POST['parent'])) { |
|
812 | - if($_POST['parent'] == 0) { |
|
813 | - $parentname = $site_name; |
|
814 | - } else { |
|
815 | - $parentlookup = $_POST['parent']; |
|
816 | - } |
|
817 | - } else { |
|
818 | - $parentname = $site_name; |
|
819 | - $content['parent'] = 0; |
|
820 | - } |
|
821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
822 | - $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
823 | - $parentname = $modx->db->getValue($rs); |
|
824 | - if(!$parentname) { |
|
825 | - $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
826 | - } |
|
827 | - } |
|
828 | - ?> |
|
798 | + $parentlookup = false; |
|
799 | + if(isset ($_REQUEST['id'])) { |
|
800 | + if($content['parent'] == 0) { |
|
801 | + $parentname = $site_name; |
|
802 | + } else { |
|
803 | + $parentlookup = $content['parent']; |
|
804 | + } |
|
805 | + } elseif(isset ($_REQUEST['pid'])) { |
|
806 | + if($_REQUEST['pid'] == 0) { |
|
807 | + $parentname = $site_name; |
|
808 | + } else { |
|
809 | + $parentlookup = $_REQUEST['pid']; |
|
810 | + } |
|
811 | + } elseif(isset($_POST['parent'])) { |
|
812 | + if($_POST['parent'] == 0) { |
|
813 | + $parentname = $site_name; |
|
814 | + } else { |
|
815 | + $parentlookup = $_POST['parent']; |
|
816 | + } |
|
817 | + } else { |
|
818 | + $parentname = $site_name; |
|
819 | + $content['parent'] = 0; |
|
820 | + } |
|
821 | + if($parentlookup !== false && is_numeric($parentlookup)) { |
|
822 | + $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
823 | + $parentname = $modx->db->getValue($rs); |
|
824 | + if(!$parentname) { |
|
825 | + $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
826 | + } |
|
827 | + } |
|
828 | + ?> |
|
829 | 829 | <i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i> |
830 | 830 | <b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $parentname ?>)</span></b> |
831 | 831 | <input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" /> |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | </tr> |
834 | 834 | <tr></tr> |
835 | 835 | <?php |
836 | - /* |
|
836 | + /* |
|
837 | 837 | if($content['type'] == 'reference' || $modx->manager->action == '72') { |
838 | 838 | ?> |
839 | 839 | <tr> |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | </tr> |
862 | 862 | <?php |
863 | 863 | }*/ |
864 | - ?> |
|
864 | + ?> |
|
865 | 865 | |
866 | 866 | <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
867 | 867 | <tr> |
@@ -874,36 +874,36 @@ discard block |
||
874 | 874 | <select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();"> |
875 | 875 | <option value="none"><?= $_lang['none'] ?></option> |
876 | 876 | <?php |
877 | - // invoke OnRichTextEditorRegister event |
|
878 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
879 | - if(is_array($evtOut)) { |
|
880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
881 | - $editor = $evtOut[$i]; |
|
882 | - echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
883 | - } |
|
884 | - } |
|
885 | - ?> |
|
877 | + // invoke OnRichTextEditorRegister event |
|
878 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
879 | + if(is_array($evtOut)) { |
|
880 | + for($i = 0; $i < count($evtOut); $i++) { |
|
881 | + $editor = $evtOut[$i]; |
|
882 | + echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
883 | + } |
|
884 | + } |
|
885 | + ?> |
|
886 | 886 | </select> |
887 | 887 | </label> |
888 | 888 | </div> |
889 | 889 | <div id="content_body"> |
890 | 890 | <?php |
891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
892 | - $htmlContent = $content['content']; |
|
893 | - ?> |
|
891 | + if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
892 | + $htmlContent = $content['content']; |
|
893 | + ?> |
|
894 | 894 | <div class="section-editor clearfix"> |
895 | 895 | <textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->htmlspecialchars($htmlContent) ?></textarea> |
896 | 896 | </div> |
897 | 897 | <?php |
898 | - // Richtext-[*content*] |
|
899 | - $richtexteditorIds = array(); |
|
900 | - $richtexteditorOptions = array(); |
|
901 | - $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
902 | - $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
903 | - } else { |
|
904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
905 | - } |
|
906 | - ?> |
|
898 | + // Richtext-[*content*] |
|
899 | + $richtexteditorIds = array(); |
|
900 | + $richtexteditorOptions = array(); |
|
901 | + $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
902 | + $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
903 | + } else { |
|
904 | + echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
905 | + } |
|
906 | + ?> |
|
907 | 907 | </div> |
908 | 908 | </td> |
909 | 909 | </tr> |
@@ -1190,8 +1190,8 @@ discard block |
||
1190 | 1190 | |
1191 | 1191 | <?php |
1192 | 1192 | |
1193 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1194 | - ?> |
|
1193 | + if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1194 | + ?> |
|
1195 | 1195 | <tr> |
1196 | 1196 | <td> |
1197 | 1197 | <span class="warning"><?= $_lang['resource_type'] ?></span> |
@@ -1213,15 +1213,15 @@ discard block |
||
1213 | 1213 | <td> |
1214 | 1214 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1215 | 1215 | <?php |
1216 | - if(!$content['contentType']) { |
|
1217 | - $content['contentType'] = 'text/html'; |
|
1218 | - } |
|
1219 | - $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1220 | - $ct = explode(",", $custom_contenttype); |
|
1221 | - for($i = 0; $i < count($ct); $i++) { |
|
1222 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1223 | - } |
|
1224 | - ?> |
|
1216 | + if(!$content['contentType']) { |
|
1217 | + $content['contentType'] = 'text/html'; |
|
1218 | + } |
|
1219 | + $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1220 | + $ct = explode(",", $custom_contenttype); |
|
1221 | + for($i = 0; $i < count($ct); $i++) { |
|
1222 | + echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1223 | + } |
|
1224 | + ?> |
|
1225 | 1225 | </select> |
1226 | 1226 | </td> |
1227 | 1227 | </tr> |
@@ -1244,23 +1244,23 @@ discard block |
||
1244 | 1244 | </td> |
1245 | 1245 | </tr> |
1246 | 1246 | <?php |
1247 | - } else { |
|
1248 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1249 | - // non-admin managers creating or editing a document resource |
|
1250 | - ?> |
|
1247 | + } else { |
|
1248 | + if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1249 | + // non-admin managers creating or editing a document resource |
|
1250 | + ?> |
|
1251 | 1251 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
1252 | 1252 | <input type="hidden" name="type" value="document" /> |
1253 | 1253 | <input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" /> |
1254 | 1254 | <?php |
1255 | - } else { |
|
1256 | - // non-admin managers creating or editing a reference (weblink) resource |
|
1257 | - ?> |
|
1255 | + } else { |
|
1256 | + // non-admin managers creating or editing a reference (weblink) resource |
|
1257 | + ?> |
|
1258 | 1258 | <input type="hidden" name="type" value="reference" /> |
1259 | 1259 | <input type="hidden" name="contentType" value="text/html" /> |
1260 | 1260 | <?php |
1261 | - } |
|
1262 | - }//if mgrRole |
|
1263 | - ?> |
|
1261 | + } |
|
1262 | + }//if mgrRole |
|
1263 | + ?> |
|
1264 | 1264 | |
1265 | 1265 | <tr> |
1266 | 1266 | <td> |
@@ -1343,112 +1343,112 @@ discard block |
||
1343 | 1343 | ?> |
1344 | 1344 | |
1345 | 1345 | <?php |
1346 | - /******************************* |
|
1346 | + /******************************* |
|
1347 | 1347 | * Document Access Permissions */ |
1348 | - if($use_udperms == 1) { |
|
1349 | - $groupsarray = array(); |
|
1350 | - $sql = ''; |
|
1351 | - |
|
1352 | - $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1353 | - if($documentId > 0) { |
|
1354 | - // Load up, the permissions from the parent (if new document) or existing document |
|
1355 | - $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1357 | - |
|
1358 | - // Load up the current permissions and names |
|
1359 | - $vs = array( |
|
1360 | - $tbl_document_group_names, |
|
1361 | - $tbl_document_groups, |
|
1362 | - $documentId |
|
1363 | - ); |
|
1364 | - $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1365 | - $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1366 | - } else { |
|
1367 | - // Just load up the names, we're starting clean |
|
1368 | - $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1369 | - } |
|
1370 | - |
|
1371 | - // retain selected doc groups between post |
|
1372 | - if(isset($_POST['docgroups'])) { |
|
1373 | - $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1374 | - } |
|
1348 | + if($use_udperms == 1) { |
|
1349 | + $groupsarray = array(); |
|
1350 | + $sql = ''; |
|
1351 | + |
|
1352 | + $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1353 | + if($documentId > 0) { |
|
1354 | + // Load up, the permissions from the parent (if new document) or existing document |
|
1355 | + $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1356 | + while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1357 | + |
|
1358 | + // Load up the current permissions and names |
|
1359 | + $vs = array( |
|
1360 | + $tbl_document_group_names, |
|
1361 | + $tbl_document_groups, |
|
1362 | + $documentId |
|
1363 | + ); |
|
1364 | + $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1365 | + $rs = $modx->db->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1366 | + } else { |
|
1367 | + // Just load up the names, we're starting clean |
|
1368 | + $rs = $modx->db->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1369 | + } |
|
1370 | + |
|
1371 | + // retain selected doc groups between post |
|
1372 | + if(isset($_POST['docgroups'])) { |
|
1373 | + $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1374 | + } |
|
1375 | + |
|
1376 | + $isManager = $modx->hasPermission('access_permissions'); |
|
1377 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1378 | + |
|
1379 | + // Setup Basic attributes for each Input box |
|
1380 | + $inputAttributes = array( |
|
1381 | + 'type' => 'checkbox', |
|
1382 | + 'class' => 'checkbox', |
|
1383 | + 'name' => 'docgroups[]', |
|
1384 | + 'onclick' => 'makePublic(false);', |
|
1385 | + ); |
|
1386 | + $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1387 | + $permissions_yes = 0; // count permissions the current mgr user has |
|
1388 | + $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1389 | + |
|
1390 | + // Loop through the permissions list |
|
1391 | + while($row = $modx->db->getRow($rs)) { |
|
1392 | + |
|
1393 | + // Create an inputValue pair (group ID and group link (if it exists)) |
|
1394 | + $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | + $inputId = 'group-' . $row['id']; |
|
1396 | + |
|
1397 | + $checked = in_array($inputValue, $groupsarray); |
|
1398 | + if($checked) { |
|
1399 | + $notPublic = true; |
|
1400 | + } // Mark as private access (either web or manager) |
|
1401 | + |
|
1402 | + // Skip the access permission if the user doesn't have access... |
|
1403 | + if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1404 | + continue; |
|
1405 | + } |
|
1375 | 1406 | |
1376 | - $isManager = $modx->hasPermission('access_permissions'); |
|
1377 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1378 | - |
|
1379 | - // Setup Basic attributes for each Input box |
|
1380 | - $inputAttributes = array( |
|
1381 | - 'type' => 'checkbox', |
|
1382 | - 'class' => 'checkbox', |
|
1383 | - 'name' => 'docgroups[]', |
|
1384 | - 'onclick' => 'makePublic(false);', |
|
1385 | - ); |
|
1386 | - $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1387 | - $permissions_yes = 0; // count permissions the current mgr user has |
|
1388 | - $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1389 | - |
|
1390 | - // Loop through the permissions list |
|
1391 | - while($row = $modx->db->getRow($rs)) { |
|
1392 | - |
|
1393 | - // Create an inputValue pair (group ID and group link (if it exists)) |
|
1394 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | - $inputId = 'group-' . $row['id']; |
|
1396 | - |
|
1397 | - $checked = in_array($inputValue, $groupsarray); |
|
1398 | - if($checked) { |
|
1399 | - $notPublic = true; |
|
1400 | - } // Mark as private access (either web or manager) |
|
1401 | - |
|
1402 | - // Skip the access permission if the user doesn't have access... |
|
1403 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1404 | - continue; |
|
1405 | - } |
|
1406 | - |
|
1407 | - // Setup attributes for this Input box |
|
1408 | - $inputAttributes['id'] = $inputId; |
|
1409 | - $inputAttributes['value'] = $inputValue; |
|
1410 | - if($checked) { |
|
1411 | - $inputAttributes['checked'] = 'checked'; |
|
1412 | - } else { |
|
1413 | - unset($inputAttributes['checked']); |
|
1414 | - } |
|
1415 | - |
|
1416 | - // Create attribute string list |
|
1417 | - $inputString = array(); |
|
1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1419 | - |
|
1420 | - // Make the <input> HTML |
|
1421 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1422 | - |
|
1423 | - // does user have this permission? |
|
1424 | - $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1425 | - $vs = array( |
|
1426 | - $row['id'], |
|
1427 | - $_SESSION['mgrInternalKey'] |
|
1428 | - ); |
|
1429 | - $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1430 | - $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
1431 | - $count = $modx->db->getValue($rsp); |
|
1432 | - if($count > 0) { |
|
1433 | - ++$permissions_yes; |
|
1434 | - } else { |
|
1435 | - ++$permissions_no; |
|
1436 | - } |
|
1437 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1438 | - } |
|
1439 | - // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1440 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1441 | - $permissions = array(); |
|
1442 | - } |
|
1407 | + // Setup attributes for this Input box |
|
1408 | + $inputAttributes['id'] = $inputId; |
|
1409 | + $inputAttributes['value'] = $inputValue; |
|
1410 | + if($checked) { |
|
1411 | + $inputAttributes['checked'] = 'checked'; |
|
1412 | + } else { |
|
1413 | + unset($inputAttributes['checked']); |
|
1414 | + } |
|
1443 | 1415 | |
1444 | - // See if the Access Permissions section is worth displaying... |
|
1445 | - if(!empty($permissions)) { |
|
1446 | - // Add the "All Document Groups" item if we have rights in both contexts |
|
1447 | - if($isManager && $isWeb) { |
|
1448 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1449 | - } |
|
1450 | - // Output the permissions list... |
|
1451 | - ?> |
|
1416 | + // Create attribute string list |
|
1417 | + $inputString = array(); |
|
1418 | + foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1419 | + |
|
1420 | + // Make the <input> HTML |
|
1421 | + $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1422 | + |
|
1423 | + // does user have this permission? |
|
1424 | + $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1425 | + $vs = array( |
|
1426 | + $row['id'], |
|
1427 | + $_SESSION['mgrInternalKey'] |
|
1428 | + ); |
|
1429 | + $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1430 | + $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
|
1431 | + $count = $modx->db->getValue($rsp); |
|
1432 | + if($count > 0) { |
|
1433 | + ++$permissions_yes; |
|
1434 | + } else { |
|
1435 | + ++$permissions_no; |
|
1436 | + } |
|
1437 | + $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1438 | + } |
|
1439 | + // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1440 | + if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1441 | + $permissions = array(); |
|
1442 | + } |
|
1443 | + |
|
1444 | + // See if the Access Permissions section is worth displaying... |
|
1445 | + if(!empty($permissions)) { |
|
1446 | + // Add the "All Document Groups" item if we have rights in both contexts |
|
1447 | + if($isManager && $isWeb) { |
|
1448 | + array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1449 | + } |
|
1450 | + // Output the permissions list... |
|
1451 | + ?> |
|
1452 | 1452 | <!-- Access Permissions --> |
1453 | 1453 | <div class="tab-page" id="tabAccess"> |
1454 | 1454 | <h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2> |
@@ -1482,31 +1482,31 @@ discard block |
||
1482 | 1482 | </ul> |
1483 | 1483 | </div><!--div class="tab-page" id="tabAccess"--> |
1484 | 1484 | <?php |
1485 | - } // !empty($permissions) |
|
1486 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1487 | - ?> |
|
1485 | + } // !empty($permissions) |
|
1486 | + elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1487 | + ?> |
|
1488 | 1488 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1489 | 1489 | <?php |
1490 | 1490 | |
1491 | - } |
|
1492 | - } |
|
1493 | - /* End Document Access Permissions * |
|
1491 | + } |
|
1492 | + } |
|
1493 | + /* End Document Access Permissions * |
|
1494 | 1494 | ***********************************/ |
1495 | - ?> |
|
1495 | + ?> |
|
1496 | 1496 | |
1497 | 1497 | <input type="submit" name="save" style="display:none" /> |
1498 | 1498 | <?php |
1499 | 1499 | |
1500 | - // invoke OnDocFormRender event |
|
1501 | - $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1502 | - 'id' => $id, |
|
1503 | - 'template' => $content['template'] |
|
1504 | - )); |
|
1500 | + // invoke OnDocFormRender event |
|
1501 | + $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1502 | + 'id' => $id, |
|
1503 | + 'template' => $content['template'] |
|
1504 | + )); |
|
1505 | 1505 | |
1506 | - if(is_array($evtOut)) { |
|
1507 | - echo implode('', $evtOut); |
|
1508 | - } |
|
1509 | - ?> |
|
1506 | + if(is_array($evtOut)) { |
|
1507 | + echo implode('', $evtOut); |
|
1508 | + } |
|
1509 | + ?> |
|
1510 | 1510 | </div><!--div class="tab-pane" id="documentPane"--> |
1511 | 1511 | </div><!--div class="sectionBody"--> |
1512 | 1512 | </fieldset> |
@@ -1517,63 +1517,63 @@ discard block |
||
1517 | 1517 | </script> |
1518 | 1518 | <?php |
1519 | 1519 | if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
1520 | - if(is_array($richtexteditorIds)) { |
|
1521 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1522 | - // invoke OnRichTextEditorInit event |
|
1523 | - $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1524 | - 'editor' => $editor, |
|
1525 | - 'elements' => $elements, |
|
1526 | - 'options' => $richtexteditorOptions[$editor] |
|
1527 | - )); |
|
1528 | - if(is_array($evtOut)) { |
|
1529 | - echo implode('', $evtOut); |
|
1530 | - } |
|
1531 | - } |
|
1532 | - } |
|
1520 | + if(is_array($richtexteditorIds)) { |
|
1521 | + foreach($richtexteditorIds as $editor => $elements) { |
|
1522 | + // invoke OnRichTextEditorInit event |
|
1523 | + $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1524 | + 'editor' => $editor, |
|
1525 | + 'elements' => $elements, |
|
1526 | + 'options' => $richtexteditorOptions[$editor] |
|
1527 | + )); |
|
1528 | + if(is_array($evtOut)) { |
|
1529 | + echo implode('', $evtOut); |
|
1530 | + } |
|
1531 | + } |
|
1532 | + } |
|
1533 | 1533 | } |
1534 | 1534 | |
1535 | 1535 | /** |
1536 | 1536 | * @return string |
1537 | 1537 | */ |
1538 | 1538 | function getDefaultTemplate() { |
1539 | - global $modx; |
|
1539 | + global $modx; |
|
1540 | 1540 | |
1541 | 1541 | $default_template = ''; |
1542 | - switch($modx->config['auto_template_logic']) { |
|
1543 | - case 'sibling': |
|
1544 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1545 | - $site_start = $modx->config['site_start']; |
|
1546 | - $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
1547 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
1548 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1549 | - $default_template = $sibl[0]['template']; |
|
1550 | - } |
|
1551 | - } else { |
|
1552 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1553 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1554 | - $default_template = $sibl[0]['template']; |
|
1555 | - } else { |
|
1556 | - $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1557 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1558 | - $default_template = $sibl[0]['template']; |
|
1559 | - } |
|
1560 | - } |
|
1561 | - } |
|
1562 | - if(isset($default_template)) { |
|
1563 | - break; |
|
1564 | - } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
1565 | - case 'parent': |
|
1566 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1567 | - $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
1568 | - if(isset($parent['template'])) { |
|
1569 | - $default_template = $parent['template']; |
|
1570 | - } |
|
1571 | - } |
|
1572 | - break; |
|
1573 | - case 'system': |
|
1574 | - default: // default_template is already set |
|
1575 | - $default_template = $modx->config['default_template']; |
|
1576 | - } |
|
1577 | - |
|
1578 | - return empty($default_template) ? $modx->config['default_template'] : $default_template; |
|
1542 | + switch($modx->config['auto_template_logic']) { |
|
1543 | + case 'sibling': |
|
1544 | + if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1545 | + $site_start = $modx->config['site_start']; |
|
1546 | + $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
|
1547 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
|
1548 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1549 | + $default_template = $sibl[0]['template']; |
|
1550 | + } |
|
1551 | + } else { |
|
1552 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1553 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1554 | + $default_template = $sibl[0]['template']; |
|
1555 | + } else { |
|
1556 | + $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
|
1557 | + if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1558 | + $default_template = $sibl[0]['template']; |
|
1559 | + } |
|
1560 | + } |
|
1561 | + } |
|
1562 | + if(isset($default_template)) { |
|
1563 | + break; |
|
1564 | + } // If $default_template could not be determined, fall back / through to "parent"-mode |
|
1565 | + case 'parent': |
|
1566 | + if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1567 | + $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
|
1568 | + if(isset($parent['template'])) { |
|
1569 | + $default_template = $parent['template']; |
|
1570 | + } |
|
1571 | + } |
|
1572 | + break; |
|
1573 | + case 'system': |
|
1574 | + default: // default_template is already set |
|
1575 | + $default_template = $modx->config['default_template']; |
|
1576 | + } |
|
1577 | + |
|
1578 | + return empty($default_template) ? $modx->config['default_template'] : $default_template; |
|
1579 | 1579 | } |
@@ -1,35 +1,35 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | |
6 | 6 | /********************/ |
7 | -$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
8 | -$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
9 | -$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
10 | -$add_path = $sd . $sb . $pg; |
|
7 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
8 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
9 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
10 | +$add_path = $sd.$sb.$pg; |
|
11 | 11 | /*******************/ |
12 | 12 | |
13 | 13 | // check permissions |
14 | -switch($modx->manager->action) { |
|
14 | +switch ($modx->manager->action) { |
|
15 | 15 | case 27: |
16 | - if(!$modx->hasPermission('edit_document')) { |
|
16 | + if (!$modx->hasPermission('edit_document')) { |
|
17 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
18 | 18 | } |
19 | 19 | break; |
20 | 20 | case 85: |
21 | 21 | case 72: |
22 | 22 | case 4: |
23 | - if(!$modx->hasPermission('new_document')) { |
|
23 | + if (!$modx->hasPermission('new_document')) { |
|
24 | 24 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
25 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | 26 | // check user has permissions for parent |
27 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
27 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
28 | 28 | $udperms = new udperms(); |
29 | 29 | $udperms->user = $modx->getLoginUserID(); |
30 | 30 | $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
31 | 31 | $udperms->role = $_SESSION['mgrRole']; |
32 | - if(!$udperms->checkPermissions()) { |
|
32 | + if (!$udperms->checkPermissions()) { |
|
33 | 33 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
34 | 34 | } |
35 | 35 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
39 | 39 | } |
40 | 40 | |
41 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
41 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
42 | 42 | |
43 | 43 | // Get table names (alphabetical) |
44 | 44 | $tbl_categories = $modx->getFullTableName('categories'); |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_templates'); |
54 | 54 | $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars'); |
55 | 55 | |
56 | -if($modx->manager->action == 27) { |
|
56 | +if ($modx->manager->action == 27) { |
|
57 | 57 | //editing an existing document |
58 | 58 | // check permissions on the document |
59 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
59 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
60 | 60 | $udperms = new udperms(); |
61 | 61 | $udperms->user = $modx->getLoginUserID(); |
62 | 62 | $udperms->document = $id; |
63 | 63 | $udperms->role = $_SESSION['mgrRole']; |
64 | 64 | |
65 | - if(!$udperms->checkPermissions()) { |
|
65 | + if (!$udperms->checkPermissions()) { |
|
66 | 66 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | 70 | // check to see if resource isn't locked |
71 | -if($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
71 | +if ($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
72 | 72 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
73 | 73 | } |
74 | 74 | // end check for lock |
@@ -77,27 +77,27 @@ discard block |
||
77 | 77 | $modx->lockElement(7, $id); |
78 | 78 | |
79 | 79 | // get document groups for current user |
80 | -if($_SESSION['mgrDocgroups']) { |
|
80 | +if ($_SESSION['mgrDocgroups']) { |
|
81 | 81 | $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
82 | 82 | } |
83 | 83 | |
84 | -if(!empty ($id)) { |
|
84 | +if (!empty ($id)) { |
|
85 | 85 | $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
86 | - if($docgrp) { |
|
86 | + if ($docgrp) { |
|
87 | 87 | $access .= " OR dg.document_group IN ({$docgrp})"; |
88 | 88 | } |
89 | 89 | $rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
90 | 90 | $content = array(); |
91 | 91 | $content = $modx->db->getRow($rs); |
92 | 92 | $modx->documentObject = &$content; |
93 | - if(!$content) { |
|
93 | + if (!$content) { |
|
94 | 94 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
95 | 95 | } |
96 | 96 | $_SESSION['itemname'] = $content['pagetitle']; |
97 | 97 | } else { |
98 | 98 | $content = array(); |
99 | 99 | |
100 | - if(isset($_REQUEST['newtemplate'])) { |
|
100 | + if (isset($_REQUEST['newtemplate'])) { |
|
101 | 101 | $content['template'] = $_REQUEST['newtemplate']; |
102 | 102 | } else { |
103 | 103 | $content['template'] = getDefaultTemplate(); |
@@ -108,22 +108,22 @@ discard block |
||
108 | 108 | |
109 | 109 | // restore saved form |
110 | 110 | $formRestored = $modx->manager->loadFormValues(); |
111 | -if(isset($_REQUEST['newtemplate'])) { |
|
111 | +if (isset($_REQUEST['newtemplate'])) { |
|
112 | 112 | $formRestored = true; |
113 | 113 | } |
114 | 114 | |
115 | 115 | // retain form values if template was changed |
116 | 116 | // edited to convert pub_date and unpub_date |
117 | 117 | // sottwell 02-09-2006 |
118 | -if($formRestored == true) { |
|
118 | +if ($formRestored == true) { |
|
119 | 119 | $content = array_merge($content, $_POST); |
120 | 120 | $content['content'] = $_POST['ta']; |
121 | - if(empty ($content['pub_date'])) { |
|
121 | + if (empty ($content['pub_date'])) { |
|
122 | 122 | unset ($content['pub_date']); |
123 | 123 | } else { |
124 | 124 | $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
125 | 125 | } |
126 | - if(empty ($content['unpub_date'])) { |
|
126 | + if (empty ($content['unpub_date'])) { |
|
127 | 127 | unset ($content['unpub_date']); |
128 | 128 | } else { |
129 | 129 | $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | // increase menu index if this is a new document |
134 | -if(!isset ($_REQUEST['id'])) { |
|
135 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
134 | +if (!isset ($_REQUEST['id'])) { |
|
135 | + if (!isset ($modx->config['auto_menuindex'])) { |
|
136 | 136 | $modx->config['auto_menuindex'] = 1; |
137 | 137 | } |
138 | - if($modx->config['auto_menuindex']) { |
|
139 | - $pid = (int)$_REQUEST['pid']; |
|
138 | + if ($modx->config['auto_menuindex']) { |
|
139 | + $pid = (int) $_REQUEST['pid']; |
|
140 | 140 | $rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
141 | 141 | $content['menuindex'] = $modx->db->getValue($rs); |
142 | 142 | } else { |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | -if(isset ($_POST['which_editor'])) { |
|
147 | +if (isset ($_POST['which_editor'])) { |
|
148 | 148 | $modx->config['which_editor'] = $_POST['which_editor']; |
149 | 149 | } |
150 | 150 | |
151 | 151 | // Add lock-element JS-Script |
152 | 152 | $lockElementId = $id; |
153 | 153 | $lockElementType = 7; |
154 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
154 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
155 | 155 | ?> |
156 | 156 | <script type="text/javascript"> |
157 | 157 | /* <![CDATA[ */ |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | }, |
182 | 182 | cancel: function() { |
183 | 183 | documentDirty = false; |
184 | - document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>'; |
|
184 | + document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>'; |
|
185 | 185 | }, |
186 | 186 | duplicate: function() { |
187 | 187 | if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } |
190 | 190 | }, |
191 | 191 | view: function() { |
192 | - window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin'); |
|
192 | + window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin'); |
|
193 | 193 | } |
194 | 194 | }; |
195 | 195 | |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | 'template' => $content['template'] |
552 | 552 | )); |
553 | 553 | |
554 | - if(is_array($evtOut)) { |
|
554 | + if (is_array($evtOut)) { |
|
555 | 555 | echo implode('', $evtOut); |
556 | 556 | } |
557 | 557 | |
@@ -575,8 +575,8 @@ discard block |
||
575 | 575 | <fieldset id="create_edit"> |
576 | 576 | |
577 | 577 | <h1> |
578 | - <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
|
579 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
578 | + <i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) { |
|
579 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>'; |
|
580 | 580 | } else { |
581 | 581 | if ($modx->manager->action == '4') { |
582 | 582 | echo $_lang['add_resource']; |
@@ -592,36 +592,36 @@ discard block |
||
592 | 592 | |
593 | 593 | <?php |
594 | 594 | // breadcrumbs |
595 | - if($modx->config['use_breadcrumbs']) { |
|
595 | + if ($modx->config['use_breadcrumbs']) { |
|
596 | 596 | $temp = array(); |
597 | 597 | $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
598 | 598 | |
599 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
599 | + if (isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
600 | 600 | $bID = (int) $_REQUEST['id']; |
601 | 601 | $temp = $modx->getParentIds($bID); |
602 | - } else if(isset($_REQUEST['pid'])) { |
|
602 | + } else if (isset($_REQUEST['pid'])) { |
|
603 | 603 | $bID = (int) $_REQUEST['pid']; |
604 | 604 | $temp = $modx->getParentIds($bID); |
605 | 605 | array_unshift($temp, $bID); |
606 | 606 | } |
607 | 607 | |
608 | - if($temp) { |
|
608 | + if ($temp) { |
|
609 | 609 | $parents = implode(',', $temp); |
610 | 610 | |
611 | - if(!empty($parents)) { |
|
611 | + if (!empty($parents)) { |
|
612 | 612 | $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
613 | 613 | $rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
614 | - while($row = $modx->db->getRow($rs)) { |
|
614 | + while ($row = $modx->db->getRow($rs)) { |
|
615 | 615 | $out .= '<li class="breadcrumbs__li"> |
616 | - <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
|
616 | + <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a> |
|
617 | 617 | <span class="breadcrumbs__sep">></span> |
618 | 618 | </li>'; |
619 | 619 | } |
620 | 620 | } |
621 | 621 | } |
622 | 622 | |
623 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
624 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
623 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>'; |
|
624 | + echo '<ul class="breadcrumbs">'.$out.'</ul>'; |
|
625 | 625 | } |
626 | 626 | ?> |
627 | 627 | |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
639 | 639 | 'id' => $id |
640 | 640 | )); |
641 | - if(is_array($evtOut)) { |
|
641 | + if (is_array($evtOut)) { |
|
642 | 642 | echo implode('', $evtOut); |
643 | 643 | } else { |
644 | 644 | ?> |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | </td> |
695 | 695 | </tr> |
696 | 696 | |
697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
697 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
698 | 698 | |
699 | 699 | <tr> |
700 | 700 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -730,17 +730,17 @@ discard block |
||
730 | 730 | $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
731 | 731 | $rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC'); |
732 | 732 | $currentCategory = ''; |
733 | - while($row = $modx->db->getRow($rs)) { |
|
734 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
733 | + while ($row = $modx->db->getRow($rs)) { |
|
734 | + if ($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
735 | 735 | continue; |
736 | 736 | }; |
737 | 737 | // Skip if not selectable but show if selected! |
738 | 738 | $thisCategory = $row['category']; |
739 | - if($thisCategory == null) { |
|
739 | + if ($thisCategory == null) { |
|
740 | 740 | $thisCategory = $_lang["no_category"]; |
741 | 741 | } |
742 | - if($thisCategory != $currentCategory) { |
|
743 | - if($closeOptGroup) { |
|
742 | + if ($thisCategory != $currentCategory) { |
|
743 | + if ($closeOptGroup) { |
|
744 | 744 | echo "\t\t\t\t\t</optgroup>\n"; |
745 | 745 | } |
746 | 746 | echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
@@ -749,10 +749,10 @@ discard block |
||
749 | 749 | |
750 | 750 | $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
751 | 751 | |
752 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
752 | + echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n"; |
|
753 | 753 | $currentCategory = $thisCategory; |
754 | 754 | } |
755 | - if($thisCategory != '') { |
|
755 | + if ($thisCategory != '') { |
|
756 | 756 | echo "\t\t\t\t\t</optgroup>\n"; |
757 | 757 | } |
758 | 758 | ?> |
@@ -796,20 +796,20 @@ discard block |
||
796 | 796 | <td valign="top"> |
797 | 797 | <?php |
798 | 798 | $parentlookup = false; |
799 | - if(isset ($_REQUEST['id'])) { |
|
800 | - if($content['parent'] == 0) { |
|
799 | + if (isset ($_REQUEST['id'])) { |
|
800 | + if ($content['parent'] == 0) { |
|
801 | 801 | $parentname = $site_name; |
802 | 802 | } else { |
803 | 803 | $parentlookup = $content['parent']; |
804 | 804 | } |
805 | - } elseif(isset ($_REQUEST['pid'])) { |
|
806 | - if($_REQUEST['pid'] == 0) { |
|
805 | + } elseif (isset ($_REQUEST['pid'])) { |
|
806 | + if ($_REQUEST['pid'] == 0) { |
|
807 | 807 | $parentname = $site_name; |
808 | 808 | } else { |
809 | 809 | $parentlookup = $_REQUEST['pid']; |
810 | 810 | } |
811 | - } elseif(isset($_POST['parent'])) { |
|
812 | - if($_POST['parent'] == 0) { |
|
811 | + } elseif (isset($_POST['parent'])) { |
|
812 | + if ($_POST['parent'] == 0) { |
|
813 | 813 | $parentname = $site_name; |
814 | 814 | } else { |
815 | 815 | $parentlookup = $_POST['parent']; |
@@ -818,10 +818,10 @@ discard block |
||
818 | 818 | $parentname = $site_name; |
819 | 819 | $content['parent'] = 0; |
820 | 820 | } |
821 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
821 | + if ($parentlookup !== false && is_numeric($parentlookup)) { |
|
822 | 822 | $rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
823 | 823 | $parentname = $modx->db->getValue($rs); |
824 | - if(!$parentname) { |
|
824 | + if (!$parentname) { |
|
825 | 825 | $modx->webAlertAndQuit($_lang["error_no_parent"]); |
826 | 826 | } |
827 | 827 | } |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | }*/ |
864 | 864 | ?> |
865 | 865 | |
866 | - <?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
866 | + <?php if ($content['type'] == 'document' || $modx->manager->action == '4') { ?> |
|
867 | 867 | <tr> |
868 | 868 | <td colspan="2"> |
869 | 869 | <hr> |
@@ -876,8 +876,8 @@ discard block |
||
876 | 876 | <?php |
877 | 877 | // invoke OnRichTextEditorRegister event |
878 | 878 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
879 | - if(is_array($evtOut)) { |
|
880 | - for($i = 0; $i < count($evtOut); $i++) { |
|
879 | + if (is_array($evtOut)) { |
|
880 | + for ($i = 0; $i < count($evtOut); $i++) { |
|
881 | 881 | $editor = $evtOut[$i]; |
882 | 882 | echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
883 | 883 | } |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | </div> |
889 | 889 | <div id="content_body"> |
890 | 890 | <?php |
891 | - if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
891 | + if (($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) { |
|
892 | 892 | $htmlContent = $content['content']; |
893 | 893 | ?> |
894 | 894 | <div class="section-editor clearfix"> |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
902 | 902 | $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
903 | 903 | } else { |
904 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
904 | + echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>'."\n"; |
|
905 | 905 | } |
906 | 906 | ?> |
907 | 907 | </div> |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | |
918 | 918 | if (($content['type'] == 'document' || $modx->manager->action == '4') || ($content['type'] == 'reference' || $modx->manager->action == 72)) { |
919 | 919 | $template = $default_template; |
920 | - $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs']; |
|
920 | + $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs']; |
|
921 | 921 | if (isset ($_REQUEST['newtemplate'])) { |
922 | 922 | $template = $_REQUEST['newtemplate']; |
923 | 923 | } else { |
@@ -945,10 +945,10 @@ discard block |
||
945 | 945 | ); |
946 | 946 | $sort = 'tvtpl.rank,tv.rank, tv.id'; |
947 | 947 | if ($group_tvs) { |
948 | - $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
948 | + $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
949 | 949 | $from .= ' |
950 | - LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category'; |
|
951 | - $sort = 'cat.rank,cat.id,' . $sort; |
|
950 | + LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category'; |
|
951 | + $sort = 'cat.rank,cat.id,'.$sort; |
|
952 | 952 | } |
953 | 953 | $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs); |
954 | 954 | $rs = $modx->db->select($field, $from, $where, $sort); |
@@ -957,37 +957,37 @@ discard block |
||
957 | 957 | <!-- Template Variables -->' . "\n"; |
958 | 958 | if (!$group_tvs) { |
959 | 959 | $templateVariables .= ' |
960 | - <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
960 | + <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
961 | 961 | <div class="sectionBody tmplvars"> |
962 | 962 | <table>'; |
963 | 963 | } else if ($group_tvs == 2) { |
964 | 964 | $templateVariables .= ' |
965 | 965 | <div class="tab-section"> |
966 | - <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
966 | + <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
967 | 967 | <div class="tab-pane" id="paneTemplateVariables"> |
968 | 968 | <script type="text/javascript"> |
969 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
969 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
970 | 970 | </script>'; |
971 | 971 | } else if ($group_tvs == 3) { |
972 | 972 | $templateVariables .= ' |
973 | 973 | <div id="templateVariables" class="tab-page tmplvars"> |
974 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
974 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
975 | 975 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>'; |
976 | 976 | } else if ($group_tvs == 4) { |
977 | 977 | $templateVariables .= ' |
978 | 978 | <div id="templateVariables" class="tab-page tmplvars"> |
979 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
979 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
980 | 980 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script> |
981 | 981 | |
982 | 982 | <div class="tab-pane" id="paneTemplateVariables"> |
983 | 983 | <script type="text/javascript"> |
984 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
984 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
985 | 985 | </script>'; |
986 | 986 | } |
987 | 987 | |
988 | 988 | $tvsArray = $modx->db->makeArray($rs, 'name'); |
989 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.inc.php'); |
|
990 | - require_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
989 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.inc.php'); |
|
990 | + require_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
991 | 991 | $i = 0; |
992 | 992 | $tab = ''; |
993 | 993 | foreach ($tvsArray as $row) { |
@@ -995,8 +995,8 @@ discard block |
||
995 | 995 | if ($group_tvs == 1 || $group_tvs == 3) { |
996 | 996 | if ($i === 0) { |
997 | 997 | $templateVariables .= ' |
998 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
999 | - <div class="tab-header">' . $row['category'] . '</div> |
|
998 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
999 | + <div class="tab-header">' . $row['category'].'</div> |
|
1000 | 1000 | <div class="tab-body tmplvars"> |
1001 | 1001 | <table>' . "\n"; |
1002 | 1002 | } else { |
@@ -1005,17 +1005,17 @@ discard block |
||
1005 | 1005 | </div> |
1006 | 1006 | </div> |
1007 | 1007 | |
1008 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
1009 | - <div class="tab-header">' . $row['category'] . '</div> |
|
1008 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
1009 | + <div class="tab-header">' . $row['category'].'</div> |
|
1010 | 1010 | <div class="tab-body tmplvars"> |
1011 | 1011 | <table>'; |
1012 | 1012 | } |
1013 | 1013 | } else if ($group_tvs == 2 || $group_tvs == 4) { |
1014 | 1014 | if ($i === 0) { |
1015 | 1015 | $templateVariables .= ' |
1016 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1017 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1018 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1016 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1017 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1018 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1019 | 1019 | |
1020 | 1020 | <div class="tab-body tmplvars"> |
1021 | 1021 | <table>'; |
@@ -1025,9 +1025,9 @@ discard block |
||
1025 | 1025 | </div> |
1026 | 1026 | </div> |
1027 | 1027 | |
1028 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1029 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1030 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1028 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1029 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1030 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1031 | 1031 | |
1032 | 1032 | <div class="tab-body tmplvars"> |
1033 | 1033 | <table>'; |
@@ -1035,18 +1035,18 @@ discard block |
||
1035 | 1035 | } else if ($group_tvs == 5) { |
1036 | 1036 | if ($i === 0) { |
1037 | 1037 | $templateVariables .= ' |
1038 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1039 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1040 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1038 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1039 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1040 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1041 | 1041 | <table>'; |
1042 | 1042 | } else { |
1043 | 1043 | $templateVariables .= ' |
1044 | 1044 | </table> |
1045 | 1045 | </div> |
1046 | 1046 | |
1047 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1048 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1049 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1047 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1048 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1049 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1050 | 1050 | |
1051 | 1051 | <table>'; |
1052 | 1052 | } |
@@ -1064,8 +1064,8 @@ discard block |
||
1064 | 1064 | $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor']; |
1065 | 1065 | }; |
1066 | 1066 | // Add richtext editor to the list |
1067 | - $richtexteditorIds[$editor][] = "tv" . $row['id']; |
|
1068 | - $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions; |
|
1067 | + $richtexteditorIds[$editor][] = "tv".$row['id']; |
|
1068 | + $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions; |
|
1069 | 1069 | } |
1070 | 1070 | // splitter |
1071 | 1071 | if ($group_tvs) { |
@@ -1079,24 +1079,24 @@ discard block |
||
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | // post back value |
1082 | - if (array_key_exists('tv' . $row['id'], $_POST)) { |
|
1083 | - if (is_array($_POST['tv' . $row['id']])) { |
|
1084 | - $tvPBV = implode('||', $_POST['tv' . $row['id']]); |
|
1082 | + if (array_key_exists('tv'.$row['id'], $_POST)) { |
|
1083 | + if (is_array($_POST['tv'.$row['id']])) { |
|
1084 | + $tvPBV = implode('||', $_POST['tv'.$row['id']]); |
|
1085 | 1085 | } else { |
1086 | - $tvPBV = $_POST['tv' . $row['id']]; |
|
1086 | + $tvPBV = $_POST['tv'.$row['id']]; |
|
1087 | 1087 | } |
1088 | 1088 | } else { |
1089 | 1089 | $tvPBV = $row['value']; |
1090 | 1090 | } |
1091 | 1091 | |
1092 | - $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : ''; |
|
1093 | - $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : ''; |
|
1094 | - $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : ''; |
|
1092 | + $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : ''; |
|
1093 | + $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : ''; |
|
1094 | + $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : ''; |
|
1095 | 1095 | |
1096 | 1096 | $templateVariables .= ' |
1097 | 1097 | <tr> |
1098 | - <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td> |
|
1099 | - <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td> |
|
1098 | + <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td> |
|
1099 | + <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td> |
|
1100 | 1100 | </tr>'; |
1101 | 1101 | |
1102 | 1102 | $tab = $row['category_id']; |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | |
1191 | 1191 | <?php |
1192 | 1192 | |
1193 | - if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1193 | + if ($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1194 | 1194 | ?> |
1195 | 1195 | <tr> |
1196 | 1196 | <td> |
@@ -1213,13 +1213,13 @@ discard block |
||
1213 | 1213 | <td> |
1214 | 1214 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1215 | 1215 | <?php |
1216 | - if(!$content['contentType']) { |
|
1216 | + if (!$content['contentType']) { |
|
1217 | 1217 | $content['contentType'] = 'text/html'; |
1218 | 1218 | } |
1219 | 1219 | $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
1220 | 1220 | $ct = explode(",", $custom_contenttype); |
1221 | - for($i = 0; $i < count($ct); $i++) { |
|
1222 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1221 | + for ($i = 0; $i < count($ct); $i++) { |
|
1222 | + echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n"; |
|
1223 | 1223 | } |
1224 | 1224 | ?> |
1225 | 1225 | </select> |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | </tr> |
1246 | 1246 | <?php |
1247 | 1247 | } else { |
1248 | - if($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1248 | + if ($content['type'] != 'reference' && $modx->manager->action != '72') { |
|
1249 | 1249 | // non-admin managers creating or editing a document resource |
1250 | 1250 | ?> |
1251 | 1251 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
@@ -1345,15 +1345,15 @@ discard block |
||
1345 | 1345 | <?php |
1346 | 1346 | /******************************* |
1347 | 1347 | * Document Access Permissions */ |
1348 | - if($use_udperms == 1) { |
|
1348 | + if ($use_udperms == 1) { |
|
1349 | 1349 | $groupsarray = array(); |
1350 | 1350 | $sql = ''; |
1351 | 1351 | |
1352 | 1352 | $documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
1353 | - if($documentId > 0) { |
|
1353 | + if ($documentId > 0) { |
|
1354 | 1354 | // Load up, the permissions from the parent (if new document) or existing document |
1355 | 1355 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1356 | + while ($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id']; |
|
1357 | 1357 | |
1358 | 1358 | // Load up the current permissions and names |
1359 | 1359 | $vs = array( |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | // retain selected doc groups between post |
1372 | - if(isset($_POST['docgroups'])) { |
|
1372 | + if (isset($_POST['docgroups'])) { |
|
1373 | 1373 | $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
1374 | 1374 | } |
1375 | 1375 | |
@@ -1388,26 +1388,26 @@ discard block |
||
1388 | 1388 | $permissions_no = 0; // count permissions the current mgr user doesn't have |
1389 | 1389 | |
1390 | 1390 | // Loop through the permissions list |
1391 | - while($row = $modx->db->getRow($rs)) { |
|
1391 | + while ($row = $modx->db->getRow($rs)) { |
|
1392 | 1392 | |
1393 | 1393 | // Create an inputValue pair (group ID and group link (if it exists)) |
1394 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | - $inputId = 'group-' . $row['id']; |
|
1394 | + $inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new'); |
|
1395 | + $inputId = 'group-'.$row['id']; |
|
1396 | 1396 | |
1397 | 1397 | $checked = in_array($inputValue, $groupsarray); |
1398 | - if($checked) { |
|
1398 | + if ($checked) { |
|
1399 | 1399 | $notPublic = true; |
1400 | 1400 | } // Mark as private access (either web or manager) |
1401 | 1401 | |
1402 | 1402 | // Skip the access permission if the user doesn't have access... |
1403 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1403 | + if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1404 | 1404 | continue; |
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | // Setup attributes for this Input box |
1408 | 1408 | $inputAttributes['id'] = $inputId; |
1409 | 1409 | $inputAttributes['value'] = $inputValue; |
1410 | - if($checked) { |
|
1410 | + if ($checked) { |
|
1411 | 1411 | $inputAttributes['checked'] = 'checked'; |
1412 | 1412 | } else { |
1413 | 1413 | unset($inputAttributes['checked']); |
@@ -1415,10 +1415,10 @@ discard block |
||
1415 | 1415 | |
1416 | 1416 | // Create attribute string list |
1417 | 1417 | $inputString = array(); |
1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1418 | + foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"'; |
|
1419 | 1419 | |
1420 | 1420 | // Make the <input> HTML |
1421 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1421 | + $inputHTML = '<input '.implode(' ', $inputString).' />'; |
|
1422 | 1422 | |
1423 | 1423 | // does user have this permission? |
1424 | 1424 | $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
@@ -1429,23 +1429,23 @@ discard block |
||
1429 | 1429 | $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
1430 | 1430 | $rsp = $modx->db->select('COUNT(mg.id)', $from, $where); |
1431 | 1431 | $count = $modx->db->getValue($rsp); |
1432 | - if($count > 0) { |
|
1432 | + if ($count > 0) { |
|
1433 | 1433 | ++$permissions_yes; |
1434 | 1434 | } else { |
1435 | 1435 | ++$permissions_no; |
1436 | 1436 | } |
1437 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1437 | + $permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>'; |
|
1438 | 1438 | } |
1439 | 1439 | // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
1440 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1440 | + if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1441 | 1441 | $permissions = array(); |
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | // See if the Access Permissions section is worth displaying... |
1445 | - if(!empty($permissions)) { |
|
1445 | + if (!empty($permissions)) { |
|
1446 | 1446 | // Add the "All Document Groups" item if we have rights in both contexts |
1447 | - if($isManager && $isWeb) { |
|
1448 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1447 | + if ($isManager && $isWeb) { |
|
1448 | + array_unshift($permissions, "\t\t".'<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true);" /><label for="groupall" class="warning">'.$_lang['all_doc_groups'].'</label></li>'); |
|
1449 | 1449 | } |
1450 | 1450 | // Output the permissions list... |
1451 | 1451 | ?> |
@@ -1478,12 +1478,12 @@ discard block |
||
1478 | 1478 | </script> |
1479 | 1479 | <p><?= $_lang['access_permissions_docs_message'] ?></p> |
1480 | 1480 | <ul> |
1481 | - <?= implode("\n", $permissions) . "\n" ?> |
|
1481 | + <?= implode("\n", $permissions)."\n" ?> |
|
1482 | 1482 | </ul> |
1483 | 1483 | </div><!--div class="tab-page" id="tabAccess"--> |
1484 | 1484 | <?php |
1485 | 1485 | } // !empty($permissions) |
1486 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1486 | + elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1487 | 1487 | ?> |
1488 | 1488 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1489 | 1489 | <?php |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | 'template' => $content['template'] |
1504 | 1504 | )); |
1505 | 1505 | |
1506 | - if(is_array($evtOut)) { |
|
1506 | + if (is_array($evtOut)) { |
|
1507 | 1507 | echo implode('', $evtOut); |
1508 | 1508 | } |
1509 | 1509 | ?> |
@@ -1516,16 +1516,16 @@ discard block |
||
1516 | 1516 | storeCurTemplate(); |
1517 | 1517 | </script> |
1518 | 1518 | <?php |
1519 | -if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
1520 | - if(is_array($richtexteditorIds)) { |
|
1521 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1519 | +if (($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) { |
|
1520 | + if (is_array($richtexteditorIds)) { |
|
1521 | + foreach ($richtexteditorIds as $editor => $elements) { |
|
1522 | 1522 | // invoke OnRichTextEditorInit event |
1523 | 1523 | $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
1524 | 1524 | 'editor' => $editor, |
1525 | 1525 | 'elements' => $elements, |
1526 | 1526 | 'options' => $richtexteditorOptions[$editor] |
1527 | 1527 | )); |
1528 | - if(is_array($evtOut)) { |
|
1528 | + if (is_array($evtOut)) { |
|
1529 | 1529 | echo implode('', $evtOut); |
1530 | 1530 | } |
1531 | 1531 | } |
@@ -1535,37 +1535,37 @@ discard block |
||
1535 | 1535 | /** |
1536 | 1536 | * @return string |
1537 | 1537 | */ |
1538 | -function getDefaultTemplate() { |
|
1538 | +function getDefaultTemplate(){ |
|
1539 | 1539 | global $modx; |
1540 | 1540 | |
1541 | 1541 | $default_template = ''; |
1542 | - switch($modx->config['auto_template_logic']) { |
|
1542 | + switch ($modx->config['auto_template_logic']) { |
|
1543 | 1543 | case 'sibling': |
1544 | - if(!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1544 | + if (!isset($_GET['pid']) || empty($_GET['pid'])) { |
|
1545 | 1545 | $site_start = $modx->config['site_start']; |
1546 | 1546 | $where = "sc.isfolder=0 AND sc.id!='{$site_start}'"; |
1547 | 1547 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1); |
1548 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1548 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1549 | 1549 | $default_template = $sibl[0]['template']; |
1550 | 1550 | } |
1551 | 1551 | } else { |
1552 | 1552 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
1553 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1553 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1554 | 1554 | $default_template = $sibl[0]['template']; |
1555 | 1555 | } else { |
1556 | 1556 | $sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1); |
1557 | - if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1557 | + if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') { |
|
1558 | 1558 | $default_template = $sibl[0]['template']; |
1559 | 1559 | } |
1560 | 1560 | } |
1561 | 1561 | } |
1562 | - if(isset($default_template)) { |
|
1562 | + if (isset($default_template)) { |
|
1563 | 1563 | break; |
1564 | 1564 | } // If $default_template could not be determined, fall back / through to "parent"-mode |
1565 | 1565 | case 'parent': |
1566 | - if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1566 | + if (isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) { |
|
1567 | 1567 | $parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template'); |
1568 | - if(isset($parent['template'])) { |
|
1568 | + if (isset($parent['template'])) { |
|
1569 | 1569 | $default_template = $parent['template']; |
1570 | 1570 | } |
1571 | 1571 | } |
@@ -478,7 +478,8 @@ discard block |
||
478 | 478 | return s; |
479 | 479 | } |
480 | 480 | |
481 | - <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
481 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
482 | +// Web Link specific ?> |
|
482 | 483 | var lastImageCtrl; |
483 | 484 | var lastFileCtrl; |
484 | 485 | |
@@ -694,7 +695,8 @@ discard block |
||
694 | 695 | </td> |
695 | 696 | </tr> |
696 | 697 | |
697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
698 | + <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
699 | +// Web Link specific ?> |
|
698 | 700 | |
699 | 701 | <tr> |
700 | 702 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -1353,7 +1355,9 @@ discard block |
||
1353 | 1355 | if($documentId > 0) { |
1354 | 1356 | // Load up, the permissions from the parent (if new document) or existing document |
1355 | 1357 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1358 | + while($currentgroup = $modx->db->getRow($rs)) { |
|
1359 | + $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1360 | + } |
|
1357 | 1361 | |
1358 | 1362 | // Load up the current permissions and names |
1359 | 1363 | $vs = array( |
@@ -1415,7 +1419,9 @@ discard block |
||
1415 | 1419 | |
1416 | 1420 | // Create attribute string list |
1417 | 1421 | $inputString = array(); |
1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1422 | + foreach($inputAttributes as $k => $v) { |
|
1423 | + $inputString[] = $k . '="' . $v . '"'; |
|
1424 | + } |
|
1419 | 1425 | |
1420 | 1426 | // Make the <input> HTML |
1421 | 1427 | $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
@@ -1535,7 +1541,8 @@ discard block |
||
1535 | 1541 | /** |
1536 | 1542 | * @return string |
1537 | 1543 | */ |
1538 | -function getDefaultTemplate() { |
|
1544 | +function getDefaultTemplate() |
|
1545 | +{ |
|
1539 | 1546 | global $modx; |
1540 | 1547 | |
1541 | 1548 | $default_template = ''; |
@@ -4,18 +4,18 @@ discard block |
||
4 | 4 | } |
5 | 5 | $logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">'; |
6 | 6 | $downloadLinks = array( |
7 | - 0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'), |
|
8 | - 1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | - 2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | - 3=>array('title'=>$_lang["extras"],'link'=>array( |
|
11 | - 'http://extras.evolution-cms.com/', |
|
12 | - 'https://github.com/extras-evolution' |
|
13 | - )), |
|
7 | + 0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'), |
|
8 | + 1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | + 2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | + 3=>array('title'=>$_lang["extras"],'link'=>array( |
|
11 | + 'http://extras.evolution-cms.com/', |
|
12 | + 'https://github.com/extras-evolution' |
|
13 | + )), |
|
14 | 14 | ); |
15 | 15 | |
16 | 16 | $translationLinks = array( |
17 | - 0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | - 1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
17 | + 0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | + 1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 | /** |
@@ -24,23 +24,23 @@ discard block |
||
24 | 24 | * @return string |
25 | 25 | */ |
26 | 26 | function createList($sectionHeader, $linkArr) { |
27 | - $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
|
28 | - $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
|
29 | - $links = ''; |
|
30 | - foreach($linkArr as $row) { |
|
31 | - if (!is_array($row['link'])) $row['link'] = array($row['link']); |
|
32 | - foreach ($row['link'] as $link) { |
|
33 | - $links .= $links != '' ? '<br/>' : ''; |
|
34 | - $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
|
35 | - } |
|
36 | - $output .= ' |
|
27 | + $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
|
28 | + $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
|
29 | + $links = ''; |
|
30 | + foreach($linkArr as $row) { |
|
31 | + if (!is_array($row['link'])) $row['link'] = array($row['link']); |
|
32 | + foreach ($row['link'] as $link) { |
|
33 | + $links .= $links != '' ? '<br/>' : ''; |
|
34 | + $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
|
35 | + } |
|
36 | + $output .= ' |
|
37 | 37 | <tr> |
38 | 38 | <td align="left"><strong>' . $row["title"] . '</strong></td> |
39 | 39 | <td align="left">' . $links . '</td> |
40 | 40 | </tr>'; |
41 | - $links = ''; |
|
42 | - } |
|
43 | - $output .= '</table></div>'."\n"; |
|
41 | + $links = ''; |
|
42 | + } |
|
43 | + $output .= '</table></div>'."\n"; |
|
44 | 44 | return $output; |
45 | 45 | } |
46 | 46 | echo $logo; |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
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 | -$logo= '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">'; |
|
5 | +$logo = '<img src="media/style/default/images/misc/login-logo.png" height="54" width="358" border="0">'; |
|
6 | 6 | $downloadLinks = array( |
7 | - 0=>array('title'=>$_lang["information"],'link'=>'https://evo.im/'), |
|
8 | - 1=>array('title'=>$_lang["download"],'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | - 2=>array('title'=>$_lang["previous_releases"],'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | - 3=>array('title'=>$_lang["extras"],'link'=>array( |
|
7 | + 0=>array('title'=>$_lang["information"], 'link'=>'https://evo.im/'), |
|
8 | + 1=>array('title'=>$_lang["download"], 'link'=>'https://github.com/evolution-cms/evolution/releases'), |
|
9 | + 2=>array('title'=>$_lang["previous_releases"], 'link'=>'https://modx.com/download/evolution/previous-releases.html'), |
|
10 | + 3=>array('title'=>$_lang["extras"], 'link'=>array( |
|
11 | 11 | 'http://extras.evolution-cms.com/', |
12 | 12 | 'https://github.com/extras-evolution' |
13 | 13 | )), |
14 | 14 | ); |
15 | 15 | |
16 | 16 | $translationLinks = array( |
17 | - 0=>array('title'=>'Evolution CMS','link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | - 1=>array('title'=>$_lang["extras"],'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
17 | + 0=>array('title'=>'Evolution CMS', 'link'=>'https://www.transifex.com/evolutioncms/evolution/'), |
|
18 | + 1=>array('title'=>$_lang["extras"], 'link'=>'https://www.transifex.com/evolutioncms/extras/'), |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 | /** |
@@ -23,20 +23,20 @@ discard block |
||
23 | 23 | * @param array $linkArr |
24 | 24 | * @return string |
25 | 25 | */ |
26 | -function createList($sectionHeader, $linkArr) { |
|
26 | +function createList($sectionHeader, $linkArr){ |
|
27 | 27 | $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
28 | 28 | $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
29 | 29 | $links = ''; |
30 | - foreach($linkArr as $row) { |
|
30 | + foreach ($linkArr as $row) { |
|
31 | 31 | if (!is_array($row['link'])) $row['link'] = array($row['link']); |
32 | 32 | foreach ($row['link'] as $link) { |
33 | 33 | $links .= $links != '' ? '<br/>' : ''; |
34 | - $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
|
34 | + $links .= '<a href="'.$link.'" target="_blank">'.$link.'</a>'; |
|
35 | 35 | } |
36 | 36 | $output .= ' |
37 | 37 | <tr> |
38 | - <td align="left"><strong>' . $row["title"] . '</strong></td> |
|
39 | - <td align="left">' . $links . '</td> |
|
38 | + <td align="left"><strong>' . $row["title"].'</strong></td> |
|
39 | + <td align="left">' . $links.'</td> |
|
40 | 40 | </tr>'; |
41 | 41 | $links = ''; |
42 | 42 | } |
@@ -23,12 +23,15 @@ |
||
23 | 23 | * @param array $linkArr |
24 | 24 | * @return string |
25 | 25 | */ |
26 | -function createList($sectionHeader, $linkArr) { |
|
26 | +function createList($sectionHeader, $linkArr) |
|
27 | +{ |
|
27 | 28 | $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
28 | 29 | $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
29 | 30 | $links = ''; |
30 | 31 | foreach($linkArr as $row) { |
31 | - if (!is_array($row['link'])) $row['link'] = array($row['link']); |
|
32 | + if (!is_array($row['link'])) { |
|
33 | + $row['link'] = array($row['link']); |
|
34 | + } |
|
32 | 35 | foreach ($row['link'] as $link) { |
33 | 36 | $links .= $links != '' ? '<br/>' : ''; |
34 | 37 | $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | die('Please use the MODx Backend.'); |
8 | 8 | } |
9 | 9 | |
10 | -require_once realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Categories.php'; |
|
10 | +require_once realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'Categories.php'; |
|
11 | 11 | |
12 | 12 | class Module_Categories_Manager extends Categories |
13 | 13 | { |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | { |
95 | 95 | global $_lang, $_style; |
96 | 96 | |
97 | - $filename = trim($view_name) . '.tpl.phtml'; |
|
98 | - $file = self::get('views_dir') . $filename; |
|
97 | + $filename = trim($view_name).'.tpl.phtml'; |
|
98 | + $file = self::get('views_dir').$filename; |
|
99 | 99 | $view = &$this; |
100 | 100 | |
101 | 101 | if (is_file($file) |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | { |
121 | 121 | |
122 | 122 | $_update = array( |
123 | - 'id' => (int)$element_id, |
|
124 | - 'category' => (int)$category_id |
|
123 | + 'id' => (int) $element_id, |
|
124 | + 'category' => (int) $category_id |
|
125 | 125 | ); |
126 | 126 | |
127 | 127 | $this->db->update( |
128 | 128 | $_update, |
129 | 129 | $this->db_tbl[$element], |
130 | - "`id` = '" . (int)$element_id . "'" |
|
130 | + "`id` = '".(int) $element_id."'" |
|
131 | 131 | ); |
132 | 132 | |
133 | 133 | return $this->db->getAffectedRows() === 1; |