@@ -1,5 +1,5 @@ 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") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Secure Manager Documents |
@@ -10,20 +10,20 @@ discard block |
||
10 | 10 | * |
11 | 11 | */ |
12 | 12 | |
13 | -function secureMgrDocument($docid='') { |
|
13 | +function secureMgrDocument($docid = ''){ |
|
14 | 14 | global $modx; |
15 | 15 | |
16 | - $modx->db->update('privatemgr = 0', $modx->getFullTableName("site_content"), ($docid>0 ? "id='$docid'":"privatemgr = 1")); |
|
16 | + $modx->db->update('privatemgr = 0', $modx->getFullTableName("site_content"), ($docid > 0 ? "id='$docid'" : "privatemgr = 1")); |
|
17 | 17 | $rs = $modx->db->select( |
18 | 18 | 'DISTINCT sc.id', |
19 | 19 | $modx->getFullTableName("site_content")." sc |
20 | 20 | LEFT JOIN ".$modx->getFullTableName("document_groups")." dg ON dg.document = sc.id |
21 | 21 | LEFT JOIN ".$modx->getFullTableName("membergroup_access")." mga ON mga.documentgroup = dg.document_group", |
22 | - ($docid>0 ? " sc.id='{$docid}' AND ":"")."mga.id>0" |
|
22 | + ($docid > 0 ? " sc.id='{$docid}' AND " : "")."mga.id>0" |
|
23 | 23 | ); |
24 | - $ids = $modx->db->getColumn("id",$rs); |
|
25 | - if(count($ids)>0) { |
|
26 | - $modx->db->update('privatemgr = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ",$ids).")"); |
|
24 | + $ids = $modx->db->getColumn("id", $rs); |
|
25 | + if (count($ids) > 0) { |
|
26 | + $modx->db->update('privatemgr = 1', $modx->getFullTableName("site_content"), "id IN (".implode(", ", $ids).")"); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | ?> |
30 | 30 | \ No newline at end of file |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | function __call($method_name, $arguments) |
128 | 128 | { |
129 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
129 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
130 | 130 | if (method_exists($this->old, $method_name)) { |
131 | 131 | $error_type = 1; |
132 | 132 | } else { |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | $info = debug_backtrace(); |
145 | 145 | $m[] = $msg; |
146 | 146 | if (!empty($this->currentSnippet)) { |
147 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
147 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
148 | 148 | } elseif (!empty($this->event->activePlugin)) { |
149 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
149 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
150 | 150 | } |
151 | 151 | $m[] = $this->decoded_request_uri; |
152 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
152 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
153 | 153 | $msg = implode('<br />', $m); |
154 | 154 | $this->logEvent(0, $error_type, $msg, $title); |
155 | 155 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | { |
167 | 167 | $flag = false; |
168 | 168 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
169 | - $flag = (bool)$this->{$connector}->conn; |
|
169 | + $flag = (bool) $this->{$connector}->conn; |
|
170 | 170 | } |
171 | 171 | return $flag; |
172 | 172 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | if (!$out && $flag) { |
195 | 195 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
196 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
196 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
197 | 197 | $out = is_file($filename) ? include $filename : false; |
198 | 198 | } |
199 | 199 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | function getMicroTime() |
211 | 211 | { |
212 | 212 | list ($usec, $sec) = explode(' ', microtime()); |
213 | - return ((float)$usec + (float)$sec); |
|
213 | + return ((float) $usec + (float) $sec); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | // append the redirect count string to the url |
234 | 234 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
235 | 235 | if ($currentNumberOfRedirects > 3) { |
236 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
236 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
237 | 237 | } else { |
238 | 238 | $currentNumberOfRedirects += 1; |
239 | 239 | if (strpos($url, "?") > 0) { |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | } |
245 | 245 | } |
246 | 246 | if ($type == 'REDIRECT_REFRESH') { |
247 | - $header = 'Refresh: 0;URL=' . $url; |
|
247 | + $header = 'Refresh: 0;URL='.$url; |
|
248 | 248 | } elseif ($type == 'REDIRECT_META') { |
249 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
249 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
250 | 250 | echo $header; |
251 | 251 | exit; |
252 | 252 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
@@ -254,10 +254,10 @@ discard block |
||
254 | 254 | global $base_url, $site_url; |
255 | 255 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
256 | 256 | // append $site_url to make it work with Location: |
257 | - $url = $site_url . substr($url, strlen($base_url)); |
|
257 | + $url = $site_url.substr($url, strlen($base_url)); |
|
258 | 258 | } |
259 | 259 | if (strpos($url, "\n") === false) { |
260 | - $header = 'Location: ' . $url; |
|
260 | + $header = 'Location: '.$url; |
|
261 | 261 | } else { |
262 | 262 | $this->messageQuit('No newline allowed in redirect url.'); |
263 | 263 | } |
@@ -366,8 +366,8 @@ discard block |
||
366 | 366 | |
367 | 367 | private function recoverySiteCache() |
368 | 368 | { |
369 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
370 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
369 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
370 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
371 | 371 | |
372 | 372 | if (is_file($site_cache_path)) { |
373 | 373 | include($site_cache_path); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | return; |
377 | 377 | } |
378 | 378 | |
379 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
379 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
380 | 380 | $cache = new synccache(); |
381 | 381 | $cache->setCachepath($site_cache_dir); |
382 | 382 | $cache->setReport(false); |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | $this->invokeEvent("OnBeforeManagerPageInit"); |
428 | 428 | } |
429 | 429 | |
430 | - if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
431 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
430 | + if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { |
|
431 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
432 | 432 | } else { |
433 | 433 | if ($usrType == 'web') { |
434 | 434 | $from = $tbl_web_user_settings; |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
449 | 449 | } |
450 | 450 | if (isset ($usrType)) { |
451 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
451 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
452 | 452 | } // store user settings in session |
453 | 453 | } |
454 | 454 | } |
@@ -593,10 +593,10 @@ discard block |
||
593 | 593 | $suf = $this->config['friendly_url_suffix']; |
594 | 594 | $pre = preg_quote($pre, '/'); |
595 | 595 | $suf = preg_quote($suf, '/'); |
596 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
596 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
597 | 597 | $q = $_[1]; |
598 | 598 | } |
599 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
599 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
600 | 600 | $q = $_[1]; |
601 | 601 | } |
602 | 602 | |
@@ -618,7 +618,7 @@ discard block |
||
618 | 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 */ |
619 | 619 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
620 | 620 | if ($this->config['use_alias_path'] == 1) { |
621 | - 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))))) { |
|
621 | + 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 | 622 | $this->documentMethod = 'id'; |
623 | 623 | return $q; |
624 | 624 | } else { /* not a valid id in terms of virtualDir, treat as alias */ |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | */ |
653 | 653 | public function getHashFile($key) |
654 | 654 | { |
655 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
655 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
656 | 656 | } |
657 | 657 | |
658 | 658 | /** |
@@ -663,9 +663,9 @@ discard block |
||
663 | 663 | $hash = $id; |
664 | 664 | $tmp = null; |
665 | 665 | $params = array(); |
666 | - if(!empty($this->systemCacheKey)){ |
|
666 | + if (!empty($this->systemCacheKey)) { |
|
667 | 667 | $hash = $this->systemCacheKey; |
668 | - }else { |
|
668 | + } else { |
|
669 | 669 | if (!empty($_GET)) { |
670 | 670 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
671 | 671 | $params = $_GET; |
@@ -673,8 +673,8 @@ discard block |
||
673 | 673 | $hash .= '_'.md5(http_build_query($params)); |
674 | 674 | } |
675 | 675 | } |
676 | - $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
|
677 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
676 | + $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
|
677 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
678 | 678 | $tmp = array_pop($evtOut); |
679 | 679 | } |
680 | 680 | return empty($tmp) ? $hash : $tmp; |
@@ -816,12 +816,12 @@ discard block |
||
816 | 816 | if ($js = $this->getRegisteredClientStartupScripts()) { |
817 | 817 | // change to just before closing </head> |
818 | 818 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
819 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
819 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | // Insert jscripts & html block into template - template must have a </body> tag |
823 | 823 | if ($js = $this->getRegisteredClientScripts()) { |
824 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
824 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
825 | 825 | } |
826 | 826 | // End fix by sirlancelot |
827 | 827 | |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | // send out content-type and content-disposition headers |
833 | 833 | if (IN_PARSER_MODE == "true") { |
834 | 834 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
835 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
835 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
836 | 836 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
837 | 837 | // header('HTTP/1.0 404 Not Found'); |
838 | 838 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | $name = preg_replace('|-+|', '-', $name); |
851 | 851 | $name = trim($name, '-'); |
852 | 852 | } |
853 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
853 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
854 | 854 | header($header); |
855 | 855 | } |
856 | 856 | } |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | |
859 | 859 | $stats = $this->getTimerStats($this->tstart); |
860 | 860 | |
861 | - $out =& $this->documentOutput; |
|
861 | + $out = & $this->documentOutput; |
|
862 | 862 | $out = str_replace("[^q^]", $stats['queries'], $out); |
863 | 863 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
864 | 864 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -897,17 +897,17 @@ discard block |
||
897 | 897 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
898 | 898 | $tt += $t; |
899 | 899 | } |
900 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
900 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; |
|
901 | 901 | echo $this->snippetsCode; |
902 | 902 | } |
903 | 903 | if ($this->dumpPlugins) { |
904 | 904 | $ps = ""; |
905 | 905 | $tc = 0; |
906 | 906 | foreach ($this->pluginsTime as $s => $t) { |
907 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
907 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
908 | 908 | $tt += $t; |
909 | 909 | } |
910 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
910 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
911 | 911 | echo $this->pluginsCode; |
912 | 912 | } |
913 | 913 | |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | $srcTags = explode(',', $tags); |
934 | 934 | $repTags = array(); |
935 | 935 | foreach ($srcTags as $tag) { |
936 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
936 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
937 | 937 | } |
938 | 938 | return array($srcTags, $repTags); |
939 | 939 | } |
@@ -955,7 +955,7 @@ discard block |
||
955 | 955 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
956 | 956 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
957 | 957 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
958 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
958 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
959 | 959 | |
960 | 960 | return $stats; |
961 | 961 | } |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | { |
989 | 989 | $cacheRefreshTime = 0; |
990 | 990 | $recent_update = 0; |
991 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
991 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
992 | 992 | $this->recentUpdate = $recent_update; |
993 | 993 | |
994 | 994 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1042,8 +1042,8 @@ discard block |
||
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | $docObjSerial = serialize($this->documentObject); |
1045 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
1046 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
1045 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
1046 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
1047 | 1047 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
1048 | 1048 | } |
1049 | 1049 | } |
@@ -1085,16 +1085,16 @@ discard block |
||
1085 | 1085 | return array(); |
1086 | 1086 | } |
1087 | 1087 | $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); |
|
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 | 1092 | |
1093 | 1093 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
1094 | 1094 | $pos[']]>'] = strpos($content, ']]>'); |
1095 | 1095 | |
1096 | 1096 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
1097 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
1097 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | $lp = explode($left, $content); |
@@ -1158,8 +1158,8 @@ discard block |
||
1158 | 1158 | } |
1159 | 1159 | } |
1160 | 1160 | } |
1161 | - foreach($tags as $i=>$tag) { |
|
1162 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1161 | + foreach ($tags as $i=>$tag) { |
|
1162 | + if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1163 | 1163 | } |
1164 | 1164 | return $tags; |
1165 | 1165 | } |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | } |
1200 | 1200 | |
1201 | 1201 | foreach ($matches[1] as $i => $key) { |
1202 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1202 | + if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1203 | 1203 | if (substr($key, 0, 1) == '#') { |
1204 | 1204 | $key = substr($key, 1); |
1205 | 1205 | } // remove # for QuickEdit format |
@@ -1219,8 +1219,8 @@ discard block |
||
1219 | 1219 | } |
1220 | 1220 | |
1221 | 1221 | if (is_array($value)) { |
1222 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
1223 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
1222 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
1223 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
1224 | 1224 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
1225 | 1225 | } |
1226 | 1226 | |
@@ -1231,8 +1231,8 @@ discard block |
||
1231 | 1231 | |
1232 | 1232 | if (strpos($content, $s) !== false) { |
1233 | 1233 | $content = str_replace($s, $value, $content); |
1234 | - } elseif($this->debug) { |
|
1235 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1234 | + } elseif ($this->debug) { |
|
1235 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1236 | 1236 | } |
1237 | 1237 | } |
1238 | 1238 | |
@@ -1399,8 +1399,8 @@ discard block |
||
1399 | 1399 | $s = &$matches[0][$i]; |
1400 | 1400 | if (strpos($content, $s) !== false) { |
1401 | 1401 | $content = str_replace($s, $value, $content); |
1402 | - } elseif($this->debug) { |
|
1403 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1402 | + } elseif ($this->debug) { |
|
1403 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1404 | 1404 | } |
1405 | 1405 | } |
1406 | 1406 | return $content; |
@@ -1453,7 +1453,7 @@ discard block |
||
1453 | 1453 | } |
1454 | 1454 | |
1455 | 1455 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
1456 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1456 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1457 | 1457 | if ($this->config['enable_at_syntax']) { |
1458 | 1458 | $value = $this->mergeConditionalTagsContent($value); |
1459 | 1459 | } |
@@ -1468,8 +1468,8 @@ discard block |
||
1468 | 1468 | $s = &$matches[0][$i]; |
1469 | 1469 | if (strpos($content, $s) !== false) { |
1470 | 1470 | $content = str_replace($s, $value, $content); |
1471 | - } elseif($this->debug) { |
|
1472 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1471 | + } elseif ($this->debug) { |
|
1472 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1473 | 1473 | } |
1474 | 1474 | } |
1475 | 1475 | return $content; |
@@ -1527,8 +1527,8 @@ discard block |
||
1527 | 1527 | $s = &$matches[0][$i]; |
1528 | 1528 | if (strpos($content, $s) !== false) { |
1529 | 1529 | $content = str_replace($s, $value, $content); |
1530 | - } elseif($this->debug) { |
|
1531 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1530 | + } elseif ($this->debug) { |
|
1531 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1532 | 1532 | } |
1533 | 1533 | } |
1534 | 1534 | return $content; |
@@ -1552,7 +1552,7 @@ discard block |
||
1552 | 1552 | return $content; |
1553 | 1553 | } |
1554 | 1554 | |
1555 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
1555 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
1556 | 1556 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); |
1557 | 1557 | |
1558 | 1558 | $pieces = explode('<@IF:', $content); |
@@ -1563,7 +1563,7 @@ discard block |
||
1563 | 1563 | } |
1564 | 1564 | list($cmd, $text) = explode('>', $split, 2); |
1565 | 1565 | $cmd = str_replace("'", "\'", $cmd); |
1566 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1566 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1567 | 1567 | $content .= $text; |
1568 | 1568 | } |
1569 | 1569 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1574,13 +1574,13 @@ discard block |
||
1574 | 1574 | } |
1575 | 1575 | list($cmd, $text) = explode('>', $split, 2); |
1576 | 1576 | $cmd = str_replace("'", "\'", $cmd); |
1577 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1577 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1578 | 1578 | $content .= $text; |
1579 | 1579 | } |
1580 | 1580 | |
1581 | 1581 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
1582 | 1582 | ob_start(); |
1583 | - $content = eval('?>' . $content); |
|
1583 | + $content = eval('?>'.$content); |
|
1584 | 1584 | $content = ob_get_clean(); |
1585 | 1585 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); |
1586 | 1586 | |
@@ -1706,7 +1706,7 @@ discard block |
||
1706 | 1706 | $matches = $this->getTagsFromContent($content, $left, $right); |
1707 | 1707 | if (!empty($matches)) { |
1708 | 1708 | foreach ($matches[0] as $i => $v) { |
1709 | - $addBreakMatches[$i] = $v . "\n"; |
|
1709 | + $addBreakMatches[$i] = $v."\n"; |
|
1710 | 1710 | } |
1711 | 1711 | $content = str_replace($addBreakMatches, '', $content); |
1712 | 1712 | if (strpos($content, $left) !== false) { |
@@ -1739,8 +1739,8 @@ discard block |
||
1739 | 1739 | $s = &$matches[0][$i]; |
1740 | 1740 | if (strpos($content, $s) !== false) { |
1741 | 1741 | $content = str_replace($s, $v, $content); |
1742 | - } elseif($this->debug) { |
|
1743 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1742 | + } elseif ($this->debug) { |
|
1743 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1744 | 1744 | } |
1745 | 1745 | } |
1746 | 1746 | return $content; |
@@ -1801,7 +1801,7 @@ discard block |
||
1801 | 1801 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg; |
1802 | 1802 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); |
1803 | 1803 | if ($this->isBackend()) { |
1804 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
1804 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
1805 | 1805 | } |
1806 | 1806 | } |
1807 | 1807 | } else { |
@@ -1847,7 +1847,7 @@ discard block |
||
1847 | 1847 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo; |
1848 | 1848 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); |
1849 | 1849 | if ($this->isBackend()) { |
1850 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
1850 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
1851 | 1851 | } |
1852 | 1852 | } |
1853 | 1853 | } |
@@ -1855,7 +1855,7 @@ discard block |
||
1855 | 1855 | if (is_array($return) || is_object($return)) { |
1856 | 1856 | return $return; |
1857 | 1857 | } else { |
1858 | - return $echo . $return; |
|
1858 | + return $echo.$return; |
|
1859 | 1859 | } |
1860 | 1860 | } |
1861 | 1861 | |
@@ -1893,8 +1893,8 @@ discard block |
||
1893 | 1893 | } |
1894 | 1894 | if (strpos($content, $s) !== false) { |
1895 | 1895 | $content = str_replace($s, $value, $content); |
1896 | - } elseif($this->debug) { |
|
1897 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1896 | + } elseif ($this->debug) { |
|
1897 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1898 | 1898 | } |
1899 | 1899 | continue; |
1900 | 1900 | } |
@@ -1905,8 +1905,8 @@ discard block |
||
1905 | 1905 | |
1906 | 1906 | if (strpos($content, $s) !== false) { |
1907 | 1907 | $content = str_replace($s, $value, $content); |
1908 | - } elseif($this->debug) { |
|
1909 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1908 | + } elseif ($this->debug) { |
|
1909 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1910 | 1910 | } |
1911 | 1911 | } |
1912 | 1912 | |
@@ -1998,7 +1998,7 @@ discard block |
||
1998 | 1998 | $eventtime = sprintf('%2.2f ms', $eventtime * 1000); |
1999 | 1999 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
2000 | 2000 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
2001 | - $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
2001 | + $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
2002 | 2002 | $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', $snippetObject['name'], $eventtime, $piece, $print_r_params, $code); |
2003 | 2003 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
2004 | 2004 | } |
@@ -2239,7 +2239,7 @@ discard block |
||
2239 | 2239 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
2240 | 2240 | $count = $this->db->getRecordCount($rs); |
2241 | 2241 | if (1 < $count) { |
2242 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
2242 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
2243 | 2243 | } |
2244 | 2244 | if ($count) { |
2245 | 2245 | $row = $this->db->getRow($rs); |
@@ -2265,7 +2265,7 @@ discard block |
||
2265 | 2265 | function toAlias($text) |
2266 | 2266 | { |
2267 | 2267 | $suff = $this->config['friendly_url_suffix']; |
2268 | - return str_replace(array('.xml' . $suff, '.rss' . $suff, '.js' . $suff, '.css' . $suff, '.txt' . $suff, '.json' . $suff, '.pdf' . $suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text); |
|
2268 | + return str_replace(array('.xml'.$suff, '.rss'.$suff, '.js'.$suff, '.css'.$suff, '.txt'.$suff, '.json'.$suff, '.pdf'.$suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text); |
|
2269 | 2269 | } |
2270 | 2270 | |
2271 | 2271 | /** |
@@ -2297,7 +2297,7 @@ discard block |
||
2297 | 2297 | $suff = '/'; |
2298 | 2298 | } |
2299 | 2299 | |
2300 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
2300 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
2301 | 2301 | } |
2302 | 2302 | |
2303 | 2303 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2334,7 +2334,7 @@ discard block |
||
2334 | 2334 | preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); |
2335 | 2335 | $ids = implode(',', array_unique($match['1'])); |
2336 | 2336 | if ($ids) { |
2337 | - $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
2337 | + $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
2338 | 2338 | while ($row = $this->db->getRow($res)) { |
2339 | 2339 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
2340 | 2340 | $parent = $row['parent']; |
@@ -2345,7 +2345,7 @@ discard block |
||
2345 | 2345 | $parent = $this->aliasListing[$parent]['parent']; |
2346 | 2346 | } |
2347 | 2347 | |
2348 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
2348 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
2349 | 2349 | } else { |
2350 | 2350 | $aliases[$row['id']] = $row['alias']; |
2351 | 2351 | } |
@@ -2357,7 +2357,7 @@ discard block |
||
2357 | 2357 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2358 | 2358 | $pref = $this->config['friendly_url_prefix']; |
2359 | 2359 | $suff = $this->config['friendly_url_suffix']; |
2360 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2360 | + $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2361 | 2361 | global $modx; |
2362 | 2362 | $thealias = $aliases[$m[1]]; |
2363 | 2363 | $thefolder = $isfolder[$m[1]]; |
@@ -2373,7 +2373,7 @@ discard block |
||
2373 | 2373 | |
2374 | 2374 | } else { |
2375 | 2375 | $in = '!\[\~([0-9]+)\~\]!is'; |
2376 | - $out = "index.php?id=" . '\1'; |
|
2376 | + $out = "index.php?id=".'\1'; |
|
2377 | 2377 | $documentSource = preg_replace($in, $out, $documentSource); |
2378 | 2378 | } |
2379 | 2379 | |
@@ -2398,7 +2398,7 @@ discard block |
||
2398 | 2398 | } else { |
2399 | 2399 | $url_path = $_SERVER['REQUEST_URI']; |
2400 | 2400 | } |
2401 | - $url_path = $q;//LANG |
|
2401 | + $url_path = $q; //LANG |
|
2402 | 2402 | |
2403 | 2403 | |
2404 | 2404 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
@@ -2411,7 +2411,7 @@ discard block |
||
2411 | 2411 | $strictURL = substr($strictURL, $len_base_url); |
2412 | 2412 | } |
2413 | 2413 | $http_host = $_SERVER['HTTP_HOST']; |
2414 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
2414 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
2415 | 2415 | |
2416 | 2416 | $site_url = $this->config['site_url']; |
2417 | 2417 | |
@@ -2427,7 +2427,7 @@ discard block |
||
2427 | 2427 | } |
2428 | 2428 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
2429 | 2429 | if (empty($_POST)) { |
2430 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
2430 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
2431 | 2431 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
2432 | 2432 | exit(0); |
2433 | 2433 | } |
@@ -2490,7 +2490,7 @@ discard block |
||
2490 | 2490 | $docgrp = implode(",", $docgrp); |
2491 | 2491 | } |
2492 | 2492 | // get document |
2493 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2493 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2494 | 2494 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
2495 | 2495 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
2496 | 2496 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2526,9 +2526,9 @@ discard block |
||
2526 | 2526 | } |
2527 | 2527 | if ($documentObject['template']) { |
2528 | 2528 | // load TVs and merge with document - Orig by Apodigm - Docvars |
2529 | - $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv |
|
2530 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
2531 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2529 | + $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv |
|
2530 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
2531 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2532 | 2532 | $tmplvars = array(); |
2533 | 2533 | while ($row = $this->db->getRow($rs)) { |
2534 | 2534 | $tmplvars[$row['name']] = array( |
@@ -2574,7 +2574,7 @@ discard block |
||
2574 | 2574 | $st = md5($source); |
2575 | 2575 | } |
2576 | 2576 | if ($this->dumpSnippets == 1) { |
2577 | - $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2577 | + $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>"; |
|
2578 | 2578 | } |
2579 | 2579 | |
2580 | 2580 | // invoke OnParseDocument event |
@@ -2660,7 +2660,7 @@ discard block |
||
2660 | 2660 | |
2661 | 2661 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
2662 | 2662 | if ($this->config['use_alias_path'] == 1) { |
2663 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
2663 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
2664 | 2664 | if (isset($this->documentListing[$alias])) { |
2665 | 2665 | $this->documentIdentifier = $this->documentListing[$alias]; |
2666 | 2666 | } else { |
@@ -2721,7 +2721,7 @@ discard block |
||
2721 | 2721 | } else { |
2722 | 2722 | $docAlias = $this->db->escape($this->documentIdentifier); |
2723 | 2723 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); |
2724 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
2724 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
2725 | 2725 | } |
2726 | 2726 | } |
2727 | 2727 | $this->documentMethod = 'id'; |
@@ -2778,7 +2778,7 @@ discard block |
||
2778 | 2778 | $_REQUEST[$n] = $_GET[$n] = $v; |
2779 | 2779 | } |
2780 | 2780 | } |
2781 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
2781 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
2782 | 2782 | $this->q = $qp['path']; |
2783 | 2783 | return $qp['path']; |
2784 | 2784 | } |
@@ -2872,7 +2872,7 @@ discard block |
||
2872 | 2872 | $this->sendErrorPage(); |
2873 | 2873 | } else { |
2874 | 2874 | // Inculde the necessary files to check document permissions |
2875 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
2875 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
2876 | 2876 | $udperms = new udperms(); |
2877 | 2877 | $udperms->user = $this->getLoginUserID(); |
2878 | 2878 | $udperms->document = $this->documentIdentifier; |
@@ -2926,7 +2926,7 @@ discard block |
||
2926 | 2926 | while ($id && $height--) { |
2927 | 2927 | $thisid = $id; |
2928 | 2928 | if ($this->config['aliaslistingfolder'] == 1) { |
2929 | - $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1"); |
|
2929 | + $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1"); |
|
2930 | 2930 | if (!$id || $id == '0') { |
2931 | 2931 | break; |
2932 | 2932 | } |
@@ -2977,15 +2977,15 @@ discard block |
||
2977 | 2977 | |
2978 | 2978 | if ($this->config['aliaslistingfolder'] == 1) { |
2979 | 2979 | |
2980 | - $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
2980 | + $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
2981 | 2981 | $idx = array(); |
2982 | 2982 | while ($row = $this->db->getRow($res)) { |
2983 | 2983 | $pAlias = ''; |
2984 | 2984 | if (isset($this->aliasListing[$row['parent']])) { |
2985 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
2986 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
2985 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
2986 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
2987 | 2987 | }; |
2988 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
2988 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
2989 | 2989 | if ($row['isfolder'] == 1) { |
2990 | 2990 | $idx[] = $row['id']; |
2991 | 2991 | } |
@@ -3017,7 +3017,7 @@ discard block |
||
3017 | 3017 | $depth--; |
3018 | 3018 | |
3019 | 3019 | foreach ($documentMap_cache[$id] as $childId) { |
3020 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
3020 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
3021 | 3021 | if (!strlen($pkey)) { |
3022 | 3022 | $pkey = "{$childId}"; |
3023 | 3023 | } |
@@ -3046,7 +3046,7 @@ discard block |
||
3046 | 3046 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
3047 | 3047 | $fnc = substr($url, 11); |
3048 | 3048 | } elseif ($url) { |
3049 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
3049 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
3050 | 3050 | } else { |
3051 | 3051 | $fnc = "history.back(-1);"; |
3052 | 3052 | } |
@@ -3055,7 +3055,7 @@ discard block |
||
3055 | 3055 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
3056 | 3056 | <script> |
3057 | 3057 | function __alertQuit() { |
3058 | - alert('" . addslashes($msg) . "'); |
|
3058 | + alert('".addslashes($msg)."'); |
|
3059 | 3059 | {$fnc} |
3060 | 3060 | } |
3061 | 3061 | window.setTimeout('__alertQuit();',100); |
@@ -3079,7 +3079,7 @@ discard block |
||
3079 | 3079 | if ($pms) { |
3080 | 3080 | $state = ($pms[$pm] == 1); |
3081 | 3081 | } |
3082 | - return (int)$state; |
|
3082 | + return (int) $state; |
|
3083 | 3083 | } |
3084 | 3084 | |
3085 | 3085 | /** |
@@ -3160,7 +3160,7 @@ discard block |
||
3160 | 3160 | $this->lockedElements = array(); |
3161 | 3161 | $this->cleanupExpiredLocks(); |
3162 | 3162 | |
3163 | - $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul |
|
3163 | + $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul |
|
3164 | 3164 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
3165 | 3165 | while ($row = $this->db->getRow($rs)) { |
3166 | 3166 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3196,7 +3196,7 @@ discard block |
||
3196 | 3196 | foreach ($rs as $row) { |
3197 | 3197 | $userSids[] = $row['sid']; |
3198 | 3198 | } |
3199 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
3199 | + $userSids = "'".implode("','", $userSids)."'"; |
|
3200 | 3200 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
3201 | 3201 | } else { |
3202 | 3202 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3393,8 +3393,8 @@ discard block |
||
3393 | 3393 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
3394 | 3394 | if ($this->config['send_errormail'] <= $type) { |
3395 | 3395 | $this->sendmail(array( |
3396 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
3397 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
3396 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
3397 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
3398 | 3398 | 'type' => 'text' |
3399 | 3399 | )); |
3400 | 3400 | } |
@@ -3442,7 +3442,7 @@ discard block |
||
3442 | 3442 | $p['fromname'] = $userinfo['username']; |
3443 | 3443 | } |
3444 | 3444 | if ($msg === '' && !isset($p['body'])) { |
3445 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
3445 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
3446 | 3446 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
3447 | 3447 | $p['body'] = $msg; |
3448 | 3448 | } |
@@ -3482,8 +3482,8 @@ discard block |
||
3482 | 3482 | $files = array(); |
3483 | 3483 | } |
3484 | 3484 | foreach ($files as $f) { |
3485 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
3486 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
3485 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
3486 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
3487 | 3487 | } |
3488 | 3488 | } |
3489 | 3489 | $rs = $this->mail->send(); |
@@ -3561,14 +3561,14 @@ discard block |
||
3561 | 3561 | $tblsc = $this->getFullTableName("site_content"); |
3562 | 3562 | $tbldg = $this->getFullTableName("document_groups"); |
3563 | 3563 | // modify field names to use sc. table reference |
3564 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3565 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3564 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3565 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3566 | 3566 | // get document groups for current user |
3567 | 3567 | if ($docgrp = $this->getUserDocGroups()) { |
3568 | 3568 | $docgrp = implode(",", $docgrp); |
3569 | 3569 | } |
3570 | 3570 | // build query |
3571 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3571 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3572 | 3572 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3573 | 3573 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3574 | 3574 | $resourceArray = $this->db->makeArray($result); |
@@ -3598,14 +3598,14 @@ discard block |
||
3598 | 3598 | $tbldg = $this->getFullTableName("document_groups"); |
3599 | 3599 | |
3600 | 3600 | // modify field names to use sc. table reference |
3601 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3602 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3601 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3602 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3603 | 3603 | // get document groups for current user |
3604 | 3604 | if ($docgrp = $this->getUserDocGroups()) { |
3605 | 3605 | $docgrp = implode(",", $docgrp); |
3606 | 3606 | } |
3607 | 3607 | // build query |
3608 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3608 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3609 | 3609 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3610 | 3610 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3611 | 3611 | $resourceArray = $this->db->makeArray($result); |
@@ -3640,16 +3640,16 @@ discard block |
||
3640 | 3640 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
3641 | 3641 | } |
3642 | 3642 | |
3643 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
3644 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
3643 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
3644 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
3645 | 3645 | |
3646 | 3646 | if ($where != '') { |
3647 | - $where = 'AND ' . $where; |
|
3647 | + $where = 'AND '.$where; |
|
3648 | 3648 | } |
3649 | 3649 | |
3650 | 3650 | // modify field names to use sc. table reference |
3651 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3652 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3651 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3652 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3653 | 3653 | |
3654 | 3654 | // get document groups for current user |
3655 | 3655 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3657,7 +3657,7 @@ discard block |
||
3657 | 3657 | } |
3658 | 3658 | |
3659 | 3659 | // build query |
3660 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3660 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3661 | 3661 | |
3662 | 3662 | $tblsc = $this->getFullTableName('site_content'); |
3663 | 3663 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3709,10 +3709,10 @@ discard block |
||
3709 | 3709 | return false; |
3710 | 3710 | } else { |
3711 | 3711 | // modify field names to use sc. table reference |
3712 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3713 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3712 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3713 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3714 | 3714 | if ($where != '') { |
3715 | - $where = 'AND ' . $where; |
|
3715 | + $where = 'AND '.$where; |
|
3716 | 3716 | } |
3717 | 3717 | |
3718 | 3718 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3723,13 +3723,13 @@ discard block |
||
3723 | 3723 | $docgrp = implode(',', $docgrp); |
3724 | 3724 | } |
3725 | 3725 | |
3726 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3726 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3727 | 3727 | |
3728 | 3728 | $tblsc = $this->getFullTableName('site_content'); |
3729 | 3729 | $tbldg = $this->getFullTableName('document_groups'); |
3730 | 3730 | |
3731 | 3731 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3732 | - LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
|
3732 | + LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
|
3733 | 3733 | |
3734 | 3734 | $resourceArray = $this->db->makeArray($result); |
3735 | 3735 | |
@@ -3834,12 +3834,12 @@ discard block |
||
3834 | 3834 | $tbldg = $this->getFullTableName("document_groups"); |
3835 | 3835 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
3836 | 3836 | // modify field names to use sc. table reference |
3837 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3837 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3838 | 3838 | // get document groups for current user |
3839 | 3839 | if ($docgrp = $this->getUserDocGroups()) { |
3840 | 3840 | $docgrp = implode(",", $docgrp); |
3841 | 3841 | } |
3842 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3842 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3843 | 3843 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
3844 | 3844 | $pageInfo = $this->db->getRow($result); |
3845 | 3845 | |
@@ -3886,7 +3886,7 @@ discard block |
||
3886 | 3886 | { |
3887 | 3887 | if ($this->currentSnippet) { |
3888 | 3888 | $tbl = $this->getFullTableName("site_snippets"); |
3889 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
3889 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
3890 | 3890 | if ($snippetId = $this->db->getValue($rs)) { |
3891 | 3891 | return $snippetId; |
3892 | 3892 | } |
@@ -3913,23 +3913,23 @@ discard block |
||
3913 | 3913 | */ |
3914 | 3914 | function clearCache($type = '', $report = false) |
3915 | 3915 | { |
3916 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
3916 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
3917 | 3917 | if (is_array($type)) { |
3918 | 3918 | foreach ($type as $_) { |
3919 | 3919 | $this->clearCache($_, $report); |
3920 | 3920 | } |
3921 | 3921 | } elseif ($type == 'full') { |
3922 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
3922 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
3923 | 3923 | $sync = new synccache(); |
3924 | 3924 | $sync->setCachepath($cache_dir); |
3925 | 3925 | $sync->setReport($report); |
3926 | 3926 | $sync->emptyCache(); |
3927 | 3927 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
3928 | 3928 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
3929 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
3930 | - $cache_path = $cache_dir . $file_name; |
|
3929 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
3930 | + $cache_path = $cache_dir.$file_name; |
|
3931 | 3931 | $files = glob($cache_path); |
3932 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
3932 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
3933 | 3933 | foreach ($files as $file) { |
3934 | 3934 | if (!is_file($file)) { |
3935 | 3935 | continue; |
@@ -3937,7 +3937,7 @@ discard block |
||
3937 | 3937 | unlink($file); |
3938 | 3938 | } |
3939 | 3939 | } else { |
3940 | - $files = glob($cache_dir . '*'); |
|
3940 | + $files = glob($cache_dir.'*'); |
|
3941 | 3941 | foreach ($files as $file) { |
3942 | 3942 | $name = basename($file); |
3943 | 3943 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4007,7 +4007,7 @@ discard block |
||
4007 | 4007 | $f_url_suffix = '/'; |
4008 | 4008 | } |
4009 | 4009 | |
4010 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : ''; |
|
4010 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : ''; |
|
4011 | 4011 | |
4012 | 4012 | if ($al && $al['alias']) { |
4013 | 4013 | $alias = $al['alias']; |
@@ -4015,7 +4015,7 @@ discard block |
||
4015 | 4015 | |
4016 | 4016 | } |
4017 | 4017 | |
4018 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
4018 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
4019 | 4019 | $url = "{$alias}{$args}"; |
4020 | 4020 | } else { |
4021 | 4021 | $url = "index.php?id={$id}{$args}"; |
@@ -4034,7 +4034,7 @@ discard block |
||
4034 | 4034 | } |
4035 | 4035 | |
4036 | 4036 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
4037 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
4037 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
4038 | 4038 | } |
4039 | 4039 | |
4040 | 4040 | //fix strictUrl by Bumkaka |
@@ -4043,9 +4043,9 @@ discard block |
||
4043 | 4043 | } |
4044 | 4044 | |
4045 | 4045 | if ($this->config['xhtml_urls']) { |
4046 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
4046 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
4047 | 4047 | } else { |
4048 | - $url = $host . $virtualDir . $url; |
|
4048 | + $url = $host.$virtualDir.$url; |
|
4049 | 4049 | } |
4050 | 4050 | |
4051 | 4051 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4069,21 +4069,21 @@ discard block |
||
4069 | 4069 | if (isset($this->aliasListing[$id])) { |
4070 | 4070 | $out = $this->aliasListing[$id]; |
4071 | 4071 | } else { |
4072 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
4072 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
4073 | 4073 | if ($this->db->getRecordCount($q) == '1') { |
4074 | 4074 | $q = $this->db->getRow($q); |
4075 | 4075 | $this->aliasListing[$id] = array( |
4076 | - 'id' => (int)$q['id'], |
|
4076 | + 'id' => (int) $q['id'], |
|
4077 | 4077 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
4078 | - 'parent' => (int)$q['parent'], |
|
4079 | - 'isfolder' => (int)$q['isfolder'], |
|
4078 | + 'parent' => (int) $q['parent'], |
|
4079 | + 'isfolder' => (int) $q['isfolder'], |
|
4080 | 4080 | ); |
4081 | 4081 | if ($this->aliasListing[$id]['parent'] > 0) { |
4082 | 4082 | //fix alias_path_usage |
4083 | 4083 | if ($this->config['use_alias_path'] == '1') { |
4084 | 4084 | //&& $tmp['path'] != '' - fix error slash with epty path |
4085 | 4085 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
4086 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
4086 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
4087 | 4087 | } else { |
4088 | 4088 | $this->aliasListing[$id]['path'] = ''; |
4089 | 4089 | } |
@@ -4124,7 +4124,7 @@ discard block |
||
4124 | 4124 | $out = array(); |
4125 | 4125 | if (empty($this->version) || !is_array($this->version)) { |
4126 | 4126 | //include for compatibility modx version < 1.0.10 |
4127 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
4127 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
4128 | 4128 | $this->version = array(); |
4129 | 4129 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
4130 | 4130 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4146,18 +4146,18 @@ discard block |
||
4146 | 4146 | { |
4147 | 4147 | if (isset ($this->snippetCache[$snippetName])) { |
4148 | 4148 | $snippet = $this->snippetCache[$snippetName]; |
4149 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
4149 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
4150 | 4150 | } else { // not in cache so let's check the db |
4151 | - $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;"; |
|
4151 | + $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 | 4152 | $result = $this->db->query($sql); |
4153 | 4153 | if ($this->db->getRecordCount($result) == 1) { |
4154 | 4154 | $row = $this->db->getRow($result); |
4155 | 4155 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
4156 | 4156 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties'])); |
4157 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
4157 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
4158 | 4158 | } else { |
4159 | 4159 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
4160 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
4160 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
4161 | 4161 | } |
4162 | 4162 | } |
4163 | 4163 | // load default params/properties |
@@ -4260,8 +4260,8 @@ discard block |
||
4260 | 4260 | } |
4261 | 4261 | if (strpos($tpl, $s) !== false) { |
4262 | 4262 | $tpl = str_replace($s, $value, $tpl); |
4263 | - } elseif($this->debug) { |
|
4264 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
4263 | + } elseif ($this->debug) { |
|
4264 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
4265 | 4265 | } |
4266 | 4266 | } |
4267 | 4267 | |
@@ -4310,7 +4310,7 @@ discard block |
||
4310 | 4310 | case 'CODE': |
4311 | 4311 | break; |
4312 | 4312 | case 'FILE': |
4313 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
4313 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
4314 | 4314 | break; |
4315 | 4315 | case 'CHUNK': |
4316 | 4316 | $template = $this->getChunk($template); |
@@ -4363,7 +4363,7 @@ discard block |
||
4363 | 4363 | } |
4364 | 4364 | |
4365 | 4365 | if (empty($mode)) { |
4366 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
4366 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
4367 | 4367 | } elseif ($mode == 'dateOnly') { |
4368 | 4368 | $strTime = strftime($dateFormat, $timestamp); |
4369 | 4369 | } elseif ($mode == 'formatOnly') { |
@@ -4459,7 +4459,7 @@ discard block |
||
4459 | 4459 | if ($v === 'value') { |
4460 | 4460 | unset($_[$i]); |
4461 | 4461 | } else { |
4462 | - $_[$i] = 'tv.' . $v; |
|
4462 | + $_[$i] = 'tv.'.$v; |
|
4463 | 4463 | } |
4464 | 4464 | } |
4465 | 4465 | $fields = join(',', $_); |
@@ -4468,12 +4468,12 @@ discard block |
||
4468 | 4468 | } |
4469 | 4469 | |
4470 | 4470 | if ($tvsort != '') { |
4471 | - $tvsort = 'tv.' . join(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4471 | + $tvsort = 'tv.'.join(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4472 | 4472 | } |
4473 | 4473 | if ($tvidnames == "*") { |
4474 | 4474 | $query = "tv.id<>0"; |
4475 | 4475 | } else { |
4476 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . join("','", $tvidnames) . "')"; |
|
4476 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".join("','", $tvidnames)."')"; |
|
4477 | 4477 | } |
4478 | 4478 | |
4479 | 4479 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -4619,7 +4619,7 @@ discard block |
||
4619 | 4619 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
4620 | 4620 | } |
4621 | 4621 | |
4622 | - if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) { |
|
4622 | + if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) { |
|
4623 | 4623 | return false; |
4624 | 4624 | } else { |
4625 | 4625 | |
@@ -4637,23 +4637,23 @@ discard block |
||
4637 | 4637 | } |
4638 | 4638 | |
4639 | 4639 | // get user defined template variables |
4640 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4641 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4640 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4641 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4642 | 4642 | |
4643 | 4643 | if ($idnames == '*') { |
4644 | 4644 | $query = 'tv.id<>0'; |
4645 | 4645 | } else { |
4646 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
4646 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
4647 | 4647 | } |
4648 | 4648 | |
4649 | - $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv |
|
4650 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
4651 | - LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
|
4649 | + $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv |
|
4650 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
4651 | + LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
|
4652 | 4652 | |
4653 | 4653 | $result = $this->db->makeArray($rs); |
4654 | 4654 | |
4655 | 4655 | // get default/built-in template variables |
4656 | - if(is_array($docRow)){ |
|
4656 | + if (is_array($docRow)) { |
|
4657 | 4657 | ksort($docRow); |
4658 | 4658 | |
4659 | 4659 | foreach ($docRow as $key => $value) { |
@@ -4691,7 +4691,7 @@ discard block |
||
4691 | 4691 | */ |
4692 | 4692 | function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '') |
4693 | 4693 | { |
4694 | - if (is_array($idnames) && empty($idnames) ) { |
|
4694 | + if (is_array($idnames) && empty($idnames)) { |
|
4695 | 4695 | return false; |
4696 | 4696 | } else { |
4697 | 4697 | $output = array(); |
@@ -4704,9 +4704,9 @@ discard block |
||
4704 | 4704 | if ($result == false) { |
4705 | 4705 | return false; |
4706 | 4706 | } else { |
4707 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
4708 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
4709 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
4707 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
4708 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
4709 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
4710 | 4710 | |
4711 | 4711 | for ($i = 0; $i < count($result); $i++) { |
4712 | 4712 | $row = $result[$i]; |
@@ -4731,7 +4731,7 @@ discard block |
||
4731 | 4731 | */ |
4732 | 4732 | function getFullTableName($tbl) |
4733 | 4733 | { |
4734 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
4734 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
4735 | 4735 | } |
4736 | 4736 | |
4737 | 4737 | /** |
@@ -4810,7 +4810,7 @@ discard block |
||
4810 | 4810 | function getCachePath() |
4811 | 4811 | { |
4812 | 4812 | global $base_url; |
4813 | - $pth = $base_url . $this->getCacheFolder(); |
|
4813 | + $pth = $base_url.$this->getCacheFolder(); |
|
4814 | 4814 | return $pth; |
4815 | 4815 | } |
4816 | 4816 | |
@@ -4862,8 +4862,8 @@ discard block |
||
4862 | 4862 | $out = false; |
4863 | 4863 | |
4864 | 4864 | if (!empty($context)) { |
4865 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4866 | - $out = $_SESSION[$context . 'InternalKey']; |
|
4865 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4866 | + $out = $_SESSION[$context.'InternalKey']; |
|
4867 | 4867 | } |
4868 | 4868 | } else { |
4869 | 4869 | switch (true) { |
@@ -4891,8 +4891,8 @@ discard block |
||
4891 | 4891 | $out = false; |
4892 | 4892 | |
4893 | 4893 | if (!empty($context)) { |
4894 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4895 | - $out = $_SESSION[$context . 'Shortname']; |
|
4894 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4895 | + $out = $_SESSION[$context.'Shortname']; |
|
4896 | 4896 | } |
4897 | 4897 | } else { |
4898 | 4898 | switch (true) { |
@@ -4963,8 +4963,8 @@ discard block |
||
4963 | 4963 | */ |
4964 | 4964 | function getWebUserInfo($uid) |
4965 | 4965 | { |
4966 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
4967 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
4966 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
4967 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
4968 | 4968 | if ($row = $this->db->getRow($rs)) { |
4969 | 4969 | if (!isset($row['usertype']) or !$row["usertype"]) { |
4970 | 4970 | $row["usertype"] = "web"; |
@@ -5000,7 +5000,7 @@ discard block |
||
5000 | 5000 | } else if (is_array($dg)) { |
5001 | 5001 | // resolve ids to names |
5002 | 5002 | $dgn = array(); |
5003 | - $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); |
|
5003 | + $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); |
|
5004 | 5004 | while ($row = $this->db->getRow($ds)) { |
5005 | 5005 | $dgn[] = $row['name']; |
5006 | 5006 | } |
@@ -5028,7 +5028,7 @@ discard block |
||
5028 | 5028 | $rt = false; |
5029 | 5029 | if ($_SESSION["webValidated"] == 1) { |
5030 | 5030 | $tbl = $this->getFullTableName("web_users"); |
5031 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5031 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
5032 | 5032 | if ($row = $this->db->getRow($ds)) { |
5033 | 5033 | if ($row["password"] == md5($oldPwd)) { |
5034 | 5034 | if (strlen($newPwd) < 6) { |
@@ -5038,7 +5038,7 @@ discard block |
||
5038 | 5038 | } else { |
5039 | 5039 | $this->db->update(array( |
5040 | 5040 | 'password' => $this->db->escape($newPwd), |
5041 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5041 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
5042 | 5042 | // invoke OnWebChangePassword event |
5043 | 5043 | $this->invokeEvent("OnWebChangePassword", array( |
5044 | 5044 | "userid" => $row["id"], |
@@ -5068,8 +5068,8 @@ discard block |
||
5068 | 5068 | // check cache |
5069 | 5069 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
5070 | 5070 | if (!is_array($grpNames)) { |
5071 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
5072 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
5071 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
5072 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
5073 | 5073 | $grpNames = $this->db->getColumn("name", $rs); |
5074 | 5074 | // save to cache |
5075 | 5075 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5102,7 +5102,7 @@ discard block |
||
5102 | 5102 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
5103 | 5103 | $this->sjscripts[$nextpos] = $src; |
5104 | 5104 | } else { |
5105 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
5105 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
5106 | 5106 | } |
5107 | 5107 | } |
5108 | 5108 | |
@@ -5181,7 +5181,7 @@ discard block |
||
5181 | 5181 | } |
5182 | 5182 | |
5183 | 5183 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
5184 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
5184 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
5185 | 5185 | } |
5186 | 5186 | if ($startup) { |
5187 | 5187 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5327,7 +5327,7 @@ discard block |
||
5327 | 5327 | $eventtime = $this->getMicroTime() - $eventtime; |
5328 | 5328 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
5329 | 5329 | foreach ($parameter as $k => $v) { |
5330 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
5330 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
5331 | 5331 | } |
5332 | 5332 | $this->pluginsCode .= '</fieldset><br />'; |
5333 | 5333 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5355,13 +5355,13 @@ discard block |
||
5355 | 5355 | $plugin = array(); |
5356 | 5356 | if (isset ($this->pluginCache[$pluginName])) { |
5357 | 5357 | $pluginCode = $this->pluginCache[$pluginName]; |
5358 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
5358 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
5359 | 5359 | } else { |
5360 | 5360 | $pluginName = $this->db->escape($pluginName); |
5361 | 5361 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
5362 | 5362 | if ($row = $this->db->getRow($result)) { |
5363 | 5363 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
5364 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
5364 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
5365 | 5365 | } else { |
5366 | 5366 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
5367 | 5367 | $pluginProperties = ''; |
@@ -5468,7 +5468,7 @@ discard block |
||
5468 | 5468 | function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
5469 | 5469 | { |
5470 | 5470 | $params = array(); |
5471 | - $fullpath = $element_dir . '/' . $filename; |
|
5471 | + $fullpath = $element_dir.'/'.$filename; |
|
5472 | 5472 | if (is_readable($fullpath)) { |
5473 | 5473 | $tpl = @fopen($fullpath, "r"); |
5474 | 5474 | if ($tpl) { |
@@ -5635,8 +5635,8 @@ discard block |
||
5635 | 5635 | $ph = array('site_url' => MODX_SITE_URL); |
5636 | 5636 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
5637 | 5637 | $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i'; |
5638 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
5639 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
5638 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
5639 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
5640 | 5640 | foreach ($parsed as $key => $val) { |
5641 | 5641 | if (is_array($val)) { |
5642 | 5642 | foreach ($val as $key2 => $val2) { |
@@ -5645,7 +5645,7 @@ discard block |
||
5645 | 5645 | $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); |
5646 | 5646 | } |
5647 | 5647 | if (preg_match($regexEmail, $val2, $url)) { |
5648 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
5648 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
5649 | 5649 | } |
5650 | 5650 | $parsed[$key][$key2] = $val2; |
5651 | 5651 | } |
@@ -5655,7 +5655,7 @@ discard block |
||
5655 | 5655 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
5656 | 5656 | } |
5657 | 5657 | if (preg_match($regexEmail, $val, $url)) { |
5658 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
5658 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
5659 | 5659 | } |
5660 | 5660 | $parsed[$key] = $val; |
5661 | 5661 | } |
@@ -5669,32 +5669,32 @@ discard block |
||
5669 | 5669 | ); |
5670 | 5670 | |
5671 | 5671 | $nl = "\n"; |
5672 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
5673 | - $list .= '<p>' . $nl; |
|
5674 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
5675 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
5676 | - $list .= '</p><br/>' . $nl; |
|
5677 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
5678 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
5679 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
5680 | - $list .= '<br/>' . $nl; |
|
5672 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
5673 | + $list .= '<p>'.$nl; |
|
5674 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
5675 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
5676 | + $list .= '</p><br/>'.$nl; |
|
5677 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
5678 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
5679 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
5680 | + $list .= '<br/>'.$nl; |
|
5681 | 5681 | $first = true; |
5682 | 5682 | foreach ($arrayParams as $param => $label) { |
5683 | 5683 | if (isset($parsed[$param])) { |
5684 | 5684 | if ($first) { |
5685 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
5686 | - $list .= '<ul class="docBlockList">' . $nl; |
|
5685 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
5686 | + $list .= '<ul class="docBlockList">'.$nl; |
|
5687 | 5687 | $first = false; |
5688 | 5688 | } |
5689 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
5690 | - $list .= ' <ul>' . $nl; |
|
5689 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
5690 | + $list .= ' <ul>'.$nl; |
|
5691 | 5691 | foreach ($parsed[$param] as $val) { |
5692 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
5692 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
5693 | 5693 | } |
5694 | - $list .= ' </ul></li>' . $nl; |
|
5694 | + $list .= ' </ul></li>'.$nl; |
|
5695 | 5695 | } |
5696 | 5696 | } |
5697 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
5697 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
5698 | 5698 | |
5699 | 5699 | return $list; |
5700 | 5700 | } |
@@ -5770,7 +5770,7 @@ discard block |
||
5770 | 5770 | */ |
5771 | 5771 | function addSnippet($name, $phpCode) |
5772 | 5772 | { |
5773 | - $this->snippetCache['#' . $name] = $phpCode; |
|
5773 | + $this->snippetCache['#'.$name] = $phpCode; |
|
5774 | 5774 | } |
5775 | 5775 | |
5776 | 5776 | /** |
@@ -5779,7 +5779,7 @@ discard block |
||
5779 | 5779 | */ |
5780 | 5780 | function addChunk($name, $text) |
5781 | 5781 | { |
5782 | - $this->chunkCache['#' . $name] = $text; |
|
5782 | + $this->chunkCache['#'.$name] = $text; |
|
5783 | 5783 | } |
5784 | 5784 | |
5785 | 5785 | /** |
@@ -5815,7 +5815,7 @@ discard block |
||
5815 | 5815 | } |
5816 | 5816 | |
5817 | 5817 | if (!$isSafe) { |
5818 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
5818 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
5819 | 5819 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
5820 | 5820 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
5821 | 5821 | return; |
@@ -5829,7 +5829,7 @@ discard block |
||
5829 | 5829 | return 'array()'; |
5830 | 5830 | } |
5831 | 5831 | |
5832 | - $output = $echo . $return; |
|
5832 | + $output = $echo.$return; |
|
5833 | 5833 | modx_sanitize_gpc($output); |
5834 | 5834 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
5835 | 5835 | } |
@@ -5847,8 +5847,8 @@ discard block |
||
5847 | 5847 | |
5848 | 5848 | $safe = explode(',', $safe_functions); |
5849 | 5849 | |
5850 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
5851 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
5850 | + $phpcode = rtrim($phpcode, ';').';'; |
|
5851 | + $tokens = token_get_all('<?php '.$phpcode); |
|
5852 | 5852 | foreach ($tokens as $i => $token) { |
5853 | 5853 | if (!is_array($token)) { |
5854 | 5854 | continue; |
@@ -5884,7 +5884,7 @@ discard block |
||
5884 | 5884 | function atBindFileContent($str = '') |
5885 | 5885 | { |
5886 | 5886 | |
5887 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); |
|
5887 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); |
|
5888 | 5888 | |
5889 | 5889 | if (stripos($str, '@FILE') !== 0) { |
5890 | 5890 | return $str; |
@@ -5907,7 +5907,7 @@ discard block |
||
5907 | 5907 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
5908 | 5908 | |
5909 | 5909 | foreach ($search_path as $path) { |
5910 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
5910 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
5911 | 5911 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
5912 | 5912 | return $errorMsg; |
5913 | 5913 | } elseif (is_file($file_path)) { |
@@ -5921,7 +5921,7 @@ discard block |
||
5921 | 5921 | return $errorMsg; |
5922 | 5922 | } |
5923 | 5923 | |
5924 | - $content = (string)file_get_contents($file_path); |
|
5924 | + $content = (string) file_get_contents($file_path); |
|
5925 | 5925 | if ($content === false) { |
5926 | 5926 | return $errorMsg; |
5927 | 5927 | } |
@@ -6034,22 +6034,22 @@ discard block |
||
6034 | 6034 | |
6035 | 6035 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
6036 | 6036 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
6037 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
6037 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
6038 | 6038 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
6039 | 6039 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
6040 | 6040 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
6041 | 6041 | if ($is_error) { |
6042 | 6042 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
6043 | 6043 | if ($msg != 'PHP Parse Error') { |
6044 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
6044 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
6045 | 6045 | } |
6046 | 6046 | } else { |
6047 | 6047 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
6048 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
6048 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
6049 | 6049 | } |
6050 | 6050 | |
6051 | 6051 | if (!empty ($query)) { |
6052 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">' . $query . '</span></div>'; |
|
6052 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL > <span id="sqlHolder">'.$query.'</span></div>'; |
|
6053 | 6053 | } |
6054 | 6054 | |
6055 | 6055 | $errortype = array( |
@@ -6072,13 +6072,13 @@ discard block |
||
6072 | 6072 | |
6073 | 6073 | if (!empty($nr) || !empty($file)) { |
6074 | 6074 | if ($text != '') { |
6075 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
6075 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
6076 | 6076 | } |
6077 | 6077 | if ($output != '') { |
6078 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
6078 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
6079 | 6079 | } |
6080 | 6080 | if ($nr !== '') { |
6081 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
6081 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
6082 | 6082 | } |
6083 | 6083 | if ($file) { |
6084 | 6084 | $table[] = array('File', $file); |
@@ -6098,7 +6098,7 @@ discard block |
||
6098 | 6098 | } |
6099 | 6099 | |
6100 | 6100 | if (!empty($this->event->activePlugin)) { |
6101 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
6101 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
6102 | 6102 | } |
6103 | 6103 | |
6104 | 6104 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6108,17 +6108,17 @@ discard block |
||
6108 | 6108 | $table[] = array('REQUEST_URI', $request_uri); |
6109 | 6109 | |
6110 | 6110 | if ($this->manager->action) { |
6111 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
6111 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
6112 | 6112 | global $action_list; |
6113 | 6113 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
6114 | 6114 | |
6115 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
6115 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
6116 | 6116 | } |
6117 | 6117 | |
6118 | 6118 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
6119 | 6119 | $resource = $this->getDocumentObject('id', $this->documentIdentifier); |
6120 | 6120 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
6121 | - $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); |
|
6121 | + $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); |
|
6122 | 6122 | } |
6123 | 6123 | $table[] = array('Referer', $referer); |
6124 | 6124 | $table[] = array('User Agent', $ua); |
@@ -6139,7 +6139,7 @@ discard block |
||
6139 | 6139 | |
6140 | 6140 | $mem = memory_get_peak_usage(true); |
6141 | 6141 | $total_mem = $mem - $this->mstart; |
6142 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
6142 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
6143 | 6143 | |
6144 | 6144 | $queryTime = $this->queryTime; |
6145 | 6145 | $phpTime = $totalTime - $queryTime; |
@@ -6160,18 +6160,18 @@ discard block |
||
6160 | 6160 | $str .= $this->get_backtrace(debug_backtrace()); |
6161 | 6161 | // Log error |
6162 | 6162 | if (!empty($this->currentSnippet)) { |
6163 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
6163 | + $source = 'Snippet - '.$this->currentSnippet; |
|
6164 | 6164 | } elseif (!empty($this->event->activePlugin)) { |
6165 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
6165 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
6166 | 6166 | } elseif ($source !== '') { |
6167 | - $source = 'Parser - ' . $source; |
|
6167 | + $source = 'Parser - '.$source; |
|
6168 | 6168 | } elseif ($query !== '') { |
6169 | 6169 | $source = 'SQL Query'; |
6170 | 6170 | } else { |
6171 | 6171 | $source = 'Parser'; |
6172 | 6172 | } |
6173 | 6173 | if ($msg) { |
6174 | - $source .= ' / ' . $msg; |
|
6174 | + $source .= ' / '.$msg; |
|
6175 | 6175 | } |
6176 | 6176 | if (isset($actionName) && !empty($actionName)) { |
6177 | 6177 | $source .= $actionName; |
@@ -6203,12 +6203,12 @@ discard block |
||
6203 | 6203 | |
6204 | 6204 | // Display error |
6205 | 6205 | if (isset($_SESSION['mgrValidated'])) { |
6206 | - echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' » ' . $release_date . '</title> |
|
6206 | + echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' » '.$release_date.'</title> |
|
6207 | 6207 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6208 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
6208 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
6209 | 6209 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
6210 | 6210 | </head><body> |
6211 | - ' . $str . '</body></html>'; |
|
6211 | + ' . $str.'</body></html>'; |
|
6212 | 6212 | |
6213 | 6213 | } else { |
6214 | 6214 | echo 'Error'; |
@@ -6246,7 +6246,7 @@ discard block |
||
6246 | 6246 | switch ($val['type']) { |
6247 | 6247 | case '->': |
6248 | 6248 | case '::': |
6249 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
6249 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
6250 | 6250 | break; |
6251 | 6251 | default: |
6252 | 6252 | $functionName = $val['function']; |
@@ -6256,7 +6256,7 @@ discard block |
||
6256 | 6256 | $args = array_pad(array(), $_, '$var'); |
6257 | 6257 | $args = implode(", ", $args); |
6258 | 6258 | $modx = &$this; |
6259 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6259 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
6260 | 6260 | $arg = $val['args'][$tmp - 1]; |
6261 | 6261 | switch (true) { |
6262 | 6262 | case is_null($arg): { |
@@ -6268,7 +6268,7 @@ discard block |
||
6268 | 6268 | break; |
6269 | 6269 | } |
6270 | 6270 | case is_scalar($arg): { |
6271 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); |
|
6271 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); |
|
6272 | 6272 | break; |
6273 | 6273 | } |
6274 | 6274 | case is_bool($arg): { |
@@ -6276,23 +6276,23 @@ discard block |
||
6276 | 6276 | break; |
6277 | 6277 | } |
6278 | 6278 | case is_array($arg): { |
6279 | - $out = 'array $var' . $tmp; |
|
6279 | + $out = 'array $var'.$tmp; |
|
6280 | 6280 | break; |
6281 | 6281 | } |
6282 | 6282 | case is_object($arg): { |
6283 | - $out = get_class($arg) . ' $var' . $tmp; |
|
6283 | + $out = get_class($arg).' $var'.$tmp; |
|
6284 | 6284 | break; |
6285 | 6285 | } |
6286 | 6286 | default: { |
6287 | - $out = '$var' . $tmp; |
|
6287 | + $out = '$var'.$tmp; |
|
6288 | 6288 | } |
6289 | 6289 | } |
6290 | 6290 | $tmp++; |
6291 | 6291 | return $out; |
6292 | 6292 | }, $args); |
6293 | 6293 | $line = array( |
6294 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
6295 | - $path . " on line " . $val['line'] |
|
6294 | + "<strong>".$functionName."</strong>(".$args.")", |
|
6295 | + $path." on line ".$val['line'] |
|
6296 | 6296 | ); |
6297 | 6297 | $table[] = array(implode("<br />", $line)); |
6298 | 6298 | } |
@@ -6333,7 +6333,7 @@ discard block |
||
6333 | 6333 | $alias = strip_tags($alias); // strip HTML |
6334 | 6334 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
6335 | 6335 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
6336 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6336 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6337 | 6337 | $alias = trim($alias, '-'); // trim excess |
6338 | 6338 | return $alias; |
6339 | 6339 | } |
@@ -6349,7 +6349,7 @@ discard block |
||
6349 | 6349 | $precisions = count($sizes) - 1; |
6350 | 6350 | foreach ($sizes as $unit => $bytes) { |
6351 | 6351 | if ($size >= $bytes) { |
6352 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
6352 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
6353 | 6353 | } |
6354 | 6354 | $precisions--; |
6355 | 6355 | } |
@@ -6454,10 +6454,10 @@ discard block |
||
6454 | 6454 | |
6455 | 6455 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
6456 | 6456 | return false; |
6457 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
6458 | - $file_path = MODX_BASE_PATH . $str; |
|
6459 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
6460 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
6457 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
6458 | + $file_path = MODX_BASE_PATH.$str; |
|
6459 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
6460 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
6461 | 6461 | } else { |
6462 | 6462 | return false; |
6463 | 6463 | } |
@@ -6582,7 +6582,7 @@ discard block |
||
6582 | 6582 | $title = 'no title'; |
6583 | 6583 | } |
6584 | 6584 | if (is_array($msg)) { |
6585 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
6585 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
6586 | 6586 | } elseif ($msg === '') { |
6587 | 6587 | $msg = $_SERVER['REQUEST_URI']; |
6588 | 6588 | } |
@@ -6627,7 +6627,7 @@ discard block |
||
6627 | 6627 | if (is_array($SystemAlertMsgQueque)) { |
6628 | 6628 | $title = ''; |
6629 | 6629 | if ($this->name && $this->activePlugin) { |
6630 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
6630 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
6631 | 6631 | } |
6632 | 6632 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
6633 | 6633 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | $sysMsgs = ""; |
14 | 14 | $limit = count($SystemAlertMsgQueque); |
15 | - for($i=0;$i<$limit;$i++) { |
|
15 | + for ($i = 0; $i < $limit; $i++) { |
|
16 | 16 | $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
17 | 17 | } |
18 | 18 | // reset message queque |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $_SESSION['SystemAlertMsgQueque'] = array(); |
21 | 21 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
22 | 22 | |
23 | - if($sysMsgs!="") { |
|
23 | + if ($sysMsgs != "") { |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <?php // fetch the styles |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | var sysAlert = new Element('div').setProperties({ |
33 | 33 | 'class': 'sysAlert' |
34 | 34 | }); |
35 | - sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs);?>'; |
|
35 | + sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs); ?>'; |
|
36 | 36 | var boxHtml = new MooPrompt('<?php echo $_lang['sys_alert']; ?>', sysAlert, { |
37 | 37 | buttons: 1, |
38 | 38 | button1: 'Ok', |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | class Paging |
32 | 32 | { |
33 | 33 | |
34 | - var $int_num_result; // Number of result to show per page (decided by user) |
|
35 | - var $int_nbr_row; // Total number of items (SQL count from db) |
|
36 | - var $int_cur_position;// Current position in recordset |
|
37 | - var $str_ext_argv; // Extra argv of query string |
|
34 | + var $int_num_result; // Number of result to show per page (decided by user) |
|
35 | + var $int_nbr_row; // Total number of items (SQL count from db) |
|
36 | + var $int_cur_position; // Current position in recordset |
|
37 | + var $str_ext_argv; // Extra argv of query string |
|
38 | 38 | |
39 | 39 | // ------------------------------------------------------------------------ Constructor |
40 | 40 | // |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | $array_paging['total'] = $this->int_nbr_row; |
65 | 65 | |
66 | 66 | if ($this->int_cur_position != 0) { |
67 | - $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0" . $this->str_ext_argv . "\">"; |
|
68 | - $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . ($this->int_cur_position - $this->int_num_result) . $this->str_ext_argv . "\">"; |
|
67 | + $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0".$this->str_ext_argv."\">"; |
|
68 | + $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=".($this->int_cur_position - $this->int_num_result).$this->str_ext_argv."\">"; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if (($this->int_nbr_row - $this->int_cur_position) > $this->int_num_result) { |
72 | 72 | $int_new_position = $this->int_cur_position + $this->int_num_result; |
73 | - $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . $this->int_nbr_row . $this->str_ext_argv . "\">"; |
|
74 | - $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position" . $this->str_ext_argv . "\">"; |
|
73 | + $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=".$this->int_nbr_row.$this->str_ext_argv."\">"; |
|
74 | + $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position".$this->str_ext_argv."\">"; |
|
75 | 75 | } |
76 | 76 | return $array_paging; |
77 | 77 | } // end function |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | for ($i = 0; $i < $this->getNumberOfPage(); $i++) { |
87 | 87 | // if current page, do not make a link |
88 | 88 | if ($i == $this->getCurrentPage()) { |
89 | - $array_all_page[$i] = "<b>" . ($i + 1) . "</b> "; |
|
89 | + $array_all_page[$i] = "<b>".($i + 1)."</b> "; |
|
90 | 90 | } else { |
91 | 91 | $int_new_position = ($i * $this->int_num_result); |
92 | - $array_all_page[$i] = "<a href=\"" . $PHP_SELF . "?int_cur_position=$int_new_position$this->str_ext_argv\">" . ($i + 1) . "</a> "; |
|
92 | + $array_all_page[$i] = "<a href=\"".$PHP_SELF."?int_cur_position=$int_new_position$this->str_ext_argv\">".($i + 1)."</a> "; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | return $array_all_page; |
@@ -12,13 +12,13 @@ |
||
12 | 12 | $modx->invokeEvent('OnManagerPageInit'); |
13 | 13 | $ok = false; |
14 | 14 | |
15 | -if($modx->elementIsLocked($_GET['type'], $_GET['id'], true)) { |
|
15 | +if ($modx->elementIsLocked($_GET['type'], $_GET['id'], true)) { |
|
16 | 16 | $modx->lockElement($_GET['type'], $_GET['id'], true); |
17 | 17 | $ok = true; |
18 | 18 | } |
19 | 19 | |
20 | 20 | header('Content-type: application/json'); |
21 | -if($ok) { |
|
21 | +if ($ok) { |
|
22 | 22 | echo '{status:"ok"}'; |
23 | 23 | } else { |
24 | 24 | echo '{status:"null"}'; |
@@ -12,24 +12,24 @@ discard block |
||
12 | 12 | |
13 | 13 | */ |
14 | 14 | |
15 | -class logHandler { |
|
15 | +class logHandler{ |
|
16 | 16 | // Single variable for a log entry |
17 | 17 | var $entry = array(); |
18 | 18 | |
19 | - function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") { |
|
19 | + function initAndWriteLog($msg = "", $internalKey = "", $username = "", $action = "", $itemid = "", $itemname = ""){ |
|
20 | 20 | global $modx; |
21 | 21 | $this->entry['msg'] = $msg; // writes testmessage to the object |
22 | - $this->entry['action'] = empty($action)? $modx->manager->action : $action; // writes the action to the object |
|
22 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
23 | 23 | |
24 | 24 | // User Credentials |
25 | 25 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
26 | 26 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
27 | 27 | |
28 | - $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 |
|
28 | + $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 |
|
30 | 30 | |
31 | - $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 |
|
31 | + $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 |
|
33 | 33 | |
34 | 34 | $this->writeToLog(); |
35 | 35 | return; |
@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | // function to write to the log |
39 | 39 | // collects all required info, and |
40 | 40 | // writes it to the logging table |
41 | - function writeToLog() { |
|
41 | + function writeToLog(){ |
|
42 | 42 | global $modx; |
43 | 43 | $tbl_manager_log = $modx->getFullTableName('manager_log'); |
44 | 44 | |
45 | - if($this->entry['internalKey'] == "") { |
|
45 | + if ($this->entry['internalKey'] == "") { |
|
46 | 46 | $modx->webAlertAndQuit("Logging error: internalKey not set."); |
47 | 47 | } |
48 | - if(empty($this->entry['action'])) { |
|
48 | + if (empty($this->entry['action'])) { |
|
49 | 49 | $modx->webAlertAndQuit("Logging error: action not set."); |
50 | 50 | } |
51 | - if($this->entry['msg'] == "") { |
|
51 | + if ($this->entry['msg'] == "") { |
|
52 | 52 | include_once "actionlist.inc.php"; |
53 | 53 | $this->entry['msg'] = getAction($this->entry['action'], $this->entry['itemId']); |
54 | - if($this->entry['msg'] == "") { |
|
54 | + if ($this->entry['msg'] == "") { |
|
55 | 55 | $modx->webAlertAndQuit("Logging error: couldn't find message to write to log."); |
56 | 56 | } |
57 | 57 | } |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | $fields['itemid'] = $this->entry['itemId']; |
64 | 64 | $fields['itemname'] = $modx->db->escape($this->entry['itemName']); |
65 | 65 | $fields['message'] = $modx->db->escape($this->entry['msg']); |
66 | - $insert_id = $modx->db->insert($fields,$tbl_manager_log); |
|
67 | - if(!$insert_id) { |
|
66 | + $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
|
67 | + if (!$insert_id) { |
|
68 | 68 | $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
69 | 69 | } else { |
70 | 70 | $limit = (isset($modx->config['manager_log_limit'])) ? intval($modx->config['manager_log_limit']) : 3000; |
71 | - $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
72 | - if(($insert_id % $trim) === 0) { |
|
73 | - $modx->rotate_log('manager_log',$limit,$trim); |
|
71 | + $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
72 | + if (($insert_id % $trim) === 0) { |
|
73 | + $modx->rotate_log('manager_log', $limit, $trim); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -1,11 +1,11 @@ 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") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | 3 | |
4 | 4 | // PROCESSOR FIRST |
5 | -if($_SESSION['mgrRole'] == 1) { |
|
6 | - if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
5 | +if ($_SESSION['mgrRole'] == 1) { |
|
6 | + if ($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
7 | 7 | $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
8 | - if(!empty($current)) { |
|
8 | + if (!empty($current)) { |
|
9 | 9 | $modx->manager->setSystemChecksum($current); |
10 | 10 | $modx->clearCache('full'); |
11 | 11 | $modx->config['sys_files_checksum'] = $current; |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | $warningspresent = 0; |
18 | 18 | |
19 | 19 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
20 | -if ($sysfiles_check!=='0'){ |
|
20 | +if ($sysfiles_check !== '0') { |
|
21 | 21 | $warningspresent = 1; |
22 | 22 | $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
23 | 23 | } |
24 | 24 | |
25 | -if (is_writable("includes/config.inc.php")){ |
|
25 | +if (is_writable("includes/config.inc.php")) { |
|
26 | 26 | // Warn if world writable |
27 | - if(@fileperms('includes/config.inc.php') & 0x0002) { |
|
27 | + if (@fileperms('includes/config.inc.php') & 0x0002) { |
|
28 | 28 | $warningspresent = 1; |
29 | 29 | $warnings[] = array($_lang['configcheck_configinc']); |
30 | 30 | } |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | $warnings[] = array($_lang['configcheck_php_gdzip']); |
41 | 41 | } |
42 | 42 | |
43 | -if(!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') { |
|
44 | - if(isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') { |
|
43 | +if (!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') { |
|
44 | + if (isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') { |
|
45 | 45 | if ($modx->db->getValue($modx->db->select('COUNT(setting_value)', $modx->getFullTableName('system_settings'), "setting_name='validate_referer' AND setting_value='0'"))) { |
46 | 46 | $warningspresent = 1; |
47 | 47 | $warnings[] = array($_lang['configcheck_validate_referer']); |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | // check for Template Switcher plugin |
53 | -if(!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') { |
|
54 | - if(isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') { |
|
53 | +if (!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') { |
|
54 | + if (isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') { |
|
55 | 55 | $rs = $modx->db->select('name, disabled', $modx->getFullTableName('site_plugins'), "name IN ('TemplateSwitcher', 'Template Switcher', 'templateswitcher', 'template_switcher', 'template switcher') OR plugincode LIKE '%TemplateSwitcher%'"); |
56 | 56 | $row = $modx->db->getRow($rs); |
57 | - if($row && $row['disabled'] == 0) { |
|
57 | + if ($row && $row['disabled'] == 0) { |
|
58 | 58 | $warningspresent = 1; |
59 | 59 | $warnings[] = array($_lang['configcheck_templateswitcher_present']); |
60 | 60 | $tplName = $row['name']; |
@@ -115,36 +115,36 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | if (!function_exists('checkSiteCache')) { |
118 | - function checkSiteCache() { |
|
118 | + function checkSiteCache(){ |
|
119 | 119 | global $modx; |
120 | - $checked= true; |
|
121 | - if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
|
122 | - $checked= @include_once ($modx->config['base_path'] . 'assets/cache/siteCache.idx.php'); |
|
120 | + $checked = true; |
|
121 | + if (file_exists($modx->config['base_path'].'assets/cache/siteCache.idx.php')) { |
|
122 | + $checked = @include_once ($modx->config['base_path'].'assets/cache/siteCache.idx.php'); |
|
123 | 123 | } |
124 | 124 | return $checked; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | -if (!is_writable(MODX_BASE_PATH . "assets/cache/")) { |
|
128 | +if (!is_writable(MODX_BASE_PATH."assets/cache/")) { |
|
129 | 129 | $warningspresent = 1; |
130 | 130 | $warnings[] = array($_lang['configcheck_cache']); |
131 | 131 | } |
132 | 132 | |
133 | 133 | if (!checkSiteCache()) { |
134 | 134 | $warningspresent = 1; |
135 | - $warnings[]= array($lang['configcheck_sitecache_integrity']); |
|
135 | + $warnings[] = array($lang['configcheck_sitecache_integrity']); |
|
136 | 136 | } |
137 | 137 | |
138 | -if (!is_writable(MODX_BASE_PATH . "assets/images/")) { |
|
138 | +if (!is_writable(MODX_BASE_PATH."assets/images/")) { |
|
139 | 139 | $warningspresent = 1; |
140 | 140 | $warnings[] = array($_lang['configcheck_images']); |
141 | 141 | } |
142 | 142 | |
143 | -if(strpos($modx->config['rb_base_dir'],MODX_BASE_PATH)!==0) { |
|
143 | +if (strpos($modx->config['rb_base_dir'], MODX_BASE_PATH) !== 0) { |
|
144 | 144 | $warningspresent = 1; |
145 | 145 | $warnings[] = array($_lang['configcheck_rb_base_dir']); |
146 | 146 | } |
147 | -if(strpos($modx->config['filemanager_path'],MODX_BASE_PATH)!==0) { |
|
147 | +if (strpos($modx->config['filemanager_path'], MODX_BASE_PATH) !== 0) { |
|
148 | 148 | $warningspresent = 1; |
149 | 149 | $warnings[] = array($_lang['configcheck_filemanager_path']); |
150 | 150 | } |
@@ -152,36 +152,36 @@ discard block |
||
152 | 152 | // clear file info cache |
153 | 153 | clearstatcache(); |
154 | 154 | |
155 | -if ($warningspresent==1) { |
|
155 | +if ($warningspresent == 1) { |
|
156 | 156 | |
157 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
157 | +if (!isset($modx->config['send_errormail'])) $modx->config['send_errormail'] = '3'; |
|
158 | 158 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
159 | 159 | |
160 | -for ($i=0;$i<count($warnings);$i++) { |
|
160 | +for ($i = 0; $i < count($warnings); $i++) { |
|
161 | 161 | switch ($warnings[$i][0]) { |
162 | 162 | case $_lang['configcheck_configinc']; |
163 | 163 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
164 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
164 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_configinc']); |
|
165 | 165 | break; |
166 | 166 | case $_lang['configcheck_installer'] : |
167 | 167 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
168 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
168 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_installer']); |
|
169 | 169 | break; |
170 | 170 | case $_lang['configcheck_cache'] : |
171 | 171 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
172 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
172 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_cache']); |
|
173 | 173 | break; |
174 | 174 | case $_lang['configcheck_images'] : |
175 | 175 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
176 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
176 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_images']); |
|
177 | 177 | break; |
178 | 178 | case $_lang['configcheck_sysfiles_mod']: |
179 | 179 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
180 | - $warnings[$i][2] = '<ul><li>'. join('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
181 | - if($modx->hasPermission('settings')) { |
|
182 | - $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>'; |
|
180 | + $warnings[$i][2] = '<ul><li>'.join('</li><li>', $sysfiles_check).'</li></ul>'; |
|
181 | + if ($modx->hasPermission('settings')) { |
|
182 | + $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 | 183 | } |
184 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
184 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1]." ".join(', ', $sysfiles_check), $_lang['configcheck_sysfiles_mod']); |
|
185 | 185 | break; |
186 | 186 | case $_lang['configcheck_lang_difference'] : |
187 | 187 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -203,18 +203,18 @@ discard block |
||
203 | 203 | break; |
204 | 204 | case $_lang['configcheck_validate_referer'] : |
205 | 205 | $msg = $_lang['configcheck_validate_referer_msg']; |
206 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
206 | + $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
207 | 207 | $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n"; |
208 | 208 | break; |
209 | 209 | case $_lang['configcheck_templateswitcher_present'] : |
210 | 210 | $msg = $_lang["configcheck_templateswitcher_present_msg"]; |
211 | - if(isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
212 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"]; |
|
211 | + if (isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
212 | + $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_disable"]; |
|
213 | 213 | } |
214 | - if(isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
215 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"]; |
|
214 | + if (isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
215 | + $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_delete"]; |
|
216 | 216 | } |
217 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
217 | + $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
218 | 218 | $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n"; |
219 | 219 | break; |
220 | 220 | case $_lang['configcheck_rb_base_dir'] : |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $warnings[$i][1] = $_lang['configcheck_default_msg']; |
228 | 228 | } |
229 | 229 | |
230 | - $admin_warning = $_SESSION['mgrRole']!=1 ? $_lang['configcheck_admin'] : "" ; |
|
230 | + $admin_warning = $_SESSION['mgrRole'] != 1 ? $_lang['configcheck_admin'] : ""; |
|
231 | 231 | $config_check_results .= " |
232 | 232 | <fieldset> |
233 | 233 | <p><strong>".$_lang['configcheck_warning']."</strong> '".$warnings[$i][0]."'</p> |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | ".(isset($warnings[$i][2]) ? '<div style="padding-left:1em">'.$warnings[$i][2].'</div>' : '')." |
237 | 237 | </fieldset> |
238 | 238 | "; |
239 | - if ($i!=count($warnings)-1) { |
|
239 | + if ($i != count($warnings) - 1) { |
|
240 | 240 | $config_check_results .= "<br />"; |
241 | 241 | } |
242 | 242 | } |
243 | - $_SESSION["mgrConfigCheck"]=true; |
|
243 | + $_SESSION["mgrConfigCheck"] = true; |
|
244 | 244 | } else { |
245 | 245 | $config_check_results = $_lang['configcheck_ok']; |
246 | 246 | } |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | $countChild++; |
66 | 66 | $id = $value[0]; |
67 | 67 | $ph['id'] = $id; |
68 | - $ph['li_class'] = $this->get_li_class($id) . $value[10]; |
|
68 | + $ph['li_class'] = $this->get_li_class($id).$value[10]; |
|
69 | 69 | $ph['href'] = $value[3]; |
70 | 70 | $ph['alt'] = $value[4]; |
71 | 71 | $ph['target'] = $value[7]; |
72 | 72 | $ph['onclick'] = $value[5]; |
73 | 73 | $ph['a_class'] = $this->get_a_class($id); |
74 | 74 | $ph['LinkAttr'] = $this->getLinkAttr($id); |
75 | - $ph['itemName'] = $value[2] . $this->getItemName($id); |
|
75 | + $ph['itemName'] = $value[2].$this->getItemName($id); |
|
76 | 76 | |
77 | 77 | $ph['DrawSub'] = ''; |
78 | 78 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | function get_li_class($id) |
112 | 112 | { |
113 | 113 | if (isset($this->menu[$id])) { |
114 | - return $this->defaults['parentClass'] . ' '; |
|
114 | + return $this->defaults['parentClass'].' '; |
|
115 | 115 | } else { |
116 | 116 | return ''; |
117 | 117 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | function get_a_class($id) |
121 | 121 | { |
122 | 122 | if (isset($this->menu[$id])) { |
123 | - return ' class="' . $this->defaults['parentLinkClass'] . '"'; |
|
123 | + return ' class="'.$this->defaults['parentLinkClass'].'"'; |
|
124 | 124 | } else { |
125 | 125 | return ''; |
126 | 126 | } |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +Class TemplateParser{ |
|
11 | 11 | |
12 | - function __construct() { |
|
12 | + function __construct(){ |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
@@ -17,46 +17,46 @@ discard block |
||
17 | 17 | * @param array $data |
18 | 18 | * @return string |
19 | 19 | */ |
20 | - public function output($config = array(), $data = array()) { |
|
20 | + public function output($config = array(), $data = array()){ |
|
21 | 21 | global $modx; |
22 | 22 | |
23 | 23 | $output = ''; |
24 | 24 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
25 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
25 | + $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : ''; |
|
26 | 26 | |
27 | - if($action) { |
|
27 | + if ($action) { |
|
28 | 28 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
29 | - FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
|
30 | - INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
|
31 | - WHERE t1.action IN(' . $action . ') ' . $tab . ' |
|
29 | + FROM ' . $modx->getFullTableName('system_templates').' AS t1 |
|
30 | + INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category |
|
31 | + WHERE t1.action IN(' . $action.') '.$tab.' |
|
32 | 32 | ORDER BY t1.tab ASC, t1.rank ASC'); |
33 | 33 | |
34 | - if($modx->db->getRecordCount($sql)) { |
|
34 | + if ($modx->db->getRecordCount($sql)) { |
|
35 | 35 | $tabs = array(); |
36 | - while($row = $modx->db->getRow($sql)) { |
|
37 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
36 | + while ($row = $modx->db->getRow($sql)) { |
|
37 | + if (!$row['value'] && !empty($data[$row['name']])) { |
|
38 | 38 | $row['value'] = $data[$row['name']]; |
39 | 39 | } |
40 | 40 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
41 | 41 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
42 | 42 | } |
43 | 43 | |
44 | - if(!empty($config['toArray'])) { |
|
44 | + if (!empty($config['toArray'])) { |
|
45 | 45 | $output = $tabs; |
46 | 46 | } else { |
47 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
47 | + $output .= '<div class="tab-pane" id="pane_'.$action.'">'; |
|
48 | 48 | $output .= ' |
49 | 49 | <script type="text/javascript"> |
50 | - var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
50 | + var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
51 | 51 | </script>'; |
52 | 52 | |
53 | - foreach($tabs as $idTab => $tab) { |
|
54 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
53 | + foreach ($tabs as $idTab => $tab) { |
|
54 | + $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">'; |
|
55 | 55 | $output .= ' |
56 | - <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
|
57 | - <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
|
56 | + <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2> |
|
57 | + <script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>'; |
|
58 | 58 | unset($tab['category_name']); |
59 | - foreach($tab as $item) { |
|
59 | + foreach ($tab as $item) { |
|
60 | 60 | $output .= $item; |
61 | 61 | } |
62 | 62 | $output .= '</div>'; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | return $output; |
70 | 70 | } |
71 | 71 | |
72 | - private function render($data) { |
|
72 | + private function render($data){ |
|
73 | 73 | global $modx, $_lang, $_country_lang; |
74 | 74 | |
75 | 75 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $output = ''; |
80 | 80 | $output .= '<div class="form-group row">'; |
81 | 81 | |
82 | - switch($data['type']) { |
|
82 | + switch ($data['type']) { |
|
83 | 83 | |
84 | 84 | case 'text': |
85 | 85 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
114 | 114 | $output .= '<div class="col-sm-7">'; |
115 | 115 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
116 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
116 | + if ($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | 117 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
118 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
119 | - foreach($_country_lang as $key => $value) { |
|
120 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
118 | + $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'> </option>'; |
|
119 | + foreach ($_country_lang as $key => $value) { |
|
120 | + $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>'; |
|
121 | 121 | } |
122 | 122 | } else { |
123 | - if($data['elements']) { |
|
123 | + if ($data['elements']) { |
|
124 | 124 | $elements = explode('||', $data['elements']); |
125 | - foreach($elements as $key => $value) { |
|
125 | + foreach ($elements as $key => $value) { |
|
126 | 126 | $value = explode('==', $value); |
127 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
127 | + $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>'; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | } |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
139 | 139 | $output .= '<div class="col-sm-7">'; |
140 | 140 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
141 | - if($data['elements']) { |
|
141 | + if ($data['elements']) { |
|
142 | 142 | $elements = explode('||', $data['elements']); |
143 | - foreach($elements as $key => $value) { |
|
143 | + foreach ($elements as $key => $value) { |
|
144 | 144 | $value = explode('==', $value); |
145 | - $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]); |
|
145 | + $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 | 146 | } |
147 | 147 | } |
148 | 148 | $output .= $data['content']; |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
155 | 155 | $output .= '<div class="col-sm-7">'; |
156 | 156 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
157 | - if($data['elements']) { |
|
157 | + if ($data['elements']) { |
|
158 | 158 | $elements = explode('||', $data['elements']); |
159 | - foreach($elements as $key => $value) { |
|
159 | + foreach ($elements as $key => $value) { |
|
160 | 160 | $value = explode('==', $value); |
161 | - $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]); |
|
161 | + $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 | 162 | } |
163 | 163 | } |
164 | 164 | $output .= $data['content']; |