@@ -172,7 +172,7 @@ discard block  | 
                                                    ||
| 172 | 172 |          if (empty($services)) { | 
                                                        
| 173 | 173 | $services = include EVO_SERVICES_FILE;  | 
                                                        
| 174 | 174 | }  | 
                                                        
| 175 | - $this->services = $services;  | 
                                                        |
| 175 | + $this->services = $services;  | 
                                                        |
| 176 | 176 | |
| 177 | 177 | $this->initialize();  | 
                                                        
| 178 | 178 | }  | 
                                                        
@@ -236,7 +236,7 @@ discard block  | 
                                                    ||
| 236 | 236 | |
| 237 | 237 |      private function checkServiceAlias($name){ | 
                                                        
| 238 | 238 |          foreach ($this->providerAliases as $alias => $interface) { | 
                                                        
| 239 | -            if($name === $interface) { | 
                                                        |
| 239 | +            if ($name === $interface) { | 
                                                        |
| 240 | 240 | return $alias;  | 
                                                        
| 241 | 241 | }  | 
                                                        
| 242 | 242 | }  | 
                                                        
@@ -415,8 +415,8 @@ discard block  | 
                                                    ||
| 415 | 415 |          if (isset($this->providerAliases[$name])) { | 
                                                        
| 416 | 416 |              if ($this->getConfig('error_reporting', 0) > 1) { | 
                                                        
| 417 | 417 | trigger_error(  | 
                                                        
| 418 | - 'Property $' . $name . ' is deprecated and should no longer be used. ' .  | 
                                                        |
| 419 | -                    'Alternative ->getService(' . $this->providerAliases[$name] . '::class)', | 
                                                        |
| 418 | + 'Property $'.$name.' is deprecated and should no longer be used. '.  | 
                                                        |
| 419 | +                    'Alternative ->getService('.$this->providerAliases[$name].'::class)', | 
                                                        |
| 420 | 420 | E_USER_DEPRECATED  | 
                                                        
| 421 | 421 | );  | 
                                                        
| 422 | 422 | }  | 
                                                        
@@ -452,12 +452,12 @@ discard block  | 
                                                    ||
| 452 | 452 | $info = debug_backtrace();  | 
                                                        
| 453 | 453 | $m[] = $msg;  | 
                                                        
| 454 | 454 |              if (!empty($this->currentSnippet)) { | 
                                                        
| 455 | - $m[] = 'Snippet - ' . $this->currentSnippet;  | 
                                                        |
| 455 | + $m[] = 'Snippet - '.$this->currentSnippet;  | 
                                                        |
| 456 | 456 |              } elseif (!empty($this->event->activePlugin)) { | 
                                                        
| 457 | - $m[] = 'Plugin - ' . $this->event->activePlugin;  | 
                                                        |
| 457 | + $m[] = 'Plugin - '.$this->event->activePlugin;  | 
                                                        |
| 458 | 458 | }  | 
                                                        
| 459 | 459 | $m[] = $this->decoded_request_uri;  | 
                                                        
| 460 | -            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; | 
                                                        |
| 460 | +            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; | 
                                                        |
| 461 | 461 |              $msg = implode('<br />', $m); | 
                                                        
| 462 | 462 | $this->logEvent(0, $error_type, $msg, $title);  | 
                                                        
| 463 | 463 | }  | 
                                                        
@@ -474,7 +474,7 @@ discard block  | 
                                                    ||
| 474 | 474 |      { | 
                                                        
| 475 | 475 | $flag = false;  | 
                                                        
| 476 | 476 |          if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof Interfaces\DatabaseInterface) { | 
                                                        
| 477 | -            $flag = (bool)$this->{$connector}->conn; | 
                                                        |
| 477 | +            $flag = (bool) $this->{$connector}->conn; | 
                                                        |
| 478 | 478 | }  | 
                                                        
| 479 | 479 | return $flag;  | 
                                                        
| 480 | 480 | }  | 
                                                        
@@ -505,7 +505,7 @@ discard block  | 
                                                    ||
| 505 | 505 | }  | 
                                                        
| 506 | 506 |              if (!$out && $flag) { | 
                                                        
| 507 | 507 |                  $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); | 
                                                        
| 508 | -                $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; | 
                                                        |
| 508 | +                $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; | 
                                                        |
| 509 | 509 | $out = is_file($filename) ? include $filename : false;  | 
                                                        
| 510 | 510 | }  | 
                                                        
