@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | function __call($method_name, $arguments) |
207 | 207 | { |
208 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
208 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
209 | 209 | if (method_exists($this->old, $method_name)) { |
210 | 210 | $error_type = 1; |
211 | 211 | } else { |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | $info = debug_backtrace(); |
224 | 224 | $m[] = $msg; |
225 | 225 | if (!empty($this->currentSnippet)) { |
226 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
226 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
227 | 227 | } elseif (!empty($this->event->activePlugin)) { |
228 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
228 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
229 | 229 | } |
230 | 230 | $m[] = $this->decoded_request_uri; |
231 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
231 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
232 | 232 | $msg = implode('<br />', $m); |
233 | 233 | $this->logEvent(0, $error_type, $msg, $title); |
234 | 234 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | $flag = false; |
247 | 247 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
248 | - $flag = (bool)$this->{$connector}->conn; |
|
248 | + $flag = (bool) $this->{$connector}->conn; |
|
249 | 249 | } |
250 | 250 | return $flag; |
251 | 251 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | if (!$out && $flag) { |
274 | 274 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
275 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
275 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
276 | 276 | $out = is_file($filename) ? include $filename : false; |
277 | 277 | } |
278 | 278 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | public function getMicroTime() |
290 | 290 | { |
291 | 291 | list ($usec, $sec) = explode(' ', microtime()); |
292 | - return ((float)$usec + (float)$sec); |
|
292 | + return ((float) $usec + (float) $sec); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | // append the redirect count string to the url |
314 | 314 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
315 | 315 | if ($currentNumberOfRedirects > 3) { |
316 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
316 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
317 | 317 | } else { |
318 | 318 | $currentNumberOfRedirects += 1; |
319 | 319 | if (strpos($url, "?") > 0) { |
@@ -324,9 +324,9 @@ discard block |
||
324 | 324 | } |
325 | 325 | } |
326 | 326 | if ($type == 'REDIRECT_REFRESH') { |
327 | - $header = 'Refresh: 0;URL=' . $url; |
|
327 | + $header = 'Refresh: 0;URL='.$url; |
|
328 | 328 | } elseif ($type == 'REDIRECT_META') { |
329 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
329 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
330 | 330 | echo $header; |
331 | 331 | exit; |
332 | 332 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | global $base_url, $site_url; |
335 | 335 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
336 | 336 | // append $site_url to make it work with Location: |
337 | - $url = $site_url . substr($url, strlen($base_url)); |
|
337 | + $url = $site_url.substr($url, strlen($base_url)); |
|
338 | 338 | } |
339 | 339 | if (strpos($url, "\n") === false) { |
340 | - $header = 'Location: ' . $url; |
|
340 | + $header = 'Location: '.$url; |
|
341 | 341 | } else { |
342 | 342 | $this->messageQuit('No newline allowed in redirect url.'); |
343 | 343 | } |
@@ -451,8 +451,8 @@ discard block |
||
451 | 451 | |
452 | 452 | private function recoverySiteCache() |
453 | 453 | { |
454 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
455 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
454 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
455 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
456 | 456 | |
457 | 457 | if (is_file($site_cache_path)) { |
458 | 458 | include($site_cache_path); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | return; |
462 | 462 | } |
463 | 463 | |
464 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
464 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
465 | 465 | $cache = new synccache(); |
466 | 466 | $cache->setCachepath($site_cache_dir); |
467 | 467 | $cache->setReport(false); |
@@ -513,8 +513,8 @@ discard block |
||
513 | 513 | $this->invokeEvent("OnBeforeManagerPageInit"); |
514 | 514 | } |
515 | 515 | |
516 | - if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
517 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
516 | + if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { |
|
517 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
518 | 518 | } else { |
519 | 519 | if ($usrType == 'web') { |
520 | 520 | $from = $tbl_web_user_settings; |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
535 | 535 | } |
536 | 536 | if (isset ($usrType)) { |
537 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
537 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
538 | 538 | } // store user settings in session |
539 | 539 | } |
540 | 540 | } |
@@ -679,10 +679,10 @@ discard block |
||
679 | 679 | $suf = $this->config['friendly_url_suffix']; |
680 | 680 | $pre = preg_quote($pre, '/'); |
681 | 681 | $suf = preg_quote($suf, '/'); |
682 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
682 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
683 | 683 | $q = $_[1]; |
684 | 684 | } |
685 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
685 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
686 | 686 | $q = $_[1]; |
687 | 687 | } |
688 | 688 | |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | 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 */ |
705 | 705 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
706 | 706 | if ($this->config['use_alias_path'] == 1) { |
707 | - 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))))) { |
|
707 | + 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))))) { |
|
708 | 708 | $this->documentMethod = 'id'; |
709 | 709 | return $q; |
710 | 710 | } else { /* not a valid id in terms of virtualDir, treat as alias */ |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | */ |
739 | 739 | public function getHashFile($key) |
740 | 740 | { |
741 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
741 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | /** |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
758 | 758 | $params = $_GET; |
759 | 759 | ksort($params); |
760 | - $hash .= '_' . md5(http_build_query($params)); |
|
760 | + $hash .= '_'.md5(http_build_query($params)); |
|
761 | 761 | } |
762 | 762 | } |
763 | 763 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
@@ -903,12 +903,12 @@ discard block |
||
903 | 903 | if ($js = $this->getRegisteredClientStartupScripts()) { |
904 | 904 | // change to just before closing </head> |
905 | 905 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
906 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
906 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | // Insert jscripts & html block into template - template must have a </body> tag |
910 | 910 | if ($js = $this->getRegisteredClientScripts()) { |
911 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
911 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
912 | 912 | } |
913 | 913 | // End fix by sirlancelot |
914 | 914 | |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | // send out content-type and content-disposition headers |
920 | 920 | if (IN_PARSER_MODE == "true") { |
921 | 921 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
922 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
922 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
923 | 923 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
924 | 924 | // header('HTTP/1.0 404 Not Found'); |
925 | 925 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | $name = preg_replace('|-+|', '-', $name); |
938 | 938 | $name = trim($name, '-'); |
939 | 939 | } |
940 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
940 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
941 | 941 | header($header); |
942 | 942 | } |
943 | 943 | } |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | |
946 | 946 | $stats = $this->getTimerStats($this->tstart); |
947 | 947 | |
948 | - $out =& $this->documentOutput; |
|
948 | + $out = & $this->documentOutput; |
|
949 | 949 | $out = str_replace("[^q^]", $stats['queries'], $out); |
950 | 950 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
951 | 951 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -984,17 +984,17 @@ discard block |
||
984 | 984 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
985 | 985 | $tt += $t; |
986 | 986 | } |
987 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
987 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; |
|
988 | 988 | echo $this->snippetsCode; |
989 | 989 | } |
990 | 990 | if ($this->dumpPlugins) { |
991 | 991 | $ps = ""; |
992 | 992 | $tt = 0; |
993 | 993 | foreach ($this->pluginsTime as $s => $t) { |
994 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
994 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
995 | 995 | $tt += $t; |
996 | 996 | } |
997 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
997 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
998 | 998 | echo $this->pluginsCode; |
999 | 999 | } |
1000 | 1000 | |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | $srcTags = explode(',', $tags); |
1021 | 1021 | $repTags = array(); |
1022 | 1022 | foreach ($srcTags as $tag) { |
1023 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
1023 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
1024 | 1024 | } |
1025 | 1025 | return array($srcTags, $repTags); |
1026 | 1026 | } |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
1043 | 1043 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
1044 | 1044 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
1045 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
1045 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
1046 | 1046 | |
1047 | 1047 | return $stats; |
1048 | 1048 | } |
@@ -1075,7 +1075,7 @@ discard block |
||
1075 | 1075 | { |
1076 | 1076 | $cacheRefreshTime = 0; |
1077 | 1077 | $recent_update = 0; |
1078 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
1078 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
1079 | 1079 | $this->recentUpdate = $recent_update; |
1080 | 1080 | |
1081 | 1081 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1145,8 +1145,8 @@ discard block |
||
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | $docObjSerial = serialize($this->documentObject); |
1148 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
1149 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
1148 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
1149 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
1150 | 1150 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
1151 | 1151 | } |
1152 | 1152 | } |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | $pos[']]>'] = strpos($content, ']]>'); |
1198 | 1198 | |
1199 | 1199 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
1200 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
1200 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
1201 | 1201 | } |
1202 | 1202 | |
1203 | 1203 | $lp = explode($left, $content); |
@@ -1322,8 +1322,8 @@ discard block |
||
1322 | 1322 | } |
1323 | 1323 | |
1324 | 1324 | if (is_array($value)) { |
1325 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
1326 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
1325 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
1326 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
1327 | 1327 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
1328 | 1328 | } |
1329 | 1329 | |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | if (strpos($content, $s) !== false) { |
1336 | 1336 | $content = str_replace($s, $value, $content); |
1337 | 1337 | } elseif ($this->debug) { |
1338 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1338 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1339 | 1339 | } |
1340 | 1340 | } |
1341 | 1341 | |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | if (strpos($content, $s) !== false) { |
1504 | 1504 | $content = str_replace($s, $value, $content); |
1505 | 1505 | } elseif ($this->debug) { |
1506 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1506 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1507 | 1507 | } |
1508 | 1508 | } |
1509 | 1509 | return $content; |
@@ -1556,7 +1556,7 @@ discard block |
||
1556 | 1556 | } |
1557 | 1557 | |
1558 | 1558 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
1559 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1559 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1560 | 1560 | if ($this->config['enable_at_syntax']) { |
1561 | 1561 | $value = $this->mergeConditionalTagsContent($value); |
1562 | 1562 | } |
@@ -1572,7 +1572,7 @@ discard block |
||
1572 | 1572 | if (strpos($content, $s) !== false) { |
1573 | 1573 | $content = str_replace($s, $value, $content); |
1574 | 1574 | } elseif ($this->debug) { |
1575 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1575 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1576 | 1576 | } |
1577 | 1577 | } |
1578 | 1578 | return $content; |
@@ -1631,7 +1631,7 @@ discard block |
||
1631 | 1631 | if (strpos($content, $s) !== false) { |
1632 | 1632 | $content = str_replace($s, $value, $content); |
1633 | 1633 | } elseif ($this->debug) { |
1634 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1634 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1635 | 1635 | } |
1636 | 1636 | } |
1637 | 1637 | return $content; |
@@ -1655,7 +1655,7 @@ discard block |
||
1655 | 1655 | return $content; |
1656 | 1656 | } |
1657 | 1657 | |
1658 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
1658 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
1659 | 1659 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); |
1660 | 1660 | |
1661 | 1661 | $pieces = explode('<@IF:', $content); |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | } |
1667 | 1667 | list($cmd, $text) = explode('>', $split, 2); |
1668 | 1668 | $cmd = str_replace("'", "\'", $cmd); |
1669 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1669 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1670 | 1670 | $content .= $text; |
1671 | 1671 | } |
1672 | 1672 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1677,13 +1677,13 @@ discard block |
||
1677 | 1677 | } |
1678 | 1678 | list($cmd, $text) = explode('>', $split, 2); |
1679 | 1679 | $cmd = str_replace("'", "\'", $cmd); |
1680 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1680 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1681 | 1681 | $content .= $text; |
1682 | 1682 | } |
1683 | 1683 | |
1684 | 1684 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
1685 | 1685 | ob_start(); |
1686 | - $content = eval('?>' . $content); |
|
1686 | + $content = eval('?>'.$content); |
|
1687 | 1687 | $content = ob_get_clean(); |
1688 | 1688 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); |
1689 | 1689 | |
@@ -1808,7 +1808,7 @@ discard block |
||
1808 | 1808 | $matches = $this->getTagsFromContent($content, $left, $right); |
1809 | 1809 | if (!empty($matches)) { |
1810 | 1810 | foreach ($matches[0] as $i => $v) { |
1811 | - $addBreakMatches[$i] = $v . "\n"; |
|
1811 | + $addBreakMatches[$i] = $v."\n"; |
|
1812 | 1812 | } |
1813 | 1813 | $content = str_replace($addBreakMatches, '', $content); |
1814 | 1814 | if (strpos($content, $left) !== false) { |
@@ -1842,7 +1842,7 @@ discard block |
||
1842 | 1842 | if (strpos($content, $s) !== false) { |
1843 | 1843 | $content = str_replace($s, $v, $content); |
1844 | 1844 | } elseif ($this->debug) { |
1845 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1845 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1846 | 1846 | } |
1847 | 1847 | } |
1848 | 1848 | return $content; |
@@ -1906,7 +1906,7 @@ discard block |
||
1906 | 1906 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg; |
1907 | 1907 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); |
1908 | 1908 | if ($this->isBackend()) { |
1909 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
1909 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
1910 | 1910 | } |
1911 | 1911 | } |
1912 | 1912 | } else { |
@@ -1952,7 +1952,7 @@ discard block |
||
1952 | 1952 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo; |
1953 | 1953 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); |
1954 | 1954 | if ($this->isBackend()) { |
1955 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
1955 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
1956 | 1956 | } |
1957 | 1957 | } |
1958 | 1958 | } |
@@ -1960,7 +1960,7 @@ discard block |
||
1960 | 1960 | if (is_array($return) || is_object($return)) { |
1961 | 1961 | return $return; |
1962 | 1962 | } else { |
1963 | - return $echo . $return; |
|
1963 | + return $echo.$return; |
|
1964 | 1964 | } |
1965 | 1965 | } |
1966 | 1966 | |
@@ -1999,7 +1999,7 @@ discard block |
||
1999 | 1999 | if (strpos($content, $s) !== false) { |
2000 | 2000 | $content = str_replace($s, $value, $content); |
2001 | 2001 | } elseif ($this->debug) { |
2002 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
2002 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
2003 | 2003 | } |
2004 | 2004 | continue; |
2005 | 2005 | } |
@@ -2011,7 +2011,7 @@ discard block |
||
2011 | 2011 | if (strpos($content, $s) !== false) { |
2012 | 2012 | $content = str_replace($s, $value, $content); |
2013 | 2013 | } elseif ($this->debug) { |
2014 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
2014 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
2015 | 2015 | } |
2016 | 2016 | } |
2017 | 2017 | |
@@ -2102,7 +2102,7 @@ discard block |
||
2102 | 2102 | $eventtime = sprintf('%2.2f ms', $eventtime * 1000); |
2103 | 2103 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
2104 | 2104 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
2105 | - $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
2105 | + $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
2106 | 2106 | $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); |
2107 | 2107 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
2108 | 2108 | } |
@@ -2346,7 +2346,7 @@ discard block |
||
2346 | 2346 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
2347 | 2347 | $count = $this->db->getRecordCount($rs); |
2348 | 2348 | if (1 < $count) { |
2349 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
2349 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
2350 | 2350 | } |
2351 | 2351 | if ($count) { |
2352 | 2352 | $row = $this->db->getRow($rs); |
@@ -2372,7 +2372,7 @@ discard block |
||
2372 | 2372 | public function toAlias($text) |
2373 | 2373 | { |
2374 | 2374 | $suff = $this->config['friendly_url_suffix']; |
2375 | - 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); |
|
2375 | + 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); |
|
2376 | 2376 | } |
2377 | 2377 | |
2378 | 2378 | /** |
@@ -2404,7 +2404,7 @@ discard block |
||
2404 | 2404 | $suff = '/'; |
2405 | 2405 | } |
2406 | 2406 | |
2407 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
2407 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
2408 | 2408 | } |
2409 | 2409 | |
2410 | 2410 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2441,7 +2441,7 @@ discard block |
||
2441 | 2441 | preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); |
2442 | 2442 | $ids = implode(',', array_unique($match['1'])); |
2443 | 2443 | if ($ids) { |
2444 | - $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
2444 | + $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
2445 | 2445 | while ($row = $this->db->getRow($res)) { |
2446 | 2446 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
2447 | 2447 | $parent = $row['parent']; |
@@ -2452,7 +2452,7 @@ discard block |
||
2452 | 2452 | $parent = $this->aliasListing[$parent]['parent']; |
2453 | 2453 | } |
2454 | 2454 | |
2455 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
2455 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
2456 | 2456 | } else { |
2457 | 2457 | $aliases[$row['id']] = $row['alias']; |
2458 | 2458 | } |
@@ -2464,7 +2464,7 @@ discard block |
||
2464 | 2464 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2465 | 2465 | $pref = $this->config['friendly_url_prefix']; |
2466 | 2466 | $suff = $this->config['friendly_url_suffix']; |
2467 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2467 | + $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2468 | 2468 | global $modx; |
2469 | 2469 | $thealias = $aliases[$m[1]]; |
2470 | 2470 | $thefolder = $isfolder[$m[1]]; |
@@ -2480,7 +2480,7 @@ discard block |
||
2480 | 2480 | |
2481 | 2481 | } else { |
2482 | 2482 | $in = '!\[\~([0-9]+)\~\]!is'; |
2483 | - $out = "index.php?id=" . '\1'; |
|
2483 | + $out = "index.php?id=".'\1'; |
|
2484 | 2484 | $documentSource = preg_replace($in, $out, $documentSource); |
2485 | 2485 | } |
2486 | 2486 | |
@@ -2501,7 +2501,7 @@ discard block |
||
2501 | 2501 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
2502 | 2502 | $len_base_url = strlen($this->config['base_url']); |
2503 | 2503 | |
2504 | - $url_path = $q;//LANG |
|
2504 | + $url_path = $q; //LANG |
|
2505 | 2505 | |
2506 | 2506 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
2507 | 2507 | $url_path = substr($url_path, $len_base_url); |
@@ -2513,7 +2513,7 @@ discard block |
||
2513 | 2513 | $strictURL = substr($strictURL, $len_base_url); |
2514 | 2514 | } |
2515 | 2515 | $http_host = $_SERVER['HTTP_HOST']; |
2516 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
2516 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
2517 | 2517 | |
2518 | 2518 | $site_url = $this->config['site_url']; |
2519 | 2519 | $url_query_string = explode('?', $_SERVER['REQUEST_URI']); |
@@ -2531,7 +2531,7 @@ discard block |
||
2531 | 2531 | } |
2532 | 2532 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
2533 | 2533 | if (empty($_POST)) { |
2534 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
2534 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
2535 | 2535 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
2536 | 2536 | exit(0); |
2537 | 2537 | } |
@@ -2590,7 +2590,7 @@ discard block |
||
2590 | 2590 | $docgrp = implode(",", $docgrp); |
2591 | 2591 | } |
2592 | 2592 | // get document |
2593 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2593 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2594 | 2594 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
2595 | 2595 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
2596 | 2596 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2626,9 +2626,9 @@ discard block |
||
2626 | 2626 | } |
2627 | 2627 | if ($documentObject['template']) { |
2628 | 2628 | // load TVs and merge with document - Orig by Apodigm - Docvars |
2629 | - $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv |
|
2630 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
2631 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2629 | + $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv |
|
2630 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
2631 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2632 | 2632 | $tmplvars = array(); |
2633 | 2633 | while ($row = $this->db->getRow($rs)) { |
2634 | 2634 | $tmplvars[$row['name']] = array( |
@@ -2674,7 +2674,7 @@ discard block |
||
2674 | 2674 | $st = md5($source); |
2675 | 2675 | } |
2676 | 2676 | if ($this->dumpSnippets == 1) { |
2677 | - $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>"; |
|
2677 | + $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>"; |
|
2678 | 2678 | } |
2679 | 2679 | |
2680 | 2680 | // invoke OnParseDocument event |
@@ -2762,7 +2762,7 @@ discard block |
||
2762 | 2762 | |
2763 | 2763 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
2764 | 2764 | if ($this->config['use_alias_path'] == 1) { |
2765 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
2765 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
2766 | 2766 | if (isset($this->documentListing[$alias])) { |
2767 | 2767 | $this->documentIdentifier = $this->documentListing[$alias]; |
2768 | 2768 | } else { |
@@ -2823,7 +2823,7 @@ discard block |
||
2823 | 2823 | } else { |
2824 | 2824 | $docAlias = $this->db->escape($this->documentIdentifier); |
2825 | 2825 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); |
2826 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
2826 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
2827 | 2827 | } |
2828 | 2828 | } |
2829 | 2829 | $this->documentMethod = 'id'; |
@@ -2880,7 +2880,7 @@ discard block |
||
2880 | 2880 | $_REQUEST[$n] = $_GET[$n] = $v; |
2881 | 2881 | } |
2882 | 2882 | } |
2883 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
2883 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
2884 | 2884 | $this->q = $qp['path']; |
2885 | 2885 | return $qp['path']; |
2886 | 2886 | } |
@@ -2974,7 +2974,7 @@ discard block |
||
2974 | 2974 | $this->sendErrorPage(); |
2975 | 2975 | } else { |
2976 | 2976 | // Inculde the necessary files to check document permissions |
2977 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
2977 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
2978 | 2978 | $udperms = new udperms(); |
2979 | 2979 | $udperms->user = $this->getLoginUserID(); |
2980 | 2980 | $udperms->document = $this->documentIdentifier; |
@@ -3028,7 +3028,7 @@ discard block |
||
3028 | 3028 | while ($id && $height--) { |
3029 | 3029 | $thisid = $id; |
3030 | 3030 | if ($this->config['aliaslistingfolder'] == 1) { |
3031 | - $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"); |
|
3031 | + $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"); |
|
3032 | 3032 | if (!$id || $id == '0') { |
3033 | 3033 | break; |
3034 | 3034 | } |
@@ -3079,15 +3079,15 @@ discard block |
||
3079 | 3079 | |
3080 | 3080 | if ($this->config['aliaslistingfolder'] == 1) { |
3081 | 3081 | |
3082 | - $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
3082 | + $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
3083 | 3083 | $idx = array(); |
3084 | 3084 | while ($row = $this->db->getRow($res)) { |
3085 | 3085 | $pAlias = ''; |
3086 | 3086 | if (isset($this->aliasListing[$row['parent']])) { |
3087 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
3088 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
3087 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
3088 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
3089 | 3089 | }; |
3090 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
3090 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
3091 | 3091 | if ($row['isfolder'] == 1) { |
3092 | 3092 | $idx[] = $row['id']; |
3093 | 3093 | } |
@@ -3119,7 +3119,7 @@ discard block |
||
3119 | 3119 | $depth--; |
3120 | 3120 | |
3121 | 3121 | foreach ($documentMap_cache[$id] as $childId) { |
3122 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
3122 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
3123 | 3123 | if (!strlen($pkey)) { |
3124 | 3124 | $pkey = "{$childId}"; |
3125 | 3125 | } |
@@ -3148,7 +3148,7 @@ discard block |
||
3148 | 3148 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
3149 | 3149 | $fnc = substr($url, 11); |
3150 | 3150 | } elseif ($url) { |
3151 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
3151 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
3152 | 3152 | } else { |
3153 | 3153 | $fnc = "history.back(-1);"; |
3154 | 3154 | } |
@@ -3157,7 +3157,7 @@ discard block |
||
3157 | 3157 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
3158 | 3158 | <script> |
3159 | 3159 | function __alertQuit() { |
3160 | - alert('" . addslashes($msg) . "'); |
|
3160 | + alert('".addslashes($msg)."'); |
|
3161 | 3161 | {$fnc} |
3162 | 3162 | } |
3163 | 3163 | window.setTimeout('__alertQuit();',100); |
@@ -3179,9 +3179,9 @@ discard block |
||
3179 | 3179 | $state = 0; |
3180 | 3180 | $pms = $_SESSION['mgrPermissions']; |
3181 | 3181 | if ($pms) { |
3182 | - $state = ((bool)$pms[$pm] === true); |
|
3182 | + $state = ((bool) $pms[$pm] === true); |
|
3183 | 3183 | } |
3184 | - return (int)$state; |
|
3184 | + return (int) $state; |
|
3185 | 3185 | } |
3186 | 3186 | |
3187 | 3187 | /** |
@@ -3194,8 +3194,8 @@ discard block |
||
3194 | 3194 | */ |
3195 | 3195 | public function elementIsLocked($type, $id, $includeThisUser = false) |
3196 | 3196 | { |
3197 | - $id = (int)$id; |
|
3198 | - $type = (int)$type; |
|
3197 | + $id = (int) $id; |
|
3198 | + $type = (int) $type; |
|
3199 | 3199 | if (!$type || !$id) { |
3200 | 3200 | return null; |
3201 | 3201 | } |
@@ -3245,7 +3245,7 @@ discard block |
||
3245 | 3245 | return $lockedElements; |
3246 | 3246 | } |
3247 | 3247 | |
3248 | - $type = (int)$type; |
|
3248 | + $type = (int) $type; |
|
3249 | 3249 | if (isset($lockedElements[$type])) { |
3250 | 3250 | return $lockedElements[$type]; |
3251 | 3251 | } else { |
@@ -3262,7 +3262,7 @@ discard block |
||
3262 | 3262 | $this->lockedElements = array(); |
3263 | 3263 | $this->cleanupExpiredLocks(); |
3264 | 3264 | |
3265 | - $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul |
|
3265 | + $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul |
|
3266 | 3266 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
3267 | 3267 | while ($row = $this->db->getRow($rs)) { |
3268 | 3268 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3285,7 +3285,7 @@ discard block |
||
3285 | 3285 | public function cleanupExpiredLocks() |
3286 | 3286 | { |
3287 | 3287 | // Clean-up active_user_sessions first |
3288 | - $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3288 | + $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
3289 | 3289 | $validSessionTimeLimit = $this->time - $timeout; |
3290 | 3290 | $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}"); |
3291 | 3291 | |
@@ -3298,7 +3298,7 @@ discard block |
||
3298 | 3298 | foreach ($rs as $row) { |
3299 | 3299 | $userSids[] = $row['sid']; |
3300 | 3300 | } |
3301 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
3301 | + $userSids = "'".implode("','", $userSids)."'"; |
|
3302 | 3302 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
3303 | 3303 | } else { |
3304 | 3304 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3382,8 +3382,8 @@ discard block |
||
3382 | 3382 | public function lockElement($type, $id) |
3383 | 3383 | { |
3384 | 3384 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3385 | - $type = (int)$type; |
|
3386 | - $id = (int)$id; |
|
3385 | + $type = (int) $type; |
|
3386 | + $id = (int) $id; |
|
3387 | 3387 | if (!$type || !$id || !$userId) { |
3388 | 3388 | return false; |
3389 | 3389 | } |
@@ -3404,8 +3404,8 @@ discard block |
||
3404 | 3404 | public function unlockElement($type, $id, $includeAllUsers = false) |
3405 | 3405 | { |
3406 | 3406 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
3407 | - $type = (int)$type; |
|
3408 | - $id = (int)$id; |
|
3407 | + $type = (int) $type; |
|
3408 | + $id = (int) $id; |
|
3409 | 3409 | if (!$type || !$id) { |
3410 | 3410 | return false; |
3411 | 3411 | } |
@@ -3472,8 +3472,8 @@ discard block |
||
3472 | 3472 | } |
3473 | 3473 | |
3474 | 3474 | $usertype = $this->isFrontend() ? 1 : 0; |
3475 | - $evtid = (int)$evtid; |
|
3476 | - $type = (int)$type; |
|
3475 | + $evtid = (int) $evtid; |
|
3476 | + $type = (int) $type; |
|
3477 | 3477 | |
3478 | 3478 | // Types: 1 = information, 2 = warning, 3 = error |
3479 | 3479 | if ($type < 1) { |
@@ -3495,8 +3495,8 @@ discard block |
||
3495 | 3495 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
3496 | 3496 | if ($this->config['send_errormail'] <= $type) { |
3497 | 3497 | $this->sendmail(array( |
3498 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
3499 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
3498 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
3499 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
3500 | 3500 | 'type' => 'text' |
3501 | 3501 | )); |
3502 | 3502 | } |
@@ -3544,7 +3544,7 @@ discard block |
||
3544 | 3544 | $p['fromname'] = $userinfo['username']; |
3545 | 3545 | } |
3546 | 3546 | if ($msg === '' && !isset($p['body'])) { |
3547 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
3547 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
3548 | 3548 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
3549 | 3549 | $p['body'] = $msg; |
3550 | 3550 | } |
@@ -3584,8 +3584,8 @@ discard block |
||
3584 | 3584 | $files = array(); |
3585 | 3585 | } |
3586 | 3586 | foreach ($files as $f) { |
3587 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
3588 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
3587 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
3588 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
3589 | 3589 | } |
3590 | 3590 | } |
3591 | 3591 | $rs = $this->mail->send(); |
@@ -3655,14 +3655,14 @@ discard block |
||
3655 | 3655 | $tblsc = $this->getFullTableName("site_content"); |
3656 | 3656 | $tbldg = $this->getFullTableName("document_groups"); |
3657 | 3657 | // modify field names to use sc. table reference |
3658 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3659 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3658 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3659 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3660 | 3660 | // get document groups for current user |
3661 | 3661 | if ($docgrp = $this->getUserDocGroups()) { |
3662 | 3662 | $docgrp = implode(",", $docgrp); |
3663 | 3663 | } |
3664 | 3664 | // build query |
3665 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3665 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3666 | 3666 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3667 | 3667 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3668 | 3668 | $resourceArray = $this->db->makeArray($result); |
@@ -3692,14 +3692,14 @@ discard block |
||
3692 | 3692 | $tbldg = $this->getFullTableName("document_groups"); |
3693 | 3693 | |
3694 | 3694 | // modify field names to use sc. table reference |
3695 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3696 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3695 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3696 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3697 | 3697 | // get document groups for current user |
3698 | 3698 | if ($docgrp = $this->getUserDocGroups()) { |
3699 | 3699 | $docgrp = implode(",", $docgrp); |
3700 | 3700 | } |
3701 | 3701 | // build query |
3702 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3702 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3703 | 3703 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3704 | 3704 | 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}"); |
3705 | 3705 | $resourceArray = $this->db->makeArray($result); |
@@ -3734,16 +3734,16 @@ discard block |
||
3734 | 3734 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
3735 | 3735 | } |
3736 | 3736 | |
3737 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
3738 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
3737 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
3738 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
3739 | 3739 | |
3740 | 3740 | if ($where != '') { |
3741 | - $where = 'AND ' . $where; |
|
3741 | + $where = 'AND '.$where; |
|
3742 | 3742 | } |
3743 | 3743 | |
3744 | 3744 | // modify field names to use sc. table reference |
3745 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3746 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3745 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3746 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3747 | 3747 | |
3748 | 3748 | // get document groups for current user |
3749 | 3749 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3751,7 +3751,7 @@ discard block |
||
3751 | 3751 | } |
3752 | 3752 | |
3753 | 3753 | // build query |
3754 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3754 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3755 | 3755 | |
3756 | 3756 | $tblsc = $this->getFullTableName('site_content'); |
3757 | 3757 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3803,10 +3803,10 @@ discard block |
||
3803 | 3803 | return false; |
3804 | 3804 | } else { |
3805 | 3805 | // modify field names to use sc. table reference |
3806 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3807 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3806 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3807 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3808 | 3808 | if ($where != '') { |
3809 | - $where = 'AND ' . $where; |
|
3809 | + $where = 'AND '.$where; |
|
3810 | 3810 | } |
3811 | 3811 | |
3812 | 3812 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3817,13 +3817,13 @@ discard block |
||
3817 | 3817 | $docgrp = implode(',', $docgrp); |
3818 | 3818 | } |
3819 | 3819 | |
3820 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3820 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3821 | 3821 | |
3822 | 3822 | $tblsc = $this->getFullTableName('site_content'); |
3823 | 3823 | $tbldg = $this->getFullTableName('document_groups'); |
3824 | 3824 | |
3825 | 3825 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3826 | - 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); |
|
3826 | + 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); |
|
3827 | 3827 | |
3828 | 3828 | $resourceArray = $this->db->makeArray($result); |
3829 | 3829 | |
@@ -3928,12 +3928,12 @@ discard block |
||
3928 | 3928 | $tbldg = $this->getFullTableName("document_groups"); |
3929 | 3929 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
3930 | 3930 | // modify field names to use sc. table reference |
3931 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3931 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3932 | 3932 | // get document groups for current user |
3933 | 3933 | if ($docgrp = $this->getUserDocGroups()) { |
3934 | 3934 | $docgrp = implode(",", $docgrp); |
3935 | 3935 | } |
3936 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3936 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3937 | 3937 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
3938 | 3938 | $pageInfo = $this->db->getRow($result); |
3939 | 3939 | |
@@ -3980,7 +3980,7 @@ discard block |
||
3980 | 3980 | { |
3981 | 3981 | if ($this->currentSnippet) { |
3982 | 3982 | $tbl = $this->getFullTableName("site_snippets"); |
3983 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
3983 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
3984 | 3984 | if ($snippetId = $this->db->getValue($rs)) { |
3985 | 3985 | return $snippetId; |
3986 | 3986 | } |
@@ -4007,23 +4007,23 @@ discard block |
||
4007 | 4007 | */ |
4008 | 4008 | public function clearCache($type = '', $report = false) |
4009 | 4009 | { |
4010 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
4010 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
4011 | 4011 | if (is_array($type)) { |
4012 | 4012 | foreach ($type as $_) { |
4013 | 4013 | $this->clearCache($_, $report); |
4014 | 4014 | } |
4015 | 4015 | } elseif ($type == 'full') { |
4016 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
4016 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
4017 | 4017 | $sync = new synccache(); |
4018 | 4018 | $sync->setCachepath($cache_dir); |
4019 | 4019 | $sync->setReport($report); |
4020 | 4020 | $sync->emptyCache(); |
4021 | 4021 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
4022 | 4022 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
4023 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
4024 | - $cache_path = $cache_dir . $file_name; |
|
4023 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
4024 | + $cache_path = $cache_dir.$file_name; |
|
4025 | 4025 | $files = glob($cache_path); |
4026 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
4026 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
4027 | 4027 | foreach ($files as $file) { |
4028 | 4028 | if (!is_file($file)) { |
4029 | 4029 | continue; |
@@ -4031,7 +4031,7 @@ discard block |
||
4031 | 4031 | unlink($file); |
4032 | 4032 | } |
4033 | 4033 | } else { |
4034 | - $files = glob($cache_dir . '*'); |
|
4034 | + $files = glob($cache_dir.'*'); |
|
4035 | 4035 | foreach ($files as $file) { |
4036 | 4036 | $name = basename($file); |
4037 | 4037 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4100,7 +4100,7 @@ discard block |
||
4100 | 4100 | $f_url_suffix = '/'; |
4101 | 4101 | } |
4102 | 4102 | |
4103 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : ''; |
|
4103 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : ''; |
|
4104 | 4104 | |
4105 | 4105 | if ($al && $al['alias']) { |
4106 | 4106 | $alias = $al['alias']; |
@@ -4108,7 +4108,7 @@ discard block |
||
4108 | 4108 | |
4109 | 4109 | } |
4110 | 4110 | |
4111 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
4111 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
4112 | 4112 | $url = "{$alias}{$args}"; |
4113 | 4113 | } else { |
4114 | 4114 | $url = "index.php?id={$id}{$args}"; |
@@ -4127,7 +4127,7 @@ discard block |
||
4127 | 4127 | } |
4128 | 4128 | |
4129 | 4129 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
4130 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
4130 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
4131 | 4131 | } |
4132 | 4132 | |
4133 | 4133 | //fix strictUrl by Bumkaka |
@@ -4136,9 +4136,9 @@ discard block |
||
4136 | 4136 | } |
4137 | 4137 | |
4138 | 4138 | if ($this->config['xhtml_urls']) { |
4139 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
4139 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
4140 | 4140 | } else { |
4141 | - $url = $host . $virtualDir . $url; |
|
4141 | + $url = $host.$virtualDir.$url; |
|
4142 | 4142 | } |
4143 | 4143 | |
4144 | 4144 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4162,21 +4162,21 @@ discard block |
||
4162 | 4162 | if (isset($this->aliasListing[$id])) { |
4163 | 4163 | $out = $this->aliasListing[$id]; |
4164 | 4164 | } else { |
4165 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
4165 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
4166 | 4166 | if ($this->db->getRecordCount($q) == '1') { |
4167 | 4167 | $q = $this->db->getRow($q); |
4168 | 4168 | $this->aliasListing[$id] = array( |
4169 | - 'id' => (int)$q['id'], |
|
4169 | + 'id' => (int) $q['id'], |
|
4170 | 4170 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
4171 | - 'parent' => (int)$q['parent'], |
|
4172 | - 'isfolder' => (int)$q['isfolder'], |
|
4171 | + 'parent' => (int) $q['parent'], |
|
4172 | + 'isfolder' => (int) $q['isfolder'], |
|
4173 | 4173 | ); |
4174 | 4174 | if ($this->aliasListing[$id]['parent'] > 0) { |
4175 | 4175 | //fix alias_path_usage |
4176 | 4176 | if ($this->config['use_alias_path'] == '1') { |
4177 | 4177 | //&& $tmp['path'] != '' - fix error slash with epty path |
4178 | 4178 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
4179 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
4179 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
4180 | 4180 | } else { |
4181 | 4181 | $this->aliasListing[$id]['path'] = ''; |
4182 | 4182 | } |
@@ -4217,7 +4217,7 @@ discard block |
||
4217 | 4217 | $out = array(); |
4218 | 4218 | if (empty($this->version) || !is_array($this->version)) { |
4219 | 4219 | //include for compatibility modx version < 1.0.10 |
4220 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
4220 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
4221 | 4221 | $this->version = array(); |
4222 | 4222 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
4223 | 4223 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4239,18 +4239,18 @@ discard block |
||
4239 | 4239 | { |
4240 | 4240 | if (isset ($this->snippetCache[$snippetName])) { |
4241 | 4241 | $snippet = $this->snippetCache[$snippetName]; |
4242 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
4242 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
4243 | 4243 | } else { // not in cache so let's check the db |
4244 | - $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;"; |
|
4244 | + $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;"; |
|
4245 | 4245 | $result = $this->db->query($sql); |
4246 | 4246 | if ($this->db->getRecordCount($result) == 1) { |
4247 | 4247 | $row = $this->db->getRow($result); |
4248 | 4248 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
4249 | 4249 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties'])); |
4250 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
4250 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
4251 | 4251 | } else { |
4252 | 4252 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
4253 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
4253 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
4254 | 4254 | } |
4255 | 4255 | } |
4256 | 4256 | // load default params/properties |
@@ -4351,7 +4351,7 @@ discard block |
||
4351 | 4351 | if (strpos($tpl, $s) !== false) { |
4352 | 4352 | $tpl = str_replace($s, $value, $tpl); |
4353 | 4353 | } elseif ($this->debug) { |
4354 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
4354 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
4355 | 4355 | } |
4356 | 4356 | } |
4357 | 4357 | |
@@ -4400,7 +4400,7 @@ discard block |
||
4400 | 4400 | case 'CODE': |
4401 | 4401 | break; |
4402 | 4402 | case 'FILE': |
4403 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
4403 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
4404 | 4404 | break; |
4405 | 4405 | case 'CHUNK': |
4406 | 4406 | $template = $this->getChunk($template); |
@@ -4433,7 +4433,7 @@ discard block |
||
4433 | 4433 | if ($mode !== 'formatOnly' && empty($timestamp)) { |
4434 | 4434 | return '-'; |
4435 | 4435 | } |
4436 | - $timestamp = (int)$timestamp; |
|
4436 | + $timestamp = (int) $timestamp; |
|
4437 | 4437 | |
4438 | 4438 | switch ($this->config['datetime_format']) { |
4439 | 4439 | case 'YYYY/mm/dd': |
@@ -4453,7 +4453,7 @@ discard block |
||
4453 | 4453 | } |
4454 | 4454 | |
4455 | 4455 | if (empty($mode)) { |
4456 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
4456 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
4457 | 4457 | } elseif ($mode == 'dateOnly') { |
4458 | 4458 | $strTime = strftime($dateFormat, $timestamp); |
4459 | 4459 | } elseif ($mode == 'formatOnly') { |
@@ -4507,7 +4507,7 @@ discard block |
||
4507 | 4507 | $S = 0; |
4508 | 4508 | } |
4509 | 4509 | $timeStamp = mktime($H, $M, $S, $m, $d, $Y); |
4510 | - $timeStamp = (int)$timeStamp; |
|
4510 | + $timeStamp = (int) $timeStamp; |
|
4511 | 4511 | return $timeStamp; |
4512 | 4512 | } |
4513 | 4513 | |
@@ -4549,7 +4549,7 @@ discard block |
||
4549 | 4549 | if ($v === 'value') { |
4550 | 4550 | unset($_[$i]); |
4551 | 4551 | } else { |
4552 | - $_[$i] = 'tv.' . $v; |
|
4552 | + $_[$i] = 'tv.'.$v; |
|
4553 | 4553 | } |
4554 | 4554 | } |
4555 | 4555 | $fields = implode(',', $_); |
@@ -4558,12 +4558,12 @@ discard block |
||
4558 | 4558 | } |
4559 | 4559 | |
4560 | 4560 | if ($tvsort != '') { |
4561 | - $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4561 | + $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4562 | 4562 | } |
4563 | 4563 | if ($tvidnames == "*") { |
4564 | 4564 | $query = "tv.id<>0"; |
4565 | 4565 | } else { |
4566 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')"; |
|
4566 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')"; |
|
4567 | 4567 | } |
4568 | 4568 | |
4569 | 4569 | $this->getUserDocGroups(); |
@@ -4725,18 +4725,18 @@ discard block |
||
4725 | 4725 | } |
4726 | 4726 | |
4727 | 4727 | // get user defined template variables |
4728 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4729 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4728 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4729 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4730 | 4730 | |
4731 | 4731 | if ($idnames == '*') { |
4732 | 4732 | $query = 'tv.id<>0'; |
4733 | 4733 | } else { |
4734 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
4734 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
4735 | 4735 | } |
4736 | 4736 | |
4737 | - $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv |
|
4738 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
4739 | - 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}" : "")); |
|
4737 | + $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv |
|
4738 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
4739 | + 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}" : "")); |
|
4740 | 4740 | |
4741 | 4741 | $result = $this->db->makeArray($rs); |
4742 | 4742 | |
@@ -4785,16 +4785,16 @@ discard block |
||
4785 | 4785 | $output = array(); |
4786 | 4786 | $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames); |
4787 | 4787 | |
4788 | - $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier; |
|
4788 | + $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier; |
|
4789 | 4789 | // remove sort for speed |
4790 | 4790 | $result = $this->getTemplateVars($vars, '*', $docid, $published, '', ''); |
4791 | 4791 | |
4792 | 4792 | if ($result == false) { |
4793 | 4793 | return false; |
4794 | 4794 | } else { |
4795 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
4796 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
4797 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
4795 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
4796 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
4797 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
4798 | 4798 | |
4799 | 4799 | for ($i = 0; $i < count($result); $i++) { |
4800 | 4800 | $row = $result[$i]; |
@@ -4819,7 +4819,7 @@ discard block |
||
4819 | 4819 | */ |
4820 | 4820 | public function getFullTableName($tbl) |
4821 | 4821 | { |
4822 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
4822 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
4823 | 4823 | } |
4824 | 4824 | |
4825 | 4825 | /** |
@@ -4898,7 +4898,7 @@ discard block |
||
4898 | 4898 | public function getCachePath() |
4899 | 4899 | { |
4900 | 4900 | global $base_url; |
4901 | - $pth = $base_url . $this->getCacheFolder(); |
|
4901 | + $pth = $base_url.$this->getCacheFolder(); |
|
4902 | 4902 | return $pth; |
4903 | 4903 | } |
4904 | 4904 | |
@@ -4950,8 +4950,8 @@ discard block |
||
4950 | 4950 | $out = false; |
4951 | 4951 | |
4952 | 4952 | if (!empty($context)) { |
4953 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4954 | - $out = $_SESSION[$context . 'InternalKey']; |
|
4953 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4954 | + $out = $_SESSION[$context.'InternalKey']; |
|
4955 | 4955 | } |
4956 | 4956 | } else { |
4957 | 4957 | switch (true) { |
@@ -4981,8 +4981,8 @@ discard block |
||
4981 | 4981 | $out = false; |
4982 | 4982 | |
4983 | 4983 | if (!empty($context)) { |
4984 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4985 | - $out = $_SESSION[$context . 'Shortname']; |
|
4984 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4985 | + $out = $_SESSION[$context.'Shortname']; |
|
4986 | 4986 | } |
4987 | 4987 | } else { |
4988 | 4988 | switch (true) { |
@@ -5055,8 +5055,8 @@ discard block |
||
5055 | 5055 | */ |
5056 | 5056 | public function getWebUserInfo($uid) |
5057 | 5057 | { |
5058 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
5059 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5058 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
5059 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5060 | 5060 | if ($row = $this->db->getRow($rs)) { |
5061 | 5061 | if (!isset($row['usertype']) or !$row["usertype"]) { |
5062 | 5062 | $row["usertype"] = "web"; |
@@ -5092,7 +5092,7 @@ discard block |
||
5092 | 5092 | } else if (is_array($dg)) { |
5093 | 5093 | // resolve ids to names |
5094 | 5094 | $dgn = array(); |
5095 | - $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); |
|
5095 | + $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); |
|
5096 | 5096 | while ($row = $this->db->getRow($ds)) { |
5097 | 5097 | $dgn[] = $row['name']; |
5098 | 5098 | } |
@@ -5120,7 +5120,7 @@ discard block |
||
5120 | 5120 | $rt = false; |
5121 | 5121 | if ($_SESSION["webValidated"] == 1) { |
5122 | 5122 | $tbl = $this->getFullTableName("web_users"); |
5123 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5123 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
5124 | 5124 | if ($row = $this->db->getRow($ds)) { |
5125 | 5125 | if ($row["password"] == md5($oldPwd)) { |
5126 | 5126 | if (strlen($newPwd) < 6) { |
@@ -5130,7 +5130,7 @@ discard block |
||
5130 | 5130 | } else { |
5131 | 5131 | $this->db->update(array( |
5132 | 5132 | 'password' => $this->db->escape($newPwd), |
5133 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5133 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
5134 | 5134 | // invoke OnWebChangePassword event |
5135 | 5135 | $this->invokeEvent("OnWebChangePassword", array( |
5136 | 5136 | "userid" => $row["id"], |
@@ -5161,8 +5161,8 @@ discard block |
||
5161 | 5161 | // check cache |
5162 | 5162 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
5163 | 5163 | if (!is_array($grpNames)) { |
5164 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
5165 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
5164 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
5165 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
5166 | 5166 | $grpNames = $this->db->getColumn("name", $rs); |
5167 | 5167 | // save to cache |
5168 | 5168 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5195,7 +5195,7 @@ discard block |
||
5195 | 5195 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
5196 | 5196 | $this->sjscripts[$nextpos] = $src; |
5197 | 5197 | } else { |
5198 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
5198 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
5199 | 5199 | } |
5200 | 5200 | } |
5201 | 5201 | |
@@ -5274,7 +5274,7 @@ discard block |
||
5274 | 5274 | } |
5275 | 5275 | |
5276 | 5276 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
5277 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
5277 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
5278 | 5278 | } |
5279 | 5279 | if ($startup) { |
5280 | 5280 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5421,7 +5421,7 @@ discard block |
||
5421 | 5421 | $eventtime = $this->getMicroTime() - $eventtime; |
5422 | 5422 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
5423 | 5423 | foreach ($parameter as $k => $v) { |
5424 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
5424 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
5425 | 5425 | } |
5426 | 5426 | $this->pluginsCode .= '</fieldset><br />'; |
5427 | 5427 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5449,13 +5449,13 @@ discard block |
||
5449 | 5449 | $plugin = array(); |
5450 | 5450 | if (isset ($this->pluginCache[$pluginName])) { |
5451 | 5451 | $pluginCode = $this->pluginCache[$pluginName]; |
5452 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
5452 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
5453 | 5453 | } else { |
5454 | 5454 | $pluginName = $this->db->escape($pluginName); |
5455 | 5455 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
5456 | 5456 | if ($row = $this->db->getRow($result)) { |
5457 | 5457 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
5458 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
5458 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
5459 | 5459 | } else { |
5460 | 5460 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
5461 | 5461 | $pluginProperties = ''; |
@@ -5562,7 +5562,7 @@ discard block |
||
5562 | 5562 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
5563 | 5563 | { |
5564 | 5564 | $params = array(); |
5565 | - $fullpath = $element_dir . '/' . $filename; |
|
5565 | + $fullpath = $element_dir.'/'.$filename; |
|
5566 | 5566 | if (is_readable($fullpath)) { |
5567 | 5567 | $tpl = @fopen($fullpath, "r"); |
5568 | 5568 | if ($tpl) { |
@@ -5729,8 +5729,8 @@ discard block |
||
5729 | 5729 | $ph = array('site_url' => MODX_SITE_URL); |
5730 | 5730 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
5731 | 5731 | $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'; |
5732 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
5733 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
5732 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
5733 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
5734 | 5734 | foreach ($parsed as $key => $val) { |
5735 | 5735 | if (is_array($val)) { |
5736 | 5736 | foreach ($val as $key2 => $val2) { |
@@ -5739,7 +5739,7 @@ discard block |
||
5739 | 5739 | $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); |
5740 | 5740 | } |
5741 | 5741 | if (preg_match($regexEmail, $val2, $url)) { |
5742 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
5742 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
5743 | 5743 | } |
5744 | 5744 | $parsed[$key][$key2] = $val2; |
5745 | 5745 | } |
@@ -5749,7 +5749,7 @@ discard block |
||
5749 | 5749 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
5750 | 5750 | } |
5751 | 5751 | if (preg_match($regexEmail, $val, $url)) { |
5752 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
5752 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
5753 | 5753 | } |
5754 | 5754 | $parsed[$key] = $val; |
5755 | 5755 | } |
@@ -5763,32 +5763,32 @@ discard block |
||
5763 | 5763 | ); |
5764 | 5764 | |
5765 | 5765 | $nl = "\n"; |
5766 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
5767 | - $list .= '<p>' . $nl; |
|
5768 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
5769 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
5770 | - $list .= '</p><br/>' . $nl; |
|
5771 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
5772 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
5773 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
5774 | - $list .= '<br/>' . $nl; |
|
5766 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
5767 | + $list .= '<p>'.$nl; |
|
5768 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
5769 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
5770 | + $list .= '</p><br/>'.$nl; |
|
5771 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
5772 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
5773 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
5774 | + $list .= '<br/>'.$nl; |
|
5775 | 5775 | $first = true; |
5776 | 5776 | foreach ($arrayParams as $param => $label) { |
5777 | 5777 | if (isset($parsed[$param])) { |
5778 | 5778 | if ($first) { |
5779 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
5780 | - $list .= '<ul class="docBlockList">' . $nl; |
|
5779 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
5780 | + $list .= '<ul class="docBlockList">'.$nl; |
|
5781 | 5781 | $first = false; |
5782 | 5782 | } |
5783 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
5784 | - $list .= ' <ul>' . $nl; |
|
5783 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
5784 | + $list .= ' <ul>'.$nl; |
|
5785 | 5785 | foreach ($parsed[$param] as $val) { |
5786 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
5786 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
5787 | 5787 | } |
5788 | - $list .= ' </ul></li>' . $nl; |
|
5788 | + $list .= ' </ul></li>'.$nl; |
|
5789 | 5789 | } |
5790 | 5790 | } |
5791 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
5791 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
5792 | 5792 | |
5793 | 5793 | return $list; |
5794 | 5794 | } |
@@ -5864,7 +5864,7 @@ discard block |
||
5864 | 5864 | */ |
5865 | 5865 | public function addSnippet($name, $phpCode) |
5866 | 5866 | { |
5867 | - $this->snippetCache['#' . $name] = $phpCode; |
|
5867 | + $this->snippetCache['#'.$name] = $phpCode; |
|
5868 | 5868 | } |
5869 | 5869 | |
5870 | 5870 | /** |
@@ -5873,7 +5873,7 @@ discard block |
||
5873 | 5873 | */ |
5874 | 5874 | public function addChunk($name, $text) |
5875 | 5875 | { |
5876 | - $this->chunkCache['#' . $name] = $text; |
|
5876 | + $this->chunkCache['#'.$name] = $text; |
|
5877 | 5877 | } |
5878 | 5878 | |
5879 | 5879 | /** |
@@ -5909,7 +5909,7 @@ discard block |
||
5909 | 5909 | } |
5910 | 5910 | |
5911 | 5911 | if (!$isSafe) { |
5912 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
5912 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
5913 | 5913 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
5914 | 5914 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
5915 | 5915 | return; |
@@ -5923,7 +5923,7 @@ discard block |
||
5923 | 5923 | return 'array()'; |
5924 | 5924 | } |
5925 | 5925 | |
5926 | - $output = $echo . $return; |
|
5926 | + $output = $echo.$return; |
|
5927 | 5927 | modx_sanitize_gpc($output); |
5928 | 5928 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
5929 | 5929 | } |
@@ -5941,8 +5941,8 @@ discard block |
||
5941 | 5941 | |
5942 | 5942 | $safe = explode(',', $safe_functions); |
5943 | 5943 | |
5944 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
5945 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
5944 | + $phpcode = rtrim($phpcode, ';').';'; |
|
5945 | + $tokens = token_get_all('<?php '.$phpcode); |
|
5946 | 5946 | foreach ($tokens as $i => $token) { |
5947 | 5947 | if (!is_array($token)) { |
5948 | 5948 | continue; |
@@ -5978,7 +5978,7 @@ discard block |
||
5978 | 5978 | public function atBindFileContent($str = '') |
5979 | 5979 | { |
5980 | 5980 | |
5981 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); |
|
5981 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); |
|
5982 | 5982 | |
5983 | 5983 | if (stripos($str, '@FILE') !== 0) { |
5984 | 5984 | return $str; |
@@ -6001,7 +6001,7 @@ discard block |
||
6001 | 6001 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
6002 | 6002 | |
6003 | 6003 | foreach ($search_path as $path) { |
6004 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
6004 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
6005 | 6005 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
6006 | 6006 | return $errorMsg; |
6007 | 6007 | } elseif (is_file($file_path)) { |
@@ -6015,7 +6015,7 @@ discard block |
||
6015 | 6015 | return $errorMsg; |
6016 | 6016 | } |
6017 | 6017 | |
6018 | - $content = (string)file_get_contents($file_path); |
|
6018 | + $content = (string) file_get_contents($file_path); |
|
6019 | 6019 | if ($content === false) { |
6020 | 6020 | return $errorMsg; |
6021 | 6021 | } |
@@ -6128,22 +6128,22 @@ discard block |
||
6128 | 6128 | |
6129 | 6129 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
6130 | 6130 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
6131 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
6131 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
6132 | 6132 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
6133 | 6133 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
6134 | 6134 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
6135 | 6135 | if ($is_error) { |
6136 | 6136 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
6137 | 6137 | if ($msg != 'PHP Parse Error') { |
6138 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
6138 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
6139 | 6139 | } |
6140 | 6140 | } else { |
6141 | 6141 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
6142 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
6142 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
6143 | 6143 | } |
6144 | 6144 | |
6145 | 6145 | if (!empty ($query)) { |
6146 | - $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>'; |
|
6146 | + $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>'; |
|
6147 | 6147 | } |
6148 | 6148 | |
6149 | 6149 | $errortype = array( |
@@ -6166,13 +6166,13 @@ discard block |
||
6166 | 6166 | |
6167 | 6167 | if (!empty($nr) || !empty($file)) { |
6168 | 6168 | if ($text != '') { |
6169 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
6169 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
6170 | 6170 | } |
6171 | 6171 | if ($output != '') { |
6172 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
6172 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
6173 | 6173 | } |
6174 | 6174 | if ($nr !== '') { |
6175 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
6175 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
6176 | 6176 | } |
6177 | 6177 | if ($file) { |
6178 | 6178 | $table[] = array('File', $file); |
@@ -6192,7 +6192,7 @@ discard block |
||
6192 | 6192 | } |
6193 | 6193 | |
6194 | 6194 | if (!empty($this->event->activePlugin)) { |
6195 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
6195 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
6196 | 6196 | } |
6197 | 6197 | |
6198 | 6198 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6202,17 +6202,17 @@ discard block |
||
6202 | 6202 | $table[] = array('REQUEST_URI', $request_uri); |
6203 | 6203 | |
6204 | 6204 | if ($this->manager->action) { |
6205 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
6205 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
6206 | 6206 | global $action_list; |
6207 | 6207 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
6208 | 6208 | |
6209 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
6209 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
6210 | 6210 | } |
6211 | 6211 | |
6212 | 6212 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
6213 | 6213 | $resource = $this->getDocumentObject('id', $this->documentIdentifier); |
6214 | 6214 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
6215 | - $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); |
|
6215 | + $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); |
|
6216 | 6216 | } |
6217 | 6217 | $table[] = array('Referer', $referer); |
6218 | 6218 | $table[] = array('User Agent', $ua); |
@@ -6233,7 +6233,7 @@ discard block |
||
6233 | 6233 | |
6234 | 6234 | $mem = memory_get_peak_usage(true); |
6235 | 6235 | $total_mem = $mem - $this->mstart; |
6236 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
6236 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
6237 | 6237 | |
6238 | 6238 | $queryTime = $this->queryTime; |
6239 | 6239 | $phpTime = $totalTime - $queryTime; |
@@ -6254,18 +6254,18 @@ discard block |
||
6254 | 6254 | $str .= $this->get_backtrace(debug_backtrace()); |
6255 | 6255 | // Log error |
6256 | 6256 | if (!empty($this->currentSnippet)) { |
6257 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
6257 | + $source = 'Snippet - '.$this->currentSnippet; |
|
6258 | 6258 | } elseif (!empty($this->event->activePlugin)) { |
6259 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
6259 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
6260 | 6260 | } elseif ($source !== '') { |
6261 | - $source = 'Parser - ' . $source; |
|
6261 | + $source = 'Parser - '.$source; |
|
6262 | 6262 | } elseif ($query !== '') { |
6263 | 6263 | $source = 'SQL Query'; |
6264 | 6264 | } else { |
6265 | 6265 | $source = 'Parser'; |
6266 | 6266 | } |
6267 | 6267 | if ($msg) { |
6268 | - $source .= ' / ' . $msg; |
|
6268 | + $source .= ' / '.$msg; |
|
6269 | 6269 | } |
6270 | 6270 | if (isset($actionName) && !empty($actionName)) { |
6271 | 6271 | $source .= $actionName; |
@@ -6297,12 +6297,12 @@ discard block |
||
6297 | 6297 | |
6298 | 6298 | // Display error |
6299 | 6299 | if (isset($_SESSION['mgrValidated'])) { |
6300 | - 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> |
|
6300 | + 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> |
|
6301 | 6301 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6302 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
6302 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
6303 | 6303 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
6304 | 6304 | </head><body> |
6305 | - ' . $str . '</body></html>'; |
|
6305 | + ' . $str.'</body></html>'; |
|
6306 | 6306 | |
6307 | 6307 | } else { |
6308 | 6308 | echo 'Error'; |
@@ -6340,7 +6340,7 @@ discard block |
||
6340 | 6340 | switch ($val['type']) { |
6341 | 6341 | case '->': |
6342 | 6342 | case '::': |
6343 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
6343 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
6344 | 6344 | break; |
6345 | 6345 | default: |
6346 | 6346 | $functionName = $val['function']; |
@@ -6350,7 +6350,7 @@ discard block |
||
6350 | 6350 | $args = array_pad(array(), $_, '$var'); |
6351 | 6351 | $args = implode(", ", $args); |
6352 | 6352 | $modx = &$this; |
6353 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6353 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
6354 | 6354 | $arg = $val['args'][$tmp - 1]; |
6355 | 6355 | switch (true) { |
6356 | 6356 | case is_null($arg): |
@@ -6365,7 +6365,7 @@ discard block |
||
6365 | 6365 | } |
6366 | 6366 | case is_scalar($arg): |
6367 | 6367 | { |
6368 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); |
|
6368 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); |
|
6369 | 6369 | break; |
6370 | 6370 | } |
6371 | 6371 | case is_bool($arg): |
@@ -6375,25 +6375,25 @@ discard block |
||
6375 | 6375 | } |
6376 | 6376 | case is_array($arg): |
6377 | 6377 | { |
6378 | - $out = 'array $var' . $tmp; |
|
6378 | + $out = 'array $var'.$tmp; |
|
6379 | 6379 | break; |
6380 | 6380 | } |
6381 | 6381 | case is_object($arg): |
6382 | 6382 | { |
6383 | - $out = get_class($arg) . ' $var' . $tmp; |
|
6383 | + $out = get_class($arg).' $var'.$tmp; |
|
6384 | 6384 | break; |
6385 | 6385 | } |
6386 | 6386 | default: |
6387 | 6387 | { |
6388 | - $out = '$var' . $tmp; |
|
6388 | + $out = '$var'.$tmp; |
|
6389 | 6389 | } |
6390 | 6390 | } |
6391 | 6391 | $tmp++; |
6392 | 6392 | return $out; |
6393 | 6393 | }, $args); |
6394 | 6394 | $line = array( |
6395 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
6396 | - $path . " on line " . $val['line'] |
|
6395 | + "<strong>".$functionName."</strong>(".$args.")", |
|
6396 | + $path." on line ".$val['line'] |
|
6397 | 6397 | ); |
6398 | 6398 | $table[] = array(implode("<br />", $line)); |
6399 | 6399 | } |
@@ -6434,7 +6434,7 @@ discard block |
||
6434 | 6434 | $alias = strip_tags($alias); // strip HTML |
6435 | 6435 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
6436 | 6436 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
6437 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6437 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6438 | 6438 | $alias = trim($alias, '-'); // trim excess |
6439 | 6439 | return $alias; |
6440 | 6440 | } |
@@ -6450,7 +6450,7 @@ discard block |
||
6450 | 6450 | $precisions = count($sizes) - 1; |
6451 | 6451 | foreach ($sizes as $unit => $bytes) { |
6452 | 6452 | if ($size >= $bytes) { |
6453 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
6453 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
6454 | 6454 | } |
6455 | 6455 | $precisions--; |
6456 | 6456 | } |
@@ -6554,10 +6554,10 @@ discard block |
||
6554 | 6554 | |
6555 | 6555 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
6556 | 6556 | return false; |
6557 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
6558 | - $file_path = MODX_BASE_PATH . $str; |
|
6559 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
6560 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
6557 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
6558 | + $file_path = MODX_BASE_PATH.$str; |
|
6559 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
6560 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
6561 | 6561 | } else { |
6562 | 6562 | return false; |
6563 | 6563 | } |
@@ -6683,7 +6683,7 @@ discard block |
||
6683 | 6683 | $title = 'no title'; |
6684 | 6684 | } |
6685 | 6685 | if (is_array($msg)) { |
6686 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
6686 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
6687 | 6687 | } elseif ($msg === '') { |
6688 | 6688 | $msg = $_SERVER['REQUEST_URI']; |
6689 | 6689 | } |
@@ -6728,7 +6728,7 @@ discard block |
||
6728 | 6728 | if (is_array($SystemAlertMsgQueque)) { |
6729 | 6729 | $title = ''; |
6730 | 6730 | if ($this->name && $this->activePlugin) { |
6731 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
6731 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
6732 | 6732 | } |
6733 | 6733 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
6734 | 6734 | } |
@@ -701,13 +701,15 @@ discard block |
||
701 | 701 | $this->virtualDir = ''; |
702 | 702 | } |
703 | 703 | |
704 | - 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 */ |
|
704 | + if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { |
|
705 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
705 | 706 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
706 | 707 | if ($this->config['use_alias_path'] == 1) { |
707 | 708 | 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))))) { |
708 | 709 | $this->documentMethod = 'id'; |
709 | 710 | return $q; |
710 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
711 | + } else { |
|
712 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
711 | 713 | $this->documentMethod = 'alias'; |
712 | 714 | return $q; |
713 | 715 | } |
@@ -715,7 +717,8 @@ discard block |
||
715 | 717 | $this->documentMethod = 'id'; |
716 | 718 | return $q; |
717 | 719 | } |
718 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
720 | + } else { |
|
721 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
719 | 722 | if ($this->config['friendly_alias_urls'] != 1) { |
720 | 723 | $q = $qOrig; |
721 | 724 | } |
@@ -1088,7 +1091,8 @@ discard block |
||
1088 | 1091 | $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0"; |
1089 | 1092 | $result_pub = $this->db->select('id', '[+prefix+]site_content', $where); |
1090 | 1093 | $this->db->update($field, '[+prefix+]site_content', $where); |
1091 | - if ($this->db->getRecordCount($result_pub) >= 1) { //Event Published doc |
|
1094 | + if ($this->db->getRecordCount($result_pub) >= 1) { |
|
1095 | +//Event Published doc |
|
1092 | 1096 | while ($row_unpub = $this->db->getRow($result_pub)) { |
1093 | 1097 | $this->invokeEvent("OnDocPublished", array( |
1094 | 1098 | "docid" => $row_unpub['id'] |
@@ -1101,7 +1105,8 @@ discard block |
||
1101 | 1105 | $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1"; |
1102 | 1106 | $result_unpub = $this->db->select('id', '[+prefix+]site_content', $where); |
1103 | 1107 | $this->db->update($field, '[+prefix+]site_content', $where); |
1104 | - if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc |
|
1108 | + if ($this->db->getRecordCount($result_unpub) >= 1) { |
|
1109 | +//Event unPublished doc |
|
1105 | 1110 | while ($row_unpub = $this->db->getRow($result_unpub)) { |
1106 | 1111 | $this->invokeEvent("OnDocUnPublished", array( |
1107 | 1112 | "docid" => $row_unpub['id'] |
@@ -1188,10 +1193,18 @@ discard block |
||
1188 | 1193 | return array(); |
1189 | 1194 | } |
1190 | 1195 | $spacer = md5('<<<EVO>>>'); |
1191 | - if ($left === '{{' && strpos($content, ';}}') !== false) $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); |
|
1192 | - if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); |
|
1193 | - if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); |
|
1194 | - if ($left === '[[' && strpos($content, ']]]') !== false) $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); |
|
1196 | + if ($left === '{{' && strpos($content, ';}}') !== false) { |
|
1197 | + $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); |
|
1198 | + } |
|
1199 | + if ($left === '{{' && strpos($content, '{{}}') !== false) { |
|
1200 | + $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); |
|
1201 | + } |
|
1202 | + if ($left === '[[' && strpos($content, ']]]]') !== false) { |
|
1203 | + $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); |
|
1204 | + } |
|
1205 | + if ($left === '[[' && strpos($content, ']]]') !== false) { |
|
1206 | + $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); |
|
1207 | + } |
|
1195 | 1208 | |
1196 | 1209 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
1197 | 1210 | $pos[']]>'] = strpos($content, ']]>'); |
@@ -1244,7 +1257,8 @@ discard block |
||
1244 | 1257 | } |
1245 | 1258 | } |
1246 | 1259 | |
1247 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
1260 | + if (!in_array($fetch, $tags)) { |
|
1261 | +// Avoid double Matches |
|
1248 | 1262 | $tags[] = $fetch; // Fetch |
1249 | 1263 | }; |
1250 | 1264 | $fetch = ''; // and reset |
@@ -1262,7 +1276,9 @@ discard block |
||
1262 | 1276 | } |
1263 | 1277 | } |
1264 | 1278 | foreach ($tags as $i => $tag) { |
1265 | - if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1279 | + if (strpos($tag, $spacer) !== false) { |
|
1280 | + $tags[$i] = str_replace($spacer, '', $tag); |
|
1281 | + } |
|
1266 | 1282 | } |
1267 | 1283 | return $tags; |
1268 | 1284 | } |
@@ -1302,7 +1318,10 @@ discard block |
||
1302 | 1318 | } |
1303 | 1319 | |
1304 | 1320 | foreach ($matches[1] as $i => $key) { |
1305 | - if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1321 | + if (strpos($key, '[+') !== false) { |
|
1322 | + continue; |
|
1323 | + } |
|
1324 | + // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1306 | 1325 | if (substr($key, 0, 1) == '#') { |
1307 | 1326 | $key = substr($key, 1); |
1308 | 1327 | } // remove # for QuickEdit format |
@@ -2027,7 +2046,8 @@ discard block |
||
2027 | 2046 | * @return mixed|string |
2028 | 2047 | */ |
2029 | 2048 | public function _getSGVar($value) |
2030 | - { // Get super globals |
|
2049 | + { |
|
2050 | +// Get super globals |
|
2031 | 2051 | $key = $value; |
2032 | 2052 | $_ = $this->config['enable_filter']; |
2033 | 2053 | $this->config['enable_filter'] = 1; |
@@ -2431,7 +2451,8 @@ discard block |
||
2431 | 2451 | if ($this->config['friendly_urls'] == 1) { |
2432 | 2452 | $aliases = array(); |
2433 | 2453 | if (is_array($this->documentListing)) { |
2434 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
2454 | + foreach ($this->documentListing as $path => $docid) { |
|
2455 | +// This is big Loop on large site! |
|
2435 | 2456 | $aliases[$docid] = $path; |
2436 | 2457 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
2437 | 2458 | } |
@@ -2464,7 +2485,7 @@ discard block |
||
2464 | 2485 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2465 | 2486 | $pref = $this->config['friendly_url_prefix']; |
2466 | 2487 | $suff = $this->config['friendly_url_suffix']; |
2467 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2488 | + $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
2468 | 2489 | global $modx; |
2469 | 2490 | $thealias = $aliases[$m[1]]; |
2470 | 2491 | $thefolder = $isfolder[$m[1]]; |
@@ -4240,7 +4261,8 @@ discard block |
||
4240 | 4261 | if (isset ($this->snippetCache[$snippetName])) { |
4241 | 4262 | $snippet = $this->snippetCache[$snippetName]; |
4242 | 4263 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
4243 | - } else { // not in cache so let's check the db |
|
4264 | + } else { |
|
4265 | +// not in cache so let's check the db |
|
4244 | 4266 | $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;"; |
4245 | 4267 | $result = $this->db->query($sql); |
4246 | 4268 | if ($this->db->getRecordCount($result) == 1) { |
@@ -5224,12 +5246,16 @@ discard block |
||
5224 | 5246 | return ''; |
5225 | 5247 | } // nothing to register |
5226 | 5248 | if (!is_array($options)) { |
5227 | - if (is_bool($options)) // backward compatibility with old plaintext parameter |
|
5249 | + if (is_bool($options)) { |
|
5250 | + // backward compatibility with old plaintext parameter |
|
5228 | 5251 | { |
5229 | 5252 | $options = array('plaintext' => $options); |
5230 | - } elseif (is_string($options)) // Also allow script name as 2nd param |
|
5253 | + } |
|
5254 | + } elseif (is_string($options)) { |
|
5255 | + // Also allow script name as 2nd param |
|
5231 | 5256 | { |
5232 | 5257 | $options = array('name' => $options); |
5258 | + } |
|
5233 | 5259 | } else { |
5234 | 5260 | $options = array(); |
5235 | 5261 | } |
@@ -5241,7 +5267,8 @@ discard block |
||
5241 | 5267 | unset($overwritepos); // probably unnecessary--just making sure |
5242 | 5268 | |
5243 | 5269 | $useThisVer = true; |
5244 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
5270 | + if (isset($this->loadedjscripts[$key])) { |
|
5271 | +// a matching script was found |
|
5245 | 5272 | // if existing script is a startup script, make sure the candidate is also a startup script |
5246 | 5273 | if ($this->loadedjscripts[$key]['startup']) { |
5247 | 5274 | $startup = true; |
@@ -5261,7 +5288,8 @@ discard block |
||
5261 | 5288 | // overwrite the old script (the position may be important for dependent scripts) |
5262 | 5289 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
5263 | 5290 | } |
5264 | - } else { // Use the original version |
|
5291 | + } else { |
|
5292 | +// Use the original version |
|
5265 | 5293 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
5266 | 5294 | // need to move the exisiting script to the head |
5267 | 5295 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5386,7 +5414,8 @@ discard block |
||
5386 | 5414 | } |
5387 | 5415 | |
5388 | 5416 | $results = null; |
5389 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
5417 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
5418 | +// start for loop |
|
5390 | 5419 | if ($this->dumpPlugins) { |
5391 | 5420 | $eventtime = $this->getMicroTime(); |
5392 | 5421 | } |
@@ -5934,7 +5963,8 @@ discard block |
||
5934 | 5963 | * @return bool |
5935 | 5964 | */ |
5936 | 5965 | public function isSafeCode($phpcode = '', $safe_functions = '') |
5937 | - { // return true or false |
|
5966 | + { |
|
5967 | +// return true or false |
|
5938 | 5968 | if ($safe_functions == '') { |
5939 | 5969 | return false; |
5940 | 5970 | } |
@@ -6350,7 +6380,7 @@ discard block |
||
6350 | 6380 | $args = array_pad(array(), $_, '$var'); |
6351 | 6381 | $args = implode(", ", $args); |
6352 | 6382 | $modx = &$this; |
6353 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6383 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
6354 | 6384 | $arg = $val['args'][$tmp - 1]; |
6355 | 6385 | switch (true) { |
6356 | 6386 | case is_null($arg): |