@@ -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 | // START HACK |
5 | 7 | if (isset ($modx)) { |
@@ -15,7 +17,9 @@ discard block |
||
15 | 17 | |
16 | 18 | $which_browser_default = $which_browser; |
17 | 19 | while ($row = $modx->db->getRow($rs)) { |
18 | - if($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') $row['setting_value'] = $which_browser_default; |
|
20 | + if($row['setting_name'] == 'which_browser' && $row['setting_value'] == 'default') { |
|
21 | + $row['setting_value'] = $which_browser_default; |
|
22 | + } |
|
19 | 23 | $settings[$row['setting_name']] = $row['setting_value']; |
20 | 24 | if (isset($modx->config)) { |
21 | 25 | $modx->config[$row['setting_name']] = $row['setting_value']; |
@@ -14,16 +14,16 @@ discard block |
||
14 | 14 | 'DIRECTORY' |
15 | 15 | ); |
16 | 16 | |
17 | -function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) { |
|
17 | +function ProcessTVCommand($value, $name = '', $docid = '', $src='docform', $tvsArray = array()) |
|
18 | +{ |
|
18 | 19 | global $modx; |
19 | 20 | $docid = intval($docid) ? intval($docid) : $modx->documentIdentifier; |
20 | 21 | $nvalue = trim($value); |
21 | - if (substr($nvalue, 0, 1) != '@') |
|
22 | - return $value; |
|
23 | - elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
22 | + if (substr($nvalue, 0, 1) != '@') { |
|
23 | + return $value; |
|
24 | + } elseif(isset($modx->config['enable_bindings']) && $modx->config['enable_bindings']!=1 && $src==='docform') { |
|
24 | 25 | return '@Bindings is disabled.'; |
25 | - } |
|
26 | - else { |
|
26 | + } else { |
|
27 | 27 | list ($cmd, $param) = ParseCommand($nvalue); |
28 | 28 | $cmd = trim($cmd); |
29 | 29 | $param = parseTvValues($param, $tvsArray); |
@@ -39,10 +39,11 @@ discard block |
||
39 | 39 | |
40 | 40 | case "DOCUMENT" : // retrieve a document and process it's content |
41 | 41 | $rs = $modx->getDocument($param); |
42 | - if (is_array($rs)) |
|
43 | - $output = $rs['content']; |
|
44 | - else |
|
45 | - $output = "Unable to locate document $param"; |
|
42 | + if (is_array($rs)) { |
|
43 | + $output = $rs['content']; |
|
44 | + } else { |
|
45 | + $output = "Unable to locate document $param"; |
|
46 | + } |
|
46 | 47 | break; |
47 | 48 | |
48 | 49 | case "SELECT" : // selects a record from the cms database |
@@ -72,8 +73,10 @@ discard block |
||
72 | 73 | |
73 | 74 | // Grab document regardless of publish status |
74 | 75 | $doc = $modx->getPageInfo($parent_id, 0, 'id,parent,published'); |
75 | - if ($doc['parent'] != 0 && !$doc['published']) |
|
76 | - continue; // hide unpublished docs if we're not at the top |
|
76 | + if ($doc['parent'] != 0 && !$doc['published']) { |
|
77 | + continue; |
|
78 | + } |
|
79 | + // hide unpublished docs if we're not at the top |
|
77 | 80 | |
78 | 81 | $tv = $modx->getTemplateVar($name, '*', $doc['id'], $doc['published']); |
79 | 82 | |
@@ -117,10 +120,13 @@ discard block |
||
117 | 120 | } |
118 | 121 | } |
119 | 122 | |
120 | -function ProcessFile($file) { |
|
123 | +function ProcessFile($file) |
|
124 | +{ |
|
121 | 125 | // get the file |
122 | 126 | $buffer = @file_get_contents($file); |
123 | - if ($buffer===false) $buffer = " Could not retrieve document '$file'."; |
|
127 | + if ($buffer===false) { |
|
128 | + $buffer = " Could not retrieve document '$file'."; |
|
129 | + } |
|
124 | 130 | return $buffer; |
125 | 131 | } |
126 | 132 | |
@@ -129,10 +135,8 @@ discard block |
||
129 | 135 | { |
130 | 136 | global $BINDINGS; |
131 | 137 | $binding_array = array(); |
132 | - foreach($BINDINGS as $cmd) |
|
133 | - { |
|
134 | - if(strpos($binding_string,'@'.$cmd)===0) |
|
135 | - { |
|
138 | + foreach($BINDINGS as $cmd) { |
|
139 | + if(strpos($binding_string,'@'.$cmd)===0) { |
|
136 | 140 | $code = substr($binding_string,strlen($cmd)+1); |
137 | 141 | $binding_array = array($cmd,trim($code)); |
138 | 142 | break; |
@@ -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 | /** |
5 | 7 | * Secure Manager Documents |
@@ -10,7 +12,8 @@ discard block |
||
10 | 12 | * |
11 | 13 | */ |
12 | 14 | |
13 | -function secureMgrDocument($docid='') { |
|
15 | +function secureMgrDocument($docid='') |
|
16 | +{ |
|
14 | 17 | global $modx; |
15 | 18 | |
16 | 19 | $modx->db->update('privatemgr = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privatemgr = 1")); |
@@ -615,13 +615,15 @@ discard block |
||
615 | 615 | $this->virtualDir = ''; |
616 | 616 | } |
617 | 617 | |
618 | - if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */ |
|
618 | + if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { |
|
619 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
619 | 620 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
620 | 621 | if ($this->config['use_alias_path'] == 1) { |
621 | 622 | if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
622 | 623 | $this->documentMethod = 'id'; |
623 | 624 | return $q; |
624 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
625 | + } else { |
|
626 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
625 | 627 | $this->documentMethod = 'alias'; |
626 | 628 | return $q; |
627 | 629 | } |
@@ -629,7 +631,8 @@ discard block |
||
629 | 631 | $this->documentMethod = 'id'; |
630 | 632 | return $q; |
631 | 633 | } |
632 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
634 | + } else { |
|
635 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
633 | 636 | if ($this->config['friendly_alias_urls'] != 1) { |
634 | 637 | $q = $qOrig; |
635 | 638 | } |
@@ -659,13 +662,14 @@ discard block |
||
659 | 662 | * @param $id |
660 | 663 | * @return array|mixed|null|string |
661 | 664 | */ |
662 | - public function makePageCacheKey($id){ |
|
665 | + public function makePageCacheKey($id) |
|
666 | + { |
|
663 | 667 | $hash = $id; |
664 | 668 | $tmp = null; |
665 | 669 | $params = array(); |
666 | - if(!empty($this->systemCacheKey)){ |
|
670 | + if(!empty($this->systemCacheKey)) { |
|
667 | 671 | $hash = $this->systemCacheKey; |
668 | - }else { |
|
672 | + } else { |
|
669 | 673 | if (!empty($_GET)) { |
670 | 674 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
671 | 675 | $params = $_GET; |
@@ -674,7 +678,7 @@ discard block |
||
674 | 678 | } |
675 | 679 | } |
676 | 680 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
677 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
681 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
678 | 682 | $tmp = array_pop($evtOut); |
679 | 683 | } |
680 | 684 | return empty($tmp) ? $hash : $tmp; |
@@ -1085,10 +1089,18 @@ discard block |
||
1085 | 1089 | return array(); |
1086 | 1090 | } |
1087 | 1091 | $spacer = md5('<<<EVO>>>'); |
1088 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1089 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1090 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1091 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1092 | + if($left==='{{' && strpos($content,';}}')!==false) { |
|
1093 | + $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1094 | + } |
|
1095 | + if($left==='{{' && strpos($content,'{{}}')!==false) { |
|
1096 | + $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1097 | + } |
|
1098 | + if($left==='[[' && strpos($content,']]]]')!==false) { |
|
1099 | + $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1100 | + } |
|
1101 | + if($left==='[[' && strpos($content,']]]')!==false) { |
|
1102 | + $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1103 | + } |
|
1092 | 1104 | |
1093 | 1105 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
1094 | 1106 | $pos[']]>'] = strpos($content, ']]>'); |
@@ -1141,7 +1153,8 @@ discard block |
||
1141 | 1153 | } |
1142 | 1154 | } |
1143 | 1155 | |
1144 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
1156 | + if (!in_array($fetch, $tags)) { |
|
1157 | +// Avoid double Matches |
|
1145 | 1158 | $tags[] = $fetch; // Fetch |
1146 | 1159 | }; |
1147 | 1160 | $fetch = ''; // and reset |
@@ -1159,7 +1172,9 @@ discard block |
||
1159 | 1172 | } |
1160 | 1173 | } |
1161 | 1174 | foreach($tags as $i=>$tag) { |
1162 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1175 | + if(strpos($tag,$spacer)!==false) { |
|
1176 | + $tags[$i] = str_replace($spacer, '', $tag); |
|
1177 | + } |
|
1163 | 1178 | } |
1164 | 1179 | return $tags; |
1165 | 1180 | } |
@@ -1199,7 +1214,10 @@ discard block |
||
1199 | 1214 | } |
1200 | 1215 | |
1201 | 1216 | foreach ($matches[1] as $i => $key) { |
1202 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1217 | + if(strpos($key,'[+')!==false) { |
|
1218 | + continue; |
|
1219 | + } |
|
1220 | + // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1203 | 1221 | if (substr($key, 0, 1) == '#') { |
1204 | 1222 | $key = substr($key, 1); |
1205 | 1223 | } // remove # for QuickEdit format |
@@ -1922,7 +1940,8 @@ discard block |
||
1922 | 1940 | * @return mixed|string |
1923 | 1941 | */ |
1924 | 1942 | function _getSGVar($value) |
1925 | - { // Get super globals |
|
1943 | + { |
|
1944 | +// Get super globals |
|
1926 | 1945 | $key = $value; |
1927 | 1946 | $_ = $this->config['enable_filter']; |
1928 | 1947 | $this->config['enable_filter'] = 1; |
@@ -2324,7 +2343,8 @@ discard block |
||
2324 | 2343 | if ($this->config['friendly_urls'] == 1) { |
2325 | 2344 | $aliases = array(); |
2326 | 2345 | if (is_array($this->documentListing)) { |
2327 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
2346 | + foreach ($this->documentListing as $path => $docid) { |
|
2347 | +// This is big Loop on large site! |
|
2328 | 2348 | $aliases[$docid] = $path; |
2329 | 2349 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
2330 | 2350 | } |
@@ -2357,7 +2377,7 @@ discard block |
||
2357 | 2377 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2358 | 2378 | $pref = $this->config['friendly_url_prefix']; |
2359 | 2379 | $suff = $this->config['friendly_url_suffix']; |
2360 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2380 | + $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
2361 | 2381 | global $modx; |
2362 | 2382 | $thealias = $aliases[$m[1]]; |
2363 | 2383 | $thefolder = $isfolder[$m[1]]; |
@@ -4147,7 +4167,8 @@ discard block |
||
4147 | 4167 | if (isset ($this->snippetCache[$snippetName])) { |
4148 | 4168 | $snippet = $this->snippetCache[$snippetName]; |
4149 | 4169 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
4150 | - } else { // not in cache so let's check the db |
|
4170 | + } else { |
|
4171 | +// not in cache so let's check the db |
|
4151 | 4172 | $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
4152 | 4173 | $result = $this->db->query($sql); |
4153 | 4174 | if ($this->db->getRecordCount($result) == 1) { |
@@ -4653,7 +4674,7 @@ discard block |
||
4653 | 4674 | $result = $this->db->makeArray($rs); |
4654 | 4675 | |
4655 | 4676 | // get default/built-in template variables |
4656 | - if(is_array($docRow)){ |
|
4677 | + if(is_array($docRow)) { |
|
4657 | 4678 | ksort($docRow); |
4658 | 4679 | |
4659 | 4680 | foreach ($docRow as $key => $value) { |
@@ -5131,12 +5152,16 @@ discard block |
||
5131 | 5152 | return ''; |
5132 | 5153 | } // nothing to register |
5133 | 5154 | if (!is_array($options)) { |
5134 | - if (is_bool($options)) // backward compatibility with old plaintext parameter |
|
5155 | + if (is_bool($options)) { |
|
5156 | + // backward compatibility with old plaintext parameter |
|
5135 | 5157 | { |
5136 | 5158 | $options = array('plaintext' => $options); |
5137 | - } elseif (is_string($options)) // Also allow script name as 2nd param |
|
5159 | + } |
|
5160 | + } elseif (is_string($options)) { |
|
5161 | + // Also allow script name as 2nd param |
|
5138 | 5162 | { |
5139 | 5163 | $options = array('name' => $options); |
5164 | + } |
|
5140 | 5165 | } else { |
5141 | 5166 | $options = array(); |
5142 | 5167 | } |
@@ -5148,7 +5173,8 @@ discard block |
||
5148 | 5173 | unset($overwritepos); // probably unnecessary--just making sure |
5149 | 5174 | |
5150 | 5175 | $useThisVer = true; |
5151 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
5176 | + if (isset($this->loadedjscripts[$key])) { |
|
5177 | +// a matching script was found |
|
5152 | 5178 | // if existing script is a startup script, make sure the candidate is also a startup script |
5153 | 5179 | if ($this->loadedjscripts[$key]['startup']) { |
5154 | 5180 | $startup = true; |
@@ -5168,7 +5194,8 @@ discard block |
||
5168 | 5194 | // overwrite the old script (the position may be important for dependent scripts) |
5169 | 5195 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
5170 | 5196 | } |
5171 | - } else { // Use the original version |
|
5197 | + } else { |
|
5198 | +// Use the original version |
|
5172 | 5199 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
5173 | 5200 | // need to move the exisiting script to the head |
5174 | 5201 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5292,7 +5319,8 @@ discard block |
||
5292 | 5319 | } |
5293 | 5320 | |
5294 | 5321 | $results = null; |
5295 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
5322 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
5323 | +// start for loop |
|
5296 | 5324 | if ($this->dumpPlugins) { |
5297 | 5325 | $eventtime = $this->getMicroTime(); |
5298 | 5326 | } |
@@ -5840,7 +5868,8 @@ discard block |
||
5840 | 5868 | * @return bool |
5841 | 5869 | */ |
5842 | 5870 | function isSafeCode($phpcode = '', $safe_functions = '') |
5843 | - { // return true or false |
|
5871 | + { |
|
5872 | +// return true or false |
|
5844 | 5873 | if ($safe_functions == '') { |
5845 | 5874 | return false; |
5846 | 5875 | } |
@@ -6256,7 +6285,7 @@ discard block |
||
6256 | 6285 | $args = array_pad(array(), $_, '$var'); |
6257 | 6286 | $args = implode(", ", $args); |
6258 | 6287 | $modx = &$this; |
6259 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6288 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
6260 | 6289 | $arg = $val['args'][$tmp - 1]; |
6261 | 6290 | switch (true) { |
6262 | 6291 | case is_null($arg): { |
@@ -12,11 +12,13 @@ discard block |
||
12 | 12 | |
13 | 13 | */ |
14 | 14 | |
15 | -class logHandler { |
|
15 | +class logHandler |
|
16 | +{ |
|
16 | 17 | // Single variable for a log entry |
17 | 18 | var $entry = array(); |
18 | 19 | |
19 | - function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") { |
|
20 | + function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") |
|
21 | + { |
|
20 | 22 | global $modx; |
21 | 23 | $this->entry['msg'] = $msg; // writes testmessage to the object |
22 | 24 | $this->entry['action'] = empty($action)? $modx->manager->action : $action; // writes the action to the object |
@@ -26,10 +28,16 @@ discard block |
||
26 | 28 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
27 | 29 | |
28 | 30 | $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
29 | - if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
31 | + if($this->entry['itemId'] == 0) { |
|
32 | + $this->entry['itemId'] = "-"; |
|
33 | + } |
|
34 | + // to stop items having id 0 |
|
30 | 35 | |
31 | 36 | $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object |
32 | - if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
37 | + if($this->entry['itemName'] == "") { |
|
38 | + $this->entry['itemName'] = "-"; |
|
39 | + } |
|
40 | + // to stop item name being empty |
|
33 | 41 | |
34 | 42 | $this->writeToLog(); |
35 | 43 | return; |
@@ -38,7 +46,8 @@ discard block |
||
38 | 46 | // function to write to the log |
39 | 47 | // collects all required info, and |
40 | 48 | // writes it to the logging table |
41 | - function writeToLog() { |
|
49 | + function writeToLog() |
|
50 | + { |
|
42 | 51 | global $modx; |
43 | 52 | $tbl_manager_log = $modx->getFullTableName('manager_log'); |
44 | 53 |
@@ -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 | // PROCESSOR FIRST |
5 | 7 | if($_SESSION['mgrRole'] == 1) { |
@@ -17,12 +19,12 @@ discard block |
||
17 | 19 | $warningspresent = 0; |
18 | 20 | |
19 | 21 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
20 | -if ($sysfiles_check!=='0'){ |
|
22 | +if ($sysfiles_check!=='0') { |
|
21 | 23 | $warningspresent = 1; |
22 | 24 | $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
23 | 25 | } |
24 | 26 | |
25 | -if (is_writable("includes/config.inc.php")){ |
|
27 | +if (is_writable("includes/config.inc.php")) { |
|
26 | 28 | // Warn if world writable |
27 | 29 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
28 | 30 | $warningspresent = 1; |
@@ -115,7 +117,8 @@ discard block |
||
115 | 117 | } |
116 | 118 | |
117 | 119 | if (!function_exists('checkSiteCache')) { |
118 | - function checkSiteCache() { |
|
120 | + function checkSiteCache() |
|
121 | + { |
|
119 | 122 | global $modx; |
120 | 123 | $checked= true; |
121 | 124 | if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
@@ -154,26 +157,36 @@ discard block |
||
154 | 157 | |
155 | 158 | if ($warningspresent==1) { |
156 | 159 | |
157 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
160 | +if(!isset($modx->config['send_errormail'])) { |
|
161 | + $modx->config['send_errormail']='3'; |
|
162 | +} |
|
158 | 163 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
159 | 164 | |
160 | 165 | for ($i=0;$i<count($warnings);$i++) { |
161 | 166 | switch ($warnings[$i][0]) { |
162 | 167 | case $_lang['configcheck_configinc']; |
163 | 168 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
164 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
169 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
170 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
171 | + } |
|
165 | 172 | break; |
166 | 173 | case $_lang['configcheck_installer'] : |
167 | 174 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
168 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
175 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
176 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
177 | + } |
|
169 | 178 | break; |
170 | 179 | case $_lang['configcheck_cache'] : |
171 | 180 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
172 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
181 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
182 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
183 | + } |
|
173 | 184 | break; |
174 | 185 | case $_lang['configcheck_images'] : |
175 | 186 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
176 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
187 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
188 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
189 | + } |
|
177 | 190 | break; |
178 | 191 | case $_lang['configcheck_sysfiles_mod']: |
179 | 192 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
@@ -181,7 +194,9 @@ discard block |
||
181 | 194 | if($modx->hasPermission('settings')) { |
182 | 195 | $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
183 | 196 | } |
184 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
197 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
198 | + $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
199 | + } |
|
185 | 200 | break; |
186 | 201 | case $_lang['configcheck_lang_difference'] : |
187 | 202 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -7,9 +7,11 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +Class TemplateParser |
|
11 | +{ |
|
11 | 12 | |
12 | - function __construct() { |
|
13 | + function __construct() |
|
14 | + { |
|
13 | 15 | } |
14 | 16 | |
15 | 17 | /** |
@@ -17,46 +19,47 @@ discard block |
||
17 | 19 | * @param array $data |
18 | 20 | * @return string |
19 | 21 | */ |
20 | - public function output($config = array(), $data = array()) { |
|
22 | + public function output($config = array(), $data = array()) |
|
23 | + { |
|
21 | 24 | global $modx; |
22 | 25 | |
23 | 26 | $output = ''; |
24 | 27 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
25 | 28 | $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
26 | 29 | |
27 | - if($action) { |
|
30 | + if($action) { |
|
28 | 31 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
29 | 32 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
30 | 33 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
31 | 34 | WHERE t1.action IN(' . $action . ') ' . $tab . ' |
32 | 35 | ORDER BY t1.tab ASC, t1.rank ASC'); |
33 | 36 | |
34 | - if($modx->db->getRecordCount($sql)) { |
|
37 | + if($modx->db->getRecordCount($sql)) { |
|
35 | 38 | $tabs = array(); |
36 | - while($row = $modx->db->getRow($sql)) { |
|
37 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
39 | + while($row = $modx->db->getRow($sql)) { |
|
40 | + if(!$row['value'] && !empty($data[$row['name']])) { |
|
38 | 41 | $row['value'] = $data[$row['name']]; |
39 | 42 | } |
40 | 43 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
41 | 44 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
42 | 45 | } |
43 | 46 | |
44 | - if(!empty($config['toArray'])) { |
|
47 | + if(!empty($config['toArray'])) { |
|
45 | 48 | $output = $tabs; |
46 | - } else { |
|
49 | + } else { |
|
47 | 50 | $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
48 | 51 | $output .= ' |
49 | 52 | <script type="text/javascript"> |
50 | 53 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
51 | 54 | </script>'; |
52 | 55 | |
53 | - foreach($tabs as $idTab => $tab) { |
|
56 | + foreach($tabs as $idTab => $tab) { |
|
54 | 57 | $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
55 | 58 | $output .= ' |
56 | 59 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
57 | 60 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
58 | 61 | unset($tab['category_name']); |
59 | - foreach($tab as $item) { |
|
62 | + foreach($tab as $item) { |
|
60 | 63 | $output .= $item; |
61 | 64 | } |
62 | 65 | $output .= '</div>'; |
@@ -69,7 +72,8 @@ discard block |
||
69 | 72 | return $output; |
70 | 73 | } |
71 | 74 | |
72 | - private function render($data) { |
|
75 | + private function render($data) |
|
76 | + { |
|
73 | 77 | global $modx, $_lang, $_country_lang; |
74 | 78 | |
75 | 79 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -79,7 +83,7 @@ discard block |
||
79 | 83 | $output = ''; |
80 | 84 | $output .= '<div class="form-group row">'; |
81 | 85 | |
82 | - switch($data['type']) { |
|
86 | + switch($data['type']) { |
|
83 | 87 | |
84 | 88 | case 'text': |
85 | 89 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -113,16 +117,16 @@ discard block |
||
113 | 117 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
114 | 118 | $output .= '<div class="col-sm-7">'; |
115 | 119 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
116 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
120 | + if($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | 121 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
118 | 122 | $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
119 | - foreach($_country_lang as $key => $value) { |
|
123 | + foreach($_country_lang as $key => $value) { |
|
120 | 124 | $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
121 | 125 | } |
122 | - } else { |
|
123 | - if($data['elements']) { |
|
126 | + } else { |
|
127 | + if($data['elements']) { |
|
124 | 128 | $elements = explode('||', $data['elements']); |
125 | - foreach($elements as $key => $value) { |
|
129 | + foreach($elements as $key => $value) { |
|
126 | 130 | $value = explode('==', $value); |
127 | 131 | $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
128 | 132 | } |
@@ -138,9 +142,9 @@ discard block |
||
138 | 142 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
139 | 143 | $output .= '<div class="col-sm-7">'; |
140 | 144 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
141 | - if($data['elements']) { |
|
145 | + if($data['elements']) { |
|
142 | 146 | $elements = explode('||', $data['elements']); |
143 | - foreach($elements as $key => $value) { |
|
147 | + foreach($elements as $key => $value) { |
|
144 | 148 | $value = explode('==', $value); |
145 | 149 | $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
146 | 150 | } |
@@ -154,9 +158,9 @@ discard block |
||
154 | 158 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
155 | 159 | $output .= '<div class="col-sm-7">'; |
156 | 160 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
157 | - if($data['elements']) { |
|
161 | + if($data['elements']) { |
|
158 | 162 | $elements = explode('||', $data['elements']); |
159 | - foreach($elements as $key => $value) { |
|
163 | + foreach($elements as $key => $value) { |
|
160 | 164 | $value = explode('==', $value); |
161 | 165 | $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
162 | 166 | } |
@@ -1,5 +1,7 @@ |
||
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 | // show debug information |
5 | 7 | if(isset($enable_debug) && $enable_debug==true) { |
@@ -3,10 +3,12 @@ discard block |
||
3 | 3 | global $ContextMenuCnt; |
4 | 4 | $ContextMenuCnt = 0; |
5 | 5 | |
6 | -class ContextMenu { |
|
6 | +class ContextMenu |
|
7 | +{ |
|
7 | 8 | var $id; |
8 | 9 | |
9 | - function __construct($id = '', $width = 120, $visible = false) { |
|
10 | + function __construct($id = '', $width = 120, $visible = false) |
|
11 | + { |
|
10 | 12 | global $ContextMenuCnt; |
11 | 13 | $ContextMenuCnt++; |
12 | 14 | $this->html = ""; |
@@ -15,7 +17,8 @@ discard block |
||
15 | 17 | $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
16 | 18 | } |
17 | 19 | |
18 | - function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
20 | + function addItem($text, $action = "", $img = "", $disabled = 0) |
|
21 | + { |
|
19 | 22 | global $base_url, $_style; |
20 | 23 | if($disabled) { |
21 | 24 | return; |
@@ -40,13 +43,15 @@ discard block |
||
40 | 43 | $this->html .= $img . ' ' . $text . '</div>'; |
41 | 44 | } |
42 | 45 | |
43 | - function addSeparator() { |
|
46 | + function addSeparator() |
|
47 | + { |
|
44 | 48 | $this->html .= " |
45 | 49 | <div class='cntxMnuSeparator'></div> |
46 | 50 | "; |
47 | 51 | } |
48 | 52 | |
49 | - function render() { |
|
53 | + function render() |
|
54 | + { |
|
50 | 55 | global $ContextMenuScript; |
51 | 56 | |
52 | 57 | $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
@@ -54,7 +59,8 @@ discard block |
||
54 | 59 | return $html; |
55 | 60 | } |
56 | 61 | |
57 | - function getClientScriptObject() { |
|
62 | + function getClientScriptObject() |
|
63 | + { |
|
58 | 64 | return "getCntxMenu('" . $this->id . "')"; |
59 | 65 | } |
60 | 66 | } |