| 511 | 511 |              if ($out && !in_array($extname, $this->extensions)) { | 
                                                        
@@ -523,7 +523,7 @@ discard block  | 
                                                    ||
| 523 | 523 | public function getMicroTime()  | 
                                                        
| 524 | 524 |      { | 
                                                        
| 525 | 525 |          list ($usec, $sec) = explode(' ', microtime()); | 
                                                        
| 526 | - return ((float)$usec + (float)$sec);  | 
                                                        |
| 526 | + return ((float) $usec + (float) $sec);  | 
                                                        |
| 527 | 527 | }  | 
                                                        
| 528 | 528 | |
| 529 | 529 | /**  | 
                                                        
@@ -547,7 +547,7 @@ discard block  | 
                                                    ||
| 547 | 547 | // append the redirect count string to the url  | 
                                                        
| 548 | 548 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0;  | 
                                                        
| 549 | 549 |              if ($currentNumberOfRedirects > 3) { | 
                                                        
| 550 | -                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); | 
                                                        |
| 550 | +                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); | 
                                                        |
| 551 | 551 |              } else { | 
                                                        
| 552 | 552 | $currentNumberOfRedirects += 1;  | 
                                                        
| 553 | 553 |                  if (strpos($url, "?") > 0) { | 
                                                        
@@ -558,19 +558,19 @@ discard block  | 
                                                    ||
| 558 | 558 | }  | 
                                                        
| 559 | 559 | }  | 
                                                        
| 560 | 560 |          if ($type == 'REDIRECT_REFRESH') { | 
                                                        
| 561 | - $header = 'Refresh: 0;URL=' . $url;  | 
                                                        |
| 561 | + $header = 'Refresh: 0;URL='.$url;  | 
                                                        |
| 562 | 562 |          } elseif ($type == 'REDIRECT_META') { | 
                                                        
| 563 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';  | 
                                                        |
| 563 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';  | 
                                                        |
| 564 | 564 | echo $header;  | 
                                                        
| 565 | 565 | exit;  | 
                                                        
| 566 | 566 |          } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { | 
                                                        
| 567 | 567 | // check if url has /$base_url  | 
                                                        
| 568 | 568 |              if (substr($url, 0, strlen(MODX_BASE_URL)) == MODX_BASE_URL) { | 
                                                        
| 569 | 569 | // append $site_url to make it work with Location:  | 
                                                        
| 570 | - $url = MODX_SITE_URL . substr($url, strlen(MODX_BASE_URL));  | 
                                                        |
| 570 | + $url = MODX_SITE_URL.substr($url, strlen(MODX_BASE_URL));  | 
                                                        |
| 571 | 571 | }  | 
                                                        
| 572 | 572 |              if (strpos($url, "\n") === false) { | 
                                                        
| 573 | - $header = 'Location: ' . $url;  | 
                                                        |
| 573 | + $header = 'Location: '.$url;  | 
                                                        |
| 574 | 574 |              } else { | 
                                                        
| 575 | 575 |                  $this->messageQuit('No newline allowed in redirect url.'); | 
                                                        
| 576 | 576 | }  | 
                                                        
@@ -579,7 +579,7 @@ discard block  | 
                                                    ||
| 579 | 579 | header($responseCode);  | 
                                                        
| 580 | 580 | }  | 
                                                        
| 581 | 581 | |
| 582 | -        if(!empty($header)) { | 
                                                        |
| 582 | +        if (!empty($header)) { | 
                                                        |
| 583 | 583 | header($header);  | 
                                                        
| 584 | 584 | }  | 
                                                        
| 585 | 585 | |
@@ -684,8 +684,8 @@ discard block  | 
                                                    ||
| 684 | 684 | |
| 685 | 685 | private function recoverySiteCache()  | 
                                                        
| 686 | 686 |      { | 
                                                        
| 687 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();  | 
                                                        |
| 688 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php';  | 
                                                        |
| 687 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();  | 
                                                        |
| 688 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php';  | 
                                                        |
| 689 | 689 | |
| 690 | 690 |          if (is_file($site_cache_path)) { | 
                                                        
| 691 | 691 | include($site_cache_path);  | 
                                                        
@@ -748,8 +748,8 @@ discard block  | 
                                                    ||
| 748 | 748 |                  $this->invokeEvent("OnBeforeManagerPageInit"); | 
                                                        
| 749 | 749 | }  | 
                                                        
| 750 | 750 | |
| 751 | -            if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { | 
                                                        |
| 752 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];  | 
                                                        |
| 751 | +            if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { | 
                                                        |
| 752 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];  | 
                                                        |
| 753 | 753 |              } else { | 
                                                        
| 754 | 754 |                  if ($usrType == 'web') { | 
                                                        
| 755 | 755 | $from = $tbl_web_user_settings;  | 
                                                        
@@ -769,7 +769,7 @@ discard block  | 
                                                    ||
| 769 | 769 | $usrSettings[$row['setting_name']] = $row['setting_value'];  | 
                                                        
| 770 | 770 | }  | 
                                                        
| 771 | 771 |                  if (isset ($usrType)) { | 
                                                        
| 772 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;  | 
                                                        |
| 772 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;  | 
                                                        |
| 773 | 773 | } // store user settings in session  | 
                                                        
| 774 | 774 | }  | 
                                                        
| 775 | 775 | }  | 
                                                        
@@ -914,10 +914,10 @@ discard block  | 
                                                    ||
| 914 | 914 | $suf = $this->config['friendly_url_suffix'];  | 
                                                        
| 915 | 915 | $pre = preg_quote($pre, '/');  | 
                                                        
| 916 | 916 | $suf = preg_quote($suf, '/');  | 
                                                        
| 917 | -        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { | 
                                                        |
| 917 | +        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { | 
                                                        |
| 918 | 918 | $q = $_[1];  | 
                                                        
| 919 | 919 | }  | 
                                                        
| 920 | -        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { | 
                                                        |
| 920 | +        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { | 
                                                        |
| 921 | 921 | $q = $_[1];  | 
                                                        
| 922 | 922 | }  | 
                                                        
| 923 | 923 | |
@@ -939,7 +939,7 @@ discard block  | 
                                                    ||
| 939 | 939 |          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 */ | 
                                                        
| 940 | 940 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */  | 
                                                        
| 941 | 941 |              if ($this->config['use_alias_path'] == 1) { | 
                                                        
| 942 | -                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))))) { | 
                                                        |
| 942 | +                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))))) { | 
                                                        |
| 943 | 943 | $this->documentMethod = 'id';  | 
                                                        
| 944 | 944 | return $q;  | 
                                                        
| 945 | 945 |                  } else { /* not a valid id in terms of virtualDir, treat as alias */ | 
                                                        
@@ -973,7 +973,7 @@ discard block  | 
                                                    ||
| 973 | 973 | */  | 
                                                        
| 974 | 974 | public function getHashFile($key)  | 
                                                        
| 975 | 975 |      { | 
                                                        
| 976 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";  | 
                                                        |
| 976 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php";  | 
                                                        |
| 977 | 977 | }  | 
                                                        
| 978 | 978 | |
| 979 | 979 | /**  | 
                                                        
@@ -984,9 +984,9 @@ discard block  | 
                                                    ||
| 984 | 984 | $hash = $id;  | 
                                                        
| 985 | 985 | $tmp = null;  | 
                                                        
| 986 | 986 | $params = array();  | 
                                                        
| 987 | -        if(!empty($this->systemCacheKey)){ | 
                                                        |
| 987 | +        if (!empty($this->systemCacheKey)) { | 
                                                        |
| 988 | 988 | $hash = $this->systemCacheKey;  | 
                                                        
| 989 | -        }else { | 
                                                        |
| 989 | +        } else { | 
                                                        |
| 990 | 990 |              if (!empty($_GET)) { | 
                                                        
| 991 | 991 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.  | 
                                                        
| 992 | 992 | $params = $_GET;  | 
                                                        
@@ -994,8 +994,8 @@ discard block  | 
                                                    ||
| 994 | 994 | $hash .= '_'.md5(http_build_query($params));  | 
                                                        
| 995 | 995 | }  | 
                                                        
| 996 | 996 | }  | 
                                                        
| 997 | -        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); | 
                                                        |
| 998 | -        if (is_array($evtOut) && count($evtOut) > 0){ | 
                                                        |
| 997 | +        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); | 
                                                        |
| 998 | +        if (is_array($evtOut) && count($evtOut) > 0) { | 
                                                        |
| 999 | 999 | $tmp = array_pop($evtOut);  | 
                                                        
| 1000 | 1000 | }  | 
                                                        
| 1001 | 1001 | return empty($tmp) ? $hash : $tmp;  | 
                                                        
@@ -1143,12 +1143,12 @@ discard block  | 
                                                    ||
| 1143 | 1143 |          if ($js = $this->getRegisteredClientStartupScripts()) { | 
                                                        
| 1144 | 1144 | // change to just before closing </head>  | 
                                                        
| 1145 | 1145 |              // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); | 
                                                        
| 1146 | -            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); | 
                                                        |
| 1146 | +            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); | 
                                                        |
| 1147 | 1147 | }  | 
                                                        
| 1148 | 1148 | |
| 1149 | 1149 | // Insert jscripts & html block into template - template must have a </body> tag  | 
                                                        
| 1150 | 1150 |          if ($js = $this->getRegisteredClientScripts()) { | 
                                                        
| 1151 | -            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); | 
                                                        |
| 1151 | +            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); | 
                                                        |
| 1152 | 1152 | }  | 
                                                        
| 1153 | 1153 | // End fix by sirlancelot  | 
                                                        
| 1154 | 1154 | |
@@ -1159,7 +1159,7 @@ discard block  | 
                                                    ||
| 1159 | 1159 | // send out content-type and content-disposition headers  | 
                                                        
| 1160 | 1160 |          if (IN_PARSER_MODE == "true") { | 
                                                        
| 1161 | 1161 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";  | 
                                                        
| 1162 | -            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); | 
                                                        |
| 1162 | +            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); | 
                                                        |
| 1163 | 1163 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)  | 
                                                        
| 1164 | 1164 |              //                header('HTTP/1.0 404 Not Found'); | 
                                                        
| 1165 | 1165 |              if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { | 
                                                        
@@ -1177,7 +1177,7 @@ discard block  | 
                                                    ||
| 1177 | 1177 |                      $name = preg_replace('|-+|', '-', $name); | 
                                                        
| 1178 | 1178 | $name = trim($name, '-');  | 
                                                        
| 1179 | 1179 | }  | 
                                                        
| 1180 | - $header = 'Content-Disposition: attachment; filename=' . $name;  | 
                                                        |
| 1180 | + $header = 'Content-Disposition: attachment; filename='.$name;  | 
                                                        |
| 1181 | 1181 | header($header);  | 
                                                        
| 1182 | 1182 | }  | 
                                                        
| 1183 | 1183 | }  | 
                                                        
@@ -1185,7 +1185,7 @@ discard block  | 
                                                    ||
| 1185 | 1185 | |
| 1186 | 1186 | $stats = $this->getTimerStats($this->tstart);  | 
                                                        
| 1187 | 1187 | |
| 1188 | - $out =& $this->documentOutput;  | 
                                                        |
| 1188 | + $out = & $this->documentOutput;  | 
                                                        |
| 1189 | 1189 |          $out = str_replace("[^q^]", $stats['queries'], $out); | 
                                                        
| 1190 | 1190 |          $out = str_replace("[^qt^]", $stats['queryTime'], $out); | 
                                                        
| 1191 | 1191 |          $out = str_replace("[^p^]", $stats['phpTime'], $out); | 
                                                        
@@ -1224,17 +1224,17 @@ discard block  | 
                                                    ||
| 1224 | 1224 |                  $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet | 
                                                        
| 1225 | 1225 | $tt += $t;  | 
                                                        
| 1226 | 1226 | }  | 
                                                        
| 1227 | -            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; | 
                                                        |
| 1227 | +            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; | 
                                                        |
| 1228 | 1228 | echo $this->snippetsCode;  | 
                                                        
| 1229 | 1229 | }  | 
                                                        
| 1230 | 1230 |          if ($this->dumpPlugins) { | 
                                                        
| 1231 | 1231 | $ps = "";  | 
                                                        
| 1232 | 1232 | $tt = 0;  | 
                                                        
| 1233 | 1233 |              foreach ($this->pluginsTime as $s => $t) { | 
                                                        
| 1234 | -                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; | 
                                                        |
| 1234 | +                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; | 
                                                        |
| 1235 | 1235 | $tt += $t;  | 
                                                        
| 1236 | 1236 | }  | 
                                                        
| 1237 | -            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; | 
                                                        |
| 1237 | +            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; | 
                                                        |
| 1238 | 1238 | echo $this->pluginsCode;  | 
                                                        
| 1239 | 1239 | }  | 
                                                        
| 1240 | 1240 | |
@@ -1260,7 +1260,7 @@ discard block  | 
                                                    ||
| 1260 | 1260 |          $srcTags = explode(',', $tags); | 
                                                        
| 1261 | 1261 | $repTags = array();  | 
                                                        
| 1262 | 1262 |          foreach ($srcTags as $tag) { | 
                                                        
| 1263 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];  | 
                                                        |
| 1263 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1];  | 
                                                        |
| 1264 | 1264 | }  | 
                                                        
| 1265 | 1265 | return array($srcTags, $repTags);  | 
                                                        
| 1266 | 1266 | }  | 
                                                        
@@ -1282,7 +1282,7 @@ discard block  | 
                                                    ||
| 1282 | 1282 |          $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); | 
                                                        
| 1283 | 1283 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";  | 
                                                        
| 1284 | 1284 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0;  | 
                                                        
| 1285 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";  | 
                                                        |
| 1285 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";  | 
                                                        |
| 1286 | 1286 | |
| 1287 | 1287 | return $stats;  | 
                                                        
| 1288 | 1288 | }  | 
                                                        
@@ -1315,7 +1315,7 @@ discard block  | 
                                                    ||
| 1315 | 1315 |      { | 
                                                        
| 1316 | 1316 | $cacheRefreshTime = 0;  | 
                                                        
| 1317 | 1317 | $recent_update = 0;  | 
                                                        
| 1318 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');  | 
                                                        |
| 1318 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');  | 
                                                        |
| 1319 | 1319 | $this->recentUpdate = $recent_update;  | 
                                                        
| 1320 | 1320 | |
| 1321 | 1321 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];  | 
                                                        
@@ -1397,8 +1397,8 @@ discard block  | 
                                                    ||
| 1397 | 1397 | }  | 
                                                        
| 1398 | 1398 | |
| 1399 | 1399 | $docObjSerial = serialize($this->documentObject);  | 
                                                        
| 1400 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;  | 
                                                        |
| 1401 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);  | 
                                                        |
| 1400 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;  | 
                                                        |
| 1401 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);  | 
                                                        |
| 1402 | 1402 |                  file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); | 
                                                        
| 1403 | 1403 | }  | 
                                                        
| 1404 | 1404 | }  | 
                                                        
@@ -1440,16 +1440,16 @@ discard block  | 
                                                    ||
| 1440 | 1440 | return array();  | 
                                                        
| 1441 | 1441 | }  | 
                                                        
| 1442 | 1442 |          $spacer = md5('<<<EVO>>>'); | 
                                                        
| 1443 | -        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content); | 
                                                        |
| 1444 | -        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); | 
                                                        |
| 1445 | -        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content); | 
                                                        |
| 1446 | -        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content); | 
                                                        |
| 1443 | +        if ($left === '{{' && strpos($content, ';}}') !== false)  $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); | 
                                                        |
| 1444 | +        if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); | 
                                                        |
| 1445 | +        if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); | 
                                                        |
| 1446 | +        if ($left === '[[' && strpos($content, ']]]') !== false)  $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); | 
                                                        |
| 1447 | 1447 | |
| 1448 | 1448 | $pos['<![CDATA['] = strpos($content, '<![CDATA[');  | 
                                                        
| 1449 | 1449 | $pos[']]>'] = strpos($content, ']]>');  | 
                                                        
| 1450 | 1450 | |
| 1451 | 1451 |          if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { | 
                                                        
| 1452 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);  | 
                                                        |
| 1452 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);  | 
                                                        |
| 1453 | 1453 | }  | 
                                                        
| 1454 | 1454 | |
| 1455 | 1455 | $lp = explode($left, $content);  | 
                                                        
@@ -1513,8 +1513,8 @@ discard block  | 
                                                    ||
| 1513 | 1513 | }  | 
                                                        
| 1514 | 1514 | }  | 
                                                        
| 1515 | 1515 | }  | 
                                                        
| 1516 | -        foreach($tags as $i=>$tag) { | 
                                                        |
| 1517 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);  | 
                                                        |
| 1516 | +        foreach ($tags as $i=>$tag) { | 
                                                        |
| 1517 | + if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag);  | 
                                                        |
| 1518 | 1518 | }  | 
                                                        
| 1519 | 1519 | return $tags;  | 
                                                        
| 1520 | 1520 | }  | 
                                                        
@@ -1554,7 +1554,7 @@ discard block  | 
                                                    ||
| 1554 | 1554 | }  | 
                                                        
| 1555 | 1555 | |
| 1556 | 1556 |          foreach ($matches[1] as $i => $key) { | 
                                                        
| 1557 | -            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content | 
                                                        |
| 1557 | +            if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content | 
                                                        |
| 1558 | 1558 |              if (substr($key, 0, 1) == '#') { | 
                                                        
| 1559 | 1559 | $key = substr($key, 1);  | 
                                                        
| 1560 | 1560 | } // remove # for QuickEdit format  | 
                                                        
@@ -1584,8 +1584,8 @@ discard block  | 
                                                    ||
| 1584 | 1584 | |
| 1585 | 1585 |              if (strpos($content, $s) !== false) { | 
                                                        
| 1586 | 1586 | $content = str_replace($s, $value, $content);  | 
                                                        
| 1587 | -            } elseif($this->debug) { | 
                                                        |
| 1588 | -                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); | 
                                                        |
| 1587 | +            } elseif ($this->debug) { | 
                                                        |
| 1588 | +                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); | 
                                                        |
| 1589 | 1589 | }  | 
                                                        
| 1590 | 1590 | }  | 
                                                        
| 1591 | 1591 | |
@@ -1752,8 +1752,8 @@ discard block  | 
                                                    ||
| 1752 | 1752 | $s = &$matches[0][$i];  | 
                                                        
| 1753 | 1753 |              if (strpos($content, $s) !== false) { | 
                                                        
| 1754 | 1754 | $content = str_replace($s, $value, $content);  | 
                                                        
| 1755 | -            } elseif($this->debug) { | 
                                                        |
| 1756 | -                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); | 
                                                        |
| 1755 | +            } elseif ($this->debug) { | 
                                                        |
| 1756 | +                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); | 
                                                        |
| 1757 | 1757 | }  | 
                                                        
| 1758 | 1758 | }  | 
                                                        
| 1759 | 1759 | return $content;  | 
                                                        
@@ -1806,7 +1806,7 @@ discard block  | 
                                                    ||
| 1806 | 1806 | }  | 
                                                        
| 1807 | 1807 | |
| 1808 | 1808 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags  | 
                                                        
| 1809 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers  | 
                                                        |
| 1809 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers  | 
                                                        |
| 1810 | 1810 |              if ($this->config['enable_at_syntax']) { | 
                                                        
| 1811 | 1811 | $value = $this->mergeConditionalTagsContent($value);  | 
                                                        
| 1812 | 1812 | }  | 
                                                        
@@ -1821,8 +1821,8 @@ discard block  | 
                                                    ||
| 1821 | 1821 | $s = &$matches[0][$i];  | 
                                                        
| 1822 | 1822 |              if (strpos($content, $s) !== false) { | 
                                                        
| 1823 | 1823 | $content = str_replace($s, $value, $content);  | 
                                                        
| 1824 | -            } elseif($this->debug) { | 
                                                        |
| 1825 | -                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); | 
                                                        |
| 1824 | +            } elseif ($this->debug) { | 
                                                        |
| 1825 | +                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); | 
                                                        |
| 1826 | 1826 | }  | 
                                                        
| 1827 | 1827 | }  | 
                                                        
| 1828 | 1828 | return $content;  | 
                                                        
@@ -1880,8 +1880,8 @@ discard block  | 
                                                    ||
| 1880 | 1880 | $s = &$matches[0][$i];  | 
                                                        
| 1881 | 1881 |              if (strpos($content, $s) !== false) { | 
                                                        
| 1882 | 1882 | $content = str_replace($s, $value, $content);  | 
                                                        
| 1883 | -            } elseif($this->debug) { | 
                                                        |
| 1884 | -                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); | 
                                                        |
| 1883 | +            } elseif ($this->debug) { | 
                                                        |
| 1884 | +                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); | 
                                                        |
| 1885 | 1885 | }  | 
                                                        
| 1886 | 1886 | }  | 
                                                        
| 1887 | 1887 | return $content;  | 
                                                        
@@ -1905,7 +1905,7 @@ discard block  | 
                                                    ||
| 1905 | 1905 | return $content;  | 
                                                        
| 1906 | 1906 | }  | 
                                                        
| 1907 | 1907 | |
| 1908 | -        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; | 
                                                        |
| 1908 | +        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; | 
                                                        |
| 1909 | 1909 |          $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); | 
                                                        
| 1910 | 1910 | |
| 1911 | 1911 |          $pieces = explode('<@IF:', $content); | 
                                                        
@@ -1916,7 +1916,7 @@ discard block  | 
                                                    ||
| 1916 | 1916 | }  | 
                                                        
| 1917 | 1917 |              list($cmd, $text) = explode('>', $split, 2); | 
                                                        
| 1918 | 1918 |              $cmd = str_replace("'", "\'", $cmd); | 
                                                        
| 1919 | -            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; | 
                                                        |
| 1919 | +            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; | 
                                                        |
| 1920 | 1920 | $content .= $text;  | 
                                                        
| 1921 | 1921 | }  | 
                                                        
| 1922 | 1922 |          $pieces = explode('<@ELSEIF:', $content); | 
                                                        
@@ -1927,13 +1927,13 @@ discard block  | 
                                                    ||
| 1927 | 1927 | }  | 
                                                        
| 1928 | 1928 |              list($cmd, $text) = explode('>', $split, 2); | 
                                                        
| 1929 | 1929 |              $cmd = str_replace("'", "\'", $cmd); | 
                                                        
| 1930 | -            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; | 
                                                        |
| 1930 | +            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; | 
                                                        |
| 1931 | 1931 | $content .= $text;  | 
                                                        
| 1932 | 1932 | }  | 
                                                        
| 1933 | 1933 | |
| 1934 | 1934 |          $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); | 
                                                        
| 1935 | 1935 | ob_start();  | 
                                                        
| 1936 | -        $content = eval('?>' . $content); | 
                                                        |
| 1936 | +        $content = eval('?>'.$content); | 
                                                        |
| 1937 | 1937 | $content = ob_get_clean();  | 
                                                        
| 1938 | 1938 |          $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); | 
                                                        
| 1939 | 1939 | |
@@ -2058,7 +2058,7 @@ discard block  | 
                                                    ||
| 2058 | 2058 | $matches = $this->getTagsFromContent($content, $left, $right);  | 
                                                        
| 2059 | 2059 |          if (!empty($matches)) { | 
                                                        
| 2060 | 2060 |              foreach ($matches[0] as $i => $v) { | 
                                                        
| 2061 | - $addBreakMatches[$i] = $v . "\n";  | 
                                                        |
| 2061 | + $addBreakMatches[$i] = $v."\n";  | 
                                                        |
| 2062 | 2062 | }  | 
                                                        
| 2063 | 2063 | $content = str_replace($addBreakMatches, '', $content);  | 
                                                        
| 2064 | 2064 |              if (strpos($content, $left) !== false) { | 
                                                        
@@ -2091,8 +2091,8 @@ discard block  | 
                                                    ||
| 2091 | 2091 | $s = &$matches[0][$i];  | 
                                                        
| 2092 | 2092 |              if (strpos($content, $s) !== false) { | 
                                                        
| 2093 | 2093 | $content = str_replace($s, $v, $content);  | 
                                                        
| 2094 | -            } elseif($this->debug) { | 
                                                        |
| 2095 | -                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); | 
                                                        |
| 2094 | +            } elseif ($this->debug) { | 
                                                        |
| 2095 | +                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); | 
                                                        |
| 2096 | 2096 | }  | 
                                                        
| 2097 | 2097 | }  | 
                                                        
| 2098 | 2098 | return $content;  | 
                                                        
@@ -2156,7 +2156,7 @@ discard block  | 
                                                    ||
| 2156 | 2156 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;  | 
                                                        
| 2157 | 2157 |                  $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); | 
                                                        
| 2158 | 2158 |                  if ($this->isBackend()) { | 
                                                        
| 2159 | -                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); | 
                                                        |
| 2159 | +                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); | 
                                                        |
| 2160 | 2160 | }  | 
                                                        
| 2161 | 2161 | }  | 
                                                        
| 2162 | 2162 |          } else { | 
                                                        
@@ -2205,7 +2205,7 @@ discard block  | 
                                                    ||
| 2205 | 2205 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;  | 
                                                        
| 2206 | 2206 |                  $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); | 
                                                        
| 2207 | 2207 |                  if ($this->isBackend()) { | 
                                                        
| 2208 | -                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); | 
                                                        |
| 2208 | +                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); | 
                                                        |
| 2209 | 2209 | }  | 
                                                        
| 2210 | 2210 | }  | 
                                                        
| 2211 | 2211 | }  | 
                                                        
@@ -2213,7 +2213,7 @@ discard block  | 
                                                    ||
| 2213 | 2213 |          if (is_array($return) || is_object($return)) { | 
                                                        
| 2214 | 2214 | return $return;  | 
                                                        
| 2215 | 2215 |          } else { | 
                                                        
| 2216 | - return $echo . $return;  | 
                                                        |
| 2216 | + return $echo.$return;  | 
                                                        |
| 2217 | 2217 | }  | 
                                                        
| 2218 | 2218 | }  | 
                                                        
| 2219 | 2219 | |
@@ -2251,8 +2251,8 @@ discard block  | 
                                                    ||
| 2251 | 2251 | }  | 
                                                        
| 2252 | 2252 |                  if (strpos($content, $s) !== false) { | 
                                                        
| 2253 | 2253 | $content = str_replace($s, $value, $content);  | 
                                                        
| 2254 | -                } elseif($this->debug) { | 
                                                        |
| 2255 | -                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); | 
                                                        |
| 2254 | +                } elseif ($this->debug) { | 
                                                        |
| 2255 | +                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); | 
                                                        |
| 2256 | 2256 | }  | 
                                                        
| 2257 | 2257 | continue;  | 
                                                        
| 2258 | 2258 | }  | 
                                                        
@@ -2263,8 +2263,8 @@ discard block  | 
                                                    ||
| 2263 | 2263 | |
| 2264 | 2264 |              if (strpos($content, $s) !== false) { | 
                                                        
| 2265 | 2265 | $content = str_replace($s, $value, $content);  | 
                                                        
| 2266 | -            } elseif($this->debug) { | 
                                                        |
| 2267 | -                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); | 
                                                        |
| 2266 | +            } elseif ($this->debug) { | 
                                                        |
| 2267 | +                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); | 
                                                        |
| 2268 | 2268 | }  | 
                                                        
| 2269 | 2269 | }  | 
                                                        
| 2270 | 2270 | |
@@ -2355,7 +2355,7 @@ discard block  | 
                                                    ||
| 2355 | 2355 |              $eventtime = sprintf('%2.2f ms', $eventtime * 1000); | 
                                                        
| 2356 | 2356 |              $code = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars($value)); | 
                                                        
| 2357 | 2357 |              $piece = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars($piece)); | 
                                                        
| 2358 | -            $print_r_params = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); | 
                                                        |
| 2358 | +            $print_r_params = str_replace("\t", '  ', $this->getPhpCompat()->htmlspecialchars('$modx->event->params = '.print_r($params, true))); | 
                                                        |
| 2359 | 2359 |              $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); | 
                                                        
| 2360 | 2360 |              $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); | 
                                                        
| 2361 | 2361 | }  | 
                                                        
@@ -2604,7 +2604,7 @@ discard block  | 
                                                    ||
| 2604 | 2604 | );  | 
                                                        
| 2605 | 2605 | $count = $this->getDatabase()->getRecordCount($rs);  | 
                                                        
| 2606 | 2606 |              if (1 < $count) { | 
                                                        
| 2607 | -                exit('Error $modx->_getSnippetObject()' . $snip_name); | 
                                                        |
| 2607 | +                exit('Error $modx->_getSnippetObject()'.$snip_name); | 
                                                        |
| 2608 | 2608 | }  | 
                                                        
| 2609 | 2609 |              if ($count) { | 
                                                        
| 2610 | 2610 | $row = $this->getDatabase()->getRow($rs);  | 
                                                        
@@ -2630,7 +2630,7 @@ discard block  | 
                                                    ||
| 2630 | 2630 | public function toAlias($text)  | 
                                                        
| 2631 | 2631 |      { | 
                                                        
| 2632 | 2632 | $suff = $this->config['friendly_url_suffix'];  | 
                                                        
| 2633 | -        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); | 
                                                        |
| 2633 | +        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); | 
                                                        |
| 2634 | 2634 | }  | 
                                                        
| 2635 | 2635 | |
| 2636 | 2636 | /**  | 
                                                        
@@ -2662,7 +2662,7 @@ discard block  | 
                                                    ||
| 2662 | 2662 | $suff = '/';  | 
                                                        
| 2663 | 2663 | }  | 
                                                        
| 2664 | 2664 | |
| 2665 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;  | 
                                                        |
| 2665 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;  | 
                                                        |
| 2666 | 2666 | }  | 
                                                        
| 2667 | 2667 | |
| 2668 | 2668 |          $evtOut = $this->invokeEvent('OnMakeDocUrl', array( | 
                                                        
@@ -2699,7 +2699,7 @@ discard block  | 
                                                    ||
| 2699 | 2699 |                  preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); | 
                                                        
| 2700 | 2700 |                  $ids = implode(',', array_unique($match['1'])); | 
                                                        
| 2701 | 2701 |                  if ($ids) { | 
                                                        
| 2702 | -                    $res = $this->getDatabase()->select("id,alias,isfolder,parent,alias_visible", $this->getDatabase()->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); | 
                                                        |
| 2702 | +                    $res = $this->getDatabase()->select("id,alias,isfolder,parent,alias_visible", $this->getDatabase()->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); | 
                                                        |
| 2703 | 2703 |                      while ($row = $this->getDatabase()->getRow($res)) { | 
                                                        
| 2704 | 2704 |                          if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { | 
                                                        
| 2705 | 2705 | $parent = $row['parent'];  | 
                                                        
@@ -2710,7 +2710,7 @@ discard block  | 
                                                    ||
| 2710 | 2710 | $parent = $this->aliasListing[$parent]['parent'];  | 
                                                        
| 2711 | 2711 | }  | 
                                                        
| 2712 | 2712 | |
| 2713 | - $aliases[$row['id']] = $path . '/' . $row['alias'];  | 
                                                        |
| 2713 | + $aliases[$row['id']] = $path.'/'.$row['alias'];  | 
                                                        |
| 2714 | 2714 |                          } else { | 
                                                        
| 2715 | 2715 | $aliases[$row['id']] = $row['alias'];  | 
                                                        
| 2716 | 2716 | }  | 
                                                        
@@ -2722,7 +2722,7 @@ discard block  | 
                                                    ||
| 2722 | 2722 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);  | 
                                                        
| 2723 | 2723 | $pref = $this->config['friendly_url_prefix'];  | 
                                                        
| 2724 | 2724 | $suff = $this->config['friendly_url_suffix'];  | 
                                                        
| 2725 | -            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { | 
                                                        |
| 2725 | +            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { | 
                                                        |
| 2726 | 2726 | global $modx;  | 
                                                        
| 2727 | 2727 | $thealias = $aliases[$m[1]];  | 
                                                        
| 2728 | 2728 | $thefolder = $isfolder[$m[1]];  | 
                                                        
@@ -2738,7 +2738,7 @@ discard block  | 
                                                    ||
| 2738 | 2738 | |
| 2739 | 2739 |          } else { | 
                                                        
| 2740 | 2740 | $in = '!\[\~([0-9]+)\~\]!is';  | 
                                                        
| 2741 | - $out = "index.php?id=" . '\1';  | 
                                                        |
| 2741 | + $out = "index.php?id=".'\1';  | 
                                                        |
| 2742 | 2742 | $documentSource = preg_replace($in, $out, $documentSource);  | 
                                                        
| 2743 | 2743 | }  | 
                                                        
| 2744 | 2744 | |
@@ -2759,7 +2759,7 @@ discard block  | 
                                                    ||
| 2759 | 2759 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';  | 
                                                        
| 2760 | 2760 | $len_base_url = strlen($this->config['base_url']);  | 
                                                        
| 2761 | 2761 | |
| 2762 | - $url_path = $q;//LANG  | 
                                                        |
| 2762 | + $url_path = $q; //LANG  | 
                                                        |
| 2763 | 2763 | |
| 2764 | 2764 |          if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { | 
                                                        
| 2765 | 2765 | $url_path = substr($url_path, $len_base_url);  | 
                                                        
@@ -2771,7 +2771,7 @@ discard block  | 
                                                    ||
| 2771 | 2771 | $strictURL = substr($strictURL, $len_base_url);  | 
                                                        
| 2772 | 2772 | }  | 
                                                        
| 2773 | 2773 | $http_host = $_SERVER['HTTP_HOST'];  | 
                                                        
| 2774 | -        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG | 
                                                        |
| 2774 | +        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG | 
                                                        |
| 2775 | 2775 | |
| 2776 | 2776 | $site_url = $this->config['site_url'];  | 
                                                        
| 2777 | 2777 |          $url_query_string = explode('?', $_SERVER['REQUEST_URI']); | 
                                                        
@@ -2789,7 +2789,7 @@ discard block  | 
                                                    ||
| 2789 | 2789 | }  | 
                                                        
| 2790 | 2790 |                  if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { | 
                                                        
| 2791 | 2791 |                      if (empty($_POST)) { | 
                                                        
| 2792 | -                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { | 
                                                        |
| 2792 | +                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { | 
                                                        |
| 2793 | 2793 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');  | 
                                                        
| 2794 | 2794 | exit(0);  | 
                                                        
| 2795 | 2795 | }  | 
                                                        
@@ -2848,7 +2848,7 @@ discard block  | 
                                                    ||
| 2848 | 2848 |                  $docgrp = implode(",", $docgrp); | 
                                                        
| 2849 | 2849 | }  | 
                                                        
| 2850 | 2850 | // get document  | 
                                                        
| 2851 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");  | 
                                                        |
| 2851 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");  | 
                                                        |
| 2852 | 2852 |              $rs = $this->getDatabase()->select('sc.*', "{$tblsc} sc | 
                                                        
| 2853 | 2853 |                  LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); | 
                                                        
| 2854 | 2854 |              if ($this->getDatabase()->getRecordCount($rs) < 1) { | 
                                                        
@@ -2884,9 +2884,9 @@ discard block  | 
                                                    ||
| 2884 | 2884 | }  | 
                                                        
| 2885 | 2885 |              if ($documentObject['template']) { | 
                                                        
| 2886 | 2886 | // load TVs and merge with document - Orig by Apodigm - Docvars  | 
                                                        
| 2887 | -                $rs = $this->getDatabase()->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getDatabase()->getFullTableName("site_tmplvars") . " tv | 
                                                        |
| 2888 | -                INNER JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id | 
                                                        |
| 2889 | -                LEFT JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); | 
                                                        |
| 2887 | +                $rs = $this->getDatabase()->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getDatabase()->getFullTableName("site_tmplvars")." tv | 
                                                        |
| 2888 | +                INNER JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id | 
                                                        |
| 2889 | +                LEFT JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); | 
                                                        |
| 2890 | 2890 | $tmplvars = array();  | 
                                                        
| 2891 | 2891 |                  while ($row = $this->getDatabase()->getRow($rs)) { | 
                                                        
| 2892 | 2892 | $tmplvars[$row['name']] = array(  | 
                                                        
@@ -2932,7 +2932,7 @@ discard block  | 
                                                    ||
| 2932 | 2932 | $st = md5($source);  | 
                                                        
| 2933 | 2933 | }  | 
                                                        
| 2934 | 2934 |              if ($this->dumpSnippets == 1) { | 
                                                        
| 2935 | - $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>";  | 
                                                        |
| 2935 | + $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>";  | 
                                                        |
| 2936 | 2936 | }  | 
                                                        
| 2937 | 2937 | |
| 2938 | 2938 | // invoke OnParseDocument event  | 
                                                        
@@ -2974,7 +2974,7 @@ discard block  | 
                                                    ||
| 2974 | 2974 | */  | 
                                                        
| 2975 | 2975 | public function executeParser()  | 
                                                        
| 2976 | 2976 |      { | 
                                                        
| 2977 | -        if(MODX_CLI) { | 
                                                        |
| 2977 | +        if (MODX_CLI) { | 
                                                        |
| 2978 | 2978 |              throw new \RuntimeException('Call DocumentParser::executeParser on CLI mode'); | 
                                                        
| 2979 | 2979 | }  | 
                                                        
| 2980 | 2980 | |
@@ -3020,7 +3020,7 @@ discard block  | 
                                                    ||
| 3020 | 3020 | |
| 3021 | 3021 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path  | 
                                                        
| 3022 | 3022 |              if ($this->config['use_alias_path'] == 1) { | 
                                                        
| 3023 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;  | 
                                                        |
| 3023 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;  | 
                                                        |
| 3024 | 3024 |                  if (isset($this->documentListing[$alias])) { | 
                                                        
| 3025 | 3025 | $this->documentIdentifier = $this->documentListing[$alias];  | 
                                                        
| 3026 | 3026 |                  } else { | 
                                                        
@@ -3081,7 +3081,7 @@ discard block  | 
                                                    ||
| 3081 | 3081 |                  } else { | 
                                                        
| 3082 | 3082 | $docAlias = $this->getDatabase()->escape($this->documentIdentifier);  | 
                                                        
| 3083 | 3083 |                      $rs = $this->getDatabase()->select('id', $this->getDatabase()->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); | 
                                                        
| 3084 | - $this->documentIdentifier = (int)$this->getDatabase()->getValue($rs);  | 
                                                        |
| 3084 | + $this->documentIdentifier = (int) $this->getDatabase()->getValue($rs);  | 
                                                        |
| 3085 | 3085 | }  | 
                                                        
| 3086 | 3086 | }  | 
                                                        
| 3087 | 3087 | $this->documentMethod = 'id';  | 
                                                        
@@ -3138,7 +3138,7 @@ discard block  | 
                                                    ||
| 3138 | 3138 | $_REQUEST[$n] = $_GET[$n] = $v;  | 
                                                        
| 3139 | 3139 | }  | 
                                                        
| 3140 | 3140 | }  | 
                                                        
| 3141 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];  | 
                                                        |
