@@ -37,15 +37,18 @@ discard block |
||
37 | 37 | "sv" => "svenska" |
38 | 38 | ); |
39 | 39 | $_langISO6391 = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2); |
40 | -if (!empty($_langFiles[$_langISO6391])) $install_language = $_langFiles[$_langISO6391]; |
|
40 | +if (!empty($_langFiles[$_langISO6391])) { |
|
41 | + $install_language = $_langFiles[$_langISO6391]; |
|
42 | +} |
|
41 | 43 | |
42 | 44 | |
43 | 45 | if (isset($_POST['language']) && !stristr($_POST['language'],"..")) { |
44 | 46 | $install_language = $_POST['language']; |
45 | 47 | } else { |
46 | - if (isset($_GET['language']) && !stristr($_GET['language'],"..")) |
|
47 | - $install_language = $_GET['language']; |
|
48 | -} |
|
48 | + if (isset($_GET['language']) && !stristr($_GET['language'],"..")) { |
|
49 | + $install_language = $_GET['language']; |
|
50 | + } |
|
51 | + } |
|
49 | 52 | # load language file |
50 | 53 | require_once("lang/english.inc.php"); // As fallback |
51 | 54 | require_once("lang/".$install_language.".inc.php"); |
@@ -55,13 +58,14 @@ discard block |
||
55 | 58 | if (isset($_POST['managerlanguage']) && !stristr($_POST['managerlanguage'],"..")) { |
56 | 59 | $manager_language = $_POST['managerlanguage']; |
57 | 60 | } else { |
58 | - if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],"..")) |
|
59 | - $manager_language = $_GET['managerlanguage']; |
|
60 | -} |
|
61 | + if (isset($_GET['managerlanguage']) && !stristr($_GET['managerlanguage'],"..")) { |
|
62 | + $manager_language = $_GET['managerlanguage']; |
|
63 | + } |
|
64 | + } |
|
61 | 65 | |
62 | -foreach($_lang as $k=>$v) |
|
63 | -{ |
|
64 | - if(strpos($v,'[+MGR_DIR+]')!==false) |
|
65 | - $_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v); |
|
66 | -} |
|
66 | +foreach($_lang as $k=>$v) { |
|
67 | + if(strpos($v,'[+MGR_DIR+]')!==false) { |
|
68 | + $_lang[$k] = str_replace('[+MGR_DIR+]', MGR_DIR, $v); |
|
69 | + } |
|
70 | + } |
|
67 | 71 | ?> |
68 | 72 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if (file_exists(dirname(__FILE__)."/../assets/cache/siteManager.php")) { |
3 | 3 | include_once(dirname(__FILE__)."/../assets/cache/siteManager.php"); |
4 | -}else{ |
|
4 | +} else { |
|
5 | 5 | define('MGR_DIR', 'manager'); |
6 | 6 | } |
7 | 7 | |
@@ -58,13 +58,15 @@ discard block |
||
58 | 58 | |
59 | 59 | // get base path and url |
60 | 60 | $a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"]))); |
61 | -if (count($a) > 1) |
|
61 | +if (count($a) > 1) { |
|
62 | 62 | array_pop($a); |
63 | +} |
|
63 | 64 | $url = implode("install", $a); |
64 | 65 | reset($a); |
65 | 66 | $a = explode("install", str_replace("\\", "/", realpath(dirname(__FILE__)))); |
66 | -if (count($a) > 1) |
|
67 | +if (count($a) > 1) { |
|
67 | 68 | array_pop($a); |
69 | +} |
|
68 | 70 | $pth = implode("install", $a); |
69 | 71 | unset ($a); |
70 | 72 | $base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
@@ -85,7 +87,9 @@ discard block |
||
85 | 87 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
86 | 88 | $create = true; |
87 | 89 | } else { |
88 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset); |
|
90 | + if (function_exists('mysqli_set_charset')) { |
|
91 | + mysqli_set_charset($conn, $database_charset); |
|
92 | + } |
|
89 | 93 | mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}"); |
90 | 94 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
91 | 95 | } |
@@ -127,7 +131,8 @@ discard block |
||
127 | 131 | if(!function_exists('parseProperties')) { |
128 | 132 | // parses a resource property string and returns the result as an array |
129 | 133 | // duplicate of method in documentParser class |
130 | - function parseProperties($propertyString) { |
|
134 | + function parseProperties($propertyString) |
|
135 | + { |
|
131 | 136 | $parameter= array (); |
132 | 137 | if (!empty ($propertyString)) { |
133 | 138 | $tmpParams= explode("&", $propertyString); |
@@ -135,11 +140,14 @@ discard block |
||
135 | 140 | if (strpos($tmpParams[$x], '=', 0)) { |
136 | 141 | $pTmp= explode("=", $tmpParams[$x]); |
137 | 142 | $pvTmp= explode(";", trim($pTmp[1])); |
138 | - if ($pvTmp[1] == 'list' && $pvTmp[3] != "") |
|
139 | - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default |
|
143 | + if ($pvTmp[1] == 'list' && $pvTmp[3] != "") { |
|
144 | + $parameter[trim($pTmp[0])]= $pvTmp[3]; |
|
145 | + } |
|
146 | + //list default |
|
140 | 147 | else |
141 | - if ($pvTmp[1] != 'list' && $pvTmp[2] != "") |
|
142 | - $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
148 | + if ($pvTmp[1] != 'list' && $pvTmp[2] != "") { |
|
149 | + $parameter[trim($pTmp[0])]= $pvTmp[2]; |
|
150 | + } |
|
143 | 151 | } |
144 | 152 | } |
145 | 153 | } |
@@ -210,7 +218,7 @@ discard block |
||
210 | 218 | // custom or not |
211 | 219 | if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) { |
212 | 220 | $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");'; |
213 | -}else{ |
|
221 | +} else { |
|
214 | 222 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
215 | 223 | } |
216 | 224 | |
@@ -346,7 +354,9 @@ discard block |
||
346 | 354 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
347 | 355 | return; |
348 | 356 | } |
349 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
357 | + if(!is_null($save_sql_id_as)) { |
|
358 | + $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
359 | + } |
|
350 | 360 | echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
351 | 361 | } |
352 | 362 | } |
@@ -440,9 +450,9 @@ discard block |
||
440 | 450 | $overwrite = mysqli_real_escape_string($conn, $moduleChunk[4]); |
441 | 451 | $filecontent = $moduleChunk[2]; |
442 | 452 | |
443 | - if (!file_exists($filecontent)) |
|
444 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
445 | - else { |
|
453 | + if (!file_exists($filecontent)) { |
|
454 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
455 | + } else { |
|
446 | 456 | |
447 | 457 | // Create the category if it does not already exist |
448 | 458 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -494,9 +504,9 @@ discard block |
||
494 | 504 | $guid = mysqli_real_escape_string($conn, $moduleModule[4]); |
495 | 505 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
496 | 506 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
497 | - if (!file_exists($filecontent)) |
|
498 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
499 | - else { |
|
507 | + if (!file_exists($filecontent)) { |
|
508 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
509 | + } else { |
|
500 | 510 | |
501 | 511 | // Create the category if it does not already exist |
502 | 512 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -546,9 +556,9 @@ discard block |
||
546 | 556 | // parse comma-separated legacy names and prepare them for sql IN clause |
547 | 557 | $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
548 | 558 | } |
549 | - if (!file_exists($filecontent)) |
|
550 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
551 | - else { |
|
559 | + if (!file_exists($filecontent)) { |
|
560 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
561 | + } else { |
|
552 | 562 | |
553 | 563 | // disable legacy versions based on legacy_names provided |
554 | 564 | if(!empty($leg_names)) { |
@@ -567,7 +577,7 @@ discard block |
||
567 | 577 | $insert = true; |
568 | 578 | while($row = mysqli_fetch_assoc($rs)) { |
569 | 579 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
570 | - if($row['description'] == $desc){ |
|
580 | + if($row['description'] == $desc) { |
|
571 | 581 | if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
572 | 582 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
573 | 583 | return; |
@@ -625,9 +635,9 @@ discard block |
||
625 | 635 | $filecontent = $moduleSnippet[2]; |
626 | 636 | $properties = $moduleSnippet[3]; |
627 | 637 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
628 | - if (!file_exists($filecontent)) |
|
629 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
630 | - else { |
|
638 | + if (!file_exists($filecontent)) { |
|
639 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
640 | + } else { |
|
631 | 641 | |
632 | 642 | // Create the category if it does not already exist |
633 | 643 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -735,13 +745,16 @@ discard block |
||
735 | 745 | } |
736 | 746 | |
737 | 747 | // call back function |
738 | -if ($callBackFnc != "") |
|
748 | +if ($callBackFnc != "") { |
|
739 | 749 | $callBackFnc ($sqlParser); |
750 | +} |
|
740 | 751 | |
741 | 752 | // Setup the MODX API -- needed for the cache processor |
742 | 753 | define('MODX_API_MODE', true); |
743 | 754 | define('MODX_BASE_PATH', $base_path); |
744 | -if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
755 | +if (!defined('MODX_MANAGER_PATH')) { |
|
756 | + define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
757 | +} |
|
745 | 758 | $database_type = 'mysqli'; |
746 | 759 | // initiate a new document parser |
747 | 760 | include_once('../'.MGR_DIR.'/includes/document.parser.class.inc.php'); |
@@ -780,11 +793,12 @@ discard block |
||
780 | 793 | } |
781 | 794 | |
782 | 795 | // Property Update function |
783 | -function propUpdate($new,$old){ |
|
796 | +function propUpdate($new,$old) |
|
797 | +{ |
|
784 | 798 | $newArr = parseProperties($new); |
785 | 799 | $oldArr = parseProperties($old); |
786 | - foreach ($oldArr as $k => $v){ |
|
787 | - if (isset($v['0']['options'])){ |
|
800 | + foreach ($oldArr as $k => $v) { |
|
801 | + if (isset($v['0']['options'])) { |
|
788 | 802 | $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options']; |
789 | 803 | } |
790 | 804 | } |
@@ -794,12 +808,17 @@ discard block |
||
794 | 808 | return $return; |
795 | 809 | } |
796 | 810 | |
797 | -function parseProperties($propertyString, $json=false) { |
|
811 | +function parseProperties($propertyString, $json=false) |
|
812 | +{ |
|
798 | 813 | $propertyString = str_replace('{}', '', $propertyString ); |
799 | 814 | $propertyString = str_replace('} {', ',', $propertyString ); |
800 | 815 | |
801 | - if(empty($propertyString)) return array(); |
|
802 | - if($propertyString=='{}' || $propertyString=='[]') return array(); |
|
816 | + if(empty($propertyString)) { |
|
817 | + return array(); |
|
818 | + } |
|
819 | + if($propertyString=='{}' || $propertyString=='[]') { |
|
820 | + return array(); |
|
821 | + } |
|
803 | 822 | |
804 | 823 | $jsonFormat = isJson($propertyString, true); |
805 | 824 | $property = array(); |
@@ -809,7 +828,7 @@ discard block |
||
809 | 828 | $arr = array(); |
810 | 829 | $key = array(); |
811 | 830 | foreach ($props as $prop) { |
812 | - if ($prop != ''){ |
|
831 | + if ($prop != '') { |
|
813 | 832 | $arr = explode(';', $prop); |
814 | 833 | $key = explode('=', $arr['0']); |
815 | 834 | $property[$key['0']]['0']['label'] = trim($key['1']); |
@@ -833,7 +852,7 @@ discard block |
||
833 | 852 | |
834 | 853 | } |
835 | 854 | // new json-format |
836 | - } else if(!empty($jsonFormat)){ |
|
855 | + } else if(!empty($jsonFormat)) { |
|
837 | 856 | $property = $jsonFormat; |
838 | 857 | } |
839 | 858 | if ($json) { |
@@ -843,12 +862,14 @@ discard block |
||
843 | 862 | return $property; |
844 | 863 | } |
845 | 864 | |
846 | -function isJson($string, $returnData=false) { |
|
865 | +function isJson($string, $returnData=false) |
|
866 | +{ |
|
847 | 867 | $data = json_decode($string, true); |
848 | 868 | return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false; |
849 | 869 | } |
850 | 870 | |
851 | -function getCreateDbCategory($category, $sqlParser) { |
|
871 | +function getCreateDbCategory($category, $sqlParser) |
|
872 | +{ |
|
852 | 873 | $dbase = $sqlParser->dbname; |
853 | 874 | $dbase = '`' . trim($dbase,'`') . '`'; |
854 | 875 | $table_prefix = $sqlParser->prefix; |
@@ -870,7 +891,8 @@ discard block |
||
870 | 891 | } |
871 | 892 | |
872 | 893 | // Remove installer Docblock only from components using plugin FileSource / fileBinding |
873 | -function removeDocblock($code, $type) { |
|
894 | +function removeDocblock($code, $type) |
|
895 | +{ |
|
874 | 896 | |
875 | 897 | $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1); |
876 | 898 | |
@@ -891,8 +913,9 @@ discard block |
||
891 | 913 | default: |
892 | 914 | return $cleaned; |
893 | 915 | }; |
894 | - if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') |
|
895 | - return $cleaned; |
|
916 | + if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') { |
|
917 | + return $cleaned; |
|
918 | + } |
|
896 | 919 | |
897 | 920 | // fileBinding not found - return code incl docblock |
898 | 921 | return $code; |
@@ -3,14 +3,16 @@ discard block |
||
3 | 3 | // MySQL Dump Parser |
4 | 4 | // SNUFFKIN/ Alex 2004 |
5 | 5 | |
6 | -class SqlParser { |
|
6 | +class SqlParser |
|
7 | +{ |
|
7 | 8 | var $host, $dbname, $prefix, $user, $password, $mysqlErrors; |
8 | 9 | var $conn, $installFailed, $sitename, $adminname, $adminemail, $adminpass, $managerlanguage; |
9 | 10 | var $mode, $fileManagerPath, $imgPath, $imgUrl; |
10 | 11 | var $dbMODx, $dbVersion; |
11 | 12 | var $connection_charset, $connection_method; |
12 | 13 | |
13 | - function SqlParser($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') { |
|
14 | + function SqlParser($host, $user, $password, $db, $prefix='modx_', $adminname, $adminemail, $adminpass, $connection_charset= 'utf8', $managerlanguage='english', $connection_method = 'SET CHARACTER SET', $auto_template_logic = 'parent') |
|
15 | + { |
|
14 | 16 | $this->host = $host; |
15 | 17 | $this->dbname = $db; |
16 | 18 | $this->prefix = $prefix; |
@@ -26,10 +28,13 @@ discard block |
||
26 | 28 | $this->autoTemplateLogic = $auto_template_logic; |
27 | 29 | } |
28 | 30 | |
29 | - function connect() { |
|
31 | + function connect() |
|
32 | + { |
|
30 | 33 | $this->conn = mysqli_connect($this->host, $this->user, $this->password); |
31 | 34 | mysqli_select_db($this->conn, $this->dbname); |
32 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($this->conn, $this->connection_charset); |
|
35 | + if (function_exists('mysqli_set_charset')) { |
|
36 | + mysqli_set_charset($this->conn, $this->connection_charset); |
|
37 | + } |
|
33 | 38 | |
34 | 39 | $this->dbVersion = 3.23; // assume version 3.23 |
35 | 40 | if(function_exists("mysqli_get_server_info")) { |
@@ -41,7 +46,8 @@ discard block |
||
41 | 46 | mysqli_query($this->conn,"{$this->connection_method} {$this->connection_charset}"); |
42 | 47 | } |
43 | 48 | |
44 | - function process($filename) { |
|
49 | + function process($filename) |
|
50 | + { |
|
45 | 51 | global $custom_placeholders; |
46 | 52 | |
47 | 53 | // check to make sure file exists |
@@ -66,7 +72,9 @@ discard block |
||
66 | 72 | // remove non-upgradeable parts |
67 | 73 | $s = strpos($idata,"non-upgrade-able[["); |
68 | 74 | $e = strpos($idata,"]]non-upgrade-able")+17; |
69 | - if($s && $e) $idata = str_replace(substr($idata,$s,$e-$s)," Removed non upgradeable items",$idata); |
|
75 | + if($s && $e) { |
|
76 | + $idata = str_replace(substr($idata,$s,$e-$s)," Removed non upgradeable items",$idata); |
|
77 | + } |
|
70 | 78 | } |
71 | 79 | |
72 | 80 | // replace {} tags |
@@ -94,7 +102,9 @@ discard block |
||
94 | 102 | foreach($sql_array as $sql_entry) { |
95 | 103 | $sql_do = trim($sql_entry, "\r\n; "); |
96 | 104 | |
97 | - if (preg_match('/^\#/', $sql_do)) continue; |
|
105 | + if (preg_match('/^\#/', $sql_do)) { |
|
106 | + continue; |
|
107 | + } |
|
98 | 108 | |
99 | 109 | // strip out comments and \n for mysql 3.x |
100 | 110 | if ($this->dbVersion <4.0) { |
@@ -105,11 +115,15 @@ discard block |
||
105 | 115 | |
106 | 116 | |
107 | 117 | $num = $num + 1; |
108 | - if ($sql_do) mysqli_query($this->conn, $sql_do); |
|
118 | + if ($sql_do) { |
|
119 | + mysqli_query($this->conn, $sql_do); |
|
120 | + } |
|
109 | 121 | if(mysqli_error($this->conn)) { |
110 | 122 | // Ignore duplicate and drop errors - Raymond |
111 | - if ($this->ignoreDuplicateErrors){ |
|
112 | - if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) continue; |
|
123 | + if ($this->ignoreDuplicateErrors) { |
|
124 | + if (mysqli_errno($this->conn) == 1060 || mysqli_errno($this->conn) == 1061 || mysqli_errno($this->conn) == 1062 ||mysqli_errno($this->conn) == 1091) { |
|
125 | + continue; |
|
126 | + } |
|
113 | 127 | } |
114 | 128 | // End Ignore duplicate |
115 | 129 | $this->mysqlErrors[] = array("error" => mysqli_error($this->conn), "sql" => $sql_do); |
@@ -118,7 +132,8 @@ discard block |
||
118 | 132 | } |
119 | 133 | } |
120 | 134 | |
121 | - function close() { |
|
135 | + function close() |
|
136 | + { |
|
122 | 137 | mysqli_close($this->conn); |
123 | 138 | } |
124 | 139 | } |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE != 'true') { |
|
2 | +if(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 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
7 | 7 | |
8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
8 | +if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
9 | 9 | // seems to be a new install - send the user to the configuration page |
10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
11 | 11 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $_SESSION['nrnewmessages'] = 0; |
17 | 17 | |
18 | 18 | // setup message info |
19 | -if($modx->hasPermission('messages')) { |
|
19 | +if($modx->hasPermission('messages')) { |
|
20 | 20 | include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
@@ -32,46 +32,46 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | // setup icons |
35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
35 | +if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
38 | 38 | } |
39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
39 | +if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
42 | 42 | } |
43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
43 | +if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
46 | 46 | } |
47 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
47 | +if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
50 | 50 | } |
51 | -if($modx->hasPermission('bk_manager')) { |
|
51 | +if($modx->hasPermission('bk_manager')) { |
|
52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
54 | 54 | } |
55 | -if($modx->hasPermission('help')) { |
|
55 | +if($modx->hasPermission('help')) { |
|
56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
58 | 58 | } |
59 | 59 | // do some config checks |
60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
60 | +if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
61 | 61 | include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
62 | - if($config_check_results != $_lang['configcheck_ok']) { |
|
62 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
63 | 63 | $ph['config_check_results'] = $config_check_results; |
64 | 64 | $ph['config_display'] = 'block'; |
65 | - } else { |
|
65 | + } else { |
|
66 | 66 | $ph['config_display'] = 'none'; |
67 | 67 | } |
68 | -} else { |
|
68 | +} else { |
|
69 | 69 | $ph['config_display'] = 'none'; |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Check logout-reminder |
73 | -if(isset($_SESSION['show_logout_reminder'])) { |
|
74 | - switch($_SESSION['show_logout_reminder']['type']) { |
|
73 | +if(isset($_SESSION['show_logout_reminder'])) { |
|
74 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
75 | 75 | case 'logout_reminder': |
76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | $ph['show_logout_reminder'] = 'block'; |
81 | 81 | unset($_SESSION['show_logout_reminder']); |
82 | -} else { |
|
82 | +} else { |
|
83 | 83 | $ph['show_logout_reminder'] = 'none'; |
84 | 84 | } |
85 | 85 | |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC'); |
142 | 142 | |
143 | -if($modx->db->getRecordCount($rs) < 1) { |
|
143 | +if($modx->db->getRecordCount($rs) < 1) { |
|
144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
145 | -} else { |
|
145 | +} else { |
|
146 | 146 | include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $userList = array(); |
169 | 169 | $userCount = array(); |
170 | 170 | // Create userlist with session-count first before output |
171 | - while($activeusers = $modx->db->getRow($rs)) { |
|
171 | + while($activeusers = $modx->db->getRow($rs)) { |
|
172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
173 | 173 | |
174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $currentaction |
187 | 187 | ); |
188 | 188 | } |
189 | - foreach($userList as $params) { |
|
189 | + foreach($userList as $params) { |
|
190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
191 | 191 | $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
192 | 192 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | // invoke event OnManagerWelcomePrerender |
233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender'); |
234 | -if(is_array($evtOut)) { |
|
234 | +if(is_array($evtOut)) { |
|
235 | 235 | $output = implode('', $evtOut); |
236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
237 | 237 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
341 | 341 | 'hide'=>'0' |
342 | 342 | ); |
343 | -if ($modx->config['rss_url_news']) { |
|
343 | +if ($modx->config['rss_url_news']) { |
|
344 | 344 | $widgets['news'] = array( |
345 | 345 | 'menuindex' => '40', |
346 | 346 | 'id' => 'news', |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | 'hide'=>'0' |
352 | 352 | ); |
353 | 353 | } |
354 | -if ($modx->config['rss_url_security']) { |
|
354 | +if ($modx->config['rss_url_security']) { |
|
355 | 355 | $widgets['security'] = array( |
356 | 356 | 'menuindex' => '50', |
357 | 357 | 'id' => 'security', |
@@ -365,29 +365,29 @@ discard block |
||
365 | 365 | |
366 | 366 | // invoke OnManagerWelcomeHome event |
367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets)); |
368 | -if(is_array($sitewidgets)) { |
|
368 | +if(is_array($sitewidgets)) { |
|
369 | 369 | $newwidgets = array(); |
370 | - foreach($sitewidgets as $widget){ |
|
370 | + foreach($sitewidgets as $widget) { |
|
371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
372 | 372 | } |
373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
374 | 374 | } |
375 | 375 | |
376 | -usort($widgets, function ($a, $b) { |
|
376 | +usort($widgets, function ($a, $b){ |
|
377 | 377 | return $a['menuindex'] - $b['menuindex']; |
378 | 378 | }); |
379 | 379 | |
380 | 380 | $tpl = getTplWidget(); |
381 | 381 | $output = ''; |
382 | -foreach($widgets as $widget) { |
|
383 | - if ($widget['hide'] != '1'){ |
|
382 | +foreach($widgets as $widget) { |
|
383 | + if ($widget['hide'] != '1') { |
|
384 | 384 | $output .= $modx->parseText($tpl, $widget); |
385 | 385 | } |
386 | 386 | } |
387 | 387 | $ph['widgets'] = $output; |
388 | 388 | |
389 | 389 | // load template |
390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
390 | +if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
391 | 391 | $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
392 | 392 | } |
393 | 393 | |
@@ -395,26 +395,28 @@ discard block |
||
395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target); |
396 | 396 | $target = $modx->mergeSettingsContent($target); |
397 | 397 | |
398 | -if(substr($target, 0, 1) === '@') { |
|
399 | - if(substr($target, 0, 6) === '@CHUNK') { |
|
398 | +if(substr($target, 0, 1) === '@') { |
|
399 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
401 | - } elseif(substr($target, 0, 5) === '@FILE') { |
|
401 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
403 | - } else { |
|
403 | + } else { |
|
404 | 404 | $content = ''; |
405 | 405 | } |
406 | -} else { |
|
406 | +} else { |
|
407 | 407 | $chunk = $modx->getChunk($target); |
408 | - if($chunk !== false && !empty($chunk)) { |
|
408 | + if($chunk !== false && !empty($chunk)) { |
|
409 | 409 | $content = $chunk; |
410 | - } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
410 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
411 | 411 | $content = file_get_contents(MODX_BASE_PATH . $target); |
412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
413 | 413 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) { |
|
415 | + // ClipperCMS compatible |
|
415 | 416 | { |
416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
417 | - } else { |
|
417 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
418 | + } |
|
419 | + } else { |
|
418 | 420 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
419 | 421 | } |
420 | 422 | } |
@@ -423,7 +425,7 @@ discard block |
||
423 | 425 | $content = $modx->mergeConditionalTagsContent($content); |
424 | 426 | $content = $modx->mergeSettingsContent($content); |
425 | 427 | $content = $modx->parseText($content, $ph); |
426 | -if(strpos($content, '[+') !== false) { |
|
428 | +if(strpos($content, '[+') !== false) { |
|
427 | 429 | $modx->toPlaceholders($ph); |
428 | 430 | $content = $modx->mergePlaceholderContent($content); |
429 | 431 | } |
@@ -432,7 +434,7 @@ discard block |
||
432 | 434 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
433 | 435 | $content = $modx->cleanUpMODXTags($content); //cleanup |
434 | 436 | |
435 | -if($js = $modx->getRegisteredClientScripts()) { |
|
437 | +if($js = $modx->getRegisteredClientScripts()) { |
|
436 | 438 | $content .= $js; |
437 | 439 | } |
438 | 440 | |
@@ -442,7 +444,9 @@ discard block |
||
442 | 444 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
443 | 445 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
444 | 446 | //</span> |
445 | -function getTplWidget() { // recent document info |
|
447 | +function getTplWidget() |
|
448 | +{ |
|
449 | +// recent document info |
|
446 | 450 | return ' |
447 | 451 | <div class="[+cols+]" id="[+id+]"> |
448 | 452 | <div class="card"[+cardAttr+]> |
@@ -453,7 +457,9 @@ discard block |
||
453 | 457 | '; |
454 | 458 | } |
455 | 459 | |
456 | -function getRecentInfo() { // recent document info |
|
460 | +function getRecentInfo() |
|
461 | +{ |
|
462 | +// recent document info |
|
457 | 463 | global $modx; |
458 | 464 | |
459 | 465 | $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
@@ -479,12 +485,13 @@ discard block |
||
479 | 485 | return $html; |
480 | 486 | } |
481 | 487 | |
482 | -function getRecentInfoList() { |
|
488 | +function getRecentInfoList() |
|
489 | +{ |
|
483 | 490 | global $modx; |
484 | 491 | |
485 | 492 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
486 | 493 | |
487 | - if($modx->db->getRecordCount($rs) < 1) { |
|
494 | + if($modx->db->getRecordCount($rs) < 1) { |
|
488 | 495 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
489 | 496 | } |
490 | 497 | |
@@ -494,22 +501,22 @@ discard block |
||
494 | 501 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
495 | 502 | |
496 | 503 | $output = array(); |
497 | - while($ph = $modx->db->getRow($rs)) { |
|
504 | + while($ph = $modx->db->getRow($rs)) { |
|
498 | 505 | $docid = $ph['id']; |
499 | 506 | $_ = $modx->getUserInfo($ph['editedby']); |
500 | 507 | $ph['username'] = $_['username']; |
501 | 508 | |
502 | - if($ph['deleted'] == 1) { |
|
509 | + if($ph['deleted'] == 1) { |
|
503 | 510 | $ph['status'] = 'deleted text-danger'; |
504 | - } elseif($ph['published'] == 0) { |
|
511 | + } elseif($ph['published'] == 0) { |
|
505 | 512 | $ph['status'] = 'unpublished font-italic text-muted'; |
506 | - } else { |
|
513 | + } else { |
|
507 | 514 | $ph['status'] = 'published'; |
508 | 515 | } |
509 | 516 | |
510 | - if($modx->hasPermission('edit_document')) { |
|
517 | + if($modx->hasPermission('edit_document')) { |
|
511 | 518 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
512 | - } else { |
|
519 | + } else { |
|
513 | 520 | $ph['edit_btn'] = ''; |
514 | 521 | } |
515 | 522 | |
@@ -522,40 +529,40 @@ discard block |
||
522 | 529 | $preview_disabled |
523 | 530 | ), $btntpl['preview_btn']); |
524 | 531 | |
525 | - if($modx->hasPermission('delete_document')) { |
|
526 | - if($ph['deleted'] == 0) { |
|
532 | + if($modx->hasPermission('delete_document')) { |
|
533 | + if($ph['deleted'] == 0) { |
|
527 | 534 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
528 | - } else { |
|
535 | + } else { |
|
529 | 536 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
530 | 537 | } |
531 | 538 | $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn); |
532 | - } else { |
|
539 | + } else { |
|
533 | 540 | $ph['delete_btn'] = ''; |
534 | 541 | } |
535 | 542 | |
536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
543 | + if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | 544 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
545 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | 546 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
547 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | 548 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
542 | - } else { |
|
549 | + } else { |
|
543 | 550 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
544 | 551 | } |
545 | 552 | $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn); |
546 | 553 | |
547 | 554 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>'); |
548 | 555 | |
549 | - if($ph['longtitle'] == '') { |
|
556 | + if($ph['longtitle'] == '') { |
|
550 | 557 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
551 | 558 | } |
552 | - if($ph['description'] == '') { |
|
559 | + if($ph['description'] == '') { |
|
553 | 560 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
554 | 561 | } |
555 | - if($ph['introtext'] == '') { |
|
562 | + if($ph['introtext'] == '') { |
|
556 | 563 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
557 | 564 | } |
558 | - if($ph['alias'] == '') { |
|
565 | + if($ph['alias'] == '') { |
|
559 | 566 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
560 | 567 | } |
561 | 568 | |
@@ -564,7 +571,8 @@ discard block |
||
564 | 571 | return join("\n", $output); |
565 | 572 | } |
566 | 573 | |
567 | -function getRecentInfoRowTpl() { |
|
574 | +function getRecentInfoRowTpl() |
|
575 | +{ |
|
568 | 576 | $tpl = ' |
569 | 577 | <tr> |
570 | 578 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +601,13 @@ discard block |
||
593 | 601 | } |
594 | 602 | |
595 | 603 | // setup icons |
596 | -function wrapIcon($i, $action) { |
|
604 | +function wrapIcon($i, $action) |
|
605 | +{ |
|
597 | 606 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i); |
598 | 607 | } |
599 | 608 | |
600 | -function getStartUpScript() { |
|
609 | +function getStartUpScript() |
|
610 | +{ |
|
601 | 611 | $script = ' |
602 | 612 | <script type="text/javascript"> |
603 | 613 | function hideConfigCheckWarning(key) { |
@@ -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> |
@@ -1356,7 +1358,9 @@ discard block |
||
1356 | 1358 | if($documentId > 0) { |
1357 | 1359 | // Load up, the permissions from the parent (if new document) or existing document |
1358 | 1360 | $rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1359 | - while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1361 | + while($currentgroup = $modx->db->getRow($rs)) { |
|
1362 | + $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1363 | + } |
|
1360 | 1364 | |
1361 | 1365 | // Load up the current permissions and names |
1362 | 1366 | $vs = array( |
@@ -1418,7 +1422,9 @@ discard block |
||
1418 | 1422 | |
1419 | 1423 | // Create attribute string list |
1420 | 1424 | $inputString = array(); |
1421 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1425 | + foreach($inputAttributes as $k => $v) { |
|
1426 | + $inputString[] = $k . '="' . $v . '"'; |
|
1427 | + } |
|
1422 | 1428 | |
1423 | 1429 | // Make the <input> HTML |
1424 | 1430 | $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
@@ -1535,7 +1541,8 @@ discard block |
||
1535 | 1541 | } |
1536 | 1542 | } |
1537 | 1543 | |
1538 | -function getDefaultTemplate() { |
|
1544 | +function getDefaultTemplate() |
|
1545 | +{ |
|
1539 | 1546 | global $modx; |
1540 | 1547 | |
1541 | 1548 | switch($modx->config['auto_template_logic']) { |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE != "true") { |
|
2 | +if(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 | -switch($modx->manager->action) { |
|
6 | +switch($modx->manager->action) { |
|
7 | 7 | case 12: |
8 | - if(!$modx->hasPermission('edit_user')) { |
|
8 | + if(!$modx->hasPermission('edit_user')) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
10 | 10 | } |
11 | 11 | break; |
12 | 12 | case 11: |
13 | - if(!$modx->hasPermission('new_user')) { |
|
13 | + if(!$modx->hasPermission('new_user')) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | 15 | } |
16 | 16 | break; |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | |
23 | 23 | // check to see the snippet editor isn't locked |
24 | 24 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
25 | -if($username = $modx->db->getValue($rs)) { |
|
25 | +if($username = $modx->db->getValue($rs)) { |
|
26 | 26 | $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user")); |
27 | 27 | } |
28 | 28 | // end check for lock |
29 | 29 | |
30 | -if($modx->manager->action == '12') { |
|
30 | +if($modx->manager->action == '12') { |
|
31 | 31 | // get user attribute |
32 | 32 | $rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'"); |
33 | 33 | $userdata = $modx->db->getRow($rs); |
34 | - if(!$userdata) { |
|
34 | + if(!$userdata) { |
|
35 | 35 | $modx->webAlertAndQuit("No user returned!"); |
36 | 36 | } |
37 | 37 | |
@@ -39,10 +39,12 @@ discard block |
||
39 | 39 | // get user settings |
40 | 40 | $rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'"); |
41 | 41 | $usersettings = array(); |
42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
42 | + while($row = $modx->db->getRow($rs)) { |
|
43 | + $usersettings[$row['setting_name']] = $row['setting_value']; |
|
44 | + } |
|
43 | 45 | // manually extract so that user display settings are not overwritten |
44 | - foreach($usersettings as $k => $v) { |
|
45 | - if($k != 'manager_language' && $k != 'manager_theme') { |
|
46 | + foreach($usersettings as $k => $v) { |
|
47 | + if($k != 'manager_language' && $k != 'manager_theme') { |
|
46 | 48 | ${$k} = $v; |
47 | 49 | } |
48 | 50 | } |
@@ -50,11 +52,11 @@ discard block |
||
50 | 52 | // get user name |
51 | 53 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'"); |
52 | 54 | $usernamedata = $modx->db->getRow($rs); |
53 | - if(!$usernamedata) { |
|
55 | + if(!$usernamedata) { |
|
54 | 56 | $modx->webAlertAndQuit("No user returned while getting username!"); |
55 | 57 | } |
56 | 58 | $_SESSION['itemname'] = $usernamedata['username']; |
57 | -} else { |
|
59 | +} else { |
|
58 | 60 | $userdata = array(); |
59 | 61 | $usersettings = array(); |
60 | 62 | $usernamedata = array(); |
@@ -62,14 +64,14 @@ discard block |
||
62 | 64 | } |
63 | 65 | |
64 | 66 | // avoid doubling htmlspecialchars (already encoded in DB) |
65 | -foreach($userdata as $key => $val) { |
|
67 | +foreach($userdata as $key => $val) { |
|
66 | 68 | $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
67 | 69 | }; |
68 | 70 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
69 | 71 | |
70 | 72 | // restore saved form |
71 | 73 | $formRestored = false; |
72 | -if($modx->manager->hasFormValues()) { |
|
74 | +if($modx->manager->hasFormValues()) { |
|
73 | 75 | $modx->manager->loadFormValues(); |
74 | 76 | // restore post values |
75 | 77 | $userdata = array_merge($userdata, $_POST); |
@@ -84,13 +86,13 @@ discard block |
||
84 | 86 | // include the country list language file |
85 | 87 | $_country_lang = array(); |
86 | 88 | include_once "lang/country/english_country.inc.php"; |
87 | -if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
|
89 | +if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
|
88 | 90 | include_once "lang/country/" . $manager_language . "_country.inc.php"; |
89 | 91 | } |
90 | 92 | asort($_country_lang); |
91 | 93 | |
92 | 94 | $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block'; |
93 | -if($which_browser == 'default') { |
|
95 | +if($which_browser == 'default') { |
|
94 | 96 | $which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser']; |
95 | 97 | } |
96 | 98 | ?> |
@@ -205,7 +207,7 @@ discard block |
||
205 | 207 | $evtOut = $modx->invokeEvent("OnUserFormPrerender", array( |
206 | 208 | "id" => $user |
207 | 209 | )); |
208 | - if(is_array($evtOut)) { |
|
210 | + if(is_array($evtOut)) { |
|
209 | 211 | echo implode("", $evtOut); |
210 | 212 | } |
211 | 213 | ?> |
@@ -305,10 +307,10 @@ discard block |
||
305 | 307 | ?> |
306 | 308 | <select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px"> |
307 | 309 | <?php |
308 | - while($row = $modx->db->getRow($rs)) { |
|
309 | - if($modx->manager->action == '11') { |
|
310 | + while($row = $modx->db->getRow($rs)) { |
|
311 | + if($modx->manager->action == '11') { |
|
310 | 312 | $selectedtext = $row['id'] == '1' ? ' selected="selected"' : ''; |
311 | - } else { |
|
313 | + } else { |
|
312 | 314 | $selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : ''; |
313 | 315 | } |
314 | 316 | ?> |
@@ -360,7 +362,7 @@ discard block |
||
360 | 362 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
361 | 363 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
362 | 364 | <?php |
363 | - foreach($_country_lang as $key => $country) { |
|
365 | + foreach($_country_lang as $key => $country) { |
|
364 | 366 | echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
365 | 367 | } |
366 | 368 | ?> |
@@ -441,8 +443,8 @@ discard block |
||
441 | 443 | <?php |
442 | 444 | $activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : ''; |
443 | 445 | $dir = dir("includes/lang"); |
444 | - while($file = $dir->read()) { |
|
445 | - if(strpos($file, ".inc.php") > 0) { |
|
446 | + while($file = $dir->read()) { |
|
447 | + if(strpos($file, ".inc.php") > 0) { |
|
446 | 448 | $endpos = strpos($file, "."); |
447 | 449 | $languagename = substr($file, 0, $endpos); |
448 | 450 | $selectedtext = $languagename == $activelang ? "selected='selected'" : ""; |
@@ -529,14 +531,14 @@ discard block |
||
529 | 531 | <option value=""></option> |
530 | 532 | <?php |
531 | 533 | $dir = dir("media/style/"); |
532 | - while($file = $dir->read()) { |
|
533 | - if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
534 | + while($file = $dir->read()) { |
|
535 | + if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') { |
|
534 | 536 | $themename = $file; |
535 | - if($themename === 'common') { |
|
537 | + if($themename === 'common') { |
|
536 | 538 | continue; |
537 | 539 | } |
538 | 540 | $attr = 'value="' . $themename . '" '; |
539 | - if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
541 | + if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) { |
|
540 | 542 | $attr .= 'selected="selected" '; |
541 | 543 | } |
542 | 544 | echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n"; |
@@ -557,7 +559,7 @@ discard block |
||
557 | 559 | <?php |
558 | 560 | $selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : ''; |
559 | 561 | echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n"; |
560 | - foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
562 | + foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) { |
|
561 | 563 | $dir = str_replace('\\', '/', $dir); |
562 | 564 | $browser_name = substr($dir, strrpos($dir, '/') + 1); |
563 | 565 | $selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : ''; |
@@ -644,8 +646,8 @@ discard block |
||
644 | 646 | // invoke OnRichTextEditorRegister event |
645 | 647 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
646 | 648 | echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n"; |
647 | - if(is_array($evtOut)) { |
|
648 | - for($i = 0; $i < count($evtOut); $i++) { |
|
649 | + if(is_array($evtOut)) { |
|
650 | + for($i = 0; $i < count($evtOut); $i++) { |
|
649 | 651 | $editor = $evtOut[$i]; |
650 | 652 | echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n"; |
651 | 653 | } |
@@ -685,7 +687,7 @@ discard block |
||
685 | 687 | <?php |
686 | 688 | // invoke OnInterfaceSettingsRender event |
687 | 689 | $evtOut = $modx->invokeEvent("OnInterfaceSettingsRender"); |
688 | - if(is_array($evtOut)) { |
|
690 | + if(is_array($evtOut)) { |
|
689 | 691 | echo implode("", $evtOut); |
690 | 692 | } |
691 | 693 | ?> |
@@ -735,17 +737,20 @@ discard block |
||
735 | 737 | </tr> |
736 | 738 | </table> |
737 | 739 | </div> |
738 | - <?php if($use_udperms == 1) { |
|
740 | + <?php if($use_udperms == 1) { |
|
739 | 741 | |
740 | 742 | $groupsarray = array(); |
741 | 743 | |
742 | - if($modx->manager->action == '12') { // only do this bit if the user is being edited |
|
744 | + if($modx->manager->action == '12') { |
|
745 | +// only do this bit if the user is being edited |
|
743 | 746 | $rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'"); |
744 | 747 | $groupsarray = $modx->db->getColumn('user_group', $rs); |
745 | 748 | } |
746 | 749 | // retain selected doc groups between post |
747 | - if(is_array($_POST['user_groups'])) { |
|
748 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
750 | + if(is_array($_POST['user_groups'])) { |
|
751 | + foreach($_POST['user_groups'] as $n => $v) { |
|
752 | + $groupsarray[] = $v; |
|
753 | + } |
|
749 | 754 | } |
750 | 755 | ?> |
751 | 756 | <div class="tab-page" id="tabAccess"> |
@@ -754,7 +759,7 @@ discard block |
||
754 | 759 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
755 | 760 | <?php |
756 | 761 | $rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name'); |
757 | - while($row = $modx->db->getRow($rs)) { |
|
762 | + while($row = $modx->db->getRow($rs)) { |
|
758 | 763 | echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />"; |
759 | 764 | } |
760 | 765 | } |
@@ -768,7 +773,7 @@ discard block |
||
768 | 773 | $evtOut = $modx->invokeEvent("OnUserFormRender", array( |
769 | 774 | "id" => $user |
770 | 775 | )); |
771 | - if(is_array($evtOut)) { |
|
776 | + if(is_array($evtOut)) { |
|
772 | 777 | echo implode("", $evtOut); |
773 | 778 | } |
774 | 779 | ?> |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE != "true") { |
|
2 | +if(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 | -switch($modx->manager->action) { |
|
6 | +switch($modx->manager->action) { |
|
7 | 7 | case 88: |
8 | - if(!$modx->hasPermission('edit_web_user')) { |
|
8 | + if(!$modx->hasPermission('edit_web_user')) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
10 | 10 | } |
11 | 11 | break; |
12 | 12 | case 87: |
13 | - if(!$modx->hasPermission('new_web_user')) { |
|
13 | + if(!$modx->hasPermission('new_web_user')) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | 15 | } |
16 | 16 | break; |
@@ -23,33 +23,35 @@ discard block |
||
23 | 23 | |
24 | 24 | // check to see the snippet editor isn't locked |
25 | 25 | $rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
26 | -if($username = $modx->db->getValue($rs)) { |
|
26 | +if($username = $modx->db->getValue($rs)) { |
|
27 | 27 | $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
31 | -if($modx->manager->action == '88') { |
|
31 | +if($modx->manager->action == '88') { |
|
32 | 32 | // get user attributes |
33 | 33 | $rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'"); |
34 | 34 | $userdata = $modx->db->getRow($rs); |
35 | - if(!$userdata) { |
|
35 | + if(!$userdata) { |
|
36 | 36 | $modx->webAlertAndQuit("No user returned!"); |
37 | 37 | } |
38 | 38 | |
39 | 39 | // get user settings |
40 | 40 | $rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$user}'"); |
41 | 41 | $usersettings = array(); |
42 | - while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
42 | + while($row = $modx->db->getRow($rs)) { |
|
43 | + $usersettings[$row['setting_name']] = $row['setting_value']; |
|
44 | + } |
|
43 | 45 | extract($usersettings, EXTR_OVERWRITE); |
44 | 46 | |
45 | 47 | // get user name |
46 | 48 | $rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'"); |
47 | 49 | $usernamedata = $modx->db->getRow($rs); |
48 | - if(!$usernamedata) { |
|
50 | + if(!$usernamedata) { |
|
49 | 51 | $modx->webAlertAndQuit("No user returned while getting username!"); |
50 | 52 | } |
51 | 53 | $_SESSION['itemname'] = $usernamedata['username']; |
52 | -} else { |
|
54 | +} else { |
|
53 | 55 | $userdata = array(); |
54 | 56 | $usersettings = array(); |
55 | 57 | $usernamedata = array(); |
@@ -57,14 +59,14 @@ discard block |
||
57 | 59 | } |
58 | 60 | |
59 | 61 | // avoid doubling htmlspecialchars (already encoded in DB) |
60 | -foreach($userdata as $key => $val) { |
|
62 | +foreach($userdata as $key => $val) { |
|
61 | 63 | $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
62 | 64 | }; |
63 | 65 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
64 | 66 | |
65 | 67 | // restore saved form |
66 | 68 | $formRestored = false; |
67 | -if($modx->manager->hasFormValues()) { |
|
69 | +if($modx->manager->hasFormValues()) { |
|
68 | 70 | $modx->manager->loadFormValues(); |
69 | 71 | // restore post values |
70 | 72 | $userdata = array_merge($userdata, $_POST); |
@@ -78,9 +80,9 @@ discard block |
||
78 | 80 | |
79 | 81 | // include the country list language file |
80 | 82 | $_country_lang = array(); |
81 | -if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
|
83 | +if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
|
82 | 84 | include_once "lang/country/" . $manager_language . "_country.inc.php"; |
83 | -} else { |
|
85 | +} else { |
|
84 | 86 | include_once "lang/country/english_country.inc.php"; |
85 | 87 | } |
86 | 88 | asort($_country_lang); |
@@ -191,7 +193,7 @@ discard block |
||
191 | 193 | <?php |
192 | 194 | // invoke OnWUsrFormPrerender event |
193 | 195 | $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user)); |
194 | - if(is_array($evtOut)) { |
|
196 | + if(is_array($evtOut)) { |
|
195 | 197 | echo implode("", $evtOut); |
196 | 198 | } |
197 | 199 | ?> |
@@ -324,7 +326,7 @@ discard block |
||
324 | 326 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
325 | 327 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
326 | 328 | <?php |
327 | - foreach($_country_lang as $key => $country) { |
|
329 | + foreach($_country_lang as $key => $country) { |
|
328 | 330 | echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
329 | 331 | } |
330 | 332 | ?> |
@@ -496,17 +498,20 @@ discard block |
||
496 | 498 | </table> |
497 | 499 | </div> |
498 | 500 | <?php |
499 | - if($use_udperms == 1) { |
|
501 | + if($use_udperms == 1) { |
|
500 | 502 | |
501 | 503 | $groupsarray = array(); |
502 | 504 | |
503 | - if($modx->manager->action == '88') { // only do this bit if the user is being edited |
|
505 | + if($modx->manager->action == '88') { |
|
506 | +// only do this bit if the user is being edited |
|
504 | 507 | $rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'"); |
505 | 508 | $groupsarray = $modx->db->getColumn('webgroup', $rs); |
506 | 509 | } |
507 | 510 | // retain selected user groups between post |
508 | - if(is_array($_POST['user_groups'])) { |
|
509 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
511 | + if(is_array($_POST['user_groups'])) { |
|
512 | + foreach($_POST['user_groups'] as $n => $v) { |
|
513 | + $groupsarray[] = $v; |
|
514 | + } |
|
510 | 515 | } |
511 | 516 | ?> |
512 | 517 | <div class="tab-page" id="tabPermissions"> |
@@ -515,7 +520,7 @@ discard block |
||
515 | 520 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
516 | 521 | <?php |
517 | 522 | $rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name'); |
518 | - while($row = $modx->db->getRow($rs)) { |
|
523 | + while($row = $modx->db->getRow($rs)) { |
|
519 | 524 | echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
520 | 525 | } |
521 | 526 | } |
@@ -526,7 +531,7 @@ discard block |
||
526 | 531 | $evtOut = $modx->invokeEvent("OnWUsrFormRender", array( |
527 | 532 | "id" => $user |
528 | 533 | )); |
529 | - if(is_array($evtOut)) { |
|
534 | + if(is_array($evtOut)) { |
|
530 | 535 | echo implode("", $evtOut); |
531 | 536 | } |
532 | 537 | ?> |
@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | -if (IN_MANAGER_MODE != "true") { |
|
2 | +if (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 | |
9 | -function array_unique_multi($array, $checkKey) |
|
10 | -{ |
|
9 | +function array_unique_multi($array, $checkKey) |
|
10 | +{ |
|
11 | 11 | // Use the builtin if we're not a multi-dimensional array |
12 | - if (!is_array(current($array)) || empty($checkKey)) { |
|
12 | + if (!is_array(current($array)) || empty($checkKey)) { |
|
13 | 13 | return array_unique($array); |
14 | 14 | } |
15 | 15 | |
16 | 16 | $ret = array(); |
17 | 17 | $checkValues = array(); // contains the unique key Values |
18 | - foreach ($array as $key => $current) { |
|
19 | - if (in_array($current[$checkKey], $checkValues)) { |
|
18 | + foreach ($array as $key => $current) { |
|
19 | + if (in_array($current[$checkKey], $checkValues)) { |
|
20 | 20 | continue; |
21 | 21 | } // duplicate |
22 | 22 | |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | return $ret; |
27 | 27 | } |
28 | 28 | |
29 | -function record_sort($array, $key) |
|
30 | -{ |
|
29 | +function record_sort($array, $key) |
|
30 | +{ |
|
31 | 31 | $hash = array(); |
32 | - foreach ($array as $k => $v) { |
|
32 | + foreach ($array as $k => $v) { |
|
33 | 33 | $hash[$k] = $v[$key]; |
34 | 34 | } |
35 | 35 | |
36 | 36 | natsort($hash); |
37 | 37 | |
38 | 38 | $records = array(); |
39 | - foreach ($hash as $k => $row) { |
|
39 | + foreach ($hash as $k => $row) { |
|
40 | 40 | $records[$k] = $array[$k]; |
41 | 41 | } |
42 | 42 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | <?php |
64 | 64 | // get all users currently in the log |
65 | 65 | $logs_user = record_sort(array_unique_multi($logs, 'internalKey'), 'username'); |
66 | - foreach ($logs_user as $row) { |
|
66 | + foreach ($logs_user as $row) { |
|
67 | 67 | $selectedtext = $row['internalKey'] == $_REQUEST['searchuser'] ? ' selected="selected"' : ''; |
68 | 68 | echo "\t\t" . '<option value="' . $row['internalKey'] . '"' . $selectedtext . '>' . $row['username'] . "</option>\n"; |
69 | 69 | } |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | // get all available actions in the log |
81 | 81 | include_once "actionlist.inc.php"; |
82 | 82 | $logs_actions = record_sort(array_unique_multi($logs, 'action'), 'action'); |
83 | - foreach ($logs_actions as $row) { |
|
83 | + foreach ($logs_actions as $row) { |
|
84 | 84 | $action = getAction($row['action']); |
85 | - if ($action == 'Idle') { |
|
85 | + if ($action == 'Idle') { |
|
86 | 86 | continue; |
87 | 87 | } |
88 | 88 | $selectedtext = $row['action'] == $_REQUEST['action'] ? ' selected="selected"' : ''; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | <?php |
101 | 101 | // get all itemid currently in logging |
102 | 102 | $logs_items = record_sort(array_unique_multi($logs, 'itemid'), 'itemid'); |
103 | - foreach ($logs_items as $row) { |
|
103 | + foreach ($logs_items as $row) { |
|
104 | 104 | $selectedtext = $row['itemid'] == $_REQUEST['itemid'] ? ' selected="selected"' : ''; |
105 | 105 | echo "\t\t" . '<option value="' . $row['itemid'] . '"' . $selectedtext . '>' . $row['itemid'] . "</option>\n"; |
106 | 106 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | <?php |
117 | 117 | // get all itemname currently in logging |
118 | 118 | $logs_names = record_sort(array_unique_multi($logs, 'itemname'), 'itemname'); |
119 | - foreach ($logs_names as $row) { |
|
119 | + foreach ($logs_names as $row) { |
|
120 | 120 | $selectedtext = $row['itemname'] == $_REQUEST['itemname'] ? ' selected="selected"' : ''; |
121 | 121 | echo "\t\t" . '<option value="' . $row['itemname'] . '"' . $selectedtext . '>' . $row['itemname'] . "</option>\n"; |
122 | 122 | } |
@@ -172,36 +172,36 @@ discard block |
||
172 | 172 | <div class="container container-body"> |
173 | 173 | |
174 | 174 | <?php |
175 | -if (isset($_REQUEST['log_submit'])) { |
|
175 | +if (isset($_REQUEST['log_submit'])) { |
|
176 | 176 | // get the selections the user made. |
177 | 177 | $sqladd = array(); |
178 | - if ($_REQUEST['searchuser'] != 0) { |
|
178 | + if ($_REQUEST['searchuser'] != 0) { |
|
179 | 179 | $sqladd[] = "internalKey='" . intval($_REQUEST['searchuser']) . "'"; |
180 | 180 | } |
181 | - if ($_REQUEST['action'] != 0) { |
|
181 | + if ($_REQUEST['action'] != 0) { |
|
182 | 182 | $sqladd[] = "action=" . intval($_REQUEST['action']); |
183 | 183 | } |
184 | - if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") { |
|
184 | + if ($_REQUEST['itemid'] != 0 || $_REQUEST['itemid'] == "-") { |
|
185 | 185 | $sqladd[] = "itemid='" . $_REQUEST['itemid'] . "'"; |
186 | 186 | } |
187 | - if ($_REQUEST['itemname'] != '0') { |
|
187 | + if ($_REQUEST['itemname'] != '0') { |
|
188 | 188 | $sqladd[] = "itemname='" . $modx->db->escape($_REQUEST['itemname']) . "'"; |
189 | 189 | } |
190 | - if ($_REQUEST['message'] != "") { |
|
190 | + if ($_REQUEST['message'] != "") { |
|
191 | 191 | $sqladd[] = "message LIKE '%" . $modx->db->escape($_REQUEST['message']) . "%'"; |
192 | 192 | } |
193 | 193 | // date stuff |
194 | - if ($_REQUEST['datefrom'] != "") { |
|
194 | + if ($_REQUEST['datefrom'] != "") { |
|
195 | 195 | $sqladd[] = "timestamp>" . $modx->toTimeStamp($_REQUEST['datefrom']); |
196 | 196 | } |
197 | - if ($_REQUEST['dateto'] != "") { |
|
197 | + if ($_REQUEST['dateto'] != "") { |
|
198 | 198 | $sqladd[] = "timestamp<" . $modx->toTimeStamp($_REQUEST['dateto']); |
199 | 199 | } |
200 | 200 | |
201 | 201 | // If current position is not set, set it to zero |
202 | - if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) { |
|
202 | + if (!isset($_REQUEST['int_cur_position']) || $_REQUEST['int_cur_position'] == 0) { |
|
203 | 203 | $int_cur_position = 0; |
204 | - } else { |
|
204 | + } else { |
|
205 | 205 | $int_cur_position = $_REQUEST['int_cur_position']; |
206 | 206 | } |
207 | 207 | |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | |
216 | 216 | $rs = $modx->db->select('*', $modx->getFullTableName('manager_log'), (!empty($sqladd) ? implode(' AND ', $sqladd) : ''), 'timestamp DESC, id DESC', "{$int_cur_position}, {$int_num_result}"); |
217 | 217 | |
218 | -if ($limit < 1) { |
|
218 | +if ($limit < 1) { |
|
219 | 219 | echo '<p>' . $_lang["mgrlog_emptysrch"] . '</p>'; |
220 | -} else { |
|
220 | +} else { |
|
221 | 221 | echo '<p>' . $_lang["mgrlog_sortinst"] . '</p>'; |
222 | 222 | |
223 | 223 | include_once "paginate.inc.php"; |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | $paging = $array_paging['first_link'] . $_lang["paging_first"] . (isset($array_paging['first_link']) ? "</a> " : " "); |
237 | 237 | $paging .= $array_paging['previous_link'] . $_lang["paging_prev"] . (isset($array_paging['previous_link']) ? "</a> " : " "); |
238 | 238 | $pagesfound = sizeof($array_row_paging); |
239 | - if ($pagesfound > 6) { |
|
239 | + if ($pagesfound > 6) { |
|
240 | 240 | $paging .= $array_row_paging[$current_row - 2]; // ." "; |
241 | 241 | $paging .= $array_row_paging[$current_row - 1]; // ." "; |
242 | 242 | $paging .= $array_row_paging[$current_row]; // ." "; |
243 | 243 | $paging .= $array_row_paging[$current_row + 1]; // ." "; |
244 | 244 | $paging .= $array_row_paging[$current_row + 2]; // ." "; |
245 | - } else { |
|
246 | - for ($i = 0; $i < $pagesfound; $i++) { |
|
245 | + } else { |
|
246 | + for ($i = 0; $i < $pagesfound; $i++) { |
|
247 | 247 | $paging .= $array_row_paging[$i] . " "; |
248 | 248 | } |
249 | 249 | } |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | // grab the entire log file... |
279 | 279 | $logentries = array(); |
280 | 280 | $i = 0; |
281 | - while ($logentry = $modx->db->getRow($rs)) { |
|
282 | - if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) { |
|
281 | + while ($logentry = $modx->db->getRow($rs)) { |
|
282 | + if (!preg_match("/^[0-9]+$/", $logentry['itemid'])) { |
|
283 | 283 | $item = '<div style="text-align:center;">-</div>'; |
284 | - } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) { |
|
284 | + } elseif ($logentry['action'] == 3 || $logentry['action'] == 27 || $logentry['action'] == 5) { |
|
285 | 285 | $item = '<a href="index.php?a=3&id=' . $logentry['itemid'] . '">' . $logentry['itemname'] . '</a>'; |
286 | - } else { |
|
286 | + } else { |
|
287 | 287 | $item = $logentry['itemname']; |
288 | 288 | } |
289 | 289 | //index.php?a=13&searchuser=' . $logentry['internalKey'] . '&action=' . $logentry['action'] . '&itemname=' . $logentry['itemname'] . '&log_submit=true' |
@@ -318,6 +318,6 @@ discard block |
||
318 | 318 | // @see index.php @ 915 |
319 | 319 | global $action; |
320 | 320 | $action = 1; |
321 | -} else { |
|
321 | +} else { |
|
322 | 322 | echo $_lang["mgrlog_noquery"]; |
323 | 323 | } |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | |
4 | 6 | if(!$modx->hasPermission('category_manager')) { |
5 | 7 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
@@ -26,16 +28,14 @@ discard block |
||
26 | 28 | $cm = new Module_Categories_Manager(); |
27 | 29 | |
28 | 30 | // assign module_params to internal params |
29 | -foreach( $_module_params as $param => $value ) |
|
30 | -{ |
|
31 | +foreach( $_module_params as $param => $value ) { |
|
31 | 32 | $cm->set( $param, $value ); |
32 | 33 | } |
33 | 34 | |
34 | 35 | // catch the request actions |
35 | 36 | include_once $cm->get('inc_dir') . 'request_trigger.inc.php'; |
36 | 37 | |
37 | -if( !$categories = $cm->getCategories() ) |
|
38 | -{ |
|
38 | +if( !$categories = $cm->getCategories() ) { |
|
39 | 39 | setcookie('webfxtab_manage-categories-pane', 0 ); |
40 | 40 | $cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' ); |
41 | 41 | } |