@@ -893,7 +893,9 @@ |
||
893 | 893 | global $modx, $_lang, $startpath, $filemanager_path, $uploadablefiles, $new_file_permissions; |
894 | 894 | $msg = ''; |
895 | 895 | foreach ($_FILES['userfile']['name'] as $i => $name) { |
896 | - if (empty($_FILES['userfile']['tmp_name'][$i])) continue; |
|
896 | + if (empty($_FILES['userfile']['tmp_name'][$i])) { |
|
897 | + continue; |
|
898 | + } |
|
897 | 899 | $userfile= array(); |
898 | 900 | |
899 | 901 | $userfile['tmp_name'] = $_FILES['userfile']['tmp_name'][$i]; |
@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | * @param string $filename |
6 | 6 | * @return array of keys from a language file |
7 | 7 | */ |
8 | -function get_lang_keys($filename) |
|
9 | -{ |
|
8 | +function get_lang_keys($filename) |
|
9 | +{ |
|
10 | 10 | $file = MODX_MANAGER_PATH . 'includes/lang' . DIRECTORY_SEPARATOR . $filename; |
11 | - if (is_file($file) && is_readable($file)) { |
|
11 | + if (is_file($file) && is_readable($file)) { |
|
12 | 12 | include($file); |
13 | 13 | $out = isset($_lang) ? array_keys($_lang) : array(); |
14 | - } else { |
|
14 | + } else { |
|
15 | 15 | $out = array(); |
16 | 16 | } |
17 | 17 | |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @param string $key |
25 | 25 | * @return array of languages that define the key in their file |
26 | 26 | */ |
27 | -function get_langs_by_key($key) |
|
28 | -{ |
|
27 | +function get_langs_by_key($key) |
|
28 | +{ |
|
29 | 29 | global $lang_keys; |
30 | 30 | $lang_return = array(); |
31 | - foreach ($lang_keys as $lang => $keys) { |
|
32 | - if (in_array($key, $keys)) { |
|
31 | + foreach ($lang_keys as $lang => $keys) { |
|
32 | + if (in_array($key, $keys)) { |
|
33 | 33 | $lang_return[] = $lang; |
34 | 34 | } |
35 | 35 | } |
@@ -46,25 +46,25 @@ discard block |
||
46 | 46 | * @param string $selected_lang specify language to select in option list, default none |
47 | 47 | * @return string html option list |
48 | 48 | */ |
49 | -function get_lang_options($key = '', $selected_lang = '') |
|
50 | -{ |
|
49 | +function get_lang_options($key = '', $selected_lang = '') |
|
50 | +{ |
|
51 | 51 | global $lang_keys, $_lang; |
52 | 52 | $lang_options = ''; |
53 | - if (!empty($key)) { |
|
53 | + if (!empty($key)) { |
|
54 | 54 | $languages = get_langs_by_key($key); |
55 | 55 | sort($languages); |
56 | 56 | $lang_options .= '<option value="">' . $_lang['language_title'] . '</option>'; |
57 | 57 | |
58 | - foreach ($languages as $language_name) { |
|
58 | + foreach ($languages as $language_name) { |
|
59 | 59 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
60 | 60 | $lang_options .= '<option value="' . $language_name . '">' . $uclanguage_name . '</option>'; |
61 | 61 | } |
62 | 62 | |
63 | 63 | return $lang_options; |
64 | - } else { |
|
64 | + } else { |
|
65 | 65 | $languages = array_keys($lang_keys); |
66 | 66 | sort($languages); |
67 | - foreach ($languages as $language_name) { |
|
67 | + foreach ($languages as $language_name) { |
|
68 | 68 | $uclanguage_name = ucwords(str_replace("_", " ", $language_name)); |
69 | 69 | $sel = $language_name === $selected_lang ? ' selected="selected"' : ''; |
70 | 70 | $lang_options .= '<option value="' . $language_name . '" ' . $sel . '>' . $uclanguage_name . '</option>'; |
@@ -81,17 +81,17 @@ discard block |
||
81 | 81 | * @param bool $disabled |
82 | 82 | * @return string |
83 | 83 | */ |
84 | -function form_radio($name, $value, $add = '', $disabled = false) |
|
85 | -{ |
|
84 | +function form_radio($name, $value, $add = '', $disabled = false) |
|
85 | +{ |
|
86 | 86 | global ${$name}; |
87 | 87 | $var = ${$name}; |
88 | 88 | $checked = ($var == $value) ? ' checked="checked"' : ''; |
89 | - if ($disabled) { |
|
89 | + if ($disabled) { |
|
90 | 90 | $disabled = ' disabled'; |
91 | - } else { |
|
91 | + } else { |
|
92 | 92 | $disabled = ''; |
93 | 93 | } |
94 | - if ($add) { |
|
94 | + if ($add) { |
|
95 | 95 | $add = ' ' . $add; |
96 | 96 | } |
97 | 97 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param string $object |
105 | 105 | * @return string |
106 | 106 | */ |
107 | -function wrap_label($str = '', $object) |
|
108 | -{ |
|
107 | +function wrap_label($str = '', $object) |
|
108 | +{ |
|
109 | 109 | return "<label>{$object}\n{$str}</label>"; |
110 | 110 | } |
111 | 111 | |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | * @param array $ph |
115 | 115 | * @return string |
116 | 116 | */ |
117 | -function parseText($tpl = '', $ph = array()) |
|
118 | -{ |
|
119 | - if (empty($ph) || empty($tpl)) { |
|
117 | +function parseText($tpl = '', $ph = array()) |
|
118 | +{ |
|
119 | + if (empty($ph) || empty($tpl)) { |
|
120 | 120 | return $tpl; |
121 | 121 | } |
122 | 122 | |
123 | - foreach ($ph as $k => $v) { |
|
123 | + foreach ($ph as $k => $v) { |
|
124 | 124 | $k = "[+{$k}+]"; |
125 | 125 | $tpl = str_replace($k, $v, $tpl); |
126 | 126 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param bool $cond |
133 | 133 | * @return string |
134 | 134 | */ |
135 | -function showHide($cond = true) |
|
136 | -{ |
|
135 | +function showHide($cond = true) |
|
136 | +{ |
|
137 | 137 | global $displayStyle; |
138 | 138 | $showHide = $cond ? $displayStyle : 'none'; |
139 | 139 |
@@ -478,7 +478,8 @@ discard block |
||
478 | 478 | return s; |
479 | 479 | } |
480 | 480 | |
481 | - <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
481 | + <?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
482 | +// Web Link specific ?> |
|
482 | 483 | var lastImageCtrl; |
483 | 484 | var lastFileCtrl; |
484 | 485 | |
@@ -694,7 +695,8 @@ discard block |
||
694 | 695 | </td> |
695 | 696 | </tr> |
696 | 697 | |
697 | - <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?> |
|
698 | + <?php if($content['type'] == 'reference' || $modx->manager->action == '72') { |
|
699 | +// Web Link specific ?> |
|
698 | 700 | |
699 | 701 | <tr> |
700 | 702 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -1353,7 +1355,9 @@ discard block |
||
1353 | 1355 | if($documentId > 0) { |
1354 | 1356 | // Load up, the permissions from the parent (if new document) or existing document |
1355 | 1357 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1356 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1358 | + while($currentgroup = $modx->db->getRow($rs)) { |
|
1359 | + $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1360 | + } |
|
1357 | 1361 | |
1358 | 1362 | // Load up the current permissions and names |
1359 | 1363 | $vs = array( |
@@ -1415,7 +1419,9 @@ discard block |
||
1415 | 1419 | |
1416 | 1420 | // Create attribute string list |
1417 | 1421 | $inputString = array(); |
1418 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1422 | + foreach($inputAttributes as $k => $v) { |
|
1423 | + $inputString[] = $k . '="' . $v . '"'; |
|
1424 | + } |
|
1419 | 1425 | |
1420 | 1426 | // Make the <input> HTML |
1421 | 1427 | $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
@@ -1535,7 +1541,8 @@ discard block |
||
1535 | 1541 | /** |
1536 | 1542 | * @return string |
1537 | 1543 | */ |
1538 | -function getDefaultTemplate() { |
|
1544 | +function getDefaultTemplate() |
|
1545 | +{ |
|
1539 | 1546 | global $modx; |
1540 | 1547 | |
1541 | 1548 | $default_template = ''; |
@@ -1,15 +1,15 @@ 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 | -switch($modx->manager->action) { |
|
5 | +switch($modx->manager->action) { |
|
6 | 6 | case 107: |
7 | - if(!$modx->hasPermission('new_module')) { |
|
7 | + if(!$modx->hasPermission('new_module')) { |
|
8 | 8 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
9 | 9 | } |
10 | 10 | break; |
11 | 11 | case 108: |
12 | - if(!$modx->hasPermission('edit_module')) { |
|
12 | + if(!$modx->hasPermission('edit_module')) { |
|
13 | 13 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
14 | 14 | } |
15 | 15 | break; |
@@ -33,7 +33,8 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return string |
35 | 35 | */ |
36 | -function createGUID() { |
|
36 | +function createGUID() |
|
37 | +{ |
|
37 | 38 | srand((double) microtime() * 1000000); |
38 | 39 | $r = rand(); |
39 | 40 | $u = uniqid(getmypid() . $r . (double) microtime() * 1000000, 1); |
@@ -42,7 +43,7 @@ discard block |
||
42 | 43 | } |
43 | 44 | |
44 | 45 | // check to see the module editor isn't locked |
45 | -if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
46 | +if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
46 | 47 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
47 | 48 | } |
48 | 49 | // end check for lock |
@@ -50,22 +51,22 @@ discard block |
||
50 | 51 | // Lock snippet for other users to edit |
51 | 52 | $modx->lockElement(6, $id); |
52 | 53 | |
53 | -if(isset($_GET['id'])) { |
|
54 | +if(isset($_GET['id'])) { |
|
54 | 55 | $rs = $modx->db->select('*', $tbl_site_modules, "id='{$id}'"); |
55 | 56 | $content = $modx->db->getRow($rs); |
56 | - if(!$content) { |
|
57 | + if(!$content) { |
|
57 | 58 | $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
58 | 59 | } |
59 | 60 | $content['properties'] = str_replace("&", "&", $content['properties']); |
60 | 61 | $_SESSION['itemname'] = $content['name']; |
61 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
62 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
62 | 63 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
63 | 64 | } |
64 | -} else { |
|
65 | +} else { |
|
65 | 66 | $_SESSION['itemname'] = $_lang["new_module"]; |
66 | 67 | $content['wrap'] = '1'; |
67 | 68 | } |
68 | -if($modx->manager->hasFormValues()) { |
|
69 | +if($modx->manager->hasFormValues()) { |
|
69 | 70 | $modx->manager->loadFormValues(); |
70 | 71 | } |
71 | 72 | |
@@ -439,7 +440,7 @@ discard block |
||
439 | 440 | <?php |
440 | 441 | // invoke OnModFormPrerender event |
441 | 442 | $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
442 | - if(is_array($evtOut)) { |
|
443 | + if(is_array($evtOut)) { |
|
443 | 444 | echo implode('', $evtOut); |
444 | 445 | } |
445 | 446 | |
@@ -502,7 +503,7 @@ discard block |
||
502 | 503 | <option> </option> |
503 | 504 | <?php |
504 | 505 | include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
505 | - foreach(getCategories() as $n => $v) { |
|
506 | + foreach(getCategories() as $n => $v) { |
|
506 | 507 | echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . "</option>\n"; |
507 | 508 | } |
508 | 509 | ?> |
@@ -654,7 +655,7 @@ discard block |
||
654 | 655 | $rs = $modx->db->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
655 | 656 | $groupsarray = $modx->db->getColumn('usergroup', $rs); |
656 | 657 | |
657 | - if($modx->hasPermission('access_permissions')) { |
|
658 | + if($modx->hasPermission('access_permissions')) { |
|
658 | 659 | ?> |
659 | 660 | <!-- User Group Access Permissions --> |
660 | 661 | <script type="text/javascript"> |
@@ -682,21 +683,21 @@ discard block |
||
682 | 683 | } |
683 | 684 | $chk = ''; |
684 | 685 | $rs = $modx->db->select('name, id', $tbl_membergroup_names, '', 'name'); |
685 | - while($row = $modx->db->getRow($rs)) { |
|
686 | + while($row = $modx->db->getRow($rs)) { |
|
686 | 687 | $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
687 | 688 | $checked = in_array($row['id'], $groupsarray); |
688 | - if($modx->hasPermission('access_permissions')) { |
|
689 | - if($checked) { |
|
689 | + if($modx->hasPermission('access_permissions')) { |
|
690 | + if($checked) { |
|
690 | 691 | $notPublic = true; |
691 | 692 | } |
692 | 693 | $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
693 | - } else { |
|
694 | - if($checked) { |
|
694 | + } else { |
|
695 | + if($checked) { |
|
695 | 696 | $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
696 | 697 | } |
697 | 698 | } |
698 | 699 | } |
699 | - if($modx->hasPermission('access_permissions')) { |
|
700 | + if($modx->hasPermission('access_permissions')) { |
|
700 | 701 | $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
701 | 702 | } |
702 | 703 | echo $chks; |
@@ -718,7 +719,7 @@ discard block |
||
718 | 719 | <?php |
719 | 720 | // invoke OnModFormRender event |
720 | 721 | $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
721 | - if(is_array($evtOut)) { |
|
722 | + if(is_array($evtOut)) { |
|
722 | 723 | echo implode('', $evtOut); |
723 | 724 | } |
724 | 725 | ?> |
@@ -104,7 +104,8 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @return string |
106 | 106 | */ |
107 | -function run() { |
|
107 | +function run() |
|
108 | +{ |
|
108 | 109 | global $modx, $_lang; |
109 | 110 | |
110 | 111 | $tbl_site_content = $modx->getFullTableName('site_content'); |
@@ -171,7 +172,8 @@ discard block |
||
171 | 172 | * @param array $files |
172 | 173 | * @param string $mode |
173 | 174 | */ |
174 | -function importFiles($parent, $filedir, $files, $mode) { |
|
175 | +function importFiles($parent, $filedir, $files, $mode) |
|
176 | +{ |
|
175 | 177 | global $modx; |
176 | 178 | global $_lang, $allowedfiles; |
177 | 179 | global $search_default, $cache_default, $publish_default; |
@@ -318,7 +320,8 @@ discard block |
||
318 | 320 | * @param int $count |
319 | 321 | * @return array |
320 | 322 | */ |
321 | -function getFiles($directory, $listing = array(), $count = 0) { |
|
323 | +function getFiles($directory, $listing = array(), $count = 0) |
|
324 | +{ |
|
322 | 325 | global $_lang; |
323 | 326 | global $filesfound; |
324 | 327 | $dummy = $count; |
@@ -346,7 +349,8 @@ discard block |
||
346 | 349 | * @param string $filepath |
347 | 350 | * @return bool|string |
348 | 351 | */ |
349 | -function getFileContent($filepath) { |
|
352 | +function getFileContent($filepath) |
|
353 | +{ |
|
350 | 354 | global $_lang; |
351 | 355 | // get the file |
352 | 356 | if(!$buffer = file_get_contents($filepath)) { |
@@ -360,7 +364,8 @@ discard block |
||
360 | 364 | * @param array $array |
361 | 365 | * @return array |
362 | 366 | */ |
363 | -function pop_index($array) { |
|
367 | +function pop_index($array) |
|
368 | +{ |
|
364 | 369 | $new_array = array(); |
365 | 370 | foreach($array as $k => $v) { |
366 | 371 | if($v !== 'index.html' && $v !== 'index.htm') { |
@@ -383,7 +388,8 @@ discard block |
||
383 | 388 | * @param string $alias |
384 | 389 | * @return array |
385 | 390 | */ |
386 | -function treatContent($src, $filename, $alias) { |
|
391 | +function treatContent($src, $filename, $alias) |
|
392 | +{ |
|
387 | 393 | global $modx; |
388 | 394 | |
389 | 395 | $src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII'); |
@@ -427,7 +433,8 @@ discard block |
||
427 | 433 | /** |
428 | 434 | * @return void |
429 | 435 | */ |
430 | -function convertLink() { |
|
436 | +function convertLink() |
|
437 | +{ |
|
431 | 438 | global $modx; |
432 | 439 | $tbl_site_content = $modx->getFullTableName('site_content'); |
433 | 440 |
@@ -299,7 +299,8 @@ |
||
299 | 299 | * @param string $status |
300 | 300 | * @return string |
301 | 301 | */ |
302 | -function render_form($name, $label, $status = '') { |
|
302 | +function render_form($name, $label, $status = '') |
|
303 | +{ |
|
303 | 304 | global $modx, $roledata; |
304 | 305 | |
305 | 306 | $tpl = '<label class="d-block" for="[+name+]check"> |
@@ -1,8 +1,8 @@ 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 | -if (!$modx->hasPermission('logs')) { |
|
5 | +if (!$modx->hasPermission('logs')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -11,17 +11,17 @@ discard block |
||
11 | 11 | * @param string $checkKey |
12 | 12 | * @return array |
13 | 13 | */ |
14 | -function array_unique_multi($array, $checkKey) |
|
15 | -{ |
|
14 | +function array_unique_multi($array, $checkKey) |
|
15 | +{ |
|
16 | 16 | // Use the builtin if we're not a multi-dimensional array |
17 | - if (!is_array(current($array)) || empty($checkKey)) { |
|
17 | + if (!is_array(current($array)) || empty($checkKey)) { |
|
18 | 18 | return array_unique($array); |
19 | 19 | } |
20 | 20 | |
21 | 21 | $ret = array(); |
22 | 22 | $checkValues = array(); // contains the unique key Values |
23 | - foreach ($array as $key => $current) { |
|
24 | - if (in_array($current[$checkKey], $checkValues)) { |
|
23 | + foreach ($array as $key => $current) { |
|
24 | + if (in_array($current[$checkKey], $checkValues)) { |
|
25 | 25 | continue; |
26 | 26 | } // duplicate |
27 | 27 | |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | * @param string $key |
37 | 37 | * @return array |
38 | 38 | */ |
39 | -function record_sort($array, $key) |
|
40 | -{ |
|
39 | +function record_sort($array, $key) |
|
40 | +{ |
|
41 | 41 | $hash = array(); |
42 | - foreach ($array as $k => $v) { |
|
42 | + foreach ($array as $k => $v) { |
|
43 | 43 | $hash[$k] = $v[$key]; |
44 | 44 | } |
45 | 45 | |
46 | 46 | natsort($hash); |
47 | 47 | |
48 | 48 | $records = array(); |
49 | - foreach ($hash as $k => $row) { |
|
49 | + foreach ($hash as $k => $row) { |
|
50 | 50 | $records[$k] = $array[$k]; |
51 | 51 | } |
52 | 52 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | <?php |
74 | 74 | // get all users currently in the log |
75 | 75 | $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username'); |
76 | - foreach ($logs_user as $row) { |
|
76 | + foreach ($logs_user as $row) { |
|
77 | 77 | $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : ''; |
78 | 78 | echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n"; |
79 | 79 | } |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | // get all available actions in the log |
91 | 91 | include_once "actionlist.inc.php"; |
92 | 92 | $logs_actions = record_sort(array_unique_multi($logs, 'action'), 'action'); |
93 | - foreach ($logs_actions as $row) { |
|
93 | + foreach ($logs_actions as $row) { |
|
94 | 94 | $action = getAction($row['action']); |
95 | - if ($action == 'Idle') { |
|
95 | + if ($action == 'Idle') { |
|
96 | 96 | continue; |
97 | 97 | } |
98 | 98 | $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : ''; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | <?php |
111 | 111 | // get all itemid currently in logging |
112 | 112 | $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid'); |
113 | - foreach ($logs_items as $row) { |
|
113 | + foreach ($logs_items as $row) { |
|
114 | 114 | $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : ''; |
115 | 115 | echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n"; |
116 | 116 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | <?php |
127 | 127 | // get all itemname currently in logging |
128 | 128 | $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname'); |
129 | - foreach ($logs_names as $row) { |
|
129 | + foreach ($logs_names as $row) { |
|
130 | 130 | $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : ''; |
131 | 131 | echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n"; |
132 | 132 | } |
@@ -182,36 +182,36 @@ discard block |
||
182 | 182 | <div class="container container-body"> |
183 | 183 | |
184 | 184 | <?php |
185 | -if (isset($_REQUEST['log_submit'])) { |
|
185 | +if (isset($_REQUEST['log_submit'])) { |
|
186 | 186 | // get the selections the user made. |
187 | 187 | $sqladd = array(); |
188 | - if ($_REQUEST['searchuser'] != 0) { |
|
188 | + if ($_REQUEST['searchuser'] != 0) { |
|
189 | 189 | $sqladd[] = "internalKey='" . (int)$_REQUEST['searchuser'] . "'"; |
190 | 190 | } |
191 | - if ($_REQUEST['action'] != 0) { |
|
191 | + if ($_REQUEST['action'] != 0) { |
|
192 | 192 | $sqladd[] = "action=" . (int)$_REQUEST['action']; |
193 | 193 | } |
194 | - if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") { |
|
194 | + if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") { |
|
195 | 195 | $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'"; |
196 | 196 | } |
197 | - if ($_REQUEST['itemname'] != '0') { |
|
197 | + if ($_REQUEST['itemname'] != '0') { |
|
198 | 198 | $sqladd[] = "itemname='" . $modx->db->escape($_REQUEST['itemname']) . "'"; |
199 | 199 | } |
200 | - if ($_REQUEST['message'] != "") { |
|
200 | + if ($_REQUEST['message'] != "") { |
|
201 | 201 | $sqladd[] = "message LIKE '%" . $modx->db->escape($_REQUEST['message']) . "%'"; |
202 | 202 | } |
203 | 203 | // date stuff |
204 | - if ($_REQUEST['datefrom'] != "") { |
|
204 | + if ($_REQUEST['datefrom'] != "") { |
|
205 | 205 | $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']); |
206 | 206 | } |
207 | - if ($_REQUEST['dateto'] != "") { |
|
207 | + if ($_REQUEST['dateto'] != "") { |
|
208 | 208 | $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']); |
209 | 209 | } |
210 | 210 | |
211 | 211 | // If current position is not set, set it to zero |
212 | - if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) { |
|
212 | + if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) { |
|
213 | 213 | $int_cur_position = 0; |
214 | - } else { |
|
214 | + } else { |
|
215 | 215 | $int_cur_position = $_REQUEST['int_cur_position']; |
216 | 216 | } |
217 | 217 | |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | |
226 | 226 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}"); |
227 | 227 | |
228 | -if ($limit < 1) { |
|
228 | +if ($limit < 1) { |
|
229 | 229 | echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>'; |
230 | -} else { |
|
230 | +} else { |
|
231 | 231 | echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>'; |
232 | 232 | |
233 | 233 | include_once "paginate.inc.php"; |
@@ -246,14 +246,14 @@ discard block |
||
246 | 246 | $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " "); |
247 | 247 | $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " "); |
248 | 248 | $pagesfound = sizeof($array_row_paging); |
249 | - if ($pagesfound > 6) { |
|
249 | + if ($pagesfound > 6) { |
|
250 | 250 | $paging .= $array_row_paging[$current_row - 2]; // ." "; |
251 | 251 | $paging .= $array_row_paging[$current_row - 1]; // ." "; |
252 | 252 | $paging .= $array_row_paging[$current_row]; // ." "; |
253 | 253 | $paging .= $array_row_paging[$current_row + 1]; // ." "; |
254 | 254 | $paging .= $array_row_paging[$current_row + 2]; // ." "; |
255 | - } else { |
|
256 | - for ($i = 0; $i < $pagesfound; $i++) { |
|
255 | + } else { |
|
256 | + for ($i = 0; $i < $pagesfound; $i++) { |
|
257 | 257 | $paging .= $array_row_paging[$i] . " "; |
258 | 258 | } |
259 | 259 | } |
@@ -288,12 +288,12 @@ discard block |
||
288 | 288 | // grab the entire log file... |
289 | 289 | $logentries = array(); |
290 | 290 | $i = 0; |
291 | - while ($logentry = $modx->db->getRow($rs)) { |
|
292 | - if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) { |
|
291 | + while ($logentry = $modx->db->getRow($rs)) { |
|
292 | + if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) { |
|
293 | 293 | $item = '<div style="text-align:center;">-</div>'; |
294 | - } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) { |
|
294 | + } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) { |
|
295 | 295 | $item = '<a href="index.php?a=3&id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>'; |
296 | - } else { |
|
296 | + } else { |
|
297 | 297 | $item = $logentry['itemname']; |
298 | 298 | } |
299 | 299 | //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true' |
@@ -328,6 +328,6 @@ discard block |
||
328 | 328 | // @see index.php @ 915 |
329 | 329 | global $action; |
330 | 330 | $action = 1; |
331 | -} else { |
|
331 | +} else { |
|
332 | 332 | echo $_lang["mgrlog_noquery"]; |
333 | 333 | } |
@@ -23,12 +23,15 @@ |
||
23 | 23 | * @param array $linkArr |
24 | 24 | * @return string |
25 | 25 | */ |
26 | -function createList($sectionHeader, $linkArr) { |
|
26 | +function createList($sectionHeader, $linkArr) |
|
27 | +{ |
|
27 | 28 | $output = '<div class="sectionHeader">'.$sectionHeader.'</div><div class="sectionBody">'."\n"; |
28 | 29 | $output .= '<table width="500" border="0" cellspacing="0" cellpadding="0">'."\n"; |
29 | 30 | $links = ''; |
30 | 31 | foreach($linkArr as $row) { |
31 | - if (!is_array($row['link'])) $row['link'] = array($row['link']); |
|
32 | + if (!is_array($row['link'])) { |
|
33 | + $row['link'] = array($row['link']); |
|
34 | + } |
|
32 | 35 | foreach ($row['link'] as $link) { |
33 | 36 | $links .= $links != '' ? '<br/>' : ''; |
34 | 37 | $links .= '<a href="' . $link . '" target="_blank">' . $link . '</a>'; |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | * @param array $tvsArray |
13 | 13 | * @return string |
14 | 14 | */ |
15 | -function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) { |
|
15 | +function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) |
|
16 | +{ |
|
16 | 17 | global $modx; |
17 | 18 | global $_style; |
18 | 19 | global $_lang; |
@@ -384,13 +385,16 @@ discard block |
||
384 | 385 | * @param string|array|mysqli_result $v |
385 | 386 | * @return array |
386 | 387 | */ |
387 | -function ParseIntputOptions($v) { |
|
388 | +function ParseIntputOptions($v) |
|
389 | +{ |
|
388 | 390 | global $modx; |
389 | 391 | $a = array(); |
390 | 392 | if(is_array($v)) { |
391 | 393 | return $v; |
392 | 394 | } else if($modx->db->isResult($v)) { |
393 | - while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols; |
|
395 | + while($cols = $modx->db->getRow($v, 'num')) { |
|
396 | + $a[] = $cols; |
|
397 | + } |
|
394 | 398 | } else { |
395 | 399 | $a = explode("||", $v); |
396 | 400 | } |