| 3141 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];  | 
                                                        |
| 3142 | 3142 | $this->q = $qp['path'];  | 
                                                        
| 3143 | 3143 | return $qp['path'];  | 
                                                        
| 3144 | 3144 | }  | 
                                                        
@@ -3288,7 +3288,7 @@ discard block  | 
                                                    ||
| 3288 | 3288 |          while ($id && $height--) { | 
                                                        
| 3289 | 3289 | $thisid = $id;  | 
                                                        
| 3290 | 3290 |              if ($this->config['aliaslistingfolder'] == 1) { | 
                                                        
| 3291 | -                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->getDatabase()->getValue("SELECT `parent` FROM " . $this->getDatabase()->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1"); | 
                                                        |
| 3291 | +                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->getDatabase()->getValue("SELECT `parent` FROM ".$this->getDatabase()->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1"); | 
                                                        |
| 3292 | 3292 |                  if (!$id || $id == '0') { | 
                                                        
| 3293 | 3293 | break;  | 
                                                        
| 3294 | 3294 | }  | 
                                                        
@@ -3339,15 +3339,15 @@ discard block  | 
                                                    ||
| 3339 | 3339 | |
| 3340 | 3340 |          if ($this->config['aliaslistingfolder'] == 1) { | 
                                                        
| 3341 | 3341 | |
| 3342 | -            $res = $this->getDatabase()->select("id,alias,isfolder,parent", $this->getDatabase()->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); | 
                                                        |
| 3342 | +            $res = $this->getDatabase()->select("id,alias,isfolder,parent", $this->getDatabase()->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); | 
                                                        |
| 3343 | 3343 | $idx = array();  | 
                                                        
| 3344 | 3344 |              while ($row = $this->getDatabase()->getRow($res)) { | 
                                                        
| 3345 | 3345 | $pAlias = '';  | 
                                                        
| 3346 | 3346 |                  if (isset($this->aliasListing[$row['parent']])) { | 
                                                        
| 3347 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';  | 
                                                        |
| 3348 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';  | 
                                                        |
| 3347 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';  | 
                                                        |
| 3348 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';  | 
                                                        |
| 3349 | 3349 | };  | 
                                                        
| 3350 | - $children[$pAlias . $row['alias']] = $row['id'];  | 
                                                        |
| 3350 | + $children[$pAlias.$row['alias']] = $row['id'];  | 
                                                        |
| 3351 | 3351 |                  if ($row['isfolder'] == 1) { | 
                                                        
| 3352 | 3352 | $idx[] = $row['id'];  | 
                                                        
| 3353 | 3353 | }  | 
                                                        
@@ -3379,7 +3379,7 @@ discard block  | 
                                                    ||
| 3379 | 3379 | $depth--;  | 
                                                        
| 3380 | 3380 | |
| 3381 | 3381 |                  foreach ($documentMap_cache[$id] as $childId) { | 
                                                        
| 3382 | -                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; | 
                                                        |
| 3382 | +                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; | 
                                                        |
| 3383 | 3383 |                      if (!strlen($pkey)) { | 
                                                        
| 3384 | 3384 |                          $pkey = "{$childId}"; | 
                                                        
| 3385 | 3385 | }  | 
                                                        
@@ -3416,7 +3416,7 @@ discard block  | 
                                                    ||
| 3416 | 3416 | $fnc = 'history.back(-1);';  | 
                                                        
| 3417 | 3417 | break;  | 
                                                        
| 3418 | 3418 | default:  | 
                                                        
| 3419 | - $fnc = "window.location.href='" . addslashes($url) . "';";  | 
                                                        |
| 3419 | + $fnc = "window.location.href='".addslashes($url)."';";  | 
                                                        |
| 3420 | 3420 | }  | 
                                                        
| 3421 | 3421 | |
| 3422 | 3422 | echo "<html><head>  | 
                                                        
@@ -3448,9 +3448,9 @@ discard block  | 
                                                    ||
| 3448 | 3448 | $state = 0;  | 
                                                        
| 3449 | 3449 | $pms = $_SESSION['mgrPermissions'];  | 
                                                        
| 3450 | 3450 |          if ($pms) { | 
                                                        
| 3451 | - $state = ((bool)$pms[$pm] === true);  | 
                                                        |
| 3451 | + $state = ((bool) $pms[$pm] === true);  | 
                                                        |
| 3452 | 3452 | }  | 
                                                        
| 3453 | - return (int)$state;  | 
                                                        |
| 3453 | + return (int) $state;  | 
                                                        |
| 3454 | 3454 | }  | 
                                                        
| 3455 | 3455 | |
| 3456 | 3456 | /**  | 
                                                        
@@ -3463,8 +3463,8 @@ discard block  | 
                                                    ||
| 3463 | 3463 | */  | 
                                                        
| 3464 | 3464 | public function elementIsLocked($type, $id, $includeThisUser = false)  | 
                                                        
| 3465 | 3465 |      { | 
                                                        
| 3466 | - $id = (int)$id;  | 
                                                        |
| 3467 | - $type = (int)$type;  | 
                                                        |
| 3466 | + $id = (int) $id;  | 
                                                        |
| 3467 | + $type = (int) $type;  | 
                                                        |
| 3468 | 3468 |          if (!$type || !$id) { | 
                                                        
| 3469 | 3469 | return null;  | 
                                                        
| 3470 | 3470 | }  | 
                                                        
@@ -3514,7 +3514,7 @@ discard block  | 
                                                    ||
| 3514 | 3514 | return $lockedElements;  | 
                                                        
| 3515 | 3515 | }  | 
                                                        
| 3516 | 3516 | |
| 3517 | - $type = (int)$type;  | 
                                                        |
| 3517 | + $type = (int) $type;  | 
                                                        |
| 3518 | 3518 |          if (isset($lockedElements[$type])) { | 
                                                        
| 3519 | 3519 | return $lockedElements[$type];  | 
                                                        
| 3520 | 3520 |          } else { | 
                                                        
@@ -3531,7 +3531,7 @@ discard block  | 
                                                    ||
| 3531 | 3531 | $this->lockedElements = array();  | 
                                                        
| 3532 | 3532 | $this->cleanupExpiredLocks();  | 
                                                        
| 3533 | 3533 | |
| 3534 | -            $rs = $this->getDatabase()->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getDatabase()->getFullTableName('active_user_locks') . " ul | 
                                                        |
| 3534 | +            $rs = $this->getDatabase()->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getDatabase()->getFullTableName('active_user_locks')." ul | 
                                                        |
| 3535 | 3535 |                  LEFT JOIN {$this->getDatabase()->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); | 
                                                        
| 3536 | 3536 |              while ($row = $this->getDatabase()->getRow($rs)) { | 
                                                        
| 3537 | 3537 | $this->lockedElements[$row['elementType']][$row['elementId']] = array(  | 
                                                        
@@ -3554,7 +3554,7 @@ discard block  | 
                                                    ||
| 3554 | 3554 | public function cleanupExpiredLocks()  | 
                                                        
| 3555 | 3555 |      { | 
                                                        
| 3556 | 3556 | // Clean-up active_user_sessions first  | 
                                                        
| 3557 | - $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  | 
                                                        |
| 3557 | + $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  | 
                                                        |
| 3558 | 3558 | $validSessionTimeLimit = $this->time - $timeout;  | 
                                                        
| 3559 | 3559 |          $this->getDatabase()->delete($this->getDatabase()->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}"); | 
                                                        
| 3560 | 3560 | |
@@ -3567,7 +3567,7 @@ discard block  | 
                                                    ||
| 3567 | 3567 |              foreach ($rs as $row) { | 
                                                        
| 3568 | 3568 | $userSids[] = $row['sid'];  | 
                                                        
| 3569 | 3569 | }  | 
                                                        
| 3570 | -            $userSids = "'" . implode("','", $userSids) . "'"; | 
                                                        |
| 3570 | +            $userSids = "'".implode("','", $userSids)."'"; | 
                                                        |
| 3571 | 3571 |              $this->getDatabase()->delete($this->getDatabase()->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); | 
                                                        
| 3572 | 3572 |          } else { | 
                                                        
| 3573 | 3573 |              $this->getDatabase()->delete($this->getDatabase()->getFullTableName('active_user_locks')); | 
                                                        
@@ -3651,8 +3651,8 @@ discard block  | 
                                                    ||
| 3651 | 3651 | public function lockElement($type, $id)  | 
                                                        
| 3652 | 3652 |      { | 
                                                        
| 3653 | 3653 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;  | 
                                                        
| 3654 | - $type = (int)$type;  | 
                                                        |
| 3655 | - $id = (int)$id;  | 
                                                        |
| 3654 | + $type = (int) $type;  | 
                                                        |
| 3655 | + $id = (int) $id;  | 
                                                        |
| 3656 | 3656 |          if (!$type || !$id || !$userId) { | 
                                                        
| 3657 | 3657 | return false;  | 
                                                        
| 3658 | 3658 | }  | 
                                                        
@@ -3673,8 +3673,8 @@ discard block  | 
                                                    ||
| 3673 | 3673 | public function unlockElement($type, $id, $includeAllUsers = false)  | 
                                                        
| 3674 | 3674 |      { | 
                                                        
| 3675 | 3675 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;  | 
                                                        
| 3676 | - $type = (int)$type;  | 
                                                        |
| 3677 | - $id = (int)$id;  | 
                                                        |
| 3676 | + $type = (int) $type;  | 
                                                        |
| 3677 | + $id = (int) $id;  | 
                                                        |
| 3678 | 3678 |          if (!$type || !$id) { | 
                                                        
| 3679 | 3679 | return false;  | 
                                                        
| 3680 | 3680 | }  | 
                                                        
@@ -3741,8 +3741,8 @@ discard block  | 
                                                    ||
| 3741 | 3741 | }  | 
                                                        
| 3742 | 3742 | |
| 3743 | 3743 | $usertype = $this->isFrontend() ? 1 : 0;  | 
                                                        
| 3744 | - $evtid = (int)$evtid;  | 
                                                        |
| 3745 | - $type = (int)$type;  | 
                                                        |
| 3744 | + $evtid = (int) $evtid;  | 
                                                        |
| 3745 | + $type = (int) $type;  | 
                                                        |
| 3746 | 3746 | |
| 3747 | 3747 | // Types: 1 = information, 2 = warning, 3 = error  | 
                                                        
| 3748 | 3748 |          if ($type < 1) { | 
                                                        
@@ -3764,8 +3764,8 @@ discard block  | 
                                                    ||
| 3764 | 3764 |          if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { | 
                                                        
| 3765 | 3765 |              if ($this->config['send_errormail'] <= $type) { | 
                                                        
| 3766 | 3766 | $this->sendmail(array(  | 
                                                        
| 3767 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'],  | 
                                                        |
| 3768 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',  | 
                                                        |
| 3767 | + 'subject' => 'MODX System Error on '.$this->config['site_name'],  | 
                                                        |
| 3768 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',  | 
                                                        |
| 3769 | 3769 | 'type' => 'text'  | 
                                                        
| 3770 | 3770 | ));  | 
                                                        
| 3771 | 3771 | }  | 
                                                        
@@ -3814,7 +3814,7 @@ discard block  | 
                                                    ||
| 3814 | 3814 | $p['fromname'] = $userinfo['username'];  | 
                                                        
| 3815 | 3815 | }  | 
                                                        
| 3816 | 3816 |          if ($msg === '' && !isset($p['body'])) { | 
                                                        
| 3817 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];  | 
                                                        |
| 3817 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];  | 
                                                        |
| 3818 | 3818 |          } elseif (is_string($msg) && 0 < strlen($msg)) { | 
                                                        
| 3819 | 3819 | $p['body'] = $msg;  | 
                                                        
| 3820 | 3820 | }  | 
                                                        
@@ -3855,8 +3855,8 @@ discard block  | 
                                                    ||
| 3855 | 3855 | $files = array();  | 
                                                        
| 3856 | 3856 | }  | 
                                                        
| 3857 | 3857 |          foreach ($files as $f) { | 
                                                        
| 3858 | -            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { | 
                                                        |
| 3859 | - $this->getMail()->AddAttachment(MODX_BASE_PATH . $f);  | 
                                                        |
| 3858 | +            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { | 
                                                        |
| 3859 | + $this->getMail()->AddAttachment(MODX_BASE_PATH.$f);  | 
                                                        |
| 3860 | 3860 | }  | 
                                                        
| 3861 | 3861 | }  | 
                                                        
| 3862 | 3862 | return $this->getMail()->send();  | 
                                                        
@@ -3900,7 +3900,7 @@ discard block  | 
                                                    ||
| 3900 | 3900 | */  | 
                                                        
| 3901 | 3901 | public function isFrontend()  | 
                                                        
| 3902 | 3902 |      { | 
                                                        
| 3903 | - return ! $this->isBackend();  | 
                                                        |
| 3903 | + return !$this->isBackend();  | 
                                                        |
| 3904 | 3904 | }  | 
                                                        
| 3905 | 3905 | |
| 3906 | 3906 | /**  | 
                                                        
@@ -3925,14 +3925,14 @@ discard block  | 
                                                    ||
| 3925 | 3925 |          $tblsc = $this->getDatabase()->getFullTableName("site_content"); | 
                                                        
| 3926 | 3926 |          $tbldg = $this->getDatabase()->getFullTableName("document_groups"); | 
                                                        
| 3927 | 3927 | // modify field names to use sc. table reference  | 
                                                        
| 3928 | -        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); | 
                                                        |
| 3929 | -        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); | 
                                                        |
| 3928 | +        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); | 
                                                        |
| 3929 | +        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); | 
                                                        |
| 3930 | 3930 | // get document groups for current user  | 
                                                        
| 3931 | 3931 |          if ($docgrp = $this->getUserDocGroups()) { | 
                                                        
| 3932 | 3932 |              $docgrp = implode(",", $docgrp); | 
                                                        
| 3933 | 3933 | }  | 
                                                        
| 3934 | 3934 | // build query  | 
                                                        
| 3935 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");  | 
                                                        |
| 3935 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");  | 
                                                        |
| 3936 | 3936 |          $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc | 
                                                        
| 3937 | 3937 |                  LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); | 
                                                        
| 3938 | 3938 | $resourceArray = $this->getDatabase()->makeArray($result);  | 
                                                        
@@ -3962,14 +3962,14 @@ discard block  | 
                                                    ||
| 3962 | 3962 |          $tbldg = $this->getDatabase()->getFullTableName("document_groups"); | 
                                                        
| 3963 | 3963 | |
| 3964 | 3964 | // modify field names to use sc. table reference  | 
                                                        
| 3965 | -        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); | 
                                                        |
| 3966 | -        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); | 
                                                        |
| 3965 | +        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); | 
                                                        |
| 3966 | +        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); | 
                                                        |
| 3967 | 3967 | // get document groups for current user  | 
                                                        
| 3968 | 3968 |          if ($docgrp = $this->getUserDocGroups()) { | 
                                                        
| 3969 | 3969 |              $docgrp = implode(",", $docgrp); | 
                                                        
| 3970 | 3970 | }  | 
                                                        
| 3971 | 3971 | // build query  | 
                                                        
| 3972 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");  | 
                                                        |
| 3972 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");  | 
                                                        |
| 3973 | 3973 |          $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc | 
                                                        
| 3974 | 3974 |                  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}"); | 
                                                        
| 3975 | 3975 | $resourceArray = $this->getDatabase()->makeArray($result);  | 
                                                        
@@ -4004,16 +4004,16 @@ discard block  | 
                                                    ||
| 4004 | 4004 | return $this->tmpCache[__FUNCTION__][$cacheKey];  | 
                                                        
| 4005 | 4005 | }  | 
                                                        
| 4006 | 4006 | |
| 4007 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';  | 
                                                        |
| 4008 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';  | 
                                                        |
| 4007 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';  | 
                                                        |
| 4008 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';  | 
                                                        |
| 4009 | 4009 | |
| 4010 | 4010 |          if ($where != '') { | 
                                                        
| 4011 | - $where = 'AND ' . $where;  | 
                                                        |
| 4011 | + $where = 'AND '.$where;  | 
                                                        |
| 4012 | 4012 | }  | 
                                                        
| 4013 | 4013 | |
| 4014 | 4014 | // modify field names to use sc. table reference  | 
                                                        
| 4015 | -        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); | 
                                                        |
| 4016 | -        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); | 
                                                        |
| 4015 | +        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); | 
                                                        |
| 4016 | +        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); | 
                                                        |
| 4017 | 4017 | |
| 4018 | 4018 | // get document groups for current user  | 
                                                        
| 4019 | 4019 |          if ($docgrp = $this->getUserDocGroups()) { | 
                                                        
@@ -4021,7 +4021,7 @@ discard block  | 
                                                    ||
| 4021 | 4021 | }  | 
                                                        
| 4022 | 4022 | |
| 4023 | 4023 | // build query  | 
                                                        
| 4024 | -        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); | 
                                                        |
| 4024 | +        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); | 
                                                        |
| 4025 | 4025 | |
| 4026 | 4026 |          $tblsc = $this->getDatabase()->getFullTableName('site_content'); | 
                                                        
| 4027 | 4027 |          $tbldg = $this->getDatabase()->getFullTableName('document_groups'); | 
                                                        
@@ -4073,10 +4073,10 @@ discard block  | 
                                                    ||
| 4073 | 4073 | return false;  | 
                                                        
| 4074 | 4074 |          } else { | 
                                                        
| 4075 | 4075 | // modify field names to use sc. table reference  | 
                                                        
| 4076 | -            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); | 
                                                        |
| 4077 | -            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); | 
                                                        |
| 4076 | +            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); | 
                                                        |
| 4077 | +            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); | 
                                                        |
| 4078 | 4078 |              if ($where != '') { | 
                                                        
| 4079 | - $where = 'AND ' . $where;  | 
                                                        |
| 4079 | + $where = 'AND '.$where;  | 
                                                        |
| 4080 | 4080 | }  | 
                                                        
| 4081 | 4081 | |
| 4082 | 4082 |              $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; | 
                                                        
@@ -4087,13 +4087,13 @@ discard block  | 
                                                    ||
| 4087 | 4087 |                  $docgrp = implode(',', $docgrp); | 
                                                        
| 4088 | 4088 | }  | 
                                                        
| 4089 | 4089 | |
| 4090 | -            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); | 
                                                        |
| 4090 | +            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); | 
                                                        |
| 4091 | 4091 | |
| 4092 | 4092 |              $tblsc = $this->getDatabase()->getFullTableName('site_content'); | 
                                                        
| 4093 | 4093 |              $tbldg = $this->getDatabase()->getFullTableName('document_groups'); | 
                                                        
| 4094 | 4094 | |
| 4095 | 4095 |              $result = $this->getDatabase()->select("DISTINCT {$fields}", "{$tblsc} sc | 
                                                        
| 4096 | -                    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); | 
                                                        |
| 4096 | +                    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); | 
                                                        |
| 4097 | 4097 | |
| 4098 | 4098 | $resourceArray = $this->getDatabase()->makeArray($result);  | 
                                                        
| 4099 | 4099 | |
@@ -4198,12 +4198,12 @@ discard block  | 
                                                    ||
| 4198 | 4198 |              $tbldg = $this->getDatabase()->getFullTableName("document_groups"); | 
                                                        
| 4199 | 4199 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";  | 
                                                        
| 4200 | 4200 | // modify field names to use sc. table reference  | 
                                                        
| 4201 | -            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); | 
                                                        |
| 4201 | +            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); | 
                                                        |
| 4202 | 4202 | // get document groups for current user  | 
                                                        
| 4203 | 4203 |              if ($docgrp = $this->getUserDocGroups()) { | 
                                                        
| 4204 | 4204 |                  $docgrp = implode(",", $docgrp); | 
                                                        
| 4205 | 4205 | }  | 
                                                        
| 4206 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");  | 
                                                        |
| 4206 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");  | 
                                                        |
| 4207 | 4207 |              $result = $this->getDatabase()->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); | 
                                                        
| 4208 | 4208 | $pageInfo = $this->getDatabase()->getRow($result);  | 
                                                        
| 4209 | 4209 | |
@@ -4250,7 +4250,7 @@ discard block  | 
                                                    ||
| 4250 | 4250 |      { | 
                                                        
| 4251 | 4251 |          if ($this->currentSnippet) { | 
                                                        
| 4252 | 4252 |              $tbl = $this->getDatabase()->getFullTableName("site_snippets"); | 
                                                        
| 4253 | -            $rs = $this->getDatabase()->select('id', $tbl, "name='" . $this->getDatabase()->escape($this->currentSnippet) . "'", '', 1); | 
                                                        |
| 4253 | +            $rs = $this->getDatabase()->select('id', $tbl, "name='".$this->getDatabase()->escape($this->currentSnippet)."'", '', 1); | 
                                                        |
| 4254 | 4254 |              if ($snippetId = $this->getDatabase()->getValue($rs)) { | 
                                                        
| 4255 | 4255 | return $snippetId;  | 
                                                        
| 4256 | 4256 | }  | 
                                                        
@@ -4277,7 +4277,7 @@ discard block  | 
                                                    ||
| 4277 | 4277 | */  | 
                                                        
| 4278 | 4278 | public function clearCache($type = '', $report = false)  | 
                                                        
| 4279 | 4279 |      { | 
                                                        
| 4280 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();  | 
                                                        |
| 4280 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();  | 
                                                        |
| 4281 | 4281 |          if (is_array($type)) { | 
                                                        
| 4282 | 4282 |              foreach ($type as $_) { | 
                                                        
| 4283 | 4283 | $this->clearCache($_, $report);  | 
                                                        
@@ -4289,10 +4289,10 @@ discard block  | 
                                                    ||
| 4289 | 4289 | $sync->emptyCache();  | 
                                                        
| 4290 | 4290 |          } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { | 
                                                        
| 4291 | 4291 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;  | 
                                                        
| 4292 | - $file_name = "docid_" . $key . "_*.pageCache.php";  | 
                                                        |
| 4293 | - $cache_path = $cache_dir . $file_name;  | 
                                                        |
| 4292 | + $file_name = "docid_".$key."_*.pageCache.php";  | 
                                                        |
| 4293 | + $cache_path = $cache_dir.$file_name;  | 
                                                        |
| 4294 | 4294 | $files = glob($cache_path);  | 
                                                        
| 4295 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";  | 
                                                        |
| 4295 | + $files[] = $cache_dir."docid_".$key.".pageCache.php";  | 
                                                        |
| 4296 | 4296 |              foreach ($files as $file) { | 
                                                        
| 4297 | 4297 |                  if (!is_file($file)) { | 
                                                        
| 4298 | 4298 | continue;  | 
                                                        
@@ -4300,7 +4300,7 @@ discard block  | 
                                                    ||
| 4300 | 4300 | unlink($file);  | 
                                                        
| 4301 | 4301 | }  | 
                                                        
| 4302 | 4302 |          } else { | 
                                                        
| 4303 | - $files = glob($cache_dir . '*');  | 
                                                        |
| 4303 | + $files = glob($cache_dir.'*');  | 
                                                        |
| 4304 | 4304 |              foreach ($files as $file) { | 
                                                        
| 4305 | 4305 | $name = basename($file);  | 
                                                        
| 4306 | 4306 |                  if (strpos($name, '.pageCache.php') === false) { | 
                                                        
@@ -4369,7 +4369,7 @@ discard block  | 
                                                    ||
| 4369 | 4369 | $f_url_suffix = '/';  | 
                                                        
| 4370 | 4370 | }  | 
                                                        
| 4371 | 4371 | |
| 4372 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : '';  | 
                                                        |
| 4372 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : '';  | 
                                                        |
| 4373 | 4373 | |
| 4374 | 4374 |                      if ($al && $al['alias']) { | 
                                                        
| 4375 | 4375 | $alias = $al['alias'];  | 
                                                        
@@ -4377,7 +4377,7 @@ discard block  | 
                                                    ||
| 4377 | 4377 | |
| 4378 | 4378 | }  | 
                                                        
| 4379 | 4379 | |
| 4380 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;  | 
                                                        |
| 4380 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;  | 
                                                        |
| 4381 | 4381 |                  $url = "{$alias}{$args}"; | 
                                                        
| 4382 | 4382 |              } else { | 
                                                        
| 4383 | 4383 |                  $url = "index.php?id={$id}{$args}"; | 
                                                        
@@ -4396,7 +4396,7 @@ discard block  | 
                                                    ||
| 4396 | 4396 | }  | 
                                                        
| 4397 | 4397 | |
| 4398 | 4398 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)  | 
                                                        
| 4399 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;  | 
                                                        |
| 4399 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;  | 
                                                        |
| 4400 | 4400 | }  | 
                                                        
| 4401 | 4401 | |
| 4402 | 4402 | //fix strictUrl by Bumkaka  | 
                                                        
@@ -4405,9 +4405,9 @@ discard block  | 
                                                    ||
| 4405 | 4405 | }  | 
                                                        
| 4406 | 4406 | |
| 4407 | 4407 |          if ($this->config['xhtml_urls']) { | 
                                                        
| 4408 | -            $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); | 
                                                        |
| 4408 | +            $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); | 
                                                        |
| 4409 | 4409 |          } else { | 
                                                        
| 4410 | - $url = $host . $virtualDir . $url;  | 
                                                        |
| 4410 | + $url = $host.$virtualDir.$url;  | 
                                                        |
| 4411 | 4411 | }  | 
                                                        
| 4412 | 4412 | |
| 4413 | 4413 |          $evtOut = $this->invokeEvent('OnMakeDocUrl', array( | 
                                                        
@@ -4431,21 +4431,21 @@ discard block  | 
                                                    ||
| 4431 | 4431 |          if (isset($this->aliasListing[$id])) { | 
                                                        
| 4432 | 4432 | $out = $this->aliasListing[$id];  | 
                                                        
| 4433 | 4433 |          } else { | 
                                                        
| 4434 | -            $q = $this->getDatabase()->query("SELECT id,alias,isfolder,parent FROM " . $this->getDatabase()->getFullTableName("site_content") . " WHERE id=" . (int)$id); | 
                                                        |
| 4434 | +            $q = $this->getDatabase()->query("SELECT id,alias,isfolder,parent FROM ".$this->getDatabase()->getFullTableName("site_content")." WHERE id=".(int) $id); | 
                                                        |
| 4435 | 4435 |              if ($this->getDatabase()->getRecordCount($q) == '1') { | 
                                                        
| 4436 | 4436 | $q = $this->getDatabase()->getRow($q);  | 
                                                        
| 4437 | 4437 | $this->aliasListing[$id] = array(  | 
                                                        
| 4438 | - 'id' => (int)$q['id'],  | 
                                                        |
| 4438 | + 'id' => (int) $q['id'],  | 
                                                        |
| 4439 | 4439 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],  | 
                                                        
| 4440 | - 'parent' => (int)$q['parent'],  | 
                                                        |
| 4441 | - 'isfolder' => (int)$q['isfolder'],  | 
                                                        |
| 4440 | + 'parent' => (int) $q['parent'],  | 
                                                        |
| 4441 | + 'isfolder' => (int) $q['isfolder'],  | 
                                                        |
| 4442 | 4442 | );  | 
                                                        
| 4443 | 4443 |                  if ($this->aliasListing[$id]['parent'] > 0) { | 
                                                        
| 4444 | 4444 | //fix alias_path_usage  | 
                                                        
| 4445 | 4445 |                      if ($this->config['use_alias_path'] == '1') { | 
                                                        
| 4446 | 4446 | //&& $tmp['path'] != '' - fix error slash with epty path  | 
                                                        
| 4447 | 4447 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);  | 
                                                        
| 4448 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');  | 
                                                        |
| 4448 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');  | 
                                                        |
| 4449 | 4449 |                      } else { | 
                                                        
| 4450 | 4450 | $this->aliasListing[$id]['path'] = '';  | 
                                                        
| 4451 | 4451 | }  | 
                                                        
@@ -4483,7 +4483,7 @@ discard block  | 
                                                    ||
| 4483 | 4483 | $out = array();  | 
                                                        
| 4484 | 4484 |          if (empty($this->version) || !is_array($this->version)) { | 
                                                        
| 4485 | 4485 | //include for compatibility modx version < 1.0.10  | 
                                                        
| 4486 | - include MODX_MANAGER_PATH . "includes/version.inc.php";  | 
                                                        |
| 4486 | + include MODX_MANAGER_PATH."includes/version.inc.php";  | 
                                                        |
| 4487 | 4487 | $this->version = array();  | 
                                                        
| 4488 | 4488 | $this->version['version'] = isset($modx_version) ? $modx_version : '';  | 
                                                        
| 4489 | 4489 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';  | 
                                                        
@@ -4505,18 +4505,18 @@ discard block  | 
                                                    ||
| 4505 | 4505 |      { | 
                                                        
| 4506 | 4506 |          if (isset ($this->snippetCache[$snippetName])) { | 
                                                        
| 4507 | 4507 | $snippet = $this->snippetCache[$snippetName];  | 
                                                        
| 4508 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';  | 
                                                        |
| 4508 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';  | 
                                                        |
| 4509 | 4509 |          } else { // not in cache so let's check the db | 
                                                        
| 4510 | -            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getDatabase()->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getDatabase()->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->getDatabase()->escape($snippetName) . "'  AND ss.disabled=0;"; | 
                                                        |
| 4510 | +            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getDatabase()->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getDatabase()->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->getDatabase()->escape($snippetName)."'  AND ss.disabled=0;"; | 
                                                        |
| 4511 | 4511 | $result = $this->getDatabase()->query($sql);  | 
                                                        
| 4512 | 4512 |              if ($this->getDatabase()->getRecordCount($result) == 1) { | 
                                                        
| 4513 | 4513 | $row = $this->getDatabase()->getRow($result);  | 
                                                        
| 4514 | 4514 | $snippet = $this->snippetCache[$snippetName] = $row['snippet'];  | 
                                                        
| 4515 | 4515 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));  | 
                                                        
| 4516 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);  | 
                                                        |
| 4516 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);  | 
                                                        |
| 4517 | 4517 |              } else { | 
                                                        
| 4518 | 4518 | $snippet = $this->snippetCache[$snippetName] = "return false;";  | 
                                                        
| 4519 | - $properties = $this->snippetCache[$snippetName . "Props"] = '';  | 
                                                        |
| 4519 | + $properties = $this->snippetCache[$snippetName."Props"] = '';  | 
                                                        |
| 4520 | 4520 | }  | 
                                                        
| 4521 | 4521 | }  | 
                                                        
| 4522 | 4522 | // load default params/properties  | 
                                                        
@@ -4620,8 +4620,8 @@ discard block  | 
                                                    ||
| 4620 | 4620 | }  | 
                                                        
| 4621 | 4621 |              if (strpos($tpl, $s) !== false) { | 
                                                        
| 4622 | 4622 | $tpl = str_replace($s, $value, $tpl);  | 
                                                        
| 4623 | -            } elseif($this->debug) { | 
                                                        |
| 4624 | -                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); | 
                                                        |
| 4623 | +            } elseif ($this->debug) { | 
                                                        |
| 4624 | +                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); | 
                                                        |
| 4625 | 4625 | }  | 
                                                        
| 4626 | 4626 | }  | 
                                                        
| 4627 | 4627 | |
@@ -4671,7 +4671,7 @@ discard block  | 
                                                    ||
| 4671 | 4671 | case 'CODE':  | 
                                                        
| 4672 | 4672 | break;  | 
                                                        
| 4673 | 4673 | case 'FILE':  | 
                                                        
| 4674 | - $template = file_get_contents(MODX_BASE_PATH . $template);  | 
                                                        |
| 4674 | + $template = file_get_contents(MODX_BASE_PATH.$template);  | 
                                                        |
| 4675 | 4675 | break;  | 
                                                        
| 4676 | 4676 | case 'CHUNK':  | 
                                                        
| 4677 | 4677 | $template = $this->getChunk($template);  | 
                                                        
@@ -4704,7 +4704,7 @@ discard block  | 
                                                    ||
| 4704 | 4704 |          if ($mode !== 'formatOnly' && empty($timestamp)) { | 
                                                        
| 4705 | 4705 | return '-';  | 
                                                        
| 4706 | 4706 | }  | 
                                                        
| 4707 | - $timestamp = (int)$timestamp;  | 
                                                        |
| 4707 | + $timestamp = (int) $timestamp;  | 
                                                        |
| 4708 | 4708 | |
| 4709 | 4709 |          switch ($this->config['datetime_format']) { | 
                                                        
| 4710 | 4710 | case 'YYYY/mm/dd':  | 
                                                        
@@ -4724,7 +4724,7 @@ discard block  | 
                                                    ||
| 4724 | 4724 | }  | 
                                                        
| 4725 | 4725 | |
| 4726 | 4726 |          if (empty($mode)) { | 
                                                        
| 4727 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);  | 
                                                        |
| 4727 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);  | 
                                                        |
| 4728 | 4728 |          } elseif ($mode == 'dateOnly') { | 
                                                        
| 4729 | 4729 | $strTime = strftime($dateFormat, $timestamp);  | 
                                                        
| 4730 | 4730 |          } elseif ($mode == 'formatOnly') { | 
                                                        
@@ -4778,7 +4778,7 @@ discard block  | 
                                                    ||
| 4778 | 4778 | $S = 0;  | 
                                                        
| 4779 | 4779 | }  | 
                                                        
| 4780 | 4780 | $timeStamp = mktime($H, $M, $S, $m, $d, $Y);  | 
                                                        
| 4781 | - $timeStamp = (int)$timeStamp;  | 
                                                        |
| 4781 | + $timeStamp = (int) $timeStamp;  | 
                                                        |
| 4782 | 4782 | return $timeStamp;  | 
                                                        
| 4783 | 4783 | }  | 
                                                        
| 4784 | 4784 | |
@@ -4820,7 +4820,7 @@ discard block  | 
                                                    ||
| 4820 | 4820 |                      if ($v === 'value') { | 
                                                        
| 4821 | 4821 | unset($_[$i]);  | 
                                                        
| 4822 | 4822 |                      } else { | 
                                                        
| 4823 | - $_[$i] = 'tv.' . $v;  | 
                                                        |
| 4823 | + $_[$i] = 'tv.'.$v;  | 
                                                        |
| 4824 | 4824 | }  | 
                                                        
| 4825 | 4825 | }  | 
                                                        
| 4826 | 4826 |                  $fields = implode(',', $_); | 
                                                        
@@ -4829,12 +4829,12 @@ discard block  | 
                                                    ||
| 4829 | 4829 | }  | 
                                                        
