@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!function_exists('makeHTML')) { |
|
3 | +if (!function_exists('makeHTML')) { |
|
4 | 4 | /** |
5 | 5 | * @param int $indent |
6 | 6 | * @param int $parent |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | case 'publishedon': |
38 | 38 | case 'pub_date': |
39 | 39 | case 'unpub_date': |
40 | - $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'], |
|
41 | - 'sc.' . $_SESSION['tree_sortby']); |
|
40 | + $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'], |
|
41 | + 'sc.'.$_SESSION['tree_sortby']); |
|
42 | 42 | break; |
43 | 43 | default: |
44 | - $sortby = 'sc.' . $_SESSION['tree_sortby']; |
|
44 | + $sortby = 'sc.'.$_SESSION['tree_sortby']; |
|
45 | 45 | }; |
46 | 46 | |
47 | - $orderby = $modx->getDatabase()->escape($sortby . ' ' . $_SESSION['tree_sortdir']); |
|
47 | + $orderby = $modx->getDatabase()->escape($sortby.' '.$_SESSION['tree_sortdir']); |
|
48 | 48 | |
49 | 49 | // Folder sorting gets special setup ;) Add menuindex and pagetitle |
50 | 50 | if ($_SESSION['tree_sortby'] == 'isfolder') { |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | $_SESSION['mgrDocgroups']) : ''; |
60 | 60 | $showProtected = false; |
61 | 61 | if (isset ($modx->config['tree_show_protected'])) { |
62 | - $showProtected = (boolean)$modx->config['tree_show_protected']; |
|
62 | + $showProtected = (boolean) $modx->config['tree_show_protected']; |
|
63 | 63 | } |
64 | - $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
64 | + $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
65 | 65 | if ($showProtected == false) { |
66 | - $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
66 | + $access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
67 | 67 | } else { |
68 | 68 | $access = ''; |
69 | 69 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | $weblinkDisplay = $row['type'] == 'reference' ? sprintf(' %s', $_style['tree_linkgo']) : ''; |
103 | - $pageIdDisplay = '<small>(' . ($modx_textdir ? '‏' : '') . $row['id'] . ')</small>'; |
|
103 | + $pageIdDisplay = '<small>('.($modx_textdir ? '‏' : '').$row['id'].')</small>'; |
|
104 | 104 | |
105 | 105 | // Prepare displaying user-locks |
106 | 106 | $lockedByUser = ''; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'element_type' => $_lang["lock_element_type_7"], |
112 | 112 | 'lasthit_df' => $rowLock['lasthit_df'] |
113 | 113 | )); |
114 | - $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>'; |
|
114 | + $lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>'; |
|
115 | 115 | } else { |
116 | 116 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
117 | 117 | 'element_type' => $_lang["lock_element_type_7"], |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | 'lasthit_df' => $rowLock['lasthit_df'] |
120 | 120 | )); |
121 | 121 | if ($modx->hasPermission('remove_locks')) { |
122 | - $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
122 | + $lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
123 | 123 | } else { |
124 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
124 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
@@ -130,22 +130,22 @@ discard block |
||
130 | 130 | |
131 | 131 | $title = ''; |
132 | 132 | if (isDateNode($nodeNameSource)) { |
133 | - $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]'; |
|
133 | + $title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]'; |
|
134 | 134 | } |
135 | - $title .= $_lang['id'] . ': ' . $row['id']; |
|
136 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle']; |
|
137 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex']; |
|
138 | - $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-'); |
|
139 | - $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename']; |
|
140 | - $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']); |
|
141 | - $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']); |
|
142 | - $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
143 | - $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
144 | - $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
145 | - $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
146 | - $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
135 | + $title .= $_lang['id'].': '.$row['id']; |
|
136 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle']; |
|
137 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex']; |
|
138 | + $title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-'); |
|
139 | + $title .= '[+lf+]'.$_lang['template'].': '.$row['templatename']; |
|
140 | + $title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']); |
|
141 | + $title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']); |
|
142 | + $title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
143 | + $title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
144 | + $title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
145 | + $title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
146 | + $title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
147 | 147 | $title = $modx->getPhpCompat()->htmlspecialchars($title); |
148 | - $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
148 | + $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
149 | 149 | |
150 | 150 | $data = array( |
151 | 151 | 'id' => $row['id'], |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | if ($ph['contextmenu']) { |
232 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
232 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | if ($_SESSION['tree_show_only_folders']) { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | } |
288 | 288 | |
289 | 289 | if ($ph['contextmenu']) { |
290 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
290 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | $node .= $modx->parseText($tpl, $ph); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | if ($ph['contextmenu']) { |
328 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
328 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | $node .= $modx->parseText($tpl, $ph); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | if ($ph['contextmenu']) { |
379 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
379 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | $node .= $modx->parseText($tpl, $ph); |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | } |
419 | 419 | |
420 | 420 | if ($ph['contextmenu']) { |
421 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
421 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | $node .= $modx->parseText($tpl, $ph); |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | } |
445 | 445 | } |
446 | 446 | |
447 | -if(!function_exists('getIconInfo')) { |
|
447 | +if (!function_exists('getIconInfo')) { |
|
448 | 448 | /** |
449 | 449 | * @param array $_style |
450 | 450 | * @return array |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | } |
479 | 479 | } |
480 | 480 | |
481 | -if(!function_exists('getNodeTitle')) { |
|
481 | +if (!function_exists('getNodeTitle')) { |
|
482 | 482 | /** |
483 | 483 | * @param string $nodeNameSource |
484 | 484 | * @param array $row |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | $nodetitle .= $modx->config['friendly_url_suffix']; |
500 | 500 | } |
501 | 501 | } |
502 | - $nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle; |
|
502 | + $nodetitle = $modx->config['friendly_url_prefix'].$nodetitle; |
|
503 | 503 | break; |
504 | 504 | case 'pagetitle': |
505 | 505 | $nodetitle = $row['pagetitle']; |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
536 | -if(!function_exists('isDateNode')) { |
|
536 | +if (!function_exists('isDateNode')) { |
|
537 | 537 | /** |
538 | 538 | * @param string $nodeNameSource |
539 | 539 | * @return bool |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | } |
554 | 554 | } |
555 | 555 | |
556 | -if(!function_exists('checkIsFolder')) { |
|
556 | +if (!function_exists('checkIsFolder')) { |
|
557 | 557 | /** |
558 | 558 | * @param int $parent |
559 | 559 | * @param int $isfolder |
@@ -563,11 +563,11 @@ discard block |
||
563 | 563 | { |
564 | 564 | $modx = evolutionCMS(); |
565 | 565 | |
566 | - return (int)$modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' ')); |
|
566 | + return (int) $modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM '.$modx->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' ')); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
570 | -if(!function_exists('_htmlentities')) { |
|
570 | +if (!function_exists('_htmlentities')) { |
|
571 | 571 | /** |
572 | 572 | * @param mixed $array |
573 | 573 | * @return string |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | } |
584 | 584 | } |
585 | 585 | |
586 | -if(!function_exists('getTplSingleNode')) { |
|
586 | +if (!function_exists('getTplSingleNode')) { |
|
587 | 587 | /** |
588 | 588 | * @return string |
589 | 589 | */ |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | } |
614 | 614 | } |
615 | 615 | |
616 | -if(!function_exists('getTplFolderNode')) { |
|
616 | +if (!function_exists('getTplFolderNode')) { |
|
617 | 617 | /** |
618 | 618 | * @return string |
619 | 619 | */ |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a><div>'; |
655 | 655 | } |
656 | 656 | } |
657 | -if(!function_exists('getTplFolderNodeNotChildren')) { |
|
657 | +if (!function_exists('getTplFolderNodeNotChildren')) { |
|
658 | 658 | /** |
659 | 659 | * @return string |
660 | 660 | */ |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('ProcessTVCommand')) { |
|
3 | +if (!function_exists('ProcessTVCommand')) { |
|
4 | 4 | /** |
5 | 5 | * @param string $value |
6 | 6 | * @param string $name |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | function ProcessTVCommand($value, $name = '', $docid = '', $src = 'docform', $tvsArray = array()) |
13 | 13 | { |
14 | 14 | $modx = evolutionCMS(); |
15 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
15 | + $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier; |
|
16 | 16 | $nvalue = trim($value); |
17 | 17 | if (substr($nvalue, 0, 1) != '@') { |
18 | 18 | return $value; |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | // if an inherited value is found and if there is content following the @INHERIT binding |
78 | 78 | // remove @INHERIT and output that following content. This content could contain other |
79 | 79 | // @ bindings, that are processed in the next step |
80 | - if ((string)$tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) { |
|
81 | - $output = trim(str_replace('@INHERIT', '', (string)$tv['value'])); |
|
80 | + if ((string) $tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) { |
|
81 | + $output = trim(str_replace('@INHERIT', '', (string) $tv['value'])); |
|
82 | 82 | break 2; |
83 | 83 | } |
84 | 84 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | case 'DIRECTORY' : |
88 | 88 | $files = array(); |
89 | - $path = $modx->config['base_path'] . $param; |
|
89 | + $path = $modx->config['base_path'].$param; |
|
90 | 90 | if (substr($path, -1, 1) != '/') { |
91 | 91 | $path .= '/'; |
92 | 92 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | -if (! function_exists('ProcessFile')) { |
|
120 | +if (!function_exists('ProcessFile')) { |
|
121 | 121 | /** |
122 | 122 | * @param $file |
123 | 123 | * @return string |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | -if (! function_exists('ParseCommand')) { |
|
137 | +if (!function_exists('ParseCommand')) { |
|
138 | 138 | /** |
139 | 139 | * ParseCommand - separate @ cmd from params |
140 | 140 | * |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | $binding_array = array(); |
157 | 157 | foreach ($BINDINGS as $cmd) { |
158 | - if (strpos($binding_string, '@' . $cmd) === 0) { |
|
158 | + if (strpos($binding_string, '@'.$cmd) === 0) { |
|
159 | 159 | $code = substr($binding_string, strlen($cmd) + 1); |
160 | 160 | $binding_array = array($cmd, trim($code)); |
161 | 161 | break; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | -if (! function_exists('parseTvValues')) { |
|
169 | +if (!function_exists('parseTvValues')) { |
|
170 | 170 | /** |
171 | 171 | * Parse MODX Template-Variables |
172 | 172 | * |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | -if (! function_exists('getTVDisplayFormat')) { |
|
200 | +if (!function_exists('getTVDisplayFormat')) { |
|
201 | 201 | /** |
202 | 202 | * @param string $name |
203 | 203 | * @param string $value |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $o = ''; |
216 | 216 | |
217 | 217 | // process any TV commands in value |
218 | - $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier; |
|
218 | + $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier; |
|
219 | 219 | $value = ProcessTVCommand($value, $name, $docid); |
220 | 220 | |
221 | 221 | $params = array(); |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | $attr['align'] = $params['align']; |
255 | 255 | } |
256 | 256 | foreach ($attr as $k => $v) { |
257 | - $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
257 | + $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
258 | 258 | } |
259 | - $attributes .= ' ' . $params['attrib']; |
|
259 | + $attributes .= ' '.$params['attrib']; |
|
260 | 260 | |
261 | 261 | // Output the image with attributes |
262 | - $o .= '<img' . rtrim($attributes) . ' />'; |
|
262 | + $o .= '<img'.rtrim($attributes).' />'; |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | break; |
@@ -331,12 +331,12 @@ discard block |
||
331 | 331 | 'target' => $params['target'], |
332 | 332 | ); |
333 | 333 | foreach ($attr as $k => $v) { |
334 | - $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
334 | + $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
335 | 335 | } |
336 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
336 | + $attributes .= ' '.$params['attrib']; // add extra |
|
337 | 337 | |
338 | 338 | // Output the link |
339 | - $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->getPhpCompat()->htmlspecialchars($params['text']) : $name) . '</a>'; |
|
339 | + $o .= '<a'.rtrim($attributes).'>'.($params['text'] ? $modx->getPhpCompat()->htmlspecialchars($params['text']) : $name).'</a>'; |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | break; |
@@ -362,12 +362,12 @@ discard block |
||
362 | 362 | 'style' => $params['style'], |
363 | 363 | ); |
364 | 364 | foreach ($attr as $k => $v) { |
365 | - $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : ''); |
|
365 | + $attributes .= ($v ? ' '.$k.'="'.$v.'"' : ''); |
|
366 | 366 | } |
367 | - $attributes .= ' ' . $params['attrib']; // add extra |
|
367 | + $attributes .= ' '.$params['attrib']; // add extra |
|
368 | 368 | |
369 | 369 | // Output the HTML Tag |
370 | - $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>'; |
|
370 | + $o .= '<'.$tagname.rtrim($attributes).'>'.$tagvalue.'</'.$tagname.'>'; |
|
371 | 371 | } |
372 | 372 | break; |
373 | 373 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $w = $params['w'] ? $params['w'] : '100%'; |
377 | 377 | $h = $params['h'] ? $params['h'] : '400px'; |
378 | 378 | $richtexteditor = $params['edt'] ? $params['edt'] : ""; |
379 | - $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">'; |
|
379 | + $o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">'; |
|
380 | 380 | $o .= $modx->getPhpCompat()->htmlspecialchars($value); |
381 | 381 | $o .= '</textarea></div>'; |
382 | 382 | $replace_richtext = array($id); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | case "viewport": |
405 | 405 | $value = parseInput($value); |
406 | - $id = '_' . time(); |
|
406 | + $id = '_'.time(); |
|
407 | 407 | if (!$params['vpid']) { |
408 | 408 | $params['vpid'] = $id; |
409 | 409 | } |
@@ -417,41 +417,41 @@ discard block |
||
417 | 417 | $h = "100%"; |
418 | 418 | } |
419 | 419 | if ($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) { |
420 | - $autoMode = "3"; //both |
|
420 | + $autoMode = "3"; //both |
|
421 | 421 | } else { |
422 | 422 | if ($params['awidth'] == 'Yes') { |
423 | 423 | $autoMode = "1"; //width only |
424 | 424 | } else { |
425 | 425 | if ($params['aheight'] == 'Yes') { |
426 | - $autoMode = "2"; //height only |
|
426 | + $autoMode = "2"; //height only |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
431 | - $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array( |
|
431 | + $modx->regClientStartupScript(MODX_MANAGER_URL."media/script/bin/viewport.js", array( |
|
432 | 432 | 'name' => 'viewport', |
433 | 433 | 'version' => '0', |
434 | 434 | 'plaintext' => false |
435 | 435 | )); |
436 | - $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' "; |
|
436 | + $o = $sTag." id='".$params['vpid']."' name='".$params['vpid']."' "; |
|
437 | 437 | if ($params['class']) { |
438 | - $o .= " class='" . $params['class'] . "' "; |
|
438 | + $o .= " class='".$params['class']."' "; |
|
439 | 439 | } |
440 | 440 | if ($params['style']) { |
441 | - $o .= " style='" . $params['style'] . "' "; |
|
441 | + $o .= " style='".$params['style']."' "; |
|
442 | 442 | } |
443 | 443 | if ($params['attrib']) { |
444 | - $o .= $params['attrib'] . " "; |
|
444 | + $o .= $params['attrib']." "; |
|
445 | 445 | } |
446 | - $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' "; |
|
447 | - $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' "; |
|
448 | - $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' "; |
|
446 | + $o .= "scrolling='".($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto"))."' "; |
|
447 | + $o .= "src='".$value."' frameborder='".$params['borsize']."' "; |
|
448 | + $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'".$params['vpid']."\\',".$autoMode.")',100);\" width='".$w."' height='".$h."' "; |
|
449 | 449 | $o .= ">"; |
450 | 450 | $o .= $eTag; |
451 | 451 | break; |
452 | 452 | |
453 | 453 | case "datagrid": |
454 | - include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php"; |
|
454 | + include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php"; |
|
455 | 455 | $grd = new DataGrid('', $value); |
456 | 456 | |
457 | 457 | $grd->noRecordMsg = $params['egmsg']; |
@@ -498,16 +498,16 @@ discard block |
||
498 | 498 | $o = ''; |
499 | 499 | /* If we are loading a file */ |
500 | 500 | if (substr($params['output'], 0, 5) == "@FILE") { |
501 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6)); |
|
501 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 6)); |
|
502 | 502 | if (!file_exists($file_name)) { |
503 | - $widget_output = $file_name . ' does not exist'; |
|
503 | + $widget_output = $file_name.' does not exist'; |
|
504 | 504 | } else { |
505 | 505 | $widget_output = file_get_contents($file_name); |
506 | 506 | } |
507 | 507 | } elseif (substr($params['output'], 0, 8) == '@INCLUDE') { |
508 | - $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9)); |
|
508 | + $file_name = MODX_BASE_PATH.trim(substr($params['output'], 9)); |
|
509 | 509 | if (!file_exists($file_name)) { |
510 | - $widget_output = $file_name . ' does not exist'; |
|
510 | + $widget_output = $file_name.' does not exist'; |
|
511 | 511 | } else { |
512 | 512 | /* The included file needs to set $widget_output. Can be string, array, object */ |
513 | 513 | include $file_name; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | } |
550 | 550 | } |
551 | 551 | |
552 | -if (! function_exists('decodeParamValue')) { |
|
552 | +if (!function_exists('decodeParamValue')) { |
|
553 | 553 | /** |
554 | 554 | * @param string $s |
555 | 555 | * @return string |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
565 | -if (! function_exists('parseInput')) { |
|
565 | +if (!function_exists('parseInput')) { |
|
566 | 566 | /** |
567 | 567 | * returns an array if a delimiter is present. returns array is a recordset is present |
568 | 568 | * |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | } |
595 | 595 | } |
596 | 596 | |
597 | -if (! function_exists('getUnixtimeFromDateString')) { |
|
597 | +if (!function_exists('getUnixtimeFromDateString')) { |
|
598 | 598 | /** |
599 | 599 | * @param string $value |
600 | 600 | * @return bool|false|int |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | } |
623 | 623 | } |
624 | 624 | |
625 | -if (! function_exists('renderFormElement')) { |
|
625 | +if (!function_exists('renderFormElement')) { |
|
626 | 626 | /** |
627 | 627 | * DISPLAY FORM ELEMENTS |
628 | 628 | * |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | $field_style = '', |
646 | 646 | $row = array(), |
647 | 647 | $tvsArray = array() |
648 | - ) { |
|
648 | + ){ |
|
649 | 649 | $modx = evolutionCMS(); |
650 | 650 | global $_style; |
651 | 651 | global $_lang; |
@@ -665,22 +665,22 @@ discard block |
||
665 | 665 | |
666 | 666 | case "text": // handler for regular text boxes |
667 | 667 | case "rawtext"; // non-htmlentity converted text boxes |
668 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />'; |
|
668 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" />'; |
|
669 | 669 | break; |
670 | 670 | case "email": // handles email input fields |
671 | - $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>'; |
|
671 | + $field_html .= '<input type="email" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%"/>'; |
|
672 | 672 | break; |
673 | 673 | case "number": // handles the input of numbers |
674 | - $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
674 | + $field_html .= '<input type="number" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>'; |
|
675 | 675 | break; |
676 | 676 | case "textareamini": // handler for textarea mini boxes |
677 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '</textarea>'; |
|
677 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">'.$modx->getPhpCompat()->htmlspecialchars($field_value).'</textarea>'; |
|
678 | 678 | break; |
679 | 679 | case "textarea": // handler for textarea boxes |
680 | 680 | case "rawtextarea": // non-htmlentity convertex textarea boxes |
681 | 681 | case "htmlarea": // handler for textarea boxes (deprecated) |
682 | 682 | case "richtext": // handler for textarea boxes |
683 | - $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '</textarea>'; |
|
683 | + $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">'.$modx->getPhpCompat()->htmlspecialchars($field_value).'</textarea>'; |
|
684 | 684 | break; |
685 | 685 | case "date": |
686 | 686 | $field_id = str_replace(array( |
@@ -690,12 +690,12 @@ discard block |
||
690 | 690 | if ($field_value == '') { |
691 | 691 | $field_value = 0; |
692 | 692 | } |
693 | - $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;" />'; |
|
694 | - $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>'; |
|
693 | + $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;" />'; |
|
694 | + $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>'; |
|
695 | 695 | |
696 | 696 | break; |
697 | 697 | case "dropdown": // handler for select boxes |
698 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">'; |
|
698 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">'; |
|
699 | 699 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', |
700 | 700 | $tvsArray)); |
701 | 701 | while (list($item, $itemvalue) = each($index_list)) { |
@@ -703,12 +703,12 @@ discard block |
||
703 | 703 | if (strlen($itemvalue) == 0) { |
704 | 704 | $itemvalue = $item; |
705 | 705 | } |
706 | - $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>'; |
|
706 | + $field_html .= '<option value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($item).'</option>'; |
|
707 | 707 | } |
708 | 708 | $field_html .= "</select>"; |
709 | 709 | break; |
710 | 710 | case "listbox": // handler for select boxes |
711 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">'; |
|
711 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">'; |
|
712 | 712 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', |
713 | 713 | $tvsArray)); |
714 | 714 | while (list($item, $itemvalue) = each($index_list)) { |
@@ -716,13 +716,13 @@ discard block |
||
716 | 716 | if (strlen($itemvalue) == 0) { |
717 | 717 | $itemvalue = $item; |
718 | 718 | } |
719 | - $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>'; |
|
719 | + $field_html .= '<option value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($item).'</option>'; |
|
720 | 720 | } |
721 | 721 | $field_html .= "</select>"; |
722 | 722 | break; |
723 | 723 | case "listbox-multiple": // handler for select boxes where you can choose multiple items |
724 | 724 | $field_value = explode("||", $field_value); |
725 | - $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
725 | + $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">'; |
|
726 | 726 | $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', |
727 | 727 | $tvsArray)); |
728 | 728 | while (list($item, $itemvalue) = each($index_list)) { |
@@ -730,8 +730,8 @@ discard block |
||
730 | 730 | if (strlen($itemvalue) == 0) { |
731 | 731 | $itemvalue = $item; |
732 | 732 | } |
733 | - $field_html .= '<option value="' . $modx->getPhpCompat()->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, |
|
734 | - $field_value) ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($item) . '</option>'; |
|
733 | + $field_html .= '<option value="'.$modx->getPhpCompat()->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue, |
|
734 | + $field_value) ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($item).'</option>'; |
|
735 | 735 | } |
736 | 736 | $field_html .= "</select>"; |
737 | 737 | break; |
@@ -743,17 +743,17 @@ discard block |
||
743 | 743 | 'ftp://' => 'ftp://', |
744 | 744 | 'mailto:' => 'mailto:' |
745 | 745 | ); |
746 | - $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;">'; |
|
746 | + $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;">'; |
|
747 | 747 | foreach ($urls as $k => $v) { |
748 | 748 | if (strpos($field_value, $v) === false) { |
749 | - $field_html .= '<option value="' . $v . '">' . $k . '</option>'; |
|
749 | + $field_html .= '<option value="'.$v.'">'.$k.'</option>'; |
|
750 | 750 | } else { |
751 | 751 | $field_value = str_replace($v, '', $field_value); |
752 | - $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>'; |
|
752 | + $field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>'; |
|
753 | 753 | } |
754 | 754 | } |
755 | 755 | $field_html .= '</select></td><td>'; |
756 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>'; |
|
756 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;" /></td></tr></table>'; |
|
757 | 757 | break; |
758 | 758 | case 'checkbox': // handles check boxes |
759 | 759 | $values = !is_array($field_value) ? explode('||', $field_value) : $field_value; |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | if (strlen($itemvalue) == 0) { |
796 | 796 | $itemvalue = $item; |
797 | 797 | } |
798 | - $field_html .= '<input type="radio" value="' . $modx->getPhpCompat()->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 />'; |
|
798 | + $field_html .= '<input type="radio" value="'.$modx->getPhpCompat()->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 />'; |
|
799 | 799 | $i++; |
800 | 800 | } |
801 | 801 | break; |
@@ -825,13 +825,13 @@ discard block |
||
825 | 825 | lastImageCtrl = ctrl; |
826 | 826 | var w = screen.width * 0.5; |
827 | 827 | var h = screen.height * 0.5; |
828 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
828 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
829 | 829 | } |
830 | 830 | function BrowseFileServer(ctrl) { |
831 | 831 | lastFileCtrl = ctrl; |
832 | 832 | var w = screen.width * 0.5; |
833 | 833 | var h = screen.height * 0.5; |
834 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
834 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
835 | 835 | } |
836 | 836 | function SetUrlChange(el) { |
837 | 837 | if ('createEvent' in document) { |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | </script>"; |
866 | 866 | $ResourceManagerLoaded = true; |
867 | 867 | } |
868 | - $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 . '\')" />'; |
|
868 | + $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.'\')" />'; |
|
869 | 869 | break; |
870 | 870 | case "file": // handles the input of file uploads |
871 | 871 | /* Modified by Timon for use with resource browser */ |
@@ -895,13 +895,13 @@ discard block |
||
895 | 895 | lastImageCtrl = ctrl; |
896 | 896 | var w = screen.width * 0.5; |
897 | 897 | var h = screen.height * 0.5; |
898 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
898 | + OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h); |
|
899 | 899 | } |
900 | 900 | function BrowseFileServer(ctrl) { |
901 | 901 | lastFileCtrl = ctrl; |
902 | 902 | var w = screen.width * 0.5; |
903 | 903 | var h = screen.height * 0.5; |
904 | - OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
904 | + OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h); |
|
905 | 905 | } |
906 | 906 | function SetUrlChange(el) { |
907 | 907 | if ('createEvent' in document) { |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | </script>"; |
936 | 936 | $ResourceManagerLoaded = true; |
937 | 937 | } |
938 | - $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 . '\')" />'; |
|
938 | + $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.'\')" />'; |
|
939 | 939 | |
940 | 940 | break; |
941 | 941 | |
@@ -943,16 +943,16 @@ discard block |
||
943 | 943 | $custom_output = ''; |
944 | 944 | /* If we are loading a file */ |
945 | 945 | if (substr($field_elements, 0, 5) == "@FILE") { |
946 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6)); |
|
946 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 6)); |
|
947 | 947 | if (!file_exists($file_name)) { |
948 | - $custom_output = $file_name . ' does not exist'; |
|
948 | + $custom_output = $file_name.' does not exist'; |
|
949 | 949 | } else { |
950 | 950 | $custom_output = file_get_contents($file_name); |
951 | 951 | } |
952 | 952 | } elseif (substr($field_elements, 0, 8) == '@INCLUDE') { |
953 | - $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9)); |
|
953 | + $file_name = MODX_BASE_PATH.trim(substr($field_elements, 9)); |
|
954 | 954 | if (!file_exists($file_name)) { |
955 | - $custom_output = $file_name . ' does not exist'; |
|
955 | + $custom_output = $file_name.' does not exist'; |
|
956 | 956 | } else { |
957 | 957 | ob_start(); |
958 | 958 | include $file_name; |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | $chunk_name = trim(substr($field_elements, 7)); |
964 | 964 | $chunk_body = $modx->getChunk($chunk_name); |
965 | 965 | if ($chunk_body == false) { |
966 | - $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')'; |
|
966 | + $custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')'; |
|
967 | 967 | } else { |
968 | 968 | $custom_output = $chunk_body; |
969 | 969 | } |
@@ -988,15 +988,15 @@ discard block |
||
988 | 988 | break; |
989 | 989 | |
990 | 990 | default: // the default handler -- for errors, mostly |
991 | - $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->getPhpCompat()->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />'; |
|
991 | + $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->getPhpCompat()->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />'; |
|
992 | 992 | |
993 | 993 | } // end switch statement |
994 | 994 | } else { |
995 | 995 | $custom = explode(":", $field_type); |
996 | 996 | $custom_output = ''; |
997 | - $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php'; |
|
997 | + $file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php'; |
|
998 | 998 | if (!file_exists($file_name)) { |
999 | - $custom_output = $file_name . ' does not exist'; |
|
999 | + $custom_output = $file_name.' does not exist'; |
|
1000 | 1000 | } else { |
1001 | 1001 | ob_start(); |
1002 | 1002 | include $file_name; |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | } // end renderFormElement function |
1021 | 1021 | } |
1022 | 1022 | |
1023 | -if (! function_exists('ParseIntputOptions')) { |
|
1023 | +if (!function_exists('ParseIntputOptions')) { |
|
1024 | 1024 | /** |
1025 | 1025 | * @param string|array|mysqli_result $v |
1026 | 1026 | * @return array |
@@ -573,7 +573,8 @@ |
||
573 | 573 | * @return array|string |
574 | 574 | */ |
575 | 575 | function parseInput($src, $delim = "||", $type = "string", $columns = true) |
576 | - { // type can be: string, array |
|
576 | + { |
|
577 | +// type can be: string, array |
|
577 | 578 | $modx = evolutionCMS(); |
578 | 579 | if ($modx->getDatabase()->isResult($src)) { |
579 | 580 | // must be a recordset |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $modx->setPlaceholder($rvKey, $rvValue); |
52 | 52 | } |
53 | 53 | $param = $modx->mergePlaceholderContent($param); |
54 | - $rs = $modx->getDatabase()->query("SELECT $param;"); |
|
54 | + $rs = $modx->getDatabase()->query("select $param;"); |
|
55 | 55 | $output = $rs; |
56 | 56 | break; |
57 | 57 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * @see https://github.com/theseer/Autoload |
4 | 4 | */ |
5 | 5 | spl_autoload_register( |
6 | - function($class) { |
|
6 | + function($class){ |
|
7 | 7 | static $classes = null; |
8 | 8 | if ($classes === null) { |
9 | 9 | $classes = array( |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | $cn = strtolower($class); |
68 | 68 | if (isset($classes[$cn])) { |
69 | - require __DIR__ . $classes[$cn]; |
|
69 | + require __DIR__.$classes[$cn]; |
|
70 | 70 | } |
71 | 71 | }, |
72 | 72 | true, |
@@ -3,7 +3,7 @@ |
||
3 | 3 | * @see https://github.com/theseer/Autoload |
4 | 4 | */ |
5 | 5 | spl_autoload_register( |
6 | - function($class) { |
|
6 | + function($class){ |
|
7 | 7 | static $classes = null; |
8 | 8 | if ($classes === null) { |
9 | 9 | $classes = array( |
@@ -4,15 +4,15 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_messages'), |
7 | - "recipient=" . $modx->getLoginUserID() . " AND messageread=0"); |
|
7 | + "recipient=".$modx->getLoginUserID()." AND messageread=0"); |
|
8 | 8 | $nrnewmessages = $modx->getDatabase()->getValue($rs); |
9 | -$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID()); |
|
9 | +$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID()); |
|
10 | 10 | $nrtotalmessages = $modx->getDatabase()->getValue($rs); |
11 | 11 | $messagesallowed = $modx->hasPermission('messages'); |
12 | 12 | |
13 | 13 | // ajax response |
14 | 14 | if (isset($_POST['updateMsgCount'])) { |
15 | 15 | header("Content-Type: application/json; charset=utf-8"); |
16 | - print $nrnewmessages . ',' . $nrtotalmessages; |
|
16 | + print $nrnewmessages.','.$nrtotalmessages; |
|
17 | 17 | exit; |
18 | 18 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $modx = evolutionCMS(); |
27 | 27 | $modx->getDatabase()->connect(); |
28 | 28 | startCMSSession(); |
29 | -if(!isset($_SESSION['mgrValidated'])) { |
|
29 | +if (!isset($_SESSION['mgrValidated'])) { |
|
30 | 30 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
31 | 31 | } |
32 | 32 | define('IN_MANAGER_MODE', true); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $manager_language = $modx->config['manager_language']; |
36 | 36 | // Pass language code from MODX to KCFinder |
37 | -if(!file_exists("../../../includes/lang/".$manager_language.".inc.php")) { |
|
37 | +if (!file_exists("../../../includes/lang/".$manager_language.".inc.php")) { |
|
38 | 38 | $manager_language = "english"; // if not set, get the english language file. |
39 | 39 | } |
40 | 40 | include_once "../../../includes/lang/".$manager_language.".inc.php"; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | // PHP VERSION CHECK |
44 | 44 | if (substr(PHP_VERSION, 0, strpos(PHP_VERSION, '.')) < 5) |
45 | - die("You are using PHP " . PHP_VERSION . " when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution."); |
|
45 | + die("You are using PHP ".PHP_VERSION." when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution."); |
|
46 | 46 | |
47 | 47 | |
48 | 48 | // SAFE MODE CHECK |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | |
53 | 53 | // MAGIC AUTOLOAD CLASSES FUNCTION |
54 | -function autoloadda9d06472ccb71b84928677ce2a6ca89($class) { |
|
54 | +function autoloadda9d06472ccb71b84928677ce2a6ca89($class){ |
|
55 | 55 | static $classes = null; |
56 | 56 | if ($classes === null) { |
57 | 57 | $classes = array( |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ); |
76 | 76 | } |
77 | 77 | if (isset($classes[$class])) { |
78 | - require dirname(__FILE__) . $classes[$class]; |
|
78 | + require dirname(__FILE__).$classes[$class]; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | spl_autoload_register('autoloadda9d06472ccb71b84928677ce2a6ca89', true); |
@@ -84,18 +84,18 @@ discard block |
||
84 | 84 | // json_encode() IMPLEMENTATION IF JSON EXTENSION IS MISSING |
85 | 85 | if (!function_exists("json_encode")) { |
86 | 86 | |
87 | - function kcfinder_json_string_encode($string) { |
|
88 | - return '"' . |
|
87 | + function kcfinder_json_string_encode($string){ |
|
88 | + return '"'. |
|
89 | 89 | str_replace('/', "\\/", |
90 | 90 | str_replace("\t", "\\t", |
91 | 91 | str_replace("\r", "\\r", |
92 | 92 | str_replace("\n", "\\n", |
93 | 93 | str_replace('"', "\\\"", |
94 | 94 | str_replace("\\", "\\\\", |
95 | - $string)))))) . '"'; |
|
95 | + $string)))))).'"'; |
|
96 | 96 | } |
97 | 97 | |
98 | - function json_encode($data) { |
|
98 | + function json_encode($data){ |
|
99 | 99 | |
100 | 100 | if (is_array($data)) { |
101 | 101 | $ret = array(); |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | // OBJECT |
104 | 104 | if (array_keys($data) !== range(0, count($data) - 1)) { |
105 | 105 | foreach ($data as $key => $val) |
106 | - $ret[] = kcfinder_json_string_encode($key) . ':' . json_encode($val); |
|
107 | - return "{" . implode(",", $ret) . "}"; |
|
106 | + $ret[] = kcfinder_json_string_encode($key).':'.json_encode($val); |
|
107 | + return "{".implode(",", $ret)."}"; |
|
108 | 108 | |
109 | 109 | // ARRAY |
110 | 110 | } else { |
111 | 111 | foreach ($data as $val) |
112 | 112 | $ret[] = json_encode($val); |
113 | - return "[" . implode(",", $ret) . "]"; |
|
113 | + return "[".implode(",", $ret)."]"; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | // BOOLEAN OR NULL |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc Uploader class |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.54 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010-2014 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - */ |
|
4 | + * |
|
5 | + * @desc Uploader class |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.54 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010-2014 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class uploader { |
16 | 16 | |
@@ -18,92 +18,92 @@ discard block |
||
18 | 18 | const VERSION = "2.54"; |
19 | 19 | |
20 | 20 | /** Config session-overrided settings |
21 | - * @var array */ |
|
21 | + * @var array */ |
|
22 | 22 | protected $config = array(); |
23 | 23 | |
24 | 24 | /** Default image driver |
25 | - * @var string */ |
|
25 | + * @var string */ |
|
26 | 26 | protected $imageDriver = "gd"; |
27 | 27 | |
28 | 28 | /** Opener applocation properties |
29 | - * $opener['name'] Got from $_GET['opener']; |
|
30 | - * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
31 | - * $opener['TinyMCE'] Boolean |
|
32 | - * @var array */ |
|
29 | + * $opener['name'] Got from $_GET['opener']; |
|
30 | + * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
31 | + * $opener['TinyMCE'] Boolean |
|
32 | + * @var array */ |
|
33 | 33 | protected $opener = array(); |
34 | 34 | |
35 | 35 | /** Got from $_GET['type'] or first one $config['types'] array key, if inexistant |
36 | - * @var string */ |
|
36 | + * @var string */ |
|
37 | 37 | protected $type; |
38 | 38 | |
39 | 39 | /** Helper property. Local filesystem path to the Type Directory |
40 | - * Equivalent: $config['uploadDir'] . "/" . $type |
|
41 | - * @var string */ |
|
40 | + * Equivalent: $config['uploadDir'] . "/" . $type |
|
41 | + * @var string */ |
|
42 | 42 | protected $typeDir; |
43 | 43 | |
44 | 44 | /** Helper property. Web URL to the Type Directory |
45 | - * Equivalent: $config['uploadURL'] . "/" . $type |
|
46 | - * @var string */ |
|
45 | + * Equivalent: $config['uploadURL'] . "/" . $type |
|
46 | + * @var string */ |
|
47 | 47 | protected $typeURL; |
48 | 48 | |
49 | 49 | /** Linked to $config['types'] |
50 | - * @var array */ |
|
50 | + * @var array */ |
|
51 | 51 | protected $types = array(); |
52 | 52 | |
53 | 53 | /** Settings which can override default settings if exists as keys in $config['types'][$type] array |
54 | - * @var array */ |
|
54 | + * @var array */ |
|
55 | 55 | protected $typeSettings = array('disabled', 'theme', 'dirPerms', 'filePerms', 'denyZipDownload', 'maxImageWidth', 'maxImageHeight', 'thumbWidth', 'thumbHeight', 'jpegQuality', 'access', 'filenameChangeChars', 'dirnameChangeChars', 'denyExtensionRename', 'deniedExts', 'watermark'); |
56 | 56 | |
57 | 57 | /** Got from language file |
58 | - * @var string */ |
|
58 | + * @var string */ |
|
59 | 59 | protected $charset; |
60 | 60 | |
61 | 61 | /** The language got from $_GET['lng'] or $_GET['lang'] or... Please see next property |
62 | - * @var string */ |
|
62 | + * @var string */ |
|
63 | 63 | protected $lang = 'en'; |
64 | 64 | |
65 | 65 | /** Possible language $_GET keys |
66 | - * @var array */ |
|
66 | + * @var array */ |
|
67 | 67 | protected $langInputNames = array('lang', 'langCode', 'lng', 'language', 'lang_code'); |
68 | 68 | |
69 | 69 | /** Uploaded file(s) info. Linked to first $_FILES element |
70 | - * @var array */ |
|
70 | + * @var array */ |
|
71 | 71 | protected $file; |
72 | 72 | |
73 | 73 | /** Next three properties are got from the current language file |
74 | - * @var string */ |
|
74 | + * @var string */ |
|
75 | 75 | protected $dateTimeFull; // Currently not used |
76 | 76 | protected $dateTimeMid; // Currently not used |
77 | 77 | protected $dateTimeSmall; |
78 | 78 | |
79 | 79 | /** Contain Specified language labels |
80 | - * @var array */ |
|
80 | + * @var array */ |
|
81 | 81 | protected $labels = array(); |
82 | 82 | |
83 | 83 | /** Contain unprocessed $_GET array. Please use this instead of $_GET |
84 | - * @var array */ |
|
84 | + * @var array */ |
|
85 | 85 | protected $get; |
86 | 86 | |
87 | 87 | /** Contain unprocessed $_POST array. Please use this instead of $_POST |
88 | - * @var array */ |
|
88 | + * @var array */ |
|
89 | 89 | protected $post; |
90 | 90 | |
91 | 91 | /** Contain unprocessed $_COOKIE array. Please use this instead of $_COOKIE |
92 | - * @var array */ |
|
92 | + * @var array */ |
|
93 | 93 | protected $cookie; |
94 | 94 | |
95 | 95 | /** Session array. Please use this property instead of $_SESSION |
96 | - * @var array */ |
|
96 | + * @var array */ |
|
97 | 97 | protected $session; |
98 | 98 | |
99 | 99 | /** CMS integration attribute (got from $_GET['cms']) |
100 | - * @var string */ |
|
100 | + * @var string */ |
|
101 | 101 | protected $cms = ""; |
102 | 102 | |
103 | 103 | protected $modx = null; |
104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
105 | - * @param string $property |
|
106 | - * @return mixed */ |
|
105 | + * @param string $property |
|
106 | + * @return mixed */ |
|
107 | 107 | public function __get($property) { |
108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
109 | 109 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ) |
133 | 133 | $this->cms = $this->get['cms']; |
134 | 134 | |
135 | - // LINKING UPLOADED FILE |
|
135 | + // LINKING UPLOADED FILE |
|
136 | 136 | if (count($_FILES)) |
137 | 137 | $this->file = &$_FILES[key($_FILES)]; |
138 | 138 | |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
229 | 229 | ? path::normalize($this->config['uploadDir']) |
230 | 230 | : path::url2fullPath("/$path"); |
231 | - $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
232 | - $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
231 | + $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
232 | + $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
233 | 233 | |
234 | 234 | // SITE ROOT |
235 | 235 | } elseif ($this->config['uploadURL'] == "/") { |
@@ -365,36 +365,36 @@ discard block |
||
365 | 365 | } |
366 | 366 | |
367 | 367 | |
368 | - protected function getTransaliasSettings() { |
|
369 | - $modx = evolutionCMS(); |
|
370 | - |
|
371 | - // Cleaning uploaded filename? |
|
372 | - $setting = $modx->getDatabase()->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
373 | - if ($modx->getDatabase()->getValue($setting)>0) { |
|
374 | - // Transalias plugin active? |
|
375 | - $res = $modx->getDatabase()->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
376 | - if ($properties = $modx->getDatabase()->getValue($res)) { |
|
377 | - $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
378 | - } else { |
|
379 | - $properties = NULL; |
|
380 | - } |
|
381 | - } else { |
|
382 | - $properties = NULL; |
|
383 | - } |
|
384 | - return $properties; |
|
385 | - } |
|
386 | - |
|
387 | - |
|
388 | - protected function normalizeFilename($filename) { |
|
389 | - if ($this->getTransaliasSettings()) { |
|
390 | - $format = strrchr($filename, "."); |
|
391 | - $filename = str_replace($format, "", $filename); |
|
392 | - $filename = $this->modx->stripAlias($filename).$format; |
|
393 | - } |
|
394 | - return $filename; |
|
395 | - } |
|
396 | - |
|
397 | - protected function normalizeDirname($dirname) { |
|
368 | + protected function getTransaliasSettings() { |
|
369 | + $modx = evolutionCMS(); |
|
370 | + |
|
371 | + // Cleaning uploaded filename? |
|
372 | + $setting = $modx->getDatabase()->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
373 | + if ($modx->getDatabase()->getValue($setting)>0) { |
|
374 | + // Transalias plugin active? |
|
375 | + $res = $modx->getDatabase()->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
376 | + if ($properties = $modx->getDatabase()->getValue($res)) { |
|
377 | + $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
378 | + } else { |
|
379 | + $properties = NULL; |
|
380 | + } |
|
381 | + } else { |
|
382 | + $properties = NULL; |
|
383 | + } |
|
384 | + return $properties; |
|
385 | + } |
|
386 | + |
|
387 | + |
|
388 | + protected function normalizeFilename($filename) { |
|
389 | + if ($this->getTransaliasSettings()) { |
|
390 | + $format = strrchr($filename, "."); |
|
391 | + $filename = str_replace($format, "", $filename); |
|
392 | + $filename = $this->modx->stripAlias($filename).$format; |
|
393 | + } |
|
394 | + return $filename; |
|
395 | + } |
|
396 | + |
|
397 | + protected function normalizeDirname($dirname) { |
|
398 | 398 | return $this->modx->stripAlias($dirname); |
399 | 399 | } |
400 | 400 | |
@@ -472,10 +472,10 @@ discard block |
||
472 | 472 | return $this->label("The image is too big and/or cannot be resized."); |
473 | 473 | |
474 | 474 | |
475 | - // CHECK FOR MODX MAX FILE SIZE |
|
476 | - $actualfilesize=filesize($file['tmp_name']); |
|
477 | - if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
478 | - return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
475 | + // CHECK FOR MODX MAX FILE SIZE |
|
476 | + $actualfilesize=filesize($file['tmp_name']); |
|
477 | + if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
478 | + return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
479 | 479 | |
480 | 480 | return true; |
481 | 481 | } |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | $top = isset($this->config['watermark']['top']) |
628 | 628 | ? $this->config['watermark']['top'] : false; |
629 | 629 | $img->watermark($this->config['watermark']['file'], $left, $top); |
630 | - } |
|
630 | + } |
|
631 | 631 | |
632 | 632 | $options = array( 'file' => $file ); |
633 | 633 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class uploader { |
|
15 | +class uploader{ |
|
16 | 16 | |
17 | 17 | /** Release version */ |
18 | 18 | const VERSION = "2.54"; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | |
73 | 73 | /** Next three properties are got from the current language file |
74 | 74 | * @var string */ |
75 | - protected $dateTimeFull; // Currently not used |
|
76 | - protected $dateTimeMid; // Currently not used |
|
75 | + protected $dateTimeFull; // Currently not used |
|
76 | + protected $dateTimeMid; // Currently not used |
|
77 | 77 | protected $dateTimeSmall; |
78 | 78 | |
79 | 79 | /** Contain Specified language labels |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
105 | 105 | * @param string $property |
106 | 106 | * @return mixed */ |
107 | - public function __get($property) { |
|
107 | + public function __get($property){ |
|
108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
109 | 109 | } |
110 | 110 | |
111 | - public function __construct($modx) { |
|
111 | + public function __construct($modx){ |
|
112 | 112 | |
113 | 113 | //MODX |
114 | 114 | try { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | // COOKIES INIT |
208 | 208 | $ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'; |
209 | - $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/'; |
|
209 | + $ip = '/^'.implode('\.', array($ip, $ip, $ip, $ip)).'$/'; |
|
210 | 210 | if (preg_match($ip, $_SERVER['HTTP_HOST']) || |
211 | 211 | preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST']) |
212 | 212 | ) |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | ) { |
225 | 225 | list($unused, $protocol, $domain, $unused, $port, $path) = $patt; |
226 | 226 | $path = path::normalize($path); |
227 | - $this->config['uploadURL'] = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/$path"; |
|
227 | + $this->config['uploadURL'] = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/$path"; |
|
228 | 228 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
229 | 229 | ? path::normalize($this->config['uploadDir']) |
230 | 230 | : path::url2fullPath("/$path"); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | foreach ($this->langInputNames as $key) |
268 | 268 | if (isset($this->get[$key]) && |
269 | 269 | preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) && |
270 | - file_exists("lang/" . strtolower($this->get[$key]) . ".php") |
|
270 | + file_exists("lang/".strtolower($this->get[$key]).".php") |
|
271 | 271 | ) { |
272 | 272 | $this->lang = $this->get[$key]; |
273 | 273 | break; |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $this->backMsg("Cannot read upload folder."); |
299 | 299 | } |
300 | 300 | |
301 | - public function upload() { |
|
301 | + public function upload(){ |
|
302 | 302 | $config = &$this->config; |
303 | 303 | $file = &$this->file; |
304 | 304 | $url = $message = ""; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | @mkdir(path::normalize($dir), $this->config['dirPerms'], true); |
330 | 330 | |
331 | 331 | $filename = $this->normalizeFilename($file['name']); |
332 | - $target = file::getInexistantFilename($dir . $filename); |
|
332 | + $target = file::getInexistantFilename($dir.$filename); |
|
333 | 333 | |
334 | 334 | if (!@move_uploaded_file($file['tmp_name'], $target) && |
335 | 335 | !@rename($file['tmp_name'], $target) && |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | $this->makeThumb($target); |
343 | 343 | $url = $this->typeURL; |
344 | 344 | if (isset($udir)) $url .= "/$udir"; |
345 | - $url .= "/" . basename($target); |
|
345 | + $url .= "/".basename($target); |
|
346 | 346 | if (preg_match('/^([a-z]+)\:\/\/([^\/^\:]+)(\:(\d+))?\/(.+)$/', $url, $patt)) { |
347 | 347 | list($unused, $protocol, $domain, $unused, $port, $path) = $patt; |
348 | - $base = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/"; |
|
349 | - $url = $base . path::urlPathEncode($path); |
|
348 | + $base = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/"; |
|
349 | + $url = $base.path::urlPathEncode($path); |
|
350 | 350 | } else |
351 | 351 | $url = path::urlPathEncode($url); |
352 | 352 | } |
@@ -365,12 +365,12 @@ discard block |
||
365 | 365 | } |
366 | 366 | |
367 | 367 | |
368 | - protected function getTransaliasSettings() { |
|
368 | + protected function getTransaliasSettings(){ |
|
369 | 369 | $modx = evolutionCMS(); |
370 | 370 | |
371 | 371 | // Cleaning uploaded filename? |
372 | 372 | $setting = $modx->getDatabase()->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
373 | - if ($modx->getDatabase()->getValue($setting)>0) { |
|
373 | + if ($modx->getDatabase()->getValue($setting) > 0) { |
|
374 | 374 | // Transalias plugin active? |
375 | 375 | $res = $modx->getDatabase()->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
376 | 376 | if ($properties = $modx->getDatabase()->getValue($res)) { |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | |
388 | - protected function normalizeFilename($filename) { |
|
388 | + protected function normalizeFilename($filename){ |
|
389 | 389 | if ($this->getTransaliasSettings()) { |
390 | 390 | $format = strrchr($filename, "."); |
391 | 391 | $filename = str_replace($format, "", $filename); |
@@ -394,11 +394,11 @@ discard block |
||
394 | 394 | return $filename; |
395 | 395 | } |
396 | 396 | |
397 | - protected function normalizeDirname($dirname) { |
|
397 | + protected function normalizeDirname($dirname){ |
|
398 | 398 | return $this->modx->stripAlias($dirname); |
399 | 399 | } |
400 | 400 | |
401 | - protected function checkUploadedFile(array $aFile=null) { |
|
401 | + protected function checkUploadedFile(array $aFile = null){ |
|
402 | 402 | $config = &$this->config; |
403 | 403 | $file = ($aFile === null) ? $this->file : $aFile; |
404 | 404 | |
@@ -437,8 +437,7 @@ discard block |
||
437 | 437 | ($file['error'] == UPLOAD_ERR_NO_TMP_DIR) ? |
438 | 438 | $this->label("Missing a temporary folder.") : ( |
439 | 439 | ($file['error'] == UPLOAD_ERR_CANT_WRITE) ? |
440 | - $this->label("Failed to write file.") : |
|
441 | - $this->label("Unknown error.") |
|
440 | + $this->label("Failed to write file.") : $this->label("Unknown error.") |
|
442 | 441 | ))))); |
443 | 442 | |
444 | 443 | // HIDDEN FILENAMES CHECK |
@@ -473,14 +472,14 @@ discard block |
||
473 | 472 | |
474 | 473 | |
475 | 474 | // CHECK FOR MODX MAX FILE SIZE |
476 | - $actualfilesize=filesize($file['tmp_name']); |
|
475 | + $actualfilesize = filesize($file['tmp_name']); |
|
477 | 476 | if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
478 | 477 | return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
479 | 478 | |
480 | 479 | return true; |
481 | 480 | } |
482 | 481 | |
483 | - protected function checkInputDir($dir, $inclType=true, $existing=true) { |
|
482 | + protected function checkInputDir($dir, $inclType = true, $existing = true){ |
|
484 | 483 | $dir = path::normalize($dir); |
485 | 484 | if (substr($dir, 0, 1) == "/") |
486 | 485 | $dir = substr($dir, 1); |
@@ -506,7 +505,7 @@ discard block |
||
506 | 505 | return (is_dir($path) && is_readable($path)) ? $return : false; |
507 | 506 | } |
508 | 507 | |
509 | - protected function validateExtension($ext, $type) { |
|
508 | + protected function validateExtension($ext, $type){ |
|
510 | 509 | $ext = trim(strtolower($ext)); |
511 | 510 | if (!isset($this->types[$type])) |
512 | 511 | return false; |
@@ -531,17 +530,17 @@ discard block |
||
531 | 530 | return in_array($ext, $exts); |
532 | 531 | } |
533 | 532 | |
534 | - protected function getTypeFromPath($path) { |
|
533 | + protected function getTypeFromPath($path){ |
|
535 | 534 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
536 | 535 | ? $patt[1] : $path; |
537 | 536 | } |
538 | 537 | |
539 | - protected function removeTypeFromPath($path) { |
|
538 | + protected function removeTypeFromPath($path){ |
|
540 | 539 | return preg_match('/^[^\/]*\/(.*)$/', $path, $patt) |
541 | 540 | ? $patt[1] : ""; |
542 | 541 | } |
543 | 542 | |
544 | - protected function imageResize($image, $file=null) { |
|
543 | + protected function imageResize($image, $file = null){ |
|
545 | 544 | |
546 | 545 | if (!($image instanceof image)) { |
547 | 546 | $img = image::factory($this->imageDriver, $image); |
@@ -629,24 +628,24 @@ discard block |
||
629 | 628 | $img->watermark($this->config['watermark']['file'], $left, $top); |
630 | 629 | } |
631 | 630 | |
632 | - $options = array( 'file' => $file ); |
|
631 | + $options = array('file' => $file); |
|
633 | 632 | |
634 | - $type = exif_imagetype( $file ); |
|
633 | + $type = exif_imagetype($file); |
|
635 | 634 | |
636 | - switch ( $type ) { |
|
635 | + switch ($type) { |
|
637 | 636 | case IMAGETYPE_GIF: |
638 | - return $img->output( 'gif', $options ); |
|
637 | + return $img->output('gif', $options); |
|
639 | 638 | |
640 | 639 | case IMAGETYPE_PNG: |
641 | - return $img->output( 'png', $options ); |
|
640 | + return $img->output('png', $options); |
|
642 | 641 | |
643 | 642 | default: |
644 | - return $img->output( 'jpeg', array_merge( $options, array( 'quality' => $this->config['jpegQuality'] ) ) ); |
|
643 | + return $img->output('jpeg', array_merge($options, array('quality' => $this->config['jpegQuality']))); |
|
645 | 644 | } |
646 | 645 | |
647 | 646 | } |
648 | 647 | |
649 | - protected function makeThumb($file, $overwrite=true) { |
|
648 | + protected function makeThumb($file, $overwrite = true){ |
|
650 | 649 | $img = image::factory($this->imageDriver, $file); |
651 | 650 | |
652 | 651 | // Drop files which are not images |
@@ -654,7 +653,7 @@ discard block |
||
654 | 653 | return true; |
655 | 654 | |
656 | 655 | $thumb = substr($file, strlen($this->config['uploadDir'])); |
657 | - $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb; |
|
656 | + $thumb = $this->config['uploadDir']."/".$this->config['thumbsDir']."/".$thumb; |
|
658 | 657 | $thumb = path::normalize($thumb); |
659 | 658 | $thumbDir = dirname($thumb); |
660 | 659 | if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) |
@@ -677,15 +676,15 @@ discard block |
||
677 | 676 | if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) |
678 | 677 | return false; |
679 | 678 | |
680 | - if ( $this->imageDriver == 'gd' ) { |
|
681 | - $width = imagesx( $img->image ); |
|
682 | - $height = imagesy( $img->image ); |
|
683 | - $back = image::factory( $this->imageDriver, array( $width, $height ) ); |
|
684 | - $tile = image::factory( $this->imageDriver, __DIR__ . '/../themes/' . $this->config['theme'] . '/img/bg_transparent.png' ); |
|
679 | + if ($this->imageDriver == 'gd') { |
|
680 | + $width = imagesx($img->image); |
|
681 | + $height = imagesy($img->image); |
|
682 | + $back = image::factory($this->imageDriver, array($width, $height)); |
|
683 | + $tile = image::factory($this->imageDriver, __DIR__.'/../themes/'.$this->config['theme'].'/img/bg_transparent.png'); |
|
685 | 684 | |
686 | - imagesettile( $back->image, $tile->image ); |
|
687 | - imagefilledrectangle( $back->image, 0, 0, $width, $height, IMG_COLOR_TILED ); |
|
688 | - imagecopy( $back->image, $img->image, 0, 0, 0, 0, $width, $height ); |
|
685 | + imagesettile($back->image, $tile->image); |
|
686 | + imagefilledrectangle($back->image, 0, 0, $width, $height, IMG_COLOR_TILED); |
|
687 | + imagecopy($back->image, $img->image, 0, 0, 0, 0, $width, $height); |
|
689 | 688 | |
690 | 689 | $img = $back; |
691 | 690 | } |
@@ -697,7 +696,7 @@ discard block |
||
697 | 696 | )); |
698 | 697 | } |
699 | 698 | |
700 | - protected function localize($langCode) { |
|
699 | + protected function localize($langCode){ |
|
701 | 700 | require "lang/{$langCode}.php"; |
702 | 701 | setlocale(LC_ALL, $lang['_locale']); |
703 | 702 | $this->charset = $lang['_charset']; |
@@ -712,7 +711,7 @@ discard block |
||
712 | 711 | $this->labels = $lang; |
713 | 712 | } |
714 | 713 | |
715 | - protected function label($string, array $data=null) { |
|
714 | + protected function label($string, array $data = null){ |
|
716 | 715 | $return = isset($this->labels[$string]) ? $this->labels[$string] : $string; |
717 | 716 | if (is_array($data)) |
718 | 717 | foreach ($data as $key => $val) |
@@ -720,7 +719,7 @@ discard block |
||
720 | 719 | return $return; |
721 | 720 | } |
722 | 721 | |
723 | - protected function backMsg($message, array $data=null) { |
|
722 | + protected function backMsg($message, array $data = null){ |
|
724 | 723 | $message = $this->label($message, $data); |
725 | 724 | if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) |
726 | 725 | @unlink($this->file['tmp_name']); |
@@ -728,7 +727,7 @@ discard block |
||
728 | 727 | die; |
729 | 728 | } |
730 | 729 | |
731 | - protected function callBack($url, $message="") { |
|
730 | + protected function callBack($url, $message = ""){ |
|
732 | 731 | $message = text::jsValue($message); |
733 | 732 | $CKfuncNum = isset($this->opener['CKEditor']['funcNum']) |
734 | 733 | ? $this->opener['CKEditor']['funcNum'] : 0; |
@@ -769,7 +768,7 @@ discard block |
||
769 | 768 | |
770 | 769 | } |
771 | 770 | |
772 | - protected function get_htaccess() { |
|
771 | + protected function get_htaccess(){ |
|
773 | 772 | return "<IfModule mod_php4.c> |
774 | 773 | php_value engine off |
775 | 774 | </IfModule> |
@@ -376,10 +376,10 @@ |
||
376 | 376 | if ($properties = $modx->getDatabase()->getValue($res)) { |
377 | 377 | $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
378 | 378 | } else { |
379 | - $properties = NULL; |
|
379 | + $properties = null; |
|
380 | 380 | } |
381 | 381 | } else { |
382 | - $properties = NULL; |
|
382 | + $properties = null; |
|
383 | 383 | } |
384 | 384 | return $properties; |
385 | 385 | } |
@@ -19,11 +19,11 @@ discard block |
||
19 | 19 | $modx->loadExtension("ManagerAPI"); |
20 | 20 | |
21 | 21 | $_lang = array(); |
22 | -include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php'; |
|
22 | +include_once MODX_MANAGER_PATH.'/includes/lang/english.inc.php'; |
|
23 | 23 | if ($modx->config['manager_language'] != 'english') { |
24 | - include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php'; |
|
24 | + include_once MODX_MANAGER_PATH.'/includes/lang/'.$modx->config['manager_language'].'.inc.php'; |
|
25 | 25 | } |
26 | -include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php'; |
|
26 | +include_once MODX_MANAGER_PATH.'/media/style/'.$modx->config['manager_theme'].'/style.php'; |
|
27 | 27 | |
28 | 28 | $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : ''; |
29 | 29 | $frame = isset($_REQUEST['f']) ? $_REQUEST['f'] : ''; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | switch ($frame) { |
42 | 42 | case 'nodes': |
43 | - include_once MODX_MANAGER_PATH . '/frames/nodes.php'; |
|
43 | + include_once MODX_MANAGER_PATH.'/frames/nodes.php'; |
|
44 | 44 | |
45 | 45 | break; |
46 | 46 | } |
@@ -58,21 +58,21 @@ discard block |
||
58 | 58 | $sql = ''; |
59 | 59 | $a = ''; |
60 | 60 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '%*_') : ''; |
61 | - $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : ''; |
|
62 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
61 | + $sqlLike = $filter ? 'WHERE t1.name LIKE "'.$modx->getDatabase()->escape($filter).'%"' : ''; |
|
62 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
63 | 63 | |
64 | 64 | switch ($elements) { |
65 | 65 | case 'element_templates': |
66 | 66 | $a = 16; |
67 | - $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : ''; |
|
67 | + $sqlLike = $filter ? 'WHERE t1.templatename LIKE "'.$modx->getDatabase()->escape($filter).'%"' : ''; |
|
68 | 68 | $sql = $modx->getDatabase()->query('SELECT t1.id, t1.templatename AS name, t1.locked, 0 AS disabled |
69 | - FROM ' . $modx->getFullTableName('site_templates') . ' AS t1 |
|
70 | - ' . $sqlLike . ' |
|
69 | + FROM ' . $modx->getFullTableName('site_templates').' AS t1 |
|
70 | + ' . $sqlLike.' |
|
71 | 71 | ORDER BY t1.templatename ASC |
72 | 72 | ' . $sqlLimit); |
73 | 73 | |
74 | 74 | if ($modx->hasPermission('new_template')) { |
75 | - $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>'; |
|
75 | + $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>'.$_lang['new_template'].'</a></li>'; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | break; |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | case 'element_tplvars': |
81 | 81 | $a = 301; |
82 | 82 | $sql = $modx->getDatabase()->query('SELECT t1.id, t1.name, t1.locked, IF(MIN(t2.tmplvarid),0,1) AS disabled |
83 | - FROM ' . $modx->getFullTableName('site_tmplvars') . ' AS t1 |
|
84 | - LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates') . ' AS t2 ON t1.id=t2.tmplvarid |
|
85 | - ' . $sqlLike . ' |
|
83 | + FROM ' . $modx->getFullTableName('site_tmplvars').' AS t1 |
|
84 | + LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates').' AS t2 ON t1.id=t2.tmplvarid |
|
85 | + ' . $sqlLike.' |
|
86 | 86 | GROUP BY t1.id |
87 | 87 | ORDER BY t1.name ASC |
88 | 88 | ' . $sqlLimit); |
89 | 89 | |
90 | 90 | if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
91 | - $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>'; |
|
91 | + $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>'.$_lang['new_tmplvars'].'</a></li>'; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | break; |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | case 'element_htmlsnippets': |
97 | 97 | $a = 78; |
98 | 98 | $sql = $modx->getDatabase()->query('SELECT t1.id, t1.name, t1.locked, t1.disabled |
99 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . ' AS t1 |
|
100 | - ' . $sqlLike . ' |
|
99 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').' AS t1 |
|
100 | + ' . $sqlLike.' |
|
101 | 101 | ORDER BY t1.name ASC |
102 | 102 | ' . $sqlLimit); |
103 | 103 | |
104 | 104 | if ($modx->hasPermission('new_chunk')) { |
105 | - $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>'; |
|
105 | + $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>'.$_lang['new_htmlsnippet'].'</a></li>'; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | break; |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | case 'element_snippets': |
111 | 111 | $a = 22; |
112 | 112 | $sql = $modx->getDatabase()->query('SELECT t1.id, t1.name, t1.locked, t1.disabled |
113 | - FROM ' . $modx->getFullTableName('site_snippets') . ' AS t1 |
|
114 | - ' . $sqlLike . ' |
|
113 | + FROM ' . $modx->getFullTableName('site_snippets').' AS t1 |
|
114 | + ' . $sqlLike.' |
|
115 | 115 | ORDER BY t1.name ASC |
116 | 116 | ' . $sqlLimit); |
117 | 117 | |
118 | 118 | if ($modx->hasPermission('new_snippet')) { |
119 | - $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>'; |
|
119 | + $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>'.$_lang['new_snippet'].'</a></li>'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | break; |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | case 'element_plugins': |
125 | 125 | $a = 102; |
126 | 126 | $sql = $modx->getDatabase()->query('SELECT t1.id, t1.name, t1.locked, t1.disabled |
127 | - FROM ' . $modx->getFullTableName('site_plugins') . ' AS t1 |
|
128 | - ' . $sqlLike . ' |
|
127 | + FROM ' . $modx->getFullTableName('site_plugins').' AS t1 |
|
128 | + ' . $sqlLike.' |
|
129 | 129 | ORDER BY t1.name ASC |
130 | 130 | ' . $sqlLimit); |
131 | 131 | |
132 | 132 | if ($modx->hasPermission('new_plugin')) { |
133 | - $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>'; |
|
133 | + $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>'.$_lang['new_plugin'].'</a></li>'; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | break; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | continue; |
146 | 146 | } |
147 | 147 | |
148 | - $items .= '<li class="item ' . ($row['disabled'] ? 'disabled' : '') . ($row['locked'] ? ' locked' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main" data-parent-id="a_76__elements_' . $elements . '">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>' . "\n"; |
|
148 | + $items .= '<li class="item '.($row['disabled'] ? 'disabled' : '').($row['locked'] ? ' locked' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main" data-parent-id="a_76__elements_'.$elements.'">'.$row['name'].' <small>('.$row['id'].')</small></a></li>'."\n"; |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -166,23 +166,23 @@ discard block |
||
166 | 166 | $output = ''; |
167 | 167 | $items = ''; |
168 | 168 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : ''; |
169 | - $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : ''; |
|
170 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
169 | + $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->getDatabase()->escape($filter).'%"' : ''; |
|
170 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
171 | 171 | |
172 | - if(!$modx->hasPermission('save_role')) { |
|
172 | + if (!$modx->hasPermission('save_role')) { |
|
173 | 173 | $sqlLike .= $sqlLike ? ' AND ' : 'WHERE '; |
174 | 174 | $sqlLike .= 't2.role != 1'; |
175 | 175 | } |
176 | 176 | |
177 | 177 | $sql = $modx->getDatabase()->query('SELECT t1.*, t1.username AS name, t2.blocked |
178 | - FROM ' . $modx->getFullTableName('manager_users') . ' AS t1 |
|
179 | - LEFT JOIN ' . $modx->getFullTableName('user_attributes') . ' AS t2 ON t1.id=t2.internalKey |
|
180 | - ' . $sqlLike . ' |
|
178 | + FROM ' . $modx->getFullTableName('manager_users').' AS t1 |
|
179 | + LEFT JOIN ' . $modx->getFullTableName('user_attributes').' AS t2 ON t1.id=t2.internalKey |
|
180 | + ' . $sqlLike.' |
|
181 | 181 | ORDER BY t1.username ASC |
182 | 182 | ' . $sqlLimit); |
183 | 183 | |
184 | 184 | if ($modx->hasPermission('new_user')) { |
185 | - $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>'; |
|
185 | + $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>'.$_lang['new_user'].'</a></li>'; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | if ($count = $modx->getDatabase()->getRecordCount($sql)) { |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
191 | 191 | } |
192 | 192 | while ($row = $modx->getDatabase()->getRow($sql)) { |
193 | - $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>'; |
|
193 | + $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>'; |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
@@ -210,18 +210,18 @@ discard block |
||
210 | 210 | $output = ''; |
211 | 211 | $items = ''; |
212 | 212 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : ''; |
213 | - $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : ''; |
|
214 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
213 | + $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->getDatabase()->escape($filter).'%"' : ''; |
|
214 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
215 | 215 | |
216 | 216 | $sql = $modx->getDatabase()->query('SELECT t1.*, t1.username AS name, t2.blocked |
217 | - FROM ' . $modx->getFullTableName('web_users') . ' AS t1 |
|
218 | - LEFT JOIN ' . $modx->getFullTableName('web_user_attributes') . ' AS t2 ON t1.id=t2.internalKey |
|
219 | - ' . $sqlLike . ' |
|
217 | + FROM ' . $modx->getFullTableName('web_users').' AS t1 |
|
218 | + LEFT JOIN ' . $modx->getFullTableName('web_user_attributes').' AS t2 ON t1.id=t2.internalKey |
|
219 | + ' . $sqlLike.' |
|
220 | 220 | ORDER BY t1.username ASC |
221 | 221 | ' . $sqlLimit); |
222 | 222 | |
223 | 223 | if ($modx->hasPermission('new_web_user')) { |
224 | - $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>'; |
|
224 | + $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>'.$_lang['new_web_user'].'</a></li>'; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | if ($count = $modx->getDatabase()->getRecordCount($sql)) { |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
230 | 230 | } |
231 | 231 | while ($row = $modx->getDatabase()->getRow($sql)) { |
232 | - $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>'; |
|
232 | + $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>'; |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
@@ -255,35 +255,35 @@ discard block |
||
255 | 255 | case 'SnippetNoCache': { |
256 | 256 | |
257 | 257 | $sql = $modx->getDatabase()->query('SELECT * |
258 | - FROM ' . $modx->getFullTableName('site_snippets') . ' |
|
259 | - WHERE name="' . $name . '" |
|
258 | + FROM ' . $modx->getFullTableName('site_snippets').' |
|
259 | + WHERE name="' . $name.'" |
|
260 | 260 | LIMIT 1'); |
261 | 261 | |
262 | 262 | if ($modx->getDatabase()->getRecordCount($sql)) { |
263 | 263 | $row = $modx->getDatabase()->getRow($sql); |
264 | 264 | $contextmenu = array( |
265 | 265 | 'header' => array( |
266 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name'] |
|
266 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$row['name'] |
|
267 | 267 | ), |
268 | 268 | 'item' => array( |
269 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
270 | - 'url' => "index.php?a=22&id=" . $row['id'] |
|
269 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
270 | + 'url' => "index.php?a=22&id=".$row['id'] |
|
271 | 271 | ) |
272 | 272 | ); |
273 | 273 | if (!empty($row['description'])) { |
274 | 274 | $contextmenu['seperator'] = ''; |
275 | 275 | $contextmenu['description'] = array( |
276 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
276 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
277 | 277 | ); |
278 | 278 | } |
279 | 279 | } else { |
280 | 280 | $contextmenu = array( |
281 | 281 | 'header' => array( |
282 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
|
282 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$name |
|
283 | 283 | ), |
284 | 284 | 'item' => array( |
285 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'], |
|
286 | - 'url' => "index.php?a=23&itemname=" . $name |
|
285 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'], |
|
286 | + 'url' => "index.php?a=23&itemname=".$name |
|
287 | 287 | ) |
288 | 288 | ); |
289 | 289 | } |
@@ -293,35 +293,35 @@ discard block |
||
293 | 293 | case 'Chunk' : { |
294 | 294 | |
295 | 295 | $sql = $modx->getDatabase()->query('SELECT * |
296 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . ' |
|
297 | - WHERE name="' . $name . '" |
|
296 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').' |
|
297 | + WHERE name="' . $name.'" |
|
298 | 298 | LIMIT 1'); |
299 | 299 | |
300 | 300 | if ($modx->getDatabase()->getRecordCount($sql)) { |
301 | 301 | $row = $modx->getDatabase()->getRow($sql); |
302 | 302 | $contextmenu = array( |
303 | 303 | 'header' => array( |
304 | - 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $row['name'] |
|
304 | + 'innerHTML' => '<i class="fa fa-th-large"></i> '.$row['name'] |
|
305 | 305 | ), |
306 | 306 | 'item' => array( |
307 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
308 | - 'url' => "index.php?a=78&id=" . $row['id'] |
|
307 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
308 | + 'url' => "index.php?a=78&id=".$row['id'] |
|
309 | 309 | ) |
310 | 310 | ); |
311 | 311 | if (!empty($row['description'])) { |
312 | 312 | $contextmenu['seperator'] = ''; |
313 | 313 | $contextmenu['description'] = array( |
314 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
314 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
315 | 315 | ); |
316 | 316 | } |
317 | 317 | } else { |
318 | 318 | $contextmenu = array( |
319 | 319 | 'header' => array( |
320 | - 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name |
|
320 | + 'innerHTML' => '<i class="fa fa-th-large"></i> '.$name |
|
321 | 321 | ), |
322 | 322 | 'item' => array( |
323 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'], |
|
324 | - 'url' => "index.php?a=77&itemname=" . $name |
|
323 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'], |
|
324 | + 'url' => "index.php?a=77&itemname=".$name |
|
325 | 325 | ) |
326 | 326 | ); |
327 | 327 | } |
@@ -330,8 +330,8 @@ discard block |
||
330 | 330 | } |
331 | 331 | case 'AttributeValue': { |
332 | 332 | $sql = $modx->getDatabase()->query('SELECT * |
333 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . ' |
|
334 | - WHERE name="' . $name . '" |
|
333 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').' |
|
334 | + WHERE name="' . $name.'" |
|
335 | 335 | LIMIT 1'); |
336 | 336 | |
337 | 337 | if ($modx->getDatabase()->getRecordCount($sql)) { |
@@ -341,52 +341,52 @@ discard block |
||
341 | 341 | 'innerText' => $row['name'] |
342 | 342 | ), |
343 | 343 | 'item' => array( |
344 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
345 | - 'url' => "index.php?a=78&id=" . $row['id'] |
|
344 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
345 | + 'url' => "index.php?a=78&id=".$row['id'] |
|
346 | 346 | ) |
347 | 347 | ); |
348 | 348 | if (!empty($row['description'])) { |
349 | 349 | $contextmenu['seperator'] = ''; |
350 | 350 | $contextmenu['description'] = array( |
351 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
351 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
352 | 352 | ); |
353 | 353 | } |
354 | 354 | } else { |
355 | 355 | |
356 | 356 | $sql = $modx->getDatabase()->query('SELECT * |
357 | - FROM ' . $modx->getFullTableName('site_snippets') . ' |
|
358 | - WHERE name="' . $name . '" |
|
357 | + FROM ' . $modx->getFullTableName('site_snippets').' |
|
358 | + WHERE name="' . $name.'" |
|
359 | 359 | LIMIT 1'); |
360 | 360 | |
361 | 361 | if ($modx->getDatabase()->getRecordCount($sql)) { |
362 | 362 | $row = $modx->getDatabase()->getRow($sql); |
363 | 363 | $contextmenu = array( |
364 | 364 | 'header' => array( |
365 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name'] |
|
365 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$row['name'] |
|
366 | 366 | ), |
367 | 367 | 'item' => array( |
368 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
369 | - 'url' => "index.php?a=22&id=" . $row['id'] |
|
368 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
369 | + 'url' => "index.php?a=22&id=".$row['id'] |
|
370 | 370 | ) |
371 | 371 | ); |
372 | 372 | if (!empty($row['description'])) { |
373 | 373 | $contextmenu['seperator'] = ''; |
374 | 374 | $contextmenu['description'] = array( |
375 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
375 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
376 | 376 | ); |
377 | 377 | } |
378 | 378 | } else { |
379 | 379 | $contextmenu = array( |
380 | 380 | 'header' => array( |
381 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
|
381 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$name |
|
382 | 382 | ), |
383 | 383 | 'item' => array( |
384 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'], |
|
385 | - 'url' => "index.php?a=77&itemname=" . $name |
|
384 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'], |
|
385 | + 'url' => "index.php?a=77&itemname=".$name |
|
386 | 386 | ), |
387 | 387 | 'item2' => array( |
388 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'], |
|
389 | - 'url' => "index.php?a=23&itemname=" . $name |
|
388 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'], |
|
389 | + 'url' => "index.php?a=23&itemname=".$name |
|
390 | 390 | ) |
391 | 391 | ); |
392 | 392 | } |
@@ -442,35 +442,35 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | $sql = $modx->getDatabase()->query('SELECT * |
445 | - FROM ' . $modx->getFullTableName('site_tmplvars') . ' |
|
446 | - WHERE name="' . $name . '" |
|
445 | + FROM ' . $modx->getFullTableName('site_tmplvars').' |
|
446 | + WHERE name="' . $name.'" |
|
447 | 447 | LIMIT 1'); |
448 | 448 | |
449 | 449 | if ($modx->getDatabase()->getRecordCount($sql)) { |
450 | 450 | $row = $modx->getDatabase()->getRow($sql); |
451 | 451 | $contextmenu = array( |
452 | 452 | 'header' => array( |
453 | - 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $row['name'] |
|
453 | + 'innerHTML' => '<i class="fa fa-list-alt"></i> '.$row['name'] |
|
454 | 454 | ), |
455 | 455 | 'item' => array( |
456 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
457 | - 'url' => "index.php?a=301&id=" . $row['id'] |
|
456 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
457 | + 'url' => "index.php?a=301&id=".$row['id'] |
|
458 | 458 | ) |
459 | 459 | ); |
460 | 460 | if (!empty($row['description'])) { |
461 | 461 | $contextmenu['seperator'] = ''; |
462 | 462 | $contextmenu['description'] = array( |
463 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
463 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
464 | 464 | ); |
465 | 465 | } |
466 | 466 | } else { |
467 | 467 | $contextmenu = array( |
468 | 468 | 'header' => array( |
469 | - 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name |
|
469 | + 'innerHTML' => '<i class="fa fa-list-alt"></i> '.$name |
|
470 | 470 | ), |
471 | 471 | 'item' => array( |
472 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_tmplvars'], |
|
473 | - 'url' => "index.php?a=300&itemname=" . $name |
|
472 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_tmplvars'], |
|
473 | + 'url' => "index.php?a=300&itemname=".$name |
|
474 | 474 | ) |
475 | 475 | ); |
476 | 476 | } |
@@ -489,15 +489,15 @@ discard block |
||
489 | 489 | $json = array(); |
490 | 490 | |
491 | 491 | if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
492 | - $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
|
493 | - $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0; |
|
492 | + $id = !empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; |
|
493 | + $parent = isset($_REQUEST['parent']) ? (int) $_REQUEST['parent'] : 0; |
|
494 | 494 | $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0; |
495 | 495 | |
496 | 496 | // set parent |
497 | 497 | if ($id && $parent >= 0) { |
498 | 498 | |
499 | 499 | // find older parent |
500 | - $parentOld = $modx->getDatabase()->getValue($modx->getDatabase()->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id)); |
|
500 | + $parentOld = $modx->getDatabase()->getValue($modx->getDatabase()->select('parent', $modx->getFullTableName('site_content'), 'id='.$id)); |
|
501 | 501 | |
502 | 502 | $eventOut = $modx->invokeEvent('onBeforeMoveDocument', [ |
503 | 503 | 'id_document' => $id, |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | if (empty($json['errors'])) { |
519 | 519 | // check privileges user for move docs |
520 | 520 | if (!empty($modx->config['tree_show_protected']) && $role != 1) { |
521 | - $sql = $modx->getDatabase()->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')'); |
|
521 | + $sql = $modx->getDatabase()->select('*', $modx->getFullTableName('document_groups'), 'document IN('.$id.','.$parent.','.$parentOld.')'); |
|
522 | 522 | if ($modx->getDatabase()->getRecordCount($sql)) { |
523 | 523 | $document_groups = array(); |
524 | 524 | while ($row = $modx->getDatabase()->getRow($sql)) { |
@@ -543,22 +543,22 @@ discard block |
||
543 | 543 | // set new parent |
544 | 544 | $modx->getDatabase()->update(array( |
545 | 545 | 'parent' => $parent |
546 | - ), $modx->getFullTableName('site_content'), 'id=' . $id); |
|
546 | + ), $modx->getFullTableName('site_content'), 'id='.$id); |
|
547 | 547 | // set parent isfolder = 1 |
548 | 548 | $modx->getDatabase()->update(array( |
549 | 549 | 'isfolder' => 1 |
550 | - ), $modx->getFullTableName('site_content'), 'id=' . $parent); |
|
550 | + ), $modx->getFullTableName('site_content'), 'id='.$parent); |
|
551 | 551 | |
552 | 552 | if ($parent != $parentOld) { |
553 | 553 | // check children docs and set parent isfolder |
554 | - if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) { |
|
554 | + if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getFullTableName('site_content'), 'parent='.$parentOld))) { |
|
555 | 555 | $modx->getDatabase()->update(array( |
556 | 556 | 'isfolder' => 1 |
557 | - ), $modx->getFullTableName('site_content'), 'id=' . $parentOld); |
|
557 | + ), $modx->getFullTableName('site_content'), 'id='.$parentOld); |
|
558 | 558 | } else { |
559 | 559 | $modx->getDatabase()->update(array( |
560 | 560 | 'isfolder' => 0 |
561 | - ), $modx->getFullTableName('site_content'), 'id=' . $parentOld); |
|
561 | + ), $modx->getFullTableName('site_content'), 'id='.$parentOld); |
|
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | if (!empty($menuindex)) { |
567 | 567 | $menuindex = explode(',', $menuindex); |
568 | 568 | foreach ($menuindex as $key => $value) { |
569 | - $modx->getDatabase()->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value); |
|
569 | + $modx->getDatabase()->query('UPDATE '.$modx->getFullTableName('site_content').' SET menuindex='.$key.' WHERE id='.$value); |
|
570 | 570 | } |
571 | 571 | } else { |
572 | 572 | // TODO: max(*) menuindex |
@@ -595,19 +595,19 @@ discard block |
||
595 | 595 | } |
596 | 596 | |
597 | 597 | case 'getLockedElements': { |
598 | - $type = isset($_REQUEST['type']) ? (int)$_REQUEST['type'] : 0; |
|
599 | - $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
598 | + $type = isset($_REQUEST['type']) ? (int) $_REQUEST['type'] : 0; |
|
599 | + $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
600 | 600 | |
601 | 601 | $output = !!$modx->elementIsLocked($type, $id, true); |
602 | 602 | |
603 | 603 | if (!$output) { |
604 | 604 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
605 | - $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : ''; |
|
605 | + $docgrp_cond = $docgrp ? ' OR dg.document_group IN ('.$docgrp.')' : ''; |
|
606 | 606 | $sql = ' |
607 | - SELECT MAX(IF(1=' . $role . ' OR sc.privatemgr=0' . $docgrp_cond . ', 0, 1)) AS locked |
|
608 | - FROM ' . $modx->getFullTableName('site_content') . ' AS sc |
|
609 | - LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id |
|
610 | - WHERE sc.id=' . $id . ' GROUP BY sc.id'; |
|
607 | + SELECT MAX(IF(1=' . $role.' OR sc.privatemgr=0'.$docgrp_cond.', 0, 1)) AS locked |
|
608 | + FROM ' . $modx->getFullTableName('site_content').' AS sc |
|
609 | + LEFT JOIN ' . $modx->getFullTableName('document_groups').' dg ON dg.document=sc.id |
|
610 | + WHERE sc.id=' . $id.' GROUP BY sc.id'; |
|
611 | 611 | $sql = $modx->getDatabase()->query($sql); |
612 | 612 | if ($modx->getDatabase()->getRecordCount($sql)) { |
613 | 613 | $row = $modx->getDatabase()->getRow($sql); |
@@ -7,11 +7,11 @@ discard block |
||
7 | 7 | |
8 | 8 | $modx->getDatabase()->connect(); |
9 | 9 | |
10 | -if (empty ($modx->config)) { |
|
10 | +if (empty ($modx->config)) { |
|
11 | 11 | $modx->getSettings(); |
12 | 12 | } |
13 | 13 | |
14 | -if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) { |
|
14 | +if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) { |
|
15 | 15 | $modx->sendErrorPage(); |
16 | 16 | } |
17 | 17 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | $_lang = array(); |
22 | 22 | include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php'; |
23 | -if ($modx->config['manager_language'] != 'english') { |
|
23 | +if ($modx->config['manager_language'] != 'english') { |
|
24 | 24 | include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php'; |
25 | 25 | } |
26 | 26 | include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php'; |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | // set limit sql query |
34 | 34 | $limit = !empty($modx->config['number_of_results']) ? (int) $modx->config['number_of_results'] : 100; |
35 | 35 | |
36 | -if (isset($action)) { |
|
37 | - switch ($action) { |
|
36 | +if (isset($action)) { |
|
37 | + switch ($action) { |
|
38 | 38 | |
39 | 39 | case '1': { |
40 | 40 | |
41 | - switch ($frame) { |
|
41 | + switch ($frame) { |
|
42 | 42 | case 'nodes': |
43 | 43 | include_once MODX_MANAGER_PATH . '/frames/nodes.php'; |
44 | 44 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $elements = isset($_REQUEST['elements']) && is_scalar($_REQUEST['elements']) ? htmlentities($_REQUEST['elements']) : ''; |
54 | 54 | |
55 | - if ($elements) { |
|
55 | + if ($elements) { |
|
56 | 56 | $output = ''; |
57 | 57 | $items = ''; |
58 | 58 | $sql = ''; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : ''; |
62 | 62 | $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
63 | 63 | |
64 | - switch ($elements) { |
|
64 | + switch ($elements) { |
|
65 | 65 | case 'element_templates': |
66 | 66 | $a = 16; |
67 | 67 | $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : ''; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | ORDER BY t1.templatename ASC |
72 | 72 | ' . $sqlLimit); |
73 | 73 | |
74 | - if ($modx->hasPermission('new_template')) { |
|
74 | + if ($modx->hasPermission('new_template')) { |
|
75 | 75 | $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>'; |
76 | 76 | } |
77 | 77 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | ORDER BY t1.name ASC |
88 | 88 | ' . $sqlLimit); |
89 | 89 | |
90 | - if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
|
90 | + if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) { |
|
91 | 91 | $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>'; |
92 | 92 | } |
93 | 93 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | ORDER BY t1.name ASC |
102 | 102 | ' . $sqlLimit); |
103 | 103 | |
104 | - if ($modx->hasPermission('new_chunk')) { |
|
104 | + if ($modx->hasPermission('new_chunk')) { |
|
105 | 105 | $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>'; |
106 | 106 | } |
107 | 107 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ORDER BY t1.name ASC |
116 | 116 | ' . $sqlLimit); |
117 | 117 | |
118 | - if ($modx->hasPermission('new_snippet')) { |
|
118 | + if ($modx->hasPermission('new_snippet')) { |
|
119 | 119 | $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>'; |
120 | 120 | } |
121 | 121 | |
@@ -129,19 +129,19 @@ discard block |
||
129 | 129 | ORDER BY t1.name ASC |
130 | 130 | ' . $sqlLimit); |
131 | 131 | |
132 | - if ($modx->hasPermission('new_plugin')) { |
|
132 | + if ($modx->hasPermission('new_plugin')) { |
|
133 | 133 | $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>'; |
134 | 134 | } |
135 | 135 | |
136 | 136 | break; |
137 | 137 | } |
138 | 138 | |
139 | - if ($count = $modx->getDatabase()->getRecordCount($sql)) { |
|
140 | - if ($count == $limit) { |
|
139 | + if ($count = $modx->getDatabase()->getRecordCount($sql)) { |
|
140 | + if ($count == $limit) { |
|
141 | 141 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
142 | 142 | } |
143 | - while ($row = $modx->getDatabase()->getRow($sql)) { |
|
144 | - if (($row['disabled'] || $row['locked']) && $role != 1) { |
|
143 | + while ($row = $modx->getDatabase()->getRow($sql)) { |
|
144 | + if (($row['disabled'] || $row['locked']) && $role != 1) { |
|
145 | 145 | continue; |
146 | 146 | } |
147 | 147 | |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | - if (isset($_REQUEST['filter'])) { |
|
152 | + if (isset($_REQUEST['filter'])) { |
|
153 | 153 | $output = $items; |
154 | - } else { |
|
154 | + } else { |
|
155 | 155 | $output .= $items; |
156 | 156 | } |
157 | 157 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : ''; |
170 | 170 | $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
171 | 171 | |
172 | - if(!$modx->hasPermission('save_role')) { |
|
172 | + if(!$modx->hasPermission('save_role')) { |
|
173 | 173 | $sqlLike .= $sqlLike ? ' AND ' : 'WHERE '; |
174 | 174 | $sqlLike .= 't2.role != 1'; |
175 | 175 | } |
@@ -181,22 +181,22 @@ discard block |
||
181 | 181 | ORDER BY t1.username ASC |
182 | 182 | ' . $sqlLimit); |
183 | 183 | |
184 | - if ($modx->hasPermission('new_user')) { |
|
184 | + if ($modx->hasPermission('new_user')) { |
|
185 | 185 | $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>'; |
186 | 186 | } |
187 | 187 | |
188 | - if ($count = $modx->getDatabase()->getRecordCount($sql)) { |
|
189 | - if ($count == $limit) { |
|
188 | + if ($count = $modx->getDatabase()->getRecordCount($sql)) { |
|
189 | + if ($count == $limit) { |
|
190 | 190 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
191 | 191 | } |
192 | - while ($row = $modx->getDatabase()->getRow($sql)) { |
|
192 | + while ($row = $modx->getDatabase()->getRow($sql)) { |
|
193 | 193 | $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>'; |
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
197 | - if (isset($_REQUEST['filter'])) { |
|
197 | + if (isset($_REQUEST['filter'])) { |
|
198 | 198 | $output = $items; |
199 | - } else { |
|
199 | + } else { |
|
200 | 200 | $output .= $items; |
201 | 201 | } |
202 | 202 | |
@@ -220,22 +220,22 @@ discard block |
||
220 | 220 | ORDER BY t1.username ASC |
221 | 221 | ' . $sqlLimit); |
222 | 222 | |
223 | - if ($modx->hasPermission('new_web_user')) { |
|
223 | + if ($modx->hasPermission('new_web_user')) { |
|
224 | 224 | $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>'; |
225 | 225 | } |
226 | 226 | |
227 | - if ($count = $modx->getDatabase()->getRecordCount($sql)) { |
|
228 | - if ($count == $limit) { |
|
227 | + if ($count = $modx->getDatabase()->getRecordCount($sql)) { |
|
228 | + if ($count == $limit) { |
|
229 | 229 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
230 | 230 | } |
231 | - while ($row = $modx->getDatabase()->getRow($sql)) { |
|
231 | + while ($row = $modx->getDatabase()->getRow($sql)) { |
|
232 | 232 | $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>'; |
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - if (isset($_REQUEST['filter'])) { |
|
236 | + if (isset($_REQUEST['filter'])) { |
|
237 | 237 | $output = $items; |
238 | - } else { |
|
238 | + } else { |
|
239 | 239 | $output .= $items; |
240 | 240 | } |
241 | 241 | |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | $type = isset($_REQUEST['type']) && is_scalar($_REQUEST['type']) ? $modx->getDatabase()->escape($_REQUEST['type']) : false; |
250 | 250 | $contextmenu = ''; |
251 | 251 | |
252 | - if ($role && $name && $type) { |
|
253 | - switch ($type) { |
|
252 | + if ($role && $name && $type) { |
|
253 | + switch ($type) { |
|
254 | 254 | case 'Snippet': |
255 | 255 | case 'SnippetNoCache': { |
256 | 256 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | WHERE name="' . $name . '" |
260 | 260 | LIMIT 1'); |
261 | 261 | |
262 | - if ($modx->getDatabase()->getRecordCount($sql)) { |
|
262 | + if ($modx->getDatabase()->getRecordCount($sql)) { |
|
263 | 263 | $row = $modx->getDatabase()->getRow($sql); |
264 | 264 | $contextmenu = array( |
265 | 265 | 'header' => array( |
@@ -270,13 +270,13 @@ discard block |
||
270 | 270 | 'url' => "index.php?a=22&id=" . $row['id'] |
271 | 271 | ) |
272 | 272 | ); |
273 | - if (!empty($row['description'])) { |
|
273 | + if (!empty($row['description'])) { |
|
274 | 274 | $contextmenu['seperator'] = ''; |
275 | 275 | $contextmenu['description'] = array( |
276 | 276 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
277 | 277 | ); |
278 | 278 | } |
279 | - } else { |
|
279 | + } else { |
|
280 | 280 | $contextmenu = array( |
281 | 281 | 'header' => array( |
282 | 282 | 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | WHERE name="' . $name . '" |
298 | 298 | LIMIT 1'); |
299 | 299 | |
300 | - if ($modx->getDatabase()->getRecordCount($sql)) { |
|
300 | + if ($modx->getDatabase()->getRecordCount($sql)) { |
|
301 | 301 | $row = $modx->getDatabase()->getRow($sql); |
302 | 302 | $contextmenu = array( |
303 | 303 | 'header' => array( |
@@ -308,13 +308,13 @@ discard block |
||
308 | 308 | 'url' => "index.php?a=78&id=" . $row['id'] |
309 | 309 | ) |
310 | 310 | ); |
311 | - if (!empty($row['description'])) { |
|
311 | + if (!empty($row['description'])) { |
|
312 | 312 | $contextmenu['seperator'] = ''; |
313 | 313 | $contextmenu['description'] = array( |
314 | 314 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
315 | 315 | ); |
316 | 316 | } |
317 | - } else { |
|
317 | + } else { |
|
318 | 318 | $contextmenu = array( |
319 | 319 | 'header' => array( |
320 | 320 | 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | WHERE name="' . $name . '" |
335 | 335 | LIMIT 1'); |
336 | 336 | |
337 | - if ($modx->getDatabase()->getRecordCount($sql)) { |
|
337 | + if ($modx->getDatabase()->getRecordCount($sql)) { |
|
338 | 338 | $row = $modx->getDatabase()->getRow($sql); |
339 | 339 | $contextmenu = array( |
340 | 340 | 'header' => array( |
@@ -345,20 +345,20 @@ discard block |
||
345 | 345 | 'url' => "index.php?a=78&id=" . $row['id'] |
346 | 346 | ) |
347 | 347 | ); |
348 | - if (!empty($row['description'])) { |
|
348 | + if (!empty($row['description'])) { |
|
349 | 349 | $contextmenu['seperator'] = ''; |
350 | 350 | $contextmenu['description'] = array( |
351 | 351 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
352 | 352 | ); |
353 | 353 | } |
354 | - } else { |
|
354 | + } else { |
|
355 | 355 | |
356 | 356 | $sql = $modx->getDatabase()->query('SELECT * |
357 | 357 | FROM ' . $modx->getFullTableName('site_snippets') . ' |
358 | 358 | WHERE name="' . $name . '" |
359 | 359 | LIMIT 1'); |
360 | 360 | |
361 | - if ($modx->getDatabase()->getRecordCount($sql)) { |
|
361 | + if ($modx->getDatabase()->getRecordCount($sql)) { |
|
362 | 362 | $row = $modx->getDatabase()->getRow($sql); |
363 | 363 | $contextmenu = array( |
364 | 364 | 'header' => array( |
@@ -369,13 +369,13 @@ discard block |
||
369 | 369 | 'url' => "index.php?a=22&id=" . $row['id'] |
370 | 370 | ) |
371 | 371 | ); |
372 | - if (!empty($row['description'])) { |
|
372 | + if (!empty($row['description'])) { |
|
373 | 373 | $contextmenu['seperator'] = ''; |
374 | 374 | $contextmenu['description'] = array( |
375 | 375 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
376 | 376 | ); |
377 | 377 | } |
378 | - } else { |
|
378 | + } else { |
|
379 | 379 | $contextmenu = array( |
380 | 380 | 'header' => array( |
381 | 381 | 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | 'alias_visible' |
438 | 438 | ); |
439 | 439 | |
440 | - if (in_array($name, $default_field)) { |
|
440 | + if (in_array($name, $default_field)) { |
|
441 | 441 | return; |
442 | 442 | } |
443 | 443 | |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | WHERE name="' . $name . '" |
447 | 447 | LIMIT 1'); |
448 | 448 | |
449 | - if ($modx->getDatabase()->getRecordCount($sql)) { |
|
449 | + if ($modx->getDatabase()->getRecordCount($sql)) { |
|
450 | 450 | $row = $modx->getDatabase()->getRow($sql); |
451 | 451 | $contextmenu = array( |
452 | 452 | 'header' => array( |
@@ -457,13 +457,13 @@ discard block |
||
457 | 457 | 'url' => "index.php?a=301&id=" . $row['id'] |
458 | 458 | ) |
459 | 459 | ); |
460 | - if (!empty($row['description'])) { |
|
460 | + if (!empty($row['description'])) { |
|
461 | 461 | $contextmenu['seperator'] = ''; |
462 | 462 | $contextmenu['description'] = array( |
463 | 463 | 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
464 | 464 | ); |
465 | 465 | } |
466 | - } else { |
|
466 | + } else { |
|
467 | 467 | $contextmenu = array( |
468 | 468 | 'header' => array( |
469 | 469 | 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name |
@@ -488,13 +488,13 @@ discard block |
||
488 | 488 | case 'movedocument' : { |
489 | 489 | $json = array(); |
490 | 490 | |
491 | - if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
|
491 | + if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
|
492 | 492 | $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
493 | 493 | $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0; |
494 | 494 | $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0; |
495 | 495 | |
496 | 496 | // set parent |
497 | - if ($id && $parent >= 0) { |
|
497 | + if ($id && $parent >= 0) { |
|
498 | 498 | |
499 | 499 | // find older parent |
500 | 500 | $parentOld = $modx->getDatabase()->getValue($modx->getDatabase()->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id)); |
@@ -505,31 +505,31 @@ discard block |
||
505 | 505 | 'new_parent' => $parent, |
506 | 506 | ]); |
507 | 507 | |
508 | - if (is_array($eventOut) && count($eventOut) > 0) { |
|
508 | + if (is_array($eventOut) && count($eventOut) > 0) { |
|
509 | 509 | $eventParent = array_pop($eventOut); |
510 | 510 | |
511 | - if ($eventParent == $parentOld) { |
|
511 | + if ($eventParent == $parentOld) { |
|
512 | 512 | $json['errors'] = $_lang['error_movedocument2']; |
513 | - } else { |
|
513 | + } else { |
|
514 | 514 | $parent = $eventParent; |
515 | 515 | } |
516 | 516 | } |
517 | 517 | |
518 | - if (empty($json['errors'])) { |
|
518 | + if (empty($json['errors'])) { |
|
519 | 519 | // check privileges user for move docs |
520 | - if (!empty($modx->config['tree_show_protected']) && $role != 1) { |
|
520 | + if (!empty($modx->config['tree_show_protected']) && $role != 1) { |
|
521 | 521 | $sql = $modx->getDatabase()->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')'); |
522 | - if ($modx->getDatabase()->getRecordCount($sql)) { |
|
522 | + if ($modx->getDatabase()->getRecordCount($sql)) { |
|
523 | 523 | $document_groups = array(); |
524 | - while ($row = $modx->getDatabase()->getRow($sql)) { |
|
524 | + while ($row = $modx->getDatabase()->getRow($sql)) { |
|
525 | 525 | $document_groups[$row['document']]['groups'][] = $row['document_group']; |
526 | 526 | } |
527 | - foreach ($document_groups as $key => $value) { |
|
528 | - if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) { |
|
527 | + foreach ($document_groups as $key => $value) { |
|
528 | + if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) { |
|
529 | 529 | $json['errors'] = $_lang["error_no_privileges"]; |
530 | 530 | } |
531 | 531 | } |
532 | - if ($json['errors']) { |
|
532 | + if ($json['errors']) { |
|
533 | 533 | header('content-type: application/json'); |
534 | 534 | echo json_encode($json, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE); |
535 | 535 | break; |
@@ -537,9 +537,9 @@ discard block |
||
537 | 537 | } |
538 | 538 | } |
539 | 539 | |
540 | - if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) { |
|
540 | + if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) { |
|
541 | 541 | $json['errors'] = $_lang["error_no_privileges"]; |
542 | - } else { |
|
542 | + } else { |
|
543 | 543 | // set new parent |
544 | 544 | $modx->getDatabase()->update(array( |
545 | 545 | 'parent' => $parent |
@@ -549,13 +549,13 @@ discard block |
||
549 | 549 | 'isfolder' => 1 |
550 | 550 | ), $modx->getFullTableName('site_content'), 'id=' . $parent); |
551 | 551 | |
552 | - if ($parent != $parentOld) { |
|
552 | + if ($parent != $parentOld) { |
|
553 | 553 | // check children docs and set parent isfolder |
554 | - if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) { |
|
554 | + if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) { |
|
555 | 555 | $modx->getDatabase()->update(array( |
556 | 556 | 'isfolder' => 1 |
557 | 557 | ), $modx->getFullTableName('site_content'), 'id=' . $parentOld); |
558 | - } else { |
|
558 | + } else { |
|
559 | 559 | $modx->getDatabase()->update(array( |
560 | 560 | 'isfolder' => 0 |
561 | 561 | ), $modx->getFullTableName('site_content'), 'id=' . $parentOld); |
@@ -563,16 +563,16 @@ discard block |
||
563 | 563 | } |
564 | 564 | |
565 | 565 | // set menuindex |
566 | - if (!empty($menuindex)) { |
|
566 | + if (!empty($menuindex)) { |
|
567 | 567 | $menuindex = explode(',', $menuindex); |
568 | - foreach ($menuindex as $key => $value) { |
|
568 | + foreach ($menuindex as $key => $value) { |
|
569 | 569 | $modx->getDatabase()->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value); |
570 | 570 | } |
571 | - } else { |
|
571 | + } else { |
|
572 | 572 | // TODO: max(*) menuindex |
573 | 573 | } |
574 | 574 | |
575 | - if (!$json['errors']) { |
|
575 | + if (!$json['errors']) { |
|
576 | 576 | $json['success'] = $_lang["actioncomplete"]; |
577 | 577 | |
578 | 578 | $modx->invokeEvent('onAfterMoveDocument', [ |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | } |
585 | 585 | } |
586 | 586 | } |
587 | - } else { |
|
587 | + } else { |
|
588 | 588 | $json['errors'] = $_lang["error_no_privileges"]; |
589 | 589 | } |
590 | 590 | |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | |
601 | 601 | $output = !!$modx->elementIsLocked($type, $id, true); |
602 | 602 | |
603 | - if (!$output) { |
|
603 | + if (!$output) { |
|
604 | 604 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
605 | 605 | $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : ''; |
606 | 606 | $sql = ' |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id |
610 | 610 | WHERE sc.id=' . $id . ' GROUP BY sc.id'; |
611 | 611 | $sql = $modx->getDatabase()->query($sql); |
612 | - if ($modx->getDatabase()->getRecordCount($sql)) { |
|
612 | + if ($modx->getDatabase()->getRecordCount($sql)) { |
|
613 | 613 | $row = $modx->getDatabase()->getRow($sql); |
614 | 614 | $output = !!$row['locked']; |
615 | 615 | } |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | // invoke OnManagerTreeInit event |
7 | 7 | $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST); |
8 | 8 | if(is_array($evtOut)) { |
9 | - echo implode("\n", $evtOut); |
|
9 | + echo implode("\n", $evtOut); |
|
10 | 10 | } |
11 | 11 | ?> |
12 | 12 | |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | |
53 | 53 | <div id="treeHolder"> |
54 | 54 | <?php |
55 | - // invoke OnManagerTreePrerender event |
|
56 | - $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST)); |
|
57 | - if(is_array($evtOut)) { |
|
58 | - echo implode("\n", $evtOut); |
|
59 | - } |
|
60 | - ?> |
|
55 | + // invoke OnManagerTreePrerender event |
|
56 | + $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST)); |
|
57 | + if(is_array($evtOut)) { |
|
58 | + echo implode("\n", $evtOut); |
|
59 | + } |
|
60 | + ?> |
|
61 | 61 | <div id="node0" class="rootNode"><a class="node" onclick="modx.tree.treeAction(event, 0)" data-id="0" data-title-esc="<?php $site_name = htmlspecialchars($site_name, ENT_QUOTES, $modx->config['modx_charset']); |
62 | - echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a> |
|
62 | + echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a> |
|
63 | 63 | <div id="treeloader"><i class="fa fa-cog fa-spin fa-3x fa-fw"></i></div> |
64 | 64 | </div> |
65 | 65 | <div id="treeRoot"></div> |
66 | 66 | <?php |
67 | - // invoke OnManagerTreeRender event |
|
68 | - $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST)); |
|
69 | - if(is_array($evtOut)) { |
|
70 | - echo implode("\n", $evtOut); |
|
71 | - } |
|
72 | - ?> |
|
67 | + // invoke OnManagerTreeRender event |
|
68 | + $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST)); |
|
69 | + if(is_array($evtOut)) { |
|
70 | + echo implode("\n", $evtOut); |
|
71 | + } |
|
72 | + ?> |
|
73 | 73 | </div> |
74 | 74 | </div> |
@@ -1,11 +1,11 @@ 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 | // invoke OnManagerTreeInit event |
7 | 7 | $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST); |
8 | -if(is_array($evtOut)) { |
|
8 | +if (is_array($evtOut)) { |
|
9 | 9 | echo implode("\n", $evtOut); |
10 | 10 | } |
11 | 11 | ?> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | <a class="treeButton" id="treeMenu_collapsetree" onclick="modx.tree.collapseTree();" title="<?php echo $_lang['collapse_tree']; ?>"><?php echo $_style['collapse_tree']; ?></a> |
19 | 19 | |
20 | - <?php if($modx->hasPermission('new_document')) { ?> |
|
20 | + <?php if ($modx->hasPermission('new_document')) { ?> |
|
21 | 21 | <a class="treeButton" id="treeMenu_addresource" onclick="modx.tabs({url:'<?= MODX_MANAGER_URL ?>?a=4', title: '<?php echo $_lang['add_resource']; ?>'});" title="<?php echo $_lang['add_resource']; ?>"><?php echo $_style['add_doc_tree']; ?></a> |
22 | 22 | <a class="treeButton" id="treeMenu_addweblink" onclick="modx.tabs({url:'<?= MODX_MANAGER_URL ?>?a=72', title: '<?php echo $_lang['add_weblink']; ?>'});" title="<?php echo $_lang['add_weblink']; ?>"><?php echo $_style['add_weblink_tree']; ?></a> |
23 | 23 | <?php } ?> |
@@ -26,23 +26,23 @@ discard block |
||
26 | 26 | |
27 | 27 | <a class="treeButton" id="treeMenu_sortingtree" onclick="modx.tree.showSorter(event);" title="<?php echo $_lang['sort_tree']; ?>"><?php echo $_style['sort_tree']; ?></a> |
28 | 28 | |
29 | - <?php if($modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { ?> |
|
29 | + <?php if ($modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { ?> |
|
30 | 30 | <a class="treeButton" id="treeMenu_sortingindex" onclick="modx.tabs({url: '<?= MODX_MANAGER_URL ?>?a=56&id=0', title: '<?php echo $_lang['sort_menuindex']; ?>'});" title="<?php echo $_lang['sort_menuindex']; ?>"><?php echo $_style['sort_menuindex']; ?></a> |
31 | 31 | <?php } ?> |
32 | 32 | |
33 | - <?php if($use_browser && $modx->hasPermission('assets_images')) { ?> |
|
34 | - <a class="treeButton" id="treeMenu_openimages" title="<?php echo $_lang["images_management"] . "\n" . $_lang['em_button_shift'] ?>"><?php echo $_style['images_management']; ?></a> |
|
33 | + <?php if ($use_browser && $modx->hasPermission('assets_images')) { ?> |
|
34 | + <a class="treeButton" id="treeMenu_openimages" title="<?php echo $_lang["images_management"]."\n".$_lang['em_button_shift'] ?>"><?php echo $_style['images_management']; ?></a> |
|
35 | 35 | <?php } ?> |
36 | 36 | |
37 | - <?php if($use_browser && $modx->hasPermission('assets_files')) { ?> |
|
38 | - <a class="treeButton" id="treeMenu_openfiles" title="<?php echo $_lang["files_management"] . "\n" . $_lang['em_button_shift'] ?>"><?php echo $_style['files_management']; ?></a> |
|
37 | + <?php if ($use_browser && $modx->hasPermission('assets_files')) { ?> |
|
38 | + <a class="treeButton" id="treeMenu_openfiles" title="<?php echo $_lang["files_management"]."\n".$_lang['em_button_shift'] ?>"><?php echo $_style['files_management']; ?></a> |
|
39 | 39 | <?php } ?> |
40 | 40 | |
41 | - <?php if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?> |
|
42 | - <a class="treeButton" id="treeMenu_openelements" title="<?php echo $_lang["element_management"] . "\n" . $_lang['em_button_shift'] ?>"><?php echo $_style['element_management']; ?></a> |
|
41 | + <?php if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?> |
|
42 | + <a class="treeButton" id="treeMenu_openelements" title="<?php echo $_lang["element_management"]."\n".$_lang['em_button_shift'] ?>"><?php echo $_style['element_management']; ?></a> |
|
43 | 43 | <?php } ?> |
44 | 44 | |
45 | - <?php if($modx->hasPermission('empty_trash')) { ?> |
|
45 | + <?php if ($modx->hasPermission('empty_trash')) { ?> |
|
46 | 46 | <a class="treeButton treeButtonDisabled" id="treeMenu_emptytrash" title="<?php echo $_lang['empty_recycle_bin_empty']; ?>"><?php echo $_style['empty_recycle_bin_empty']; ?></a> |
47 | 47 | <?php } ?> |
48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | <?php |
55 | 55 | // invoke OnManagerTreePrerender event |
56 | 56 | $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST)); |
57 | - if(is_array($evtOut)) { |
|
57 | + if (is_array($evtOut)) { |
|
58 | 58 | echo implode("\n", $evtOut); |
59 | 59 | } |
60 | 60 | ?> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | <?php |
67 | 67 | // invoke OnManagerTreeRender event |
68 | 68 | $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST)); |
69 | - if(is_array($evtOut)) { |
|
69 | + if (is_array($evtOut)) { |
|
70 | 70 | echo implode("\n", $evtOut); |
71 | 71 | } |
72 | 72 | ?> |
@@ -1,11 +1,11 @@ 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 | // invoke OnManagerTreeInit event |
7 | 7 | $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST); |
8 | -if(is_array($evtOut)) { |
|
8 | +if(is_array($evtOut)) { |
|
9 | 9 | echo implode("\n", $evtOut); |
10 | 10 | } |
11 | 11 | ?> |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | <?php |
55 | 55 | // invoke OnManagerTreePrerender event |
56 | 56 | $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST)); |
57 | - if(is_array($evtOut)) { |
|
57 | + if(is_array($evtOut)) { |
|
58 | 58 | echo implode("\n", $evtOut); |
59 | 59 | } |
60 | 60 | ?> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | <?php |
67 | 67 | // invoke OnManagerTreeRender event |
68 | 68 | $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST)); |
69 | - if(is_array($evtOut)) { |
|
69 | + if(is_array($evtOut)) { |
|
70 | 70 | echo implode("\n", $evtOut); |
71 | 71 | } |
72 | 72 | ?> |
@@ -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 | header("X-XSS-Protection: 0"); |
@@ -11,22 +11,22 @@ discard block |
||
11 | 11 | |
12 | 12 | $mxla = $modx_lang_attribute ? $modx_lang_attribute : 'en'; |
13 | 13 | |
14 | -if (!isset($modx->config['manager_menu_height'])) { |
|
14 | +if (!isset($modx->config['manager_menu_height'])) { |
|
15 | 15 | $modx->config['manager_menu_height'] = 2.2; // rem |
16 | 16 | } |
17 | 17 | |
18 | -if (!isset($modx->config['manager_tree_width'])) { |
|
18 | +if (!isset($modx->config['manager_tree_width'])) { |
|
19 | 19 | $modx->config['manager_tree_width'] = 20; // rem |
20 | 20 | } |
21 | 21 | |
22 | -if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) { |
|
22 | +if (isset($_SESSION['onLoginForwardToAction']) && is_int($_SESSION['onLoginForwardToAction'])) { |
|
23 | 23 | $initMainframeAction = $_SESSION['onLoginForwardToAction']; |
24 | 24 | unset($_SESSION['onLoginForwardToAction']); |
25 | -} else { |
|
25 | +} else { |
|
26 | 26 | $initMainframeAction = 2; // welcome.static |
27 | 27 | } |
28 | 28 | |
29 | -if (!isset($_SESSION['tree_show_only_folders'])) { |
|
29 | +if (!isset($_SESSION['tree_show_only_folders'])) { |
|
30 | 30 | $_SESSION['tree_show_only_folders'] = 0; |
31 | 31 | } |
32 | 32 | |
@@ -35,29 +35,29 @@ discard block |
||
35 | 35 | $tree_width = $modx->config['manager_tree_width']; |
36 | 36 | $tree_min_width = 0; |
37 | 37 | |
38 | -if (isset($_COOKIE['MODX_widthSideBar'])) { |
|
38 | +if (isset($_COOKIE['MODX_widthSideBar'])) { |
|
39 | 39 | $MODX_widthSideBar = $_COOKIE['MODX_widthSideBar']; |
40 | -} else { |
|
40 | +} else { |
|
41 | 41 | $MODX_widthSideBar = $tree_width; |
42 | 42 | } |
43 | 43 | |
44 | -if (!$MODX_widthSideBar) { |
|
44 | +if (!$MODX_widthSideBar) { |
|
45 | 45 | $body_class .= 'sidebar-closed'; |
46 | 46 | } |
47 | 47 | |
48 | 48 | $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness'); |
49 | -if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) { |
|
49 | +if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) { |
|
50 | 50 | $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']]; |
51 | -} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) { |
|
51 | +} elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) { |
|
52 | 52 | $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']]; |
53 | 53 | } |
54 | 54 | |
55 | 55 | $navbar_position = $modx->config['manager_menu_position']; |
56 | -if ($navbar_position == 'left') { |
|
56 | +if ($navbar_position == 'left') { |
|
57 | 57 | $body_class .= ' navbar-left navbar-left-icon-and-text'; |
58 | 58 | } |
59 | 59 | |
60 | -if (isset($modx->pluginCache['ElementsInTree'])) { |
|
60 | +if (isset($modx->pluginCache['ElementsInTree'])) { |
|
61 | 61 | $body_class .= ' ElementsInTree'; |
62 | 62 | } |
63 | 63 | |
@@ -73,19 +73,19 @@ discard block |
||
73 | 73 | 'type8' => $_lang["lock_element_type_8"] |
74 | 74 | ); |
75 | 75 | |
76 | -foreach ($unlockTranslations as $key => $value) { |
|
76 | +foreach ($unlockTranslations as $key => $value) { |
|
77 | 77 | $unlockTranslations[$key] = iconv($modx->config["modx_charset"], "utf-8", $value); |
78 | 78 | } |
79 | 79 | |
80 | 80 | $user = $modx->getUserInfo($modx->getLoginUserID()); |
81 | -if ($user['which_browser'] == 'default') { |
|
81 | +if ($user['which_browser'] == 'default') { |
|
82 | 82 | $user['which_browser'] = $modx->config['which_browser']; |
83 | 83 | } |
84 | 84 | |
85 | 85 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/page.css?v=' . $lastInstallTime; |
86 | 86 | |
87 | -if ($modx->config['manager_theme'] == 'default') { |
|
88 | - if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
87 | +if ($modx->config['manager_theme'] == 'default') { |
|
88 | + if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css') && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) { |
|
89 | 89 | require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php'; |
90 | 90 | $minifier = new Formatter\CSSMinify(); |
91 | 91 | $minifier->addFile(MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css'); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $css = $minifier->minify(); |
103 | 103 | file_put_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css', $css); |
104 | 104 | } |
105 | - if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
105 | + if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) { |
|
106 | 106 | $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime; |
107 | 107 | } |
108 | 108 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | <?php |
258 | 258 | // invoke OnManagerTopPrerender event |
259 | 259 | $evtOut = $modx->invokeEvent('OnManagerTopPrerender', $_REQUEST); |
260 | - if (is_array($evtOut)) { |
|
260 | + if (is_array($evtOut)) { |
|
261 | 261 | echo implode("\n", $evtOut); |
262 | 262 | } |
263 | 263 | ?> |
@@ -428,11 +428,14 @@ discard block |
||
428 | 428 | <div id="evo-tab-page-home" class="evo-tab-page show iframe-scroller"> |
429 | 429 | <iframe id="mainframe" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> |
430 | 430 | </div> |
431 | - <?php else: ?> |
|
431 | + <?php else { |
|
432 | + : ?> |
|
432 | 433 | <div class="iframe-scroller"> |
433 | 434 | <iframe id="mainframe" name="main" src="index.php?a=<?= $initMainframeAction ?>" scrolling="auto" frameborder="0" onload="modx.main.onload(event);"></iframe> |
434 | 435 | </div> |
435 | - <?php endif; ?> |
|
436 | + <?php endif; |
|
437 | +} |
|
438 | +?> |
|
436 | 439 | <script> |
437 | 440 | if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) { |
438 | 441 | document.getElementById('mainframe').setAttribute('scrolling', 'no'); |
@@ -451,11 +454,11 @@ discard block |
||
451 | 454 | 'tree_sortdir', |
452 | 455 | 'tree_nodename' |
453 | 456 | ); |
454 | - foreach ($sortParams as $param) { |
|
455 | - if (isset($_REQUEST[$param])) { |
|
457 | + foreach ($sortParams as $param) { |
|
458 | + if (isset($_REQUEST[$param])) { |
|
456 | 459 | $modx->getManagerApi()->saveLastUserSetting($param, $_REQUEST[$param]); |
457 | 460 | $_SESSION[$param] = $_REQUEST[$param]; |
458 | - } else if (!isset($_SESSION[$param])) { |
|
461 | + } else if (!isset($_SESSION[$param])) { |
|
459 | 462 | $_SESSION[$param] = $modx->getManagerApi()->getLastUserSetting($param); |
460 | 463 | } |
461 | 464 | } |
@@ -506,16 +509,16 @@ discard block |
||
506 | 509 | </div> |
507 | 510 | |
508 | 511 | <?php |
509 | - if(!function_exists('constructLink')) { |
|
512 | + if(!function_exists('constructLink')) { |
|
510 | 513 | /** |
511 | 514 | * @param string $action |
512 | 515 | * @param string $img |
513 | 516 | * @param string $text |
514 | 517 | * @param bool $allowed |
515 | 518 | */ |
516 | - function constructLink($action, $img, $text, $allowed) |
|
517 | - { |
|
518 | - if ((bool)$allowed) { |
|
519 | + function constructLink($action, $img, $text, $allowed) |
|
520 | + { |
|
521 | + if ((bool)$allowed) { |
|
519 | 522 | echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action, |
520 | 523 | $action); |
521 | 524 | echo sprintf('<i class="%s"></i> %s</div>', $img, $text); |
@@ -650,7 +653,7 @@ discard block |
||
650 | 653 | ?> |
651 | 654 | |
652 | 655 | </div> |
653 | -<?php if ($modx->config['show_picker'] != "0") { |
|
656 | +<?php if ($modx->config['show_picker'] != "0") { |
|
654 | 657 | include('media/style/' . $modx->config['manager_theme'] . '/color.switcher.php'); |
655 | 658 | } ?> |
656 | 659 | </body> |