| 4830 | 4830 | |
| 4831 | 4831 |              if ($tvsort != '') { | 
                                                        
| 4832 | -                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); | 
                                                        |
| 4832 | +                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); | 
                                                        |
| 4833 | 4833 | }  | 
                                                        
| 4834 | 4834 |              if ($tvidnames == "*") { | 
                                                        
| 4835 | 4835 | $query = "tv.id<>0";  | 
                                                        
| 4836 | 4836 |              } else { | 
                                                        
| 4837 | -                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')"; | 
                                                        |
| 4837 | +                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')"; | 
                                                        |
| 4838 | 4838 | }  | 
                                                        
| 4839 | 4839 | |
| 4840 | 4840 | $this->getUserDocGroups();  | 
                                                        
@@ -4846,10 +4846,10 @@ discard block  | 
                                                    ||
| 4846 | 4846 | $rs = $this->getDatabase()->select(  | 
                                                        
| 4847 | 4847 |                      "{$fields}, IF(tvc.value!='',tvc.value,tv.default_text) as value ", | 
                                                        
| 4848 | 4848 | |
| 4849 | -                    $this->getDatabase()->getFullTableName("site_tmplvars") . | 
                                                        |
| 4850 | -                    " tv INNER JOIN " . $this->getDatabase()->getFullTableName("site_tmplvar_templates") . | 
                                                        |
| 4851 | - " tvtpl ON tvtpl.tmplvarid = tv.id LEFT JOIN " .  | 
                                                        |
| 4852 | -                    $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues") . | 
                                                        |
| 4849 | +                    $this->getDatabase()->getFullTableName("site_tmplvars"). | 
                                                        |
| 4850 | +                    " tv INNER JOIN ".$this->getDatabase()->getFullTableName("site_tmplvar_templates"). | 
                                                        |
| 4851 | + " tvtpl ON tvtpl.tmplvarid = tv.id LEFT JOIN ".  | 
                                                        |
| 4852 | +                    $this->getDatabase()->getFullTableName("site_tmplvar_contentvalues"). | 
                                                        |
| 4853 | 4853 |                      " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid='{$docid}'", | 
                                                        
| 4854 | 4854 | |
| 4855 | 4855 |                      "{$query} AND tvtpl.templateid = '{$doc['template']}'", | 
                                                        
@@ -4987,7 +4987,7 @@ discard block  | 
                                                    ||
| 4987 | 4987 | return $this->tmpCache[__FUNCTION__][$cacheKey];  | 
                                                        
| 4988 | 4988 | }  | 
                                                        
| 4989 | 4989 | |
| 4990 | -        if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) { | 
                                                        |
| 4990 | +        if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) { | 
                                                        |
| 4991 | 4991 | return false;  | 
                                                        
| 4992 | 4992 |          } else { | 
                                                        
| 4993 | 4993 | |
@@ -5005,23 +5005,23 @@ discard block  | 
                                                    ||
| 5005 | 5005 | }  | 
                                                        
| 5006 | 5006 | |
| 5007 | 5007 | // get user defined template variables  | 
                                                        
| 5008 | -            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); | 
                                                        |
| 5009 | -            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); | 
                                                        |
| 5008 | +            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); | 
                                                        |
| 5009 | +            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); | 
                                                        |
| 5010 | 5010 | |
| 5011 | 5011 |              if ($idnames == '*') { | 
                                                        
| 5012 | 5012 | $query = 'tv.id<>0';  | 
                                                        
| 5013 | 5013 |              } else { | 
                                                        
| 5014 | -                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; | 
                                                        |
| 5014 | +                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; | 
                                                        |
| 5015 | 5015 | }  | 
                                                        
| 5016 | 5016 | |
| 5017 | -            $rs = $this->getDatabase()->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getDatabase()->getFullTableName('site_tmplvars') . " tv | 
                                                        |
| 5018 | -                    INNER JOIN " . $this->getDatabase()->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id | 
                                                        |
| 5019 | -                    LEFT JOIN " . $this->getDatabase()->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); | 
                                                        |
| 5017 | +            $rs = $this->getDatabase()->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getDatabase()->getFullTableName('site_tmplvars')." tv | 
                                                        |
| 5018 | +                    INNER JOIN " . $this->getDatabase()->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id | 
                                                        |
| 5019 | +                    LEFT JOIN " . $this->getDatabase()->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); | 
                                                        |
| 5020 | 5020 | |
| 5021 | 5021 | $result = $this->getDatabase()->makeArray($rs);  | 
                                                        
| 5022 | 5022 | |
| 5023 | 5023 | // get default/built-in template variables  | 
                                                        
| 5024 | -            if(is_array($docRow)){ | 
                                                        |
| 5024 | +            if (is_array($docRow)) { | 
                                                        |
| 5025 | 5025 | ksort($docRow);  | 
                                                        
| 5026 | 5026 | |
| 5027 | 5027 |                  foreach ($docRow as $key => $value) { | 
                                                        
@@ -5059,13 +5059,13 @@ discard block  | 
                                                    ||
| 5059 | 5059 | */  | 
                                                        
| 5060 | 5060 | public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '')  | 
                                                        
| 5061 | 5061 |      { | 
                                                        
| 5062 | -        if (is_array($idnames) && empty($idnames) ) { | 
                                                        |
| 5062 | +        if (is_array($idnames) && empty($idnames)) { | 
                                                        |
| 5063 | 5063 | return false;  | 
                                                        
| 5064 | 5064 |          } else { | 
                                                        
| 5065 | 5065 | $output = array();  | 
                                                        
| 5066 | 5066 | $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);  | 
                                                        
| 5067 | 5067 | |
| 5068 | - $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;  | 
                                                        |
| 5068 | + $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;  | 
                                                        |
| 5069 | 5069 | // remove sort for speed  | 
                                                        
| 5070 | 5070 | $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');  | 
                                                        
| 5071 | 5071 | |
@@ -5174,7 +5174,7 @@ discard block  | 
                                                    ||
| 5174 | 5174 | */  | 
                                                        
| 5175 | 5175 | public function getCachePath()  | 
                                                        
| 5176 | 5176 |      { | 
                                                        
| 5177 | - return MODX_BASE_URL . $this->getCacheFolder();  | 
                                                        |
| 5177 | + return MODX_BASE_URL.$this->getCacheFolder();  | 
                                                        |
| 5178 | 5178 | }  | 
                                                        
| 5179 | 5179 | |
| 5180 | 5180 | /**  | 
                                                        
@@ -5225,8 +5225,8 @@ discard block  | 
                                                    ||
| 5225 | 5225 | $out = false;  | 
                                                        
| 5226 | 5226 | |
| 5227 | 5227 |          if (!empty($context)) { | 
                                                        
| 5228 | -            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { | 
                                                        |
| 5229 | - $out = $_SESSION[$context . 'InternalKey'];  | 
                                                        |
| 5228 | +            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { | 
                                                        |
| 5229 | + $out = $_SESSION[$context.'InternalKey'];  | 
                                                        |
| 5230 | 5230 | }  | 
                                                        
| 5231 | 5231 |          } else { | 
                                                        
| 5232 | 5232 |              switch (true) { | 
                                                        
@@ -5254,8 +5254,8 @@ discard block  | 
                                                    ||
| 5254 | 5254 | $out = false;  | 
                                                        
| 5255 | 5255 | |
| 5256 | 5256 |          if (!empty($context)) { | 
                                                        
| 5257 | -            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { | 
                                                        |
| 5258 | - $out = $_SESSION[$context . 'Shortname'];  | 
                                                        |
| 5257 | +            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { | 
                                                        |
| 5258 | + $out = $_SESSION[$context.'Shortname'];  | 
                                                        |
| 5259 | 5259 | }  | 
                                                        
| 5260 | 5260 |          } else { | 
                                                        
| 5261 | 5261 |              switch (true) { | 
                                                        
@@ -5300,8 +5300,8 @@ discard block  | 
                                                    ||
| 5300 | 5300 | return $this->tmpCache[__FUNCTION__][$uid];  | 
                                                        
| 5301 | 5301 | }  | 
                                                        
| 5302 | 5302 | |
| 5303 | -        $from = $this->getDatabase()->getFullTableName('manager_users') . ' mu INNER JOIN ' . | 
                                                        |
| 5304 | -            $this->getDatabase()->getFullTableName('user_attributes'). ' mua ON mua.internalkey=mu.id'; | 
                                                        |
| 5303 | +        $from = $this->getDatabase()->getFullTableName('manager_users').' mu INNER JOIN '. | 
                                                        |
| 5304 | +            $this->getDatabase()->getFullTableName('user_attributes').' mua ON mua.internalkey=mu.id'; | 
                                                        |
| 5305 | 5305 |          $where = sprintf("mu.id='%s'", $this->getDatabase()->escape($uid)); | 
                                                        
| 5306 | 5306 |          $rs = $this->getDatabase()->select('mu.username, mu.password, mua.*', $from, $where, '', 1); | 
                                                        
| 5307 | 5307 | |
@@ -5327,8 +5327,8 @@ discard block  | 
                                                    ||
| 5327 | 5327 | */  | 
                                                        
| 5328 | 5328 | public function getWebUserInfo($uid)  | 
                                                        
| 5329 | 5329 |      { | 
                                                        
| 5330 | -        $rs = $this->getDatabase()->select('wu.username, wu.password, wua.*', $this->getDatabase()->getFullTableName("web_users") . " wu | 
                                                        |
| 5331 | -                INNER JOIN " . $this->getDatabase()->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); | 
                                                        |
| 5330 | +        $rs = $this->getDatabase()->select('wu.username, wu.password, wua.*', $this->getDatabase()->getFullTableName("web_users")." wu | 
                                                        |
| 5331 | +                INNER JOIN " . $this->getDatabase()->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); | 
                                                        |
| 5332 | 5332 |          if ($row = $this->getDatabase()->getRow($rs)) { | 
                                                        
| 5333 | 5333 |              if (!isset($row['usertype']) or !$row["usertype"]) { | 
                                                        
| 5334 | 5334 | $row["usertype"] = "web";  | 
                                                        
@@ -5364,7 +5364,7 @@ discard block  | 
                                                    ||
| 5364 | 5364 |          } else if (is_array($dg)) { | 
                                                        
| 5365 | 5365 | // resolve ids to names  | 
                                                        
| 5366 | 5366 | $dgn = array();  | 
                                                        
| 5367 | -            $ds = $this->getDatabase()->select('name', $this->getDatabase()->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); | 
                                                        |
| 5367 | +            $ds = $this->getDatabase()->select('name', $this->getDatabase()->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); | 
                                                        |
| 5368 | 5368 |              while ($row = $this->getDatabase()->getRow($ds)) { | 
                                                        
| 5369 | 5369 | $dgn[] = $row['name'];  | 
                                                        
| 5370 | 5370 | }  | 
                                                        
@@ -5392,7 +5392,7 @@ discard block  | 
                                                    ||
| 5392 | 5392 | $rt = false;  | 
                                                        
| 5393 | 5393 |          if ($_SESSION["webValidated"] == 1) { | 
                                                        
| 5394 | 5394 |              $tbl = $this->getDatabase()->getFullTableName("web_users"); | 
                                                        
| 5395 | -            $ds = $this->getDatabase()->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); | 
                                                        |
| 5395 | +            $ds = $this->getDatabase()->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); | 
                                                        |
| 5396 | 5396 |              if ($row = $this->getDatabase()->getRow($ds)) { | 
                                                        
| 5397 | 5397 |                  if ($row["password"] == md5($oldPwd)) { | 
                                                        
| 5398 | 5398 |                      if (strlen($newPwd) < 6) { | 
                                                        
@@ -5402,7 +5402,7 @@ discard block  | 
                                                    ||
| 5402 | 5402 |                      } else { | 
                                                        
| 5403 | 5403 | $this->getDatabase()->update(array(  | 
                                                        
| 5404 | 5404 | 'password' => $this->getDatabase()->escape($newPwd),  | 
                                                        
| 5405 | - ), $tbl, "id='" . $this->getLoginUserID() . "'");  | 
                                                        |
| 5405 | + ), $tbl, "id='".$this->getLoginUserID()."'");  | 
                                                        |
| 5406 | 5406 | // invoke OnWebChangePassword event  | 
                                                        
| 5407 | 5407 |                          $this->invokeEvent("OnWebChangePassword", array( | 
                                                        
| 5408 | 5408 | "userid" => $row["id"],  | 
                                                        
@@ -5433,8 +5433,8 @@ discard block  | 
                                                    ||
| 5433 | 5433 | // check cache  | 
                                                        
| 5434 | 5434 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;  | 
                                                        
| 5435 | 5435 |          if (!is_array($grpNames)) { | 
                                                        
| 5436 | -            $rs = $this->getDatabase()->select('wgn.name', $this->getDatabase()->getFullTableName("webgroup_names") . " wgn | 
                                                        |
| 5437 | -                    INNER JOIN " . $this->getDatabase()->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); | 
                                                        |
| 5436 | +            $rs = $this->getDatabase()->select('wgn.name', $this->getDatabase()->getFullTableName("webgroup_names")." wgn | 
                                                        |
| 5437 | +                    INNER JOIN " . $this->getDatabase()->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); | 
                                                        |
| 5438 | 5438 |              $grpNames = $this->getDatabase()->getColumn("name", $rs); | 
                                                        
| 5439 | 5439 | // save to cache  | 
                                                        
| 5440 | 5440 | $_SESSION['webUserGroupNames'] = $grpNames;  | 
                                                        
@@ -5467,7 +5467,7 @@ discard block  | 
                                                    ||
| 5467 | 5467 |          if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { | 
                                                        
| 5468 | 5468 | $this->sjscripts[$nextpos] = $src;  | 
                                                        
| 5469 | 5469 |          } else { | 
                                                        
| 5470 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';  | 
                                                        |
| 5470 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';  | 
                                                        |
| 5471 | 5471 | }  | 
                                                        
| 5472 | 5472 | }  | 
                                                        
| 5473 | 5473 | |
@@ -5546,7 +5546,7 @@ discard block  | 
                                                    ||
| 5546 | 5546 | }  | 
                                                        
| 5547 | 5547 | |
| 5548 | 5548 |          if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { | 
                                                        
| 5549 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';  | 
                                                        |
| 5549 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';  | 
                                                        |
| 5550 | 5550 | }  | 
                                                        
| 5551 | 5551 |          if ($startup) { | 
                                                        
| 5552 | 5552 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;  | 
                                                        
@@ -5693,7 +5693,7 @@ discard block  | 
                                                    ||
| 5693 | 5693 | $eventtime = $this->getMicroTime() - $eventtime;  | 
                                                        
| 5694 | 5694 |                  $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); | 
                                                        
| 5695 | 5695 |                  foreach ($parameter as $k => $v) { | 
                                                        
| 5696 | -                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; | 
                                                        |
| 5696 | +                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; | 
                                                        |
| 5697 | 5697 | }  | 
                                                        
| 5698 | 5698 | $this->pluginsCode .= '</fieldset><br />';  | 
                                                        
| 5699 | 5699 |                  $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; | 
                                                        
@@ -5721,13 +5721,13 @@ discard block  | 
                                                    ||
| 5721 | 5721 | $plugin = array();  | 
                                                        
| 5722 | 5722 |          if (isset ($this->pluginCache[$pluginName])) { | 
                                                        
| 5723 | 5723 | $pluginCode = $this->pluginCache[$pluginName];  | 
                                                        
| 5724 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';  | 
                                                        |
| 5724 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';  | 
                                                        |
| 5725 | 5725 |          } else { | 
                                                        
| 5726 | 5726 | $pluginName = $this->getDatabase()->escape($pluginName);  | 
                                                        
| 5727 | 5727 |              $result = $this->getDatabase()->select('name, plugincode, properties', $this->getDatabase()->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); | 
                                                        
| 5728 | 5728 |              if ($row = $this->getDatabase()->getRow($result)) { | 
                                                        
| 5729 | 5729 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];  | 
                                                        
| 5730 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];  | 
                                                        |
| 5730 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];  | 
                                                        |
| 5731 | 5731 |              } else { | 
                                                        
| 5732 | 5732 | $pluginCode = $this->pluginCache[$pluginName] = "return false;";  | 
                                                        
| 5733 | 5733 | $pluginProperties = '';  | 
                                                        
@@ -5751,7 +5751,7 @@ discard block  | 
                                                    ||
| 5751 | 5751 |      { | 
                                                        
| 5752 | 5752 | $property = array();  | 
                                                        
| 5753 | 5753 | |
| 5754 | -        if(\is_scalar($propertyString)) { | 
                                                        |
| 5754 | +        if (\is_scalar($propertyString)) { | 
                                                        |
| 5755 | 5755 | $propertyString = trim($propertyString);  | 
                                                        
| 5756 | 5756 |              $propertyString = str_replace('{}', '', $propertyString); | 
                                                        
| 5757 | 5757 |              $propertyString = str_replace('} {', ',', $propertyString); | 
                                                        
@@ -5805,7 +5805,7 @@ discard block  | 
                                                    ||
| 5805 | 5805 | }  | 
                                                        
| 5806 | 5806 | }  | 
                                                        
| 5807 | 5807 | }  | 
                                                        
| 5808 | -        elseif(\is_array($propertyString)) { | 
                                                        |
| 5808 | +        elseif (\is_array($propertyString)) { | 
                                                        |
| 5809 | 5809 | $property = $propertyString;  | 
                                                        
| 5810 | 5810 | }  | 
                                                        
| 5811 | 5811 |          if (!empty($elementName) && !empty($elementType)) { | 
                                                        
@@ -5836,7 +5836,7 @@ discard block  | 
                                                    ||
| 5836 | 5836 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)  | 
                                                        
| 5837 | 5837 |      { | 
                                                        
| 5838 | 5838 | $params = array();  | 
                                                        
| 5839 | - $fullpath = $element_dir . '/' . $filename;  | 
                                                        |
| 5839 | + $fullpath = $element_dir.'/'.$filename;  | 
                                                        |
| 5840 | 5840 |          if (is_readable($fullpath)) { | 
                                                        
| 5841 | 5841 | $tpl = @fopen($fullpath, "r");  | 
                                                        
| 5842 | 5842 |              if ($tpl) { | 
                                                        
@@ -6003,8 +6003,8 @@ discard block  | 
                                                    ||
| 6003 | 6003 |          $ph = array('site_url' => MODX_SITE_URL); | 
                                                        
| 6004 | 6004 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";  | 
                                                        
| 6005 | 6005 | $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';  | 
                                                        
| 6006 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';  | 
                                                        |
| 6007 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';  | 
                                                        |
| 6006 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';  | 
                                                        |
| 6007 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';  | 
                                                        |
| 6008 | 6008 |          foreach ($parsed as $key => $val) { | 
                                                        
| 6009 | 6009 |              if (is_array($val)) { | 
                                                        
| 6010 | 6010 |                  foreach ($val as $key2 => $val2) { | 
                                                        
@@ -6013,7 +6013,7 @@ discard block  | 
                                                    ||
| 6013 | 6013 |                          $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); | 
                                                        
| 6014 | 6014 | }  | 
                                                        
| 6015 | 6015 |                      if (preg_match($regexEmail, $val2, $url)) { | 
                                                        
| 6016 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);  | 
                                                        |
| 6016 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);  | 
                                                        |
| 6017 | 6017 | }  | 
                                                        
| 6018 | 6018 | $parsed[$key][$key2] = $val2;  | 
                                                        
| 6019 | 6019 | }  | 
                                                        
@@ -6023,7 +6023,7 @@ discard block  | 
                                                    ||
| 6023 | 6023 |                      $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); | 
                                                        
| 6024 | 6024 | }  | 
                                                        
| 6025 | 6025 |                  if (preg_match($regexEmail, $val, $url)) { | 
                                                        
| 6026 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);  | 
                                                        |
| 6026 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);  | 
                                                        |
| 6027 | 6027 | }  | 
                                                        
| 6028 | 6028 | $parsed[$key] = $val;  | 
                                                        
| 6029 | 6029 | }  | 
                                                        
@@ -6037,32 +6037,32 @@ discard block  | 
                                                    ||
| 6037 | 6037 | );  | 
                                                        
| 6038 | 6038 | |
| 6039 | 6039 | $nl = "\n";  | 
                                                        
| 6040 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';  | 
                                                        |
| 6041 | - $list .= '<p>' . $nl;  | 
                                                        |
| 6042 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';  | 
                                                        |
| 6043 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';  | 
                                                        |
| 6044 | - $list .= '</p><br/>' . $nl;  | 
                                                        |
| 6045 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';  | 
                                                        |
| 6046 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';  | 
                                                        |
| 6047 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';  | 
                                                        |
| 6048 | - $list .= '<br/>' . $nl;  | 
                                                        |
| 6040 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';  | 
                                                        |
| 6041 | + $list .= '<p>'.$nl;  | 
                                                        |
| 6042 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';  | 
                                                        |
| 6043 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';  | 
                                                        |
| 6044 | + $list .= '</p><br/>'.$nl;  | 
                                                        |
| 6045 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';  | 
                                                        |
| 6046 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';  | 
                                                        |
| 6047 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';  | 
                                                        |
| 6048 | + $list .= '<br/>'.$nl;  | 
                                                        |
| 6049 | 6049 | $first = true;  | 
                                                        
| 6050 | 6050 |          foreach ($arrayParams as $param => $label) { | 
                                                        
| 6051 | 6051 |              if (isset($parsed[$param])) { | 
                                                        
| 6052 | 6052 |                  if ($first) { | 
                                                        
| 6053 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;  | 
                                                        |
| 6054 | - $list .= '<ul class="docBlockList">' . $nl;  | 
                                                        |
| 6053 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;  | 
                                                        |
| 6054 | + $list .= '<ul class="docBlockList">'.$nl;  | 
                                                        |
| 6055 | 6055 | $first = false;  | 
                                                        
| 6056 | 6056 | }  | 
                                                        
| 6057 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl;  | 
                                                        |
| 6058 | - $list .= ' <ul>' . $nl;  | 
                                                        |
| 6057 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl;  | 
                                                        |
| 6058 | + $list .= ' <ul>'.$nl;  | 
                                                        |
| 6059 | 6059 |                  foreach ($parsed[$param] as $val) { | 
                                                        
| 6060 | - $list .= ' <li>' . $val . '</li>' . $nl;  | 
                                                        |
| 6060 | + $list .= ' <li>'.$val.'</li>'.$nl;  | 
                                                        |
| 6061 | 6061 | }  | 
                                                        
| 6062 | - $list .= ' </ul></li>' . $nl;  | 
                                                        |
| 6062 | + $list .= ' </ul></li>'.$nl;  | 
                                                        |
| 6063 | 6063 | }  | 
                                                        
| 6064 | 6064 | }  | 
                                                        
| 6065 | - $list .= !$first ? '</ul>' . $nl : '';  | 
                                                        |
| 6065 | + $list .= !$first ? '</ul>'.$nl : '';  | 
                                                        |
| 6066 | 6066 | |
| 6067 | 6067 | return $list;  | 
                                                        
| 6068 | 6068 | }  | 
                                                        
@@ -6137,8 +6137,8 @@ discard block  | 
                                                    ||
| 6137 | 6137 | */  | 
                                                        
| 6138 | 6138 | public function addSnippet($name, $phpCode, $namespace = '#', array $defaultParams = array())  | 
                                                        
| 6139 | 6139 |      { | 
                                                        
| 6140 | - $this->snippetCache[$namespace . $name] = $phpCode;  | 
                                                        |
| 6141 | - $this->snippetCache[$namespace . $name . 'Props'] = $defaultParams;  | 
                                                        |
| 6140 | + $this->snippetCache[$namespace.$name] = $phpCode;  | 
                                                        |
| 6141 | + $this->snippetCache[$namespace.$name.'Props'] = $defaultParams;  | 
                                                        |
| 6142 | 6142 | }  | 
                                                        
| 6143 | 6143 | |
| 6144 | 6144 | /**  | 
                                                        
@@ -6146,7 +6146,7 @@ discard block  | 
                                                    ||
| 6146 | 6146 | */  | 
                                                        
| 6147 | 6147 | public function addChunk($name, $text, $namespace = '#')  | 
                                                        
| 6148 | 6148 |      { | 
                                                        
| 6149 | - $this->chunkCache[$namespace . $name] = $text;  | 
                                                        |
| 6149 | + $this->chunkCache[$namespace.$name] = $text;  | 
                                                        |
| 6150 | 6150 | }  | 
                                                        
| 6151 | 6151 | |
| 6152 | 6152 | /**  | 
                                                        
@@ -6156,7 +6156,7 @@ discard block  | 
                                                    ||
| 6156 | 6156 |      { | 
                                                        
| 6157 | 6157 | $out = array();  | 
                                                        
| 6158 | 6158 | |
| 6159 | -        if (! is_dir($scanPath) || empty($ext)) { | 
                                                        |
| 6159 | +        if (!is_dir($scanPath) || empty($ext)) { | 
                                                        |
| 6160 | 6160 | return $out;  | 
                                                        
| 6161 | 6161 | }  | 
                                                        
| 6162 | 6162 | $iterator = new \RecursiveIteratorIterator(  | 
                                                        
@@ -6168,22 +6168,22 @@ discard block  | 
                                                    ||
| 6168 | 6168 | * @var \SplFileInfo $item  | 
                                                        
| 6169 | 6169 | */  | 
                                                        
| 6170 | 6170 |              if ($item->isFile() && $item->isReadable() && \in_array($item->getExtension(), $ext)) { | 
                                                        
| 6171 | -                $name = $item->getBasename('.' . $item->getExtension()); | 
                                                        |
| 6171 | +                $name = $item->getBasename('.'.$item->getExtension()); | 
                                                        |
| 6172 | 6172 | $path = ltrim(str_replace(  | 
                                                        
| 6173 | 6173 | array(rtrim($scanPath, '//'), '/'),  | 
                                                        
| 6174 | 6174 |                      array('', '\\'), | 
                                                        
| 6175 | - $item->getPath() . '/'  | 
                                                        |
| 6175 | + $item->getPath().'/'  | 
                                                        |
| 6176 | 6176 | ), '\\');  | 
                                                        
| 6177 | 6177 | |
| 6178 | 6178 |                  if (!empty($path)) { | 
                                                        
| 6179 | - $name = $path . $name;  | 
                                                        |
| 6179 | + $name = $path.$name;  | 
                                                        |
| 6180 | 6180 | }  | 
                                                        
| 6181 | 6181 |                  switch ($type) { | 
                                                        
| 6182 | 6182 | case 'chunk':  | 
                                                        
| 6183 | 6183 | $out[$name] = file_get_contents($item->getRealPath());  | 
                                                        
| 6184 | 6184 | break;  | 
                                                        
| 6185 | 6185 | case 'snippet':  | 
                                                        
| 6186 | - $out[$name] = "return require '" . $item->getRealPath() . "';";  | 
                                                        |
| 6186 | + $out[$name] = "return require '".$item->getRealPath()."';";  | 
                                                        |
| 6187 | 6187 | break;  | 
                                                        
| 6188 | 6188 | default:  | 
                                                        
| 6189 | 6189 | throw new \Exception;  | 
                                                        
@@ -6227,7 +6227,7 @@ discard block  | 
                                                    ||
| 6227 | 6227 | }  | 
                                                        
| 6228 | 6228 | |
| 6229 | 6229 |          if (!$isSafe) { | 
                                                        
| 6230 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);  | 
                                                        |
| 6230 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);  | 
                                                        |
| 6231 | 6231 |              $title = sprintf('Unknown eval was executed (%s)', $this->getPhpCompat()->htmlspecialchars(substr(trim($phpcode), 0, 50))); | 
                                                        
| 6232 | 6232 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg);  | 
                                                        
| 6233 | 6233 | return;  | 
                                                        
@@ -6241,7 +6241,7 @@ discard block  | 
                                                    ||
| 6241 | 6241 | return 'array()';  | 
                                                        
| 6242 | 6242 | }  | 
                                                        
| 6243 | 6243 | |
| 6244 | - $output = $echo . $return;  | 
                                                        |
| 6244 | + $output = $echo.$return;  | 
                                                        |
| 6245 | 6245 | modx_sanitize_gpc($output);  | 
                                                        
| 6246 | 6246 | return $this->getPhpCompat()->htmlspecialchars($output); // Maybe, all html tags are dangerous  | 
                                                        
| 6247 | 6247 | }  | 
                                                        
@@ -6259,8 +6259,8 @@ discard block  | 
                                                    ||
| 6259 | 6259 | |
| 6260 | 6260 |          $safe = explode(',', $safe_functions); | 
                                                        
| 6261 | 6261 | |
| 6262 | - $phpcode = rtrim($phpcode, ';') . ';';  | 
                                                        |
| 6263 | -        $tokens = token_get_all('<?php ' . $phpcode); | 
                                                        |
| 6262 | + $phpcode = rtrim($phpcode, ';').';';  | 
                                                        |
| 6263 | +        $tokens = token_get_all('<?php '.$phpcode); | 
                                                        |
| 6264 | 6264 |          foreach ($tokens as $i => $token) { | 
                                                        
| 6265 | 6265 |              if (!is_array($token)) { | 
                                                        
| 6266 | 6266 | continue;  | 
                                                        
@@ -6296,7 +6296,7 @@ discard block  | 
                                                    ||
| 6296 | 6296 | public function atBindFileContent($str = '')  | 
                                                        
| 6297 | 6297 |      { | 
                                                        
| 6298 | 6298 | |
| 6299 | -        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); | 
                                                        |
| 6299 | +        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); | 
                                                        |
| 6300 | 6300 | |
| 6301 | 6301 |          if (stripos($str, '@FILE') !== 0) { | 
                                                        
| 6302 | 6302 | return $str;  | 
                                                        
@@ -6319,7 +6319,7 @@ discard block  | 
                                                    ||
| 6319 | 6319 |          $errorMsg = sprintf("Could not retrieve string '%s'.", $str); | 
                                                        
| 6320 | 6320 | |
| 6321 | 6321 |          foreach ($search_path as $path) { | 
                                                        
| 6322 | - $file_path = MODX_BASE_PATH . $path . $str;  | 
                                                        |
| 6322 | + $file_path = MODX_BASE_PATH.$path.$str;  | 
                                                        |
| 6323 | 6323 |              if (strpos($file_path, MODX_MANAGER_PATH) === 0) { | 
                                                        
| 6324 | 6324 | return $errorMsg;  | 
                                                        
| 6325 | 6325 |              } elseif (is_file($file_path)) { | 
                                                        
@@ -6333,7 +6333,7 @@ discard block  | 
                                                    ||
| 6333 | 6333 | return $errorMsg;  | 
                                                        
| 6334 | 6334 | }  | 
                                                        
| 6335 | 6335 | |
| 6336 | - $content = (string)file_get_contents($file_path);  | 
                                                        |
| 6336 | + $content = (string) file_get_contents($file_path);  | 
                                                        |
| 6337 | 6337 |          if ($content === false) { | 
                                                        
| 6338 | 6338 | return $errorMsg;  | 
                                                        
| 6339 | 6339 | }  | 
                                                        
@@ -6442,22 +6442,22 @@ discard block  | 
                                                    ||
| 6442 | 6442 | |
| 6443 | 6443 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';  | 
                                                        
| 6444 | 6444 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';  | 
                                                        
| 6445 | -        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; | 
                                                        |
| 6445 | +        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; | 
                                                        |
| 6446 | 6446 | $request_uri = $this->getPhpCompat()->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);  | 
                                                        
| 6447 | 6447 | $ua = $this->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);  | 
                                                        
| 6448 | 6448 | $referer = $this->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);  | 
                                                        
| 6449 | 6449 |          if ($is_error) { | 
                                                        
| 6450 | 6450 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>';  | 
                                                        
| 6451 | 6451 |              if ($msg != 'PHP Parse Error') { | 
                                                        
| 6452 | - $str .= '<h3 style="color:red">' . $msg . '</h3>';  | 
                                                        |
| 6452 | + $str .= '<h3 style="color:red">'.$msg.'</h3>';  | 
                                                        |
| 6453 | 6453 | }  | 
                                                        
| 6454 | 6454 |          } else { | 
                                                        
| 6455 | 6455 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>';  | 
                                                        
| 6456 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>';  | 
                                                        |
| 6456 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>';  | 
                                                        |
| 6457 | 6457 | }  | 
                                                        
| 6458 | 6458 | |
| 6459 | 6459 |          if (!empty ($query)) { | 
                                                        
| 6460 | - $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>';  | 
                                                        |
| 6460 | + $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>';  | 
                                                        |
| 6461 | 6461 | }  | 
                                                        
| 6462 | 6462 | |
| 6463 | 6463 | $errortype = array(  | 
                                                        
@@ -6480,13 +6480,13 @@ discard block  | 
                                                    ||
| 6480 | 6480 | |
| 6481 | 6481 |          if (!empty($nr) || !empty($file)) { | 
                                                        
| 6482 | 6482 |              if ($text != '') { | 
                                                        
| 6483 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';  | 
                                                        |
| 6483 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';  | 
                                                        |
| 6484 | 6484 | }  | 
                                                        
| 6485 | 6485 |              if ($output != '') { | 
                                                        
| 6486 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';  | 
                                                        |
| 6486 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';  | 
                                                        |
| 6487 | 6487 | }  | 
                                                        
| 6488 | 6488 |              if ($nr !== '') { | 
                                                        
| 6489 | -                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); | 
                                                        |
| 6489 | +                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); | 
                                                        |
| 6490 | 6490 | }  | 
                                                        
| 6491 | 6491 |              if ($file) { | 
                                                        
| 6492 | 6492 |                  $table[] = array('File', $file); | 
                                                        
@@ -6506,7 +6506,7 @@ discard block  | 
                                                    ||
| 6506 | 6506 | }  | 
                                                        
| 6507 | 6507 | |
| 6508 | 6508 |          if (!empty($this->event->activePlugin)) { | 
                                                        
| 6509 | -            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); | 
                                                        |
| 6509 | +            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); | 
                                                        |
| 6510 | 6510 | }  | 
                                                        
| 6511 | 6511 | |
| 6512 | 6512 |          $str .= $MakeTable->create($table, array('Error information', '')); | 
                                                        
@@ -6516,17 +6516,17 @@ discard block  | 
                                                    ||
| 6516 | 6516 |          $table[] = array('REQUEST_URI', $request_uri); | 
                                                        
| 6517 | 6517 | |
| 6518 | 6518 |          if ($this->getManagerApi()->action) { | 
                                                        
| 6519 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');  | 
                                                        |
| 6519 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');  | 
                                                        |
| 6520 | 6520 | global $action_list;  | 
                                                        
| 6521 | 6521 |              $actionName = (isset($action_list[$this->getManagerApi()->action])) ? " - {$action_list[$this->getManagerApi()->action]}" : ''; | 
                                                        
| 6522 | 6522 | |
| 6523 | -            $table[] = array('Manager action', $this->getManagerApi()->action . $actionName); | 
                                                        |
| 6523 | +            $table[] = array('Manager action', $this->getManagerApi()->action.$actionName); | 
                                                        |
| 6524 | 6524 | }  | 
                                                        
| 6525 | 6525 | |
| 6526 | 6526 |          if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { | 
                                                        
| 6527 | 6527 |              $resource = $this->getDocumentObject('id', $this->documentIdentifier); | 
                                                        
| 6528 | 6528 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');  | 
                                                        
| 6529 | -            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); | 
                                                        |
| 6529 | +            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); | 
                                                        |
| 6530 | 6530 | }  | 
                                                        
| 6531 | 6531 |          $table[] = array('Referer', $referer); | 
                                                        
| 6532 | 6532 |          $table[] = array('User Agent', $ua); | 
                                                        
@@ -6547,7 +6547,7 @@ discard block  | 
                                                    ||
| 6547 | 6547 | |
| 6548 | 6548 | $mem = memory_get_peak_usage(true);  | 
                                                        
| 6549 | 6549 | $total_mem = $mem - $this->mstart;  | 
                                                        
| 6550 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb';  | 
                                                        |
| 6550 | + $total_mem = ($total_mem / 1024 / 1024).' mb';  | 
                                                        |
| 6551 | 6551 | |
| 6552 | 6552 | $queryTime = $this->queryTime;  | 
                                                        
| 6553 | 6553 | $phpTime = $totalTime - $queryTime;  | 
                                                        
@@ -6568,18 +6568,18 @@ discard block  | 
                                                    ||
| 6568 | 6568 | $str .= $this->get_backtrace(debug_backtrace());  | 
                                                        
| 6569 | 6569 | // Log error  | 
                                                        
| 6570 | 6570 |          if (!empty($this->currentSnippet)) { | 
                                                        
| 6571 | - $source = 'Snippet - ' . $this->currentSnippet;  | 
                                                        |
| 6571 | + $source = 'Snippet - '.$this->currentSnippet;  | 
                                                        |
| 6572 | 6572 |          } elseif (!empty($this->event->activePlugin)) { | 
                                                        
| 6573 | - $source = 'Plugin - ' . $this->event->activePlugin;  | 
                                                        |
| 6573 | + $source = 'Plugin - '.$this->event->activePlugin;  | 
                                                        |
| 6574 | 6574 |          } elseif ($source !== '') { | 
                                                        
| 6575 | - $source = 'Parser - ' . $source;  | 
                                                        |
| 6575 | + $source = 'Parser - '.$source;  | 
                                                        |
| 6576 | 6576 |          } elseif ($query !== '') { | 
                                                        
| 6577 | 6577 | $source = 'SQL Query';  | 
                                                        
| 6578 | 6578 |          } else { | 
                                                        
| 6579 | 6579 | $source = 'Parser';  | 
                                                        
| 6580 | 6580 | }  | 
                                                        
| 6581 | 6581 |          if ($msg) { | 
                                                        
| 6582 | - $source .= ' / ' . $msg;  | 
                                                        |
| 6582 | + $source .= ' / '.$msg;  | 
                                                        |
| 6583 | 6583 | }  | 
                                                        
| 6584 | 6584 |          if (isset($actionName) && !empty($actionName)) { | 
                                                        
| 6585 | 6585 | $source .= $actionName;  | 
                                                        
@@ -6612,12 +6612,12 @@ discard block  | 
                                                    ||
| 6612 | 6612 | ob_get_clean();  | 
                                                        
| 6613 | 6613 | // Display error  | 
                                                        
| 6614 | 6614 |          if (isset($_SESSION['mgrValidated'])) { | 
                                                        
| 6615 | - 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>  | 
                                                        |
| 6615 | + 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>  | 
                                                        |
| 6616 | 6616 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  | 
                                                        
| 6617 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />  | 
                                                        |
| 6617 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />  | 
                                                        |
| 6618 | 6618 |                   <style type="text/css">body { padding:10px; } td {font:inherit;}</style> | 
                                                        
| 6619 | 6619 | </head><body>  | 
                                                        
| 6620 | - ' . $str . '</body></html>';  | 
                                                        |
| 6620 | + ' . $str.'</body></html>';  | 
                                                        |
| 6621 | 6621 | |
| 6622 | 6622 |          } else { | 
                                                        
| 6623 | 6623 | echo 'Error';  | 
                                                        
@@ -6652,7 +6652,7 @@ discard block  | 
                                                    ||
| 6652 | 6652 |              switch (get_by_key($val, 'type')) { | 
                                                        
| 6653 | 6653 | case '->':  | 
                                                        
| 6654 | 6654 | case '::':  | 
                                                        
| 6655 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];  | 
                                                        |
| 6655 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];  | 
                                                        |
| 6656 | 6656 | break;  | 
                                                        
| 6657 | 6657 | default:  | 
                                                        
| 6658 | 6658 | $functionName = $val['function'];  | 
                                                        
@@ -6662,7 +6662,7 @@ discard block  | 
                                                    ||
| 6662 | 6662 | $args = array_pad(array(), $_, '$var');  | 
                                                        
| 6663 | 6663 |              $args = implode(", ", $args); | 
                                                        
| 6664 | 6664 | $modx = &$this;  | 
                                                        
| 6665 | -            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { | 
                                                        |
| 6665 | +            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { | 
                                                        |
| 6666 | 6666 | $arg = $val['args'][$tmp - 1];  | 
                                                        
| 6667 | 6667 |                  switch (true) { | 
                                                        
| 6668 | 6668 |                      case is_null($arg): { | 
                                                        
@@ -6674,7 +6674,7 @@ discard block  | 
                                                    ||
| 6674 | 6674 | break;  | 
                                                        
| 6675 | 6675 | }  | 
                                                        
| 6676 | 6676 |                      case is_scalar($arg): { | 
                                                        
| 6677 | -                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->getPhpCompat()->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); | 
                                                        |
| 6677 | +                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->getPhpCompat()->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); | 
                                                        |
| 6678 | 6678 | break;  | 
                                                        
| 6679 | 6679 | }  | 
                                                        
| 6680 | 6680 |                      case is_bool($arg): { | 
                                                        
@@ -6682,23 +6682,23 @@ discard block  | 
                                                    ||
| 6682 | 6682 | break;  | 
                                                        
| 6683 | 6683 | }  | 
                                                        
| 6684 | 6684 |                      case is_array($arg): { | 
                                                        
| 6685 | - $out = 'array $var' . $tmp;  | 
                                                        |
| 6685 | + $out = 'array $var'.$tmp;  | 
                                                        |
| 6686 | 6686 | break;  | 
                                                        
| 6687 | 6687 | }  | 
                                                        
| 6688 | 6688 |                      case is_object($arg): { | 
                                                        
| 6689 | - $out = get_class($arg) . ' $var' . $tmp;  | 
                                                        |
| 6689 | + $out = get_class($arg).' $var'.$tmp;  | 
                                                        |
| 6690 | 6690 | break;  | 
                                                        
| 6691 | 6691 | }  | 
                                                        
| 6692 | 6692 |                      default: { | 
                                                        
| 6693 | - $out = '$var' . $tmp;  | 
                                                        |
| 6693 | + $out = '$var'.$tmp;  | 
                                                        |
| 6694 | 6694 | }  | 
                                                        
| 6695 | 6695 | }  | 
                                                        
| 6696 | 6696 | $tmp++;  | 
                                                        
| 6697 | 6697 | return $out;  | 
                                                        
| 6698 | 6698 | }, $args);  | 
                                                        
| 6699 | 6699 | $line = array(  | 
                                                        
| 6700 | -                "<strong>" . $functionName . "</strong>(" . $args . ")", | 
                                                        |
| 6701 | - $path . " on line " . $val['line']  | 
                                                        |
| 6700 | +                "<strong>".$functionName."</strong>(".$args.")", | 
                                                        |
| 6701 | + $path." on line ".$val['line']  | 
                                                        |
| 6702 | 6702 | );  | 
                                                        
| 6703 | 6703 |              $table[] = array(implode("<br />", $line)); | 
                                                        
| 6704 | 6704 | }  | 
                                                        
@@ -6739,7 +6739,7 @@ discard block  | 
                                                    ||
| 6739 | 6739 | $alias = strip_tags($alias); // strip HTML  | 
                                                        
| 6740 | 6740 |              $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters | 
                                                        
| 6741 | 6741 |              $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash | 
                                                        
| 6742 | -            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one | 
                                                        |
| 6742 | +            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one | 
                                                        |
| 6743 | 6743 | $alias = trim($alias, '-'); // trim excess  | 
                                                        
| 6744 | 6744 | return $alias;  | 
                                                        
| 6745 | 6745 | }  | 
                                                        
@@ -6755,7 +6755,7 @@ discard block  | 
                                                    ||
| 6755 | 6755 | $precisions = count($sizes) - 1;  | 
                                                        
| 6756 | 6756 |          foreach ($sizes as $unit => $bytes) { | 
                                                        
| 6757 | 6757 |              if ($size >= $bytes) { | 
                                                        
| 6758 | - return number_format($size / $bytes, $precisions) . ' ' . $unit;  | 
                                                        |
| 6758 | + return number_format($size / $bytes, $precisions).' '.$unit;  | 
                                                        |
| 6759 | 6759 | }  | 
                                                        
| 6760 | 6760 | $precisions--;  | 
                                                        
| 6761 | 6761 | }  | 
                                                        
@@ -6859,10 +6859,10 @@ discard block  | 
                                                    ||
| 6859 | 6859 | |
| 6860 | 6860 |          if (strpos($str, MODX_MANAGER_PATH) === 0) { | 
                                                        
| 6861 | 6861 | return false;  | 
                                                        
| 6862 | -        } elseif (is_file(MODX_BASE_PATH . $str)) { | 
                                                        |
| 6863 | - $file_path = MODX_BASE_PATH . $str;  | 
                                                        |
| 6864 | -        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { | 
                                                        |
| 6865 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str;  | 
                                                        |
| 6862 | +        } elseif (is_file(MODX_BASE_PATH.$str)) { | 
                                                        |
| 6863 | + $file_path = MODX_BASE_PATH.$str;  | 
                                                        |
| 6864 | +        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { | 
                                                        |
| 6865 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str;  | 
                                                        |
| 6866 | 6866 |          } else { | 
                                                        
| 6867 | 6867 | return false;  | 
                                                        
| 6868 | 6868 | }  | 
                                                        
@@ -6986,7 +6986,7 @@ discard block  | 
                                                    ||
| 6986 | 6986 | $title = 'no title';  | 
                                                        
| 6987 | 6987 | }  | 
                                                        
| 6988 | 6988 |          if (is_array($msg)) { | 
                                                        
| 6989 | - $msg = '<pre>' . print_r($msg, true) . '</pre>';  | 
                                                        |
| 6989 | + $msg = '<pre>'.print_r($msg, true).'</pre>';  | 
                                                        |
| 6990 | 6990 |          } elseif ($msg === '') { | 
                                                        
| 6991 | 6991 | $msg = $_SERVER['REQUEST_URI'];  | 
                                                        
| 6992 | 6992 | }  |