@@ -2224,11 +2224,11 @@ discard block |
||
2224 | 2224 | if (isset($this->snippetCache[$snip_name])) { |
2225 | 2225 | $snippetObject['name'] = $snip_name; |
2226 | 2226 | $snippetObject['content'] = $this->snippetCache[$snip_name]; |
2227 | - if (isset($this->snippetCache["{$snip_name}Props"])) { |
|
2228 | - if (!isset($this->snippetCache["{$snip_name}Props"])) { |
|
2229 | - $this->snippetCache["{$snip_name}Props"] = ''; |
|
2227 | + if (isset($this->snippetCache["{$snip_name}props"])) { |
|
2228 | + if (!isset($this->snippetCache["{$snip_name}props"])) { |
|
2229 | + $this->snippetCache["{$snip_name}props"] = ''; |
|
2230 | 2230 | } |
2231 | - $snippetObject['properties'] = $this->snippetCache["{$snip_name}Props"]; |
|
2231 | + $snippetObject['properties'] = $this->snippetCache["{$snip_name}props"]; |
|
2232 | 2232 | } |
2233 | 2233 | } elseif (substr($snip_name, 0, 1) === '@' && isset($this->pluginEvent[trim($snip_name, '@')])) { |
2234 | 2234 | $snippetObject['name'] = trim($snip_name, '@'); |
@@ -2253,7 +2253,7 @@ discard block |
||
2253 | 2253 | $snippetObject['content'] = $snip_content; |
2254 | 2254 | $snippetObject['properties'] = $snip_prop; |
2255 | 2255 | $this->snippetCache[$snip_name] = $snip_content; |
2256 | - $this->snippetCache["{$snip_name}Props"] = $snip_prop; |
|
2256 | + $this->snippetCache["{$snip_name}props"] = $snip_prop; |
|
2257 | 2257 | } |
2258 | 2258 | return $snippetObject; |
2259 | 2259 | } |
@@ -3569,7 +3569,7 @@ discard block |
||
3569 | 3569 | } |
3570 | 3570 | // build query |
3571 | 3571 | $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
3572 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3572 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3573 | 3573 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3574 | 3574 | $resourceArray = $this->db->makeArray($result); |
3575 | 3575 | $this->tmpCache[__FUNCTION__][$cacheKey] = $resourceArray; |
@@ -3606,7 +3606,7 @@ discard block |
||
3606 | 3606 | } |
3607 | 3607 | // build query |
3608 | 3608 | $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
3609 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3609 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3610 | 3610 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3611 | 3611 | $resourceArray = $this->db->makeArray($result); |
3612 | 3612 | |
@@ -3662,7 +3662,7 @@ discard block |
||
3662 | 3662 | $tblsc = $this->getFullTableName('site_content'); |
3663 | 3663 | $tbldg = $this->getFullTableName('document_groups'); |
3664 | 3664 | |
3665 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3665 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3666 | 3666 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$parentid}' {$published} {$deleted} {$where} AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
3667 | 3667 | |
3668 | 3668 | $resourceArray = $this->db->makeArray($result); |
@@ -3728,7 +3728,7 @@ discard block |
||
3728 | 3728 | $tblsc = $this->getFullTableName('site_content'); |
3729 | 3729 | $tbldg = $this->getFullTableName('document_groups'); |
3730 | 3730 | |
3731 | - $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
|
3731 | + $result = $this->db->select("distinct {$fields}", "{$tblsc} sc |
|
3732 | 3732 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit); |
3733 | 3733 | |
3734 | 3734 | $resourceArray = $this->db->makeArray($result); |
@@ -4320,7 +4320,7 @@ discard block |
||
4320 | 4320 | $template = $doc['content']; |
4321 | 4321 | break; |
4322 | 4322 | case 'SELECT': |
4323 | - $this->db->getValue($this->db->query("SELECT {$template}")); |
|
4323 | + $this->db->getValue($this->db->query("select {$template}")); |
|
4324 | 4324 | break; |
4325 | 4325 | default: |
4326 | 4326 | if (!($template = $this->getChunk($tpl))) { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php" |
253 | 253 | * $extname - extension name in lowercase |
254 | 254 | * |
255 | - * @param $extname |
|
255 | + * @param string $extname |
|
256 | 256 | * @param bool $reload |
257 | 257 | * @return bool |
258 | 258 | */ |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * @param int $count_attempts |
296 | 296 | * @param string $type $type |
297 | 297 | * @param string $responseCode |
298 | - * @return bool |
|
298 | + * @return false|null |
|
299 | 299 | * @global string $base_url |
300 | 300 | * @global string $site_url |
301 | 301 | */ |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | } |
996 | 996 | |
997 | 997 | /** |
998 | - * @param $contents |
|
998 | + * @param string $contents |
|
999 | 999 | * @return mixed |
1000 | 1000 | */ |
1001 | 1001 | public function RecoveryEscapedTags($contents) |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | /** |
1022 | - * @param $tstart |
|
1022 | + * @param double $tstart |
|
1023 | 1023 | * @return array |
1024 | 1024 | */ |
1025 | 1025 | public function getTimerStats($tstart) |
@@ -1771,7 +1771,7 @@ discard block |
||
1771 | 1771 | |
1772 | 1772 | /** |
1773 | 1773 | * Remove Comment-Tags from output like <!--@- Comment -@--> |
1774 | - * @param $content |
|
1774 | + * @param string $content |
|
1775 | 1775 | * @param string $left |
1776 | 1776 | * @param string $right |
1777 | 1777 | * @return mixed |
@@ -1944,7 +1944,7 @@ discard block |
||
1944 | 1944 | /** |
1945 | 1945 | * Run snippets as per the tags in $documentSource and replace the tags with the returned values. |
1946 | 1946 | * |
1947 | - * @param $content |
|
1947 | + * @param string $content |
|
1948 | 1948 | * @return string |
1949 | 1949 | * @internal param string $documentSource |
1950 | 1950 | */ |
@@ -2977,7 +2977,7 @@ discard block |
||
2977 | 2977 | |
2978 | 2978 | /** |
2979 | 2979 | * @param $templateID |
2980 | - * @return mixed |
|
2980 | + * @return string |
|
2981 | 2981 | */ |
2982 | 2982 | public function _getTemplateCodeFromDB($templateID) |
2983 | 2983 | { |
@@ -3018,9 +3018,9 @@ discard block |
||
3018 | 3018 | } |
3019 | 3019 | |
3020 | 3020 | /** |
3021 | - * @param $id |
|
3021 | + * @param integer $id |
|
3022 | 3022 | * @param int $top |
3023 | - * @return mixed |
|
3023 | + * @return string |
|
3024 | 3024 | */ |
3025 | 3025 | public function getUltimateParentId($id, $top = 0) |
3026 | 3026 | { |
@@ -3351,7 +3351,7 @@ discard block |
||
3351 | 3351 | * |
3352 | 3352 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3353 | 3353 | * @param int $id Element- / Resource-id |
3354 | - * @return bool |
|
3354 | + * @return false|null |
|
3355 | 3355 | */ |
3356 | 3356 | public function lockElement($type, $id) |
3357 | 3357 | { |
@@ -3373,7 +3373,7 @@ discard block |
||
3373 | 3373 | * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role |
3374 | 3374 | * @param int $id Element- / Resource-id |
3375 | 3375 | * @param bool $includeAllUsers true = Deletes not only own user-locks |
3376 | - * @return bool |
|
3376 | + * @return false|null |
|
3377 | 3377 | */ |
3378 | 3378 | public function unlockElement($type, $id, $includeAllUsers = false) |
3379 | 3379 | { |
@@ -3481,7 +3481,7 @@ discard block |
||
3481 | 3481 | * @param array $params |
3482 | 3482 | * @param string $msg |
3483 | 3483 | * @param array $files |
3484 | - * @return mixed |
|
3484 | + * @return boolean |
|
3485 | 3485 | */ |
3486 | 3486 | public function sendmail($params = array(), $msg = '', $files = array()) |
3487 | 3487 | { |
@@ -3977,7 +3977,7 @@ discard block |
||
3977 | 3977 | * |
3978 | 3978 | * @param string $type |
3979 | 3979 | * @param bool $report |
3980 | - * @return bool |
|
3980 | + * @return boolean|null |
|
3981 | 3981 | */ |
3982 | 3982 | public function clearCache($type = '', $report = false) |
3983 | 3983 | { |
@@ -5322,7 +5322,7 @@ discard block |
||
5322 | 5322 | * Remove event listener - only for use within the current execution cycle |
5323 | 5323 | * |
5324 | 5324 | * @param string $evtName |
5325 | - * @return boolean |
|
5325 | + * @return false|null |
|
5326 | 5326 | */ |
5327 | 5327 | public function removeEventListener($evtName) |
5328 | 5328 | { |
@@ -5346,7 +5346,7 @@ discard block |
||
5346 | 5346 | * |
5347 | 5347 | * @param string $evtName |
5348 | 5348 | * @param array $extParams Parameters available to plugins. Each array key will be the PHP variable name, and the array value will be the variable value. |
5349 | - * @return boolean|array |
|
5349 | + * @return false|null |
|
5350 | 5350 | */ |
5351 | 5351 | public function invokeEvent($evtName, $extParams = array()) |
5352 | 5352 | { |
@@ -5767,7 +5767,7 @@ discard block |
||
5767 | 5767 | |
5768 | 5768 | /** |
5769 | 5769 | * @param string $string |
5770 | - * @return mixed|string |
|
5770 | + * @return string |
|
5771 | 5771 | */ |
5772 | 5772 | public function removeSanitizeSeed($string = '') |
5773 | 5773 | { |
@@ -5782,7 +5782,7 @@ discard block |
||
5782 | 5782 | |
5783 | 5783 | /** |
5784 | 5784 | * @param string $content |
5785 | - * @return mixed|string |
|
5785 | + * @return string |
|
5786 | 5786 | */ |
5787 | 5787 | public function cleanUpMODXTags($content = '') |
5788 | 5788 | { |
@@ -5945,7 +5945,7 @@ discard block |
||
5945 | 5945 | |
5946 | 5946 | /** |
5947 | 5947 | * @param string $str |
5948 | - * @return bool|mixed|string |
|
5948 | + * @return string |
|
5949 | 5949 | */ |
5950 | 5950 | public function atBindFileContent($str = '') |
5951 | 5951 | { |
@@ -5996,8 +5996,8 @@ discard block |
||
5996 | 5996 | } |
5997 | 5997 | |
5998 | 5998 | /** |
5999 | - * @param $str |
|
6000 | - * @return bool|string |
|
5999 | + * @param string $str |
|
6000 | + * @return false|string |
|
6001 | 6001 | */ |
6002 | 6002 | public function getExtFromFilename($str) |
6003 | 6003 | { |
@@ -6025,7 +6025,7 @@ discard block |
||
6025 | 6025 | * @param string $text Error message |
6026 | 6026 | * @param string $file File where the error was detected |
6027 | 6027 | * @param string $line Line number within $file |
6028 | - * @return boolean |
|
6028 | + * @return boolean|null |
|
6029 | 6029 | */ |
6030 | 6030 | public function phpError($nr, $text, $file, $line) |
6031 | 6031 | { |
@@ -6077,7 +6077,7 @@ discard block |
||
6077 | 6077 | * @param string $text |
6078 | 6078 | * @param string $line |
6079 | 6079 | * @param string $output |
6080 | - * @return bool |
|
6080 | + * @return null|boolean |
|
6081 | 6081 | */ |
6082 | 6082 | public function messageQuit($msg = 'unspecified error', $query = '', $is_error = true, $nr = '', $file = '', $source = '', $text = '', $line = '', $output = '') |
6083 | 6083 | { |
@@ -6499,7 +6499,7 @@ discard block |
||
6499 | 6499 | |
6500 | 6500 | /** |
6501 | 6501 | * @param string $str |
6502 | - * @return bool|mixed|string |
|
6502 | + * @return string |
|
6503 | 6503 | */ |
6504 | 6504 | public function atBindInclude($str = '') |
6505 | 6505 | { |
@@ -6550,7 +6550,7 @@ discard block |
||
6550 | 6550 | * @param $str |
6551 | 6551 | * @param int $flags |
6552 | 6552 | * @param string $encode |
6553 | - * @return mixed |
|
6553 | + * @return string |
|
6554 | 6554 | */ |
6555 | 6555 | public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '') |
6556 | 6556 | { |
@@ -6559,7 +6559,7 @@ discard block |
||
6559 | 6559 | } |
6560 | 6560 | |
6561 | 6561 | /** |
6562 | - * @param $string |
|
6562 | + * @param string $string |
|
6563 | 6563 | * @param bool $returnData |
6564 | 6564 | * @return bool|mixed |
6565 | 6565 | */ |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | function __call($method_name, $arguments) |
204 | 204 | { |
205 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
205 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
206 | 206 | if (method_exists($this->old, $method_name)) { |
207 | 207 | $error_type = 1; |
208 | 208 | } else { |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | $info = debug_backtrace(); |
221 | 221 | $m[] = $msg; |
222 | 222 | if (!empty($this->currentSnippet)) { |
223 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
223 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
224 | 224 | } elseif (!empty($this->event->activePlugin)) { |
225 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
225 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
226 | 226 | } |
227 | 227 | $m[] = $this->decoded_request_uri; |
228 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
228 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
229 | 229 | $msg = implode('<br />', $m); |
230 | 230 | $this->logEvent(0, $error_type, $msg, $title); |
231 | 231 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | { |
243 | 243 | $flag = false; |
244 | 244 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
245 | - $flag = (bool)$this->{$connector}->conn; |
|
245 | + $flag = (bool) $this->{$connector}->conn; |
|
246 | 246 | } |
247 | 247 | return $flag; |
248 | 248 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | } |
270 | 270 | if (!$out && $flag) { |
271 | 271 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
272 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
272 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
273 | 273 | $out = is_file($filename) ? include $filename : false; |
274 | 274 | } |
275 | 275 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | public function getMicroTime() |
287 | 287 | { |
288 | 288 | list ($usec, $sec) = explode(' ', microtime()); |
289 | - return ((float)$usec + (float)$sec); |
|
289 | + return ((float) $usec + (float) $sec); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | // append the redirect count string to the url |
311 | 311 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
312 | 312 | if ($currentNumberOfRedirects > 3) { |
313 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
313 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
314 | 314 | } else { |
315 | 315 | $currentNumberOfRedirects += 1; |
316 | 316 | if (strpos($url, "?") > 0) { |
@@ -321,9 +321,9 @@ discard block |
||
321 | 321 | } |
322 | 322 | } |
323 | 323 | if ($type == 'REDIRECT_REFRESH') { |
324 | - $header = 'Refresh: 0;URL=' . $url; |
|
324 | + $header = 'Refresh: 0;URL='.$url; |
|
325 | 325 | } elseif ($type == 'REDIRECT_META') { |
326 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
326 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
327 | 327 | echo $header; |
328 | 328 | exit; |
329 | 329 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
@@ -331,10 +331,10 @@ discard block |
||
331 | 331 | global $base_url, $site_url; |
332 | 332 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
333 | 333 | // append $site_url to make it work with Location: |
334 | - $url = $site_url . substr($url, strlen($base_url)); |
|
334 | + $url = $site_url.substr($url, strlen($base_url)); |
|
335 | 335 | } |
336 | 336 | if (strpos($url, "\n") === false) { |
337 | - $header = 'Location: ' . $url; |
|
337 | + $header = 'Location: '.$url; |
|
338 | 338 | } else { |
339 | 339 | $this->messageQuit('No newline allowed in redirect url.'); |
340 | 340 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | header($responseCode); |
344 | 344 | } |
345 | 345 | |
346 | - if(!empty($header)) { |
|
346 | + if (!empty($header)) { |
|
347 | 347 | header($header); |
348 | 348 | } |
349 | 349 | |
@@ -447,8 +447,8 @@ discard block |
||
447 | 447 | |
448 | 448 | private function recoverySiteCache() |
449 | 449 | { |
450 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
451 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
450 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
451 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
452 | 452 | |
453 | 453 | if (is_file($site_cache_path)) { |
454 | 454 | include($site_cache_path); |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | return; |
458 | 458 | } |
459 | 459 | |
460 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
460 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
461 | 461 | $cache = new synccache(); |
462 | 462 | $cache->setCachepath($site_cache_dir); |
463 | 463 | $cache->setReport(false); |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | $this->invokeEvent("OnBeforeManagerPageInit"); |
509 | 509 | } |
510 | 510 | |
511 | - if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
512 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
511 | + if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { |
|
512 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
513 | 513 | } else { |
514 | 514 | if ($usrType == 'web') { |
515 | 515 | $from = $tbl_web_user_settings; |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
530 | 530 | } |
531 | 531 | if (isset ($usrType)) { |
532 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
532 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
533 | 533 | } // store user settings in session |
534 | 534 | } |
535 | 535 | } |
@@ -674,10 +674,10 @@ discard block |
||
674 | 674 | $suf = $this->config['friendly_url_suffix']; |
675 | 675 | $pre = preg_quote($pre, '/'); |
676 | 676 | $suf = preg_quote($suf, '/'); |
677 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
677 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
678 | 678 | $q = $_[1]; |
679 | 679 | } |
680 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
680 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
681 | 681 | $q = $_[1]; |
682 | 682 | } |
683 | 683 | |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | 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 */ |
700 | 700 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
701 | 701 | if ($this->config['use_alias_path'] == 1) { |
702 | - 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))))) { |
|
702 | + 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))))) { |
|
703 | 703 | $this->documentMethod = 'id'; |
704 | 704 | return $q; |
705 | 705 | } else { /* not a valid id in terms of virtualDir, treat as alias */ |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | */ |
734 | 734 | public function getHashFile($key) |
735 | 735 | { |
736 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
736 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | /** |
@@ -744,9 +744,9 @@ discard block |
||
744 | 744 | $hash = $id; |
745 | 745 | $tmp = null; |
746 | 746 | $params = array(); |
747 | - if(!empty($this->systemCacheKey)){ |
|
747 | + if (!empty($this->systemCacheKey)) { |
|
748 | 748 | $hash = $this->systemCacheKey; |
749 | - }else { |
|
749 | + } else { |
|
750 | 750 | if (!empty($_GET)) { |
751 | 751 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
752 | 752 | $params = $_GET; |
@@ -754,8 +754,8 @@ discard block |
||
754 | 754 | $hash .= '_'.md5(http_build_query($params)); |
755 | 755 | } |
756 | 756 | } |
757 | - $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
|
758 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
757 | + $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
|
758 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
759 | 759 | $tmp = array_pop($evtOut); |
760 | 760 | } |
761 | 761 | return empty($tmp) ? $hash : $tmp; |
@@ -897,12 +897,12 @@ discard block |
||
897 | 897 | if ($js = $this->getRegisteredClientStartupScripts()) { |
898 | 898 | // change to just before closing </head> |
899 | 899 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
900 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
900 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
901 | 901 | } |
902 | 902 | |
903 | 903 | // Insert jscripts & html block into template - template must have a </body> tag |
904 | 904 | if ($js = $this->getRegisteredClientScripts()) { |
905 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
905 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
906 | 906 | } |
907 | 907 | // End fix by sirlancelot |
908 | 908 | |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | // send out content-type and content-disposition headers |
914 | 914 | if (IN_PARSER_MODE == "true") { |
915 | 915 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
916 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
916 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
917 | 917 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
918 | 918 | // header('HTTP/1.0 404 Not Found'); |
919 | 919 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | $name = preg_replace('|-+|', '-', $name); |
932 | 932 | $name = trim($name, '-'); |
933 | 933 | } |
934 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
934 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
935 | 935 | header($header); |
936 | 936 | } |
937 | 937 | } |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | |
940 | 940 | $stats = $this->getTimerStats($this->tstart); |
941 | 941 | |
942 | - $out =& $this->documentOutput; |
|
942 | + $out = & $this->documentOutput; |
|
943 | 943 | $out = str_replace("[^q^]", $stats['queries'], $out); |
944 | 944 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
945 | 945 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -978,17 +978,17 @@ discard block |
||
978 | 978 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
979 | 979 | $tt += $t; |
980 | 980 | } |
981 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
981 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; |
|
982 | 982 | echo $this->snippetsCode; |
983 | 983 | } |
984 | 984 | if ($this->dumpPlugins) { |
985 | 985 | $ps = ""; |
986 | 986 | $tt = 0; |
987 | 987 | foreach ($this->pluginsTime as $s => $t) { |
988 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
988 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
989 | 989 | $tt += $t; |
990 | 990 | } |
991 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
991 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
992 | 992 | echo $this->pluginsCode; |
993 | 993 | } |
994 | 994 | |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | $srcTags = explode(',', $tags); |
1015 | 1015 | $repTags = array(); |
1016 | 1016 | foreach ($srcTags as $tag) { |
1017 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
1017 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
1018 | 1018 | } |
1019 | 1019 | return array($srcTags, $repTags); |
1020 | 1020 | } |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
1037 | 1037 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
1038 | 1038 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
1039 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
1039 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
1040 | 1040 | |
1041 | 1041 | return $stats; |
1042 | 1042 | } |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | { |
1070 | 1070 | $cacheRefreshTime = 0; |
1071 | 1071 | $recent_update = 0; |
1072 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
1072 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
1073 | 1073 | $this->recentUpdate = $recent_update; |
1074 | 1074 | |
1075 | 1075 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1123,8 +1123,8 @@ discard block |
||
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 | $docObjSerial = serialize($this->documentObject); |
1126 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
1127 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
1126 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
1127 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
1128 | 1128 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
1129 | 1129 | } |
1130 | 1130 | } |
@@ -1166,16 +1166,16 @@ discard block |
||
1166 | 1166 | return array(); |
1167 | 1167 | } |
1168 | 1168 | $spacer = md5('<<<EVO>>>'); |
1169 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1170 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1171 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1172 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1169 | + if ($left === '{{' && strpos($content, ';}}') !== false) $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); |
|
1170 | + if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); |
|
1171 | + if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); |
|
1172 | + if ($left === '[[' && strpos($content, ']]]') !== false) $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); |
|
1173 | 1173 | |
1174 | 1174 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
1175 | 1175 | $pos[']]>'] = strpos($content, ']]>'); |
1176 | 1176 | |
1177 | 1177 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
1178 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
1178 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
1179 | 1179 | } |
1180 | 1180 | |
1181 | 1181 | $lp = explode($left, $content); |
@@ -1239,8 +1239,8 @@ discard block |
||
1239 | 1239 | } |
1240 | 1240 | } |
1241 | 1241 | } |
1242 | - foreach($tags as $i=>$tag) { |
|
1243 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1242 | + foreach ($tags as $i=>$tag) { |
|
1243 | + if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1244 | 1244 | } |
1245 | 1245 | return $tags; |
1246 | 1246 | } |
@@ -1280,7 +1280,7 @@ discard block |
||
1280 | 1280 | } |
1281 | 1281 | |
1282 | 1282 | foreach ($matches[1] as $i => $key) { |
1283 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1283 | + if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1284 | 1284 | if (substr($key, 0, 1) == '#') { |
1285 | 1285 | $key = substr($key, 1); |
1286 | 1286 | } // remove # for QuickEdit format |
@@ -1300,8 +1300,8 @@ discard block |
||
1300 | 1300 | } |
1301 | 1301 | |
1302 | 1302 | if (is_array($value)) { |
1303 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
1304 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
1303 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
1304 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
1305 | 1305 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
1306 | 1306 | } |
1307 | 1307 | |
@@ -1312,8 +1312,8 @@ discard block |
||
1312 | 1312 | |
1313 | 1313 | if (strpos($content, $s) !== false) { |
1314 | 1314 | $content = str_replace($s, $value, $content); |
1315 | - } elseif($this->debug) { |
|
1316 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1315 | + } elseif ($this->debug) { |
|
1316 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1317 | 1317 | } |
1318 | 1318 | } |
1319 | 1319 | |
@@ -1480,8 +1480,8 @@ discard block |
||
1480 | 1480 | $s = &$matches[0][$i]; |
1481 | 1481 | if (strpos($content, $s) !== false) { |
1482 | 1482 | $content = str_replace($s, $value, $content); |
1483 | - } elseif($this->debug) { |
|
1484 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1483 | + } elseif ($this->debug) { |
|
1484 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1485 | 1485 | } |
1486 | 1486 | } |
1487 | 1487 | return $content; |
@@ -1534,7 +1534,7 @@ discard block |
||
1534 | 1534 | } |
1535 | 1535 | |
1536 | 1536 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
1537 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1537 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
1538 | 1538 | if ($this->config['enable_at_syntax']) { |
1539 | 1539 | $value = $this->mergeConditionalTagsContent($value); |
1540 | 1540 | } |
@@ -1549,8 +1549,8 @@ discard block |
||
1549 | 1549 | $s = &$matches[0][$i]; |
1550 | 1550 | if (strpos($content, $s) !== false) { |
1551 | 1551 | $content = str_replace($s, $value, $content); |
1552 | - } elseif($this->debug) { |
|
1553 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1552 | + } elseif ($this->debug) { |
|
1553 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1554 | 1554 | } |
1555 | 1555 | } |
1556 | 1556 | return $content; |
@@ -1608,8 +1608,8 @@ discard block |
||
1608 | 1608 | $s = &$matches[0][$i]; |
1609 | 1609 | if (strpos($content, $s) !== false) { |
1610 | 1610 | $content = str_replace($s, $value, $content); |
1611 | - } elseif($this->debug) { |
|
1612 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1611 | + } elseif ($this->debug) { |
|
1612 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1613 | 1613 | } |
1614 | 1614 | } |
1615 | 1615 | return $content; |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | return $content; |
1634 | 1634 | } |
1635 | 1635 | |
1636 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
1636 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
1637 | 1637 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); |
1638 | 1638 | |
1639 | 1639 | $pieces = explode('<@IF:', $content); |
@@ -1644,7 +1644,7 @@ discard block |
||
1644 | 1644 | } |
1645 | 1645 | list($cmd, $text) = explode('>', $split, 2); |
1646 | 1646 | $cmd = str_replace("'", "\'", $cmd); |
1647 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1647 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1648 | 1648 | $content .= $text; |
1649 | 1649 | } |
1650 | 1650 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1655,13 +1655,13 @@ discard block |
||
1655 | 1655 | } |
1656 | 1656 | list($cmd, $text) = explode('>', $split, 2); |
1657 | 1657 | $cmd = str_replace("'", "\'", $cmd); |
1658 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
1658 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
1659 | 1659 | $content .= $text; |
1660 | 1660 | } |
1661 | 1661 | |
1662 | 1662 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
1663 | 1663 | ob_start(); |
1664 | - $content = eval('?>' . $content); |
|
1664 | + $content = eval('?>'.$content); |
|
1665 | 1665 | $content = ob_get_clean(); |
1666 | 1666 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); |
1667 | 1667 | |
@@ -1786,7 +1786,7 @@ discard block |
||
1786 | 1786 | $matches = $this->getTagsFromContent($content, $left, $right); |
1787 | 1787 | if (!empty($matches)) { |
1788 | 1788 | foreach ($matches[0] as $i => $v) { |
1789 | - $addBreakMatches[$i] = $v . "\n"; |
|
1789 | + $addBreakMatches[$i] = $v."\n"; |
|
1790 | 1790 | } |
1791 | 1791 | $content = str_replace($addBreakMatches, '', $content); |
1792 | 1792 | if (strpos($content, $left) !== false) { |
@@ -1819,8 +1819,8 @@ discard block |
||
1819 | 1819 | $s = &$matches[0][$i]; |
1820 | 1820 | if (strpos($content, $s) !== false) { |
1821 | 1821 | $content = str_replace($s, $v, $content); |
1822 | - } elseif($this->debug) { |
|
1823 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1822 | + } elseif ($this->debug) { |
|
1823 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1824 | 1824 | } |
1825 | 1825 | } |
1826 | 1826 | return $content; |
@@ -1884,7 +1884,7 @@ discard block |
||
1884 | 1884 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg; |
1885 | 1885 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); |
1886 | 1886 | if ($this->isBackend()) { |
1887 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
1887 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
1888 | 1888 | } |
1889 | 1889 | } |
1890 | 1890 | } else { |
@@ -1930,7 +1930,7 @@ discard block |
||
1930 | 1930 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo; |
1931 | 1931 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); |
1932 | 1932 | if ($this->isBackend()) { |
1933 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
1933 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
1934 | 1934 | } |
1935 | 1935 | } |
1936 | 1936 | } |
@@ -1938,7 +1938,7 @@ discard block |
||
1938 | 1938 | if (is_array($return) || is_object($return)) { |
1939 | 1939 | return $return; |
1940 | 1940 | } else { |
1941 | - return $echo . $return; |
|
1941 | + return $echo.$return; |
|
1942 | 1942 | } |
1943 | 1943 | } |
1944 | 1944 | |
@@ -1976,8 +1976,8 @@ discard block |
||
1976 | 1976 | } |
1977 | 1977 | if (strpos($content, $s) !== false) { |
1978 | 1978 | $content = str_replace($s, $value, $content); |
1979 | - } elseif($this->debug) { |
|
1980 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1979 | + } elseif ($this->debug) { |
|
1980 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1981 | 1981 | } |
1982 | 1982 | continue; |
1983 | 1983 | } |
@@ -1988,8 +1988,8 @@ discard block |
||
1988 | 1988 | |
1989 | 1989 | if (strpos($content, $s) !== false) { |
1990 | 1990 | $content = str_replace($s, $value, $content); |
1991 | - } elseif($this->debug) { |
|
1992 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
1991 | + } elseif ($this->debug) { |
|
1992 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
1993 | 1993 | } |
1994 | 1994 | } |
1995 | 1995 | |
@@ -2081,7 +2081,7 @@ discard block |
||
2081 | 2081 | $eventtime = sprintf('%2.2f ms', $eventtime * 1000); |
2082 | 2082 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
2083 | 2083 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
2084 | - $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
2084 | + $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
2085 | 2085 | $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); |
2086 | 2086 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
2087 | 2087 | } |
@@ -2325,7 +2325,7 @@ discard block |
||
2325 | 2325 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
2326 | 2326 | $count = $this->db->getRecordCount($rs); |
2327 | 2327 | if (1 < $count) { |
2328 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
2328 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
2329 | 2329 | } |
2330 | 2330 | if ($count) { |
2331 | 2331 | $row = $this->db->getRow($rs); |
@@ -2351,7 +2351,7 @@ discard block |
||
2351 | 2351 | public function toAlias($text) |
2352 | 2352 | { |
2353 | 2353 | $suff = $this->config['friendly_url_suffix']; |
2354 | - 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); |
|
2354 | + 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); |
|
2355 | 2355 | } |
2356 | 2356 | |
2357 | 2357 | /** |
@@ -2383,7 +2383,7 @@ discard block |
||
2383 | 2383 | $suff = '/'; |
2384 | 2384 | } |
2385 | 2385 | |
2386 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
2386 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
2387 | 2387 | } |
2388 | 2388 | |
2389 | 2389 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2420,7 +2420,7 @@ discard block |
||
2420 | 2420 | preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); |
2421 | 2421 | $ids = implode(',', array_unique($match['1'])); |
2422 | 2422 | if ($ids) { |
2423 | - $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
2423 | + $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
2424 | 2424 | while ($row = $this->db->getRow($res)) { |
2425 | 2425 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
2426 | 2426 | $parent = $row['parent']; |
@@ -2431,7 +2431,7 @@ discard block |
||
2431 | 2431 | $parent = $this->aliasListing[$parent]['parent']; |
2432 | 2432 | } |
2433 | 2433 | |
2434 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
2434 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
2435 | 2435 | } else { |
2436 | 2436 | $aliases[$row['id']] = $row['alias']; |
2437 | 2437 | } |
@@ -2443,7 +2443,7 @@ discard block |
||
2443 | 2443 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2444 | 2444 | $pref = $this->config['friendly_url_prefix']; |
2445 | 2445 | $suff = $this->config['friendly_url_suffix']; |
2446 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2446 | + $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2447 | 2447 | global $modx; |
2448 | 2448 | $thealias = $aliases[$m[1]]; |
2449 | 2449 | $thefolder = $isfolder[$m[1]]; |
@@ -2459,7 +2459,7 @@ discard block |
||
2459 | 2459 | |
2460 | 2460 | } else { |
2461 | 2461 | $in = '!\[\~([0-9]+)\~\]!is'; |
2462 | - $out = "index.php?id=" . '\1'; |
|
2462 | + $out = "index.php?id=".'\1'; |
|
2463 | 2463 | $documentSource = preg_replace($in, $out, $documentSource); |
2464 | 2464 | } |
2465 | 2465 | |
@@ -2480,7 +2480,7 @@ discard block |
||
2480 | 2480 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
2481 | 2481 | $len_base_url = strlen($this->config['base_url']); |
2482 | 2482 | |
2483 | - $url_path = $q;//LANG |
|
2483 | + $url_path = $q; //LANG |
|
2484 | 2484 | |
2485 | 2485 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
2486 | 2486 | $url_path = substr($url_path, $len_base_url); |
@@ -2492,7 +2492,7 @@ discard block |
||
2492 | 2492 | $strictURL = substr($strictURL, $len_base_url); |
2493 | 2493 | } |
2494 | 2494 | $http_host = $_SERVER['HTTP_HOST']; |
2495 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
2495 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
2496 | 2496 | |
2497 | 2497 | $site_url = $this->config['site_url']; |
2498 | 2498 | |
@@ -2508,7 +2508,7 @@ discard block |
||
2508 | 2508 | } |
2509 | 2509 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
2510 | 2510 | if (empty($_POST)) { |
2511 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
2511 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
2512 | 2512 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
2513 | 2513 | exit(0); |
2514 | 2514 | } |
@@ -2571,7 +2571,7 @@ discard block |
||
2571 | 2571 | $docgrp = implode(",", $docgrp); |
2572 | 2572 | } |
2573 | 2573 | // get document |
2574 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2574 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
2575 | 2575 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
2576 | 2576 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
2577 | 2577 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2607,9 +2607,9 @@ discard block |
||
2607 | 2607 | } |
2608 | 2608 | if ($documentObject['template']) { |
2609 | 2609 | // load TVs and merge with document - Orig by Apodigm - Docvars |
2610 | - $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv |
|
2611 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
2612 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2610 | + $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv |
|
2611 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
2612 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
2613 | 2613 | $tmplvars = array(); |
2614 | 2614 | while ($row = $this->db->getRow($rs)) { |
2615 | 2615 | $tmplvars[$row['name']] = array( |
@@ -2655,7 +2655,7 @@ discard block |
||
2655 | 2655 | $st = md5($source); |
2656 | 2656 | } |
2657 | 2657 | if ($this->dumpSnippets == 1) { |
2658 | - $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>"; |
|
2658 | + $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>"; |
|
2659 | 2659 | } |
2660 | 2660 | |
2661 | 2661 | // invoke OnParseDocument event |
@@ -2741,7 +2741,7 @@ discard block |
||
2741 | 2741 | |
2742 | 2742 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
2743 | 2743 | if ($this->config['use_alias_path'] == 1) { |
2744 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
2744 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
2745 | 2745 | if (isset($this->documentListing[$alias])) { |
2746 | 2746 | $this->documentIdentifier = $this->documentListing[$alias]; |
2747 | 2747 | } else { |
@@ -2802,7 +2802,7 @@ discard block |
||
2802 | 2802 | } else { |
2803 | 2803 | $docAlias = $this->db->escape($this->documentIdentifier); |
2804 | 2804 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); |
2805 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
2805 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
2806 | 2806 | } |
2807 | 2807 | } |
2808 | 2808 | $this->documentMethod = 'id'; |
@@ -2855,7 +2855,7 @@ discard block |
||
2855 | 2855 | $_REQUEST[$n] = $_GET[$n] = $v; |
2856 | 2856 | } |
2857 | 2857 | } |
2858 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
2858 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
2859 | 2859 | $this->q = $qp['path']; |
2860 | 2860 | return $qp['path']; |
2861 | 2861 | } |
@@ -2949,7 +2949,7 @@ discard block |
||
2949 | 2949 | $this->sendErrorPage(); |
2950 | 2950 | } else { |
2951 | 2951 | // Inculde the necessary files to check document permissions |
2952 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
2952 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
2953 | 2953 | $udperms = new udperms(); |
2954 | 2954 | $udperms->user = $this->getLoginUserID(); |
2955 | 2955 | $udperms->document = $this->documentIdentifier; |
@@ -3003,7 +3003,7 @@ discard block |
||
3003 | 3003 | while ($id && $height--) { |
3004 | 3004 | $thisid = $id; |
3005 | 3005 | if ($this->config['aliaslistingfolder'] == 1) { |
3006 | - $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3006 | + $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1"); |
|
3007 | 3007 | if (!$id || $id == '0') { |
3008 | 3008 | break; |
3009 | 3009 | } |
@@ -3054,15 +3054,15 @@ discard block |
||
3054 | 3054 | |
3055 | 3055 | if ($this->config['aliaslistingfolder'] == 1) { |
3056 | 3056 | |
3057 | - $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
3057 | + $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
3058 | 3058 | $idx = array(); |
3059 | 3059 | while ($row = $this->db->getRow($res)) { |
3060 | 3060 | $pAlias = ''; |
3061 | 3061 | if (isset($this->aliasListing[$row['parent']])) { |
3062 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
3063 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
3062 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
3063 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
3064 | 3064 | }; |
3065 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
3065 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
3066 | 3066 | if ($row['isfolder'] == 1) { |
3067 | 3067 | $idx[] = $row['id']; |
3068 | 3068 | } |
@@ -3094,7 +3094,7 @@ discard block |
||
3094 | 3094 | $depth--; |
3095 | 3095 | |
3096 | 3096 | foreach ($documentMap_cache[$id] as $childId) { |
3097 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
3097 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
3098 | 3098 | if (!strlen($pkey)) { |
3099 | 3099 | $pkey = "{$childId}"; |
3100 | 3100 | } |
@@ -3120,11 +3120,11 @@ discard block |
||
3120 | 3120 | public function webAlertAndQuit($msg, $url = "") |
3121 | 3121 | { |
3122 | 3122 | global $modx_manager_charset; |
3123 | - if($this->ajaxMode === true) $this->jsonResponse(array('error'=>$msg)); |
|
3123 | + if ($this->ajaxMode === true) $this->jsonResponse(array('error'=>$msg)); |
|
3124 | 3124 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
3125 | 3125 | $fnc = substr($url, 11); |
3126 | 3126 | } elseif ($url) { |
3127 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
3127 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
3128 | 3128 | } else { |
3129 | 3129 | $fnc = "history.back(-1);"; |
3130 | 3130 | } |
@@ -3133,7 +3133,7 @@ discard block |
||
3133 | 3133 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
3134 | 3134 | <script> |
3135 | 3135 | function __alertQuit() { |
3136 | - alert('" . addslashes($msg) . "'); |
|
3136 | + alert('".addslashes($msg)."'); |
|
3137 | 3137 | {$fnc} |
3138 | 3138 | } |
3139 | 3139 | window.setTimeout('__alertQuit();',100); |
@@ -3157,7 +3157,7 @@ discard block |
||
3157 | 3157 | if ($pms) { |
3158 | 3158 | $state = ($pms[$pm] == 1); |
3159 | 3159 | } |
3160 | - return (int)$state; |
|
3160 | + return (int) $state; |
|
3161 | 3161 | } |
3162 | 3162 | |
3163 | 3163 | /** |
@@ -3238,7 +3238,7 @@ discard block |
||
3238 | 3238 | $this->lockedElements = array(); |
3239 | 3239 | $this->cleanupExpiredLocks(); |
3240 | 3240 | |
3241 | - $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul |
|
3241 | + $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul |
|
3242 | 3242 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
3243 | 3243 | while ($row = $this->db->getRow($rs)) { |
3244 | 3244 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3274,7 +3274,7 @@ discard block |
||
3274 | 3274 | foreach ($rs as $row) { |
3275 | 3275 | $userSids[] = $row['sid']; |
3276 | 3276 | } |
3277 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
3277 | + $userSids = "'".implode("','", $userSids)."'"; |
|
3278 | 3278 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
3279 | 3279 | } else { |
3280 | 3280 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3471,8 +3471,8 @@ discard block |
||
3471 | 3471 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
3472 | 3472 | if ($this->config['send_errormail'] <= $type) { |
3473 | 3473 | $this->sendmail(array( |
3474 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
3475 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
3474 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
3475 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
3476 | 3476 | 'type' => 'text' |
3477 | 3477 | )); |
3478 | 3478 | } |
@@ -3520,7 +3520,7 @@ discard block |
||
3520 | 3520 | $p['fromname'] = $userinfo['username']; |
3521 | 3521 | } |
3522 | 3522 | if ($msg === '' && !isset($p['body'])) { |
3523 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
3523 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
3524 | 3524 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
3525 | 3525 | $p['body'] = $msg; |
3526 | 3526 | } |
@@ -3560,8 +3560,8 @@ discard block |
||
3560 | 3560 | $files = array(); |
3561 | 3561 | } |
3562 | 3562 | foreach ($files as $f) { |
3563 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
3564 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
3563 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
3564 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
3565 | 3565 | } |
3566 | 3566 | } |
3567 | 3567 | $rs = $this->mail->send(); |
@@ -3606,7 +3606,7 @@ discard block |
||
3606 | 3606 | */ |
3607 | 3607 | public function isFrontend() |
3608 | 3608 | { |
3609 | - return ! $this->isBackend(); |
|
3609 | + return !$this->isBackend(); |
|
3610 | 3610 | } |
3611 | 3611 | |
3612 | 3612 | /** |
@@ -3631,14 +3631,14 @@ discard block |
||
3631 | 3631 | $tblsc = $this->getFullTableName("site_content"); |
3632 | 3632 | $tbldg = $this->getFullTableName("document_groups"); |
3633 | 3633 | // modify field names to use sc. table reference |
3634 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3635 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3634 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3635 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3636 | 3636 | // get document groups for current user |
3637 | 3637 | if ($docgrp = $this->getUserDocGroups()) { |
3638 | 3638 | $docgrp = implode(",", $docgrp); |
3639 | 3639 | } |
3640 | 3640 | // build query |
3641 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3641 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3642 | 3642 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3643 | 3643 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
3644 | 3644 | $resourceArray = $this->db->makeArray($result); |
@@ -3668,14 +3668,14 @@ discard block |
||
3668 | 3668 | $tbldg = $this->getFullTableName("document_groups"); |
3669 | 3669 | |
3670 | 3670 | // modify field names to use sc. table reference |
3671 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3672 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3671 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3672 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3673 | 3673 | // get document groups for current user |
3674 | 3674 | if ($docgrp = $this->getUserDocGroups()) { |
3675 | 3675 | $docgrp = implode(",", $docgrp); |
3676 | 3676 | } |
3677 | 3677 | // build query |
3678 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3678 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3679 | 3679 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3680 | 3680 | 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}"); |
3681 | 3681 | $resourceArray = $this->db->makeArray($result); |
@@ -3710,16 +3710,16 @@ discard block |
||
3710 | 3710 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
3711 | 3711 | } |
3712 | 3712 | |
3713 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
3714 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
3713 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
3714 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
3715 | 3715 | |
3716 | 3716 | if ($where != '') { |
3717 | - $where = 'AND ' . $where; |
|
3717 | + $where = 'AND '.$where; |
|
3718 | 3718 | } |
3719 | 3719 | |
3720 | 3720 | // modify field names to use sc. table reference |
3721 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3722 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3721 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3722 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3723 | 3723 | |
3724 | 3724 | // get document groups for current user |
3725 | 3725 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3727,7 +3727,7 @@ discard block |
||
3727 | 3727 | } |
3728 | 3728 | |
3729 | 3729 | // build query |
3730 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3730 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3731 | 3731 | |
3732 | 3732 | $tblsc = $this->getFullTableName('site_content'); |
3733 | 3733 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3779,10 +3779,10 @@ discard block |
||
3779 | 3779 | return false; |
3780 | 3780 | } else { |
3781 | 3781 | // modify field names to use sc. table reference |
3782 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3783 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3782 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3783 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
3784 | 3784 | if ($where != '') { |
3785 | - $where = 'AND ' . $where; |
|
3785 | + $where = 'AND '.$where; |
|
3786 | 3786 | } |
3787 | 3787 | |
3788 | 3788 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3793,13 +3793,13 @@ discard block |
||
3793 | 3793 | $docgrp = implode(',', $docgrp); |
3794 | 3794 | } |
3795 | 3795 | |
3796 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
3796 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
3797 | 3797 | |
3798 | 3798 | $tblsc = $this->getFullTableName('site_content'); |
3799 | 3799 | $tbldg = $this->getFullTableName('document_groups'); |
3800 | 3800 | |
3801 | 3801 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
3802 | - 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); |
|
3802 | + 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); |
|
3803 | 3803 | |
3804 | 3804 | $resourceArray = $this->db->makeArray($result); |
3805 | 3805 | |
@@ -3904,12 +3904,12 @@ discard block |
||
3904 | 3904 | $tbldg = $this->getFullTableName("document_groups"); |
3905 | 3905 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
3906 | 3906 | // modify field names to use sc. table reference |
3907 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3907 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
3908 | 3908 | // get document groups for current user |
3909 | 3909 | if ($docgrp = $this->getUserDocGroups()) { |
3910 | 3910 | $docgrp = implode(",", $docgrp); |
3911 | 3911 | } |
3912 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3912 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
3913 | 3913 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
3914 | 3914 | $pageInfo = $this->db->getRow($result); |
3915 | 3915 | |
@@ -3956,7 +3956,7 @@ discard block |
||
3956 | 3956 | { |
3957 | 3957 | if ($this->currentSnippet) { |
3958 | 3958 | $tbl = $this->getFullTableName("site_snippets"); |
3959 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
3959 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
3960 | 3960 | if ($snippetId = $this->db->getValue($rs)) { |
3961 | 3961 | return $snippetId; |
3962 | 3962 | } |
@@ -3983,23 +3983,23 @@ discard block |
||
3983 | 3983 | */ |
3984 | 3984 | public function clearCache($type = '', $report = false) |
3985 | 3985 | { |
3986 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
3986 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
3987 | 3987 | if (is_array($type)) { |
3988 | 3988 | foreach ($type as $_) { |
3989 | 3989 | $this->clearCache($_, $report); |
3990 | 3990 | } |
3991 | 3991 | } elseif ($type == 'full') { |
3992 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
3992 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
3993 | 3993 | $sync = new synccache(); |
3994 | 3994 | $sync->setCachepath($cache_dir); |
3995 | 3995 | $sync->setReport($report); |
3996 | 3996 | $sync->emptyCache(); |
3997 | 3997 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
3998 | 3998 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
3999 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
4000 | - $cache_path = $cache_dir . $file_name; |
|
3999 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
4000 | + $cache_path = $cache_dir.$file_name; |
|
4001 | 4001 | $files = glob($cache_path); |
4002 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
4002 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
4003 | 4003 | foreach ($files as $file) { |
4004 | 4004 | if (!is_file($file)) { |
4005 | 4005 | continue; |
@@ -4007,7 +4007,7 @@ discard block |
||
4007 | 4007 | unlink($file); |
4008 | 4008 | } |
4009 | 4009 | } else { |
4010 | - $files = glob($cache_dir . '*'); |
|
4010 | + $files = glob($cache_dir.'*'); |
|
4011 | 4011 | foreach ($files as $file) { |
4012 | 4012 | $name = basename($file); |
4013 | 4013 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4076,7 +4076,7 @@ discard block |
||
4076 | 4076 | $f_url_suffix = '/'; |
4077 | 4077 | } |
4078 | 4078 | |
4079 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : ''; |
|
4079 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : ''; |
|
4080 | 4080 | |
4081 | 4081 | if ($al && $al['alias']) { |
4082 | 4082 | $alias = $al['alias']; |
@@ -4084,7 +4084,7 @@ discard block |
||
4084 | 4084 | |
4085 | 4085 | } |
4086 | 4086 | |
4087 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
4087 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
4088 | 4088 | $url = "{$alias}{$args}"; |
4089 | 4089 | } else { |
4090 | 4090 | $url = "index.php?id={$id}{$args}"; |
@@ -4103,7 +4103,7 @@ discard block |
||
4103 | 4103 | } |
4104 | 4104 | |
4105 | 4105 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
4106 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
4106 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
4107 | 4107 | } |
4108 | 4108 | |
4109 | 4109 | //fix strictUrl by Bumkaka |
@@ -4112,9 +4112,9 @@ discard block |
||
4112 | 4112 | } |
4113 | 4113 | |
4114 | 4114 | if ($this->config['xhtml_urls']) { |
4115 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
4115 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
4116 | 4116 | } else { |
4117 | - $url = $host . $virtualDir . $url; |
|
4117 | + $url = $host.$virtualDir.$url; |
|
4118 | 4118 | } |
4119 | 4119 | |
4120 | 4120 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4138,21 +4138,21 @@ discard block |
||
4138 | 4138 | if (isset($this->aliasListing[$id])) { |
4139 | 4139 | $out = $this->aliasListing[$id]; |
4140 | 4140 | } else { |
4141 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
4141 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
4142 | 4142 | if ($this->db->getRecordCount($q) == '1') { |
4143 | 4143 | $q = $this->db->getRow($q); |
4144 | 4144 | $this->aliasListing[$id] = array( |
4145 | - 'id' => (int)$q['id'], |
|
4145 | + 'id' => (int) $q['id'], |
|
4146 | 4146 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
4147 | - 'parent' => (int)$q['parent'], |
|
4148 | - 'isfolder' => (int)$q['isfolder'], |
|
4147 | + 'parent' => (int) $q['parent'], |
|
4148 | + 'isfolder' => (int) $q['isfolder'], |
|
4149 | 4149 | ); |
4150 | 4150 | if ($this->aliasListing[$id]['parent'] > 0) { |
4151 | 4151 | //fix alias_path_usage |
4152 | 4152 | if ($this->config['use_alias_path'] == '1') { |
4153 | 4153 | //&& $tmp['path'] != '' - fix error slash with epty path |
4154 | 4154 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
4155 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
4155 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
4156 | 4156 | } else { |
4157 | 4157 | $this->aliasListing[$id]['path'] = ''; |
4158 | 4158 | } |
@@ -4193,7 +4193,7 @@ discard block |
||
4193 | 4193 | $out = array(); |
4194 | 4194 | if (empty($this->version) || !is_array($this->version)) { |
4195 | 4195 | //include for compatibility modx version < 1.0.10 |
4196 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
4196 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
4197 | 4197 | $this->version = array(); |
4198 | 4198 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
4199 | 4199 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4215,18 +4215,18 @@ discard block |
||
4215 | 4215 | { |
4216 | 4216 | if (isset ($this->snippetCache[$snippetName])) { |
4217 | 4217 | $snippet = $this->snippetCache[$snippetName]; |
4218 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
4218 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
4219 | 4219 | } else { // not in cache so let's check the db |
4220 | - $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
|
4220 | + $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."' AND ss.disabled=0;"; |
|
4221 | 4221 | $result = $this->db->query($sql); |
4222 | 4222 | if ($this->db->getRecordCount($result) == 1) { |
4223 | 4223 | $row = $this->db->getRow($result); |
4224 | 4224 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
4225 | 4225 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties'])); |
4226 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
4226 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
4227 | 4227 | } else { |
4228 | 4228 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
4229 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
4229 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
4230 | 4230 | } |
4231 | 4231 | } |
4232 | 4232 | // load default params/properties |
@@ -4329,8 +4329,8 @@ discard block |
||
4329 | 4329 | } |
4330 | 4330 | if (strpos($tpl, $s) !== false) { |
4331 | 4331 | $tpl = str_replace($s, $value, $tpl); |
4332 | - } elseif($this->debug) { |
|
4333 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
4332 | + } elseif ($this->debug) { |
|
4333 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
4334 | 4334 | } |
4335 | 4335 | } |
4336 | 4336 | |
@@ -4379,7 +4379,7 @@ discard block |
||
4379 | 4379 | case 'CODE': |
4380 | 4380 | break; |
4381 | 4381 | case 'FILE': |
4382 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
4382 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
4383 | 4383 | break; |
4384 | 4384 | case 'CHUNK': |
4385 | 4385 | $template = $this->getChunk($template); |
@@ -4432,7 +4432,7 @@ discard block |
||
4432 | 4432 | } |
4433 | 4433 | |
4434 | 4434 | if (empty($mode)) { |
4435 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
4435 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
4436 | 4436 | } elseif ($mode == 'dateOnly') { |
4437 | 4437 | $strTime = strftime($dateFormat, $timestamp); |
4438 | 4438 | } elseif ($mode == 'formatOnly') { |
@@ -4528,7 +4528,7 @@ discard block |
||
4528 | 4528 | if ($v === 'value') { |
4529 | 4529 | unset($_[$i]); |
4530 | 4530 | } else { |
4531 | - $_[$i] = 'tv.' . $v; |
|
4531 | + $_[$i] = 'tv.'.$v; |
|
4532 | 4532 | } |
4533 | 4533 | } |
4534 | 4534 | $fields = join(',', $_); |
@@ -4537,12 +4537,12 @@ discard block |
||
4537 | 4537 | } |
4538 | 4538 | |
4539 | 4539 | if ($tvsort != '') { |
4540 | - $tvsort = 'tv.' . join(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4540 | + $tvsort = 'tv.'.join(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
4541 | 4541 | } |
4542 | 4542 | if ($tvidnames == "*") { |
4543 | 4543 | $query = "tv.id<>0"; |
4544 | 4544 | } else { |
4545 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . join("','", $tvidnames) . "')"; |
|
4545 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".join("','", $tvidnames)."')"; |
|
4546 | 4546 | } |
4547 | 4547 | |
4548 | 4548 | $this->getUserDocGroups(); |
@@ -4686,7 +4686,7 @@ discard block |
||
4686 | 4686 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
4687 | 4687 | } |
4688 | 4688 | |
4689 | - if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) { |
|
4689 | + if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) { |
|
4690 | 4690 | return false; |
4691 | 4691 | } else { |
4692 | 4692 | |
@@ -4704,23 +4704,23 @@ discard block |
||
4704 | 4704 | } |
4705 | 4705 | |
4706 | 4706 | // get user defined template variables |
4707 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4708 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4707 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
4708 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
4709 | 4709 | |
4710 | 4710 | if ($idnames == '*') { |
4711 | 4711 | $query = 'tv.id<>0'; |
4712 | 4712 | } else { |
4713 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
4713 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
4714 | 4714 | } |
4715 | 4715 | |
4716 | - $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv |
|
4717 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
4718 | - LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
|
4716 | + $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv |
|
4717 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
4718 | + LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : "")); |
|
4719 | 4719 | |
4720 | 4720 | $result = $this->db->makeArray($rs); |
4721 | 4721 | |
4722 | 4722 | // get default/built-in template variables |
4723 | - if(is_array($docRow)){ |
|
4723 | + if (is_array($docRow)) { |
|
4724 | 4724 | ksort($docRow); |
4725 | 4725 | |
4726 | 4726 | foreach ($docRow as $key => $value) { |
@@ -4758,7 +4758,7 @@ discard block |
||
4758 | 4758 | */ |
4759 | 4759 | public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '') |
4760 | 4760 | { |
4761 | - if (is_array($idnames) && empty($idnames) ) { |
|
4761 | + if (is_array($idnames) && empty($idnames)) { |
|
4762 | 4762 | return false; |
4763 | 4763 | } else { |
4764 | 4764 | $output = array(); |
@@ -4771,9 +4771,9 @@ discard block |
||
4771 | 4771 | if ($result == false) { |
4772 | 4772 | return false; |
4773 | 4773 | } else { |
4774 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
4775 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
4776 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
4774 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
4775 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
4776 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
4777 | 4777 | |
4778 | 4778 | for ($i = 0; $i < count($result); $i++) { |
4779 | 4779 | $row = $result[$i]; |
@@ -4798,7 +4798,7 @@ discard block |
||
4798 | 4798 | */ |
4799 | 4799 | public function getFullTableName($tbl) |
4800 | 4800 | { |
4801 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
4801 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
4802 | 4802 | } |
4803 | 4803 | |
4804 | 4804 | /** |
@@ -4877,7 +4877,7 @@ discard block |
||
4877 | 4877 | public function getCachePath() |
4878 | 4878 | { |
4879 | 4879 | global $base_url; |
4880 | - $pth = $base_url . $this->getCacheFolder(); |
|
4880 | + $pth = $base_url.$this->getCacheFolder(); |
|
4881 | 4881 | return $pth; |
4882 | 4882 | } |
4883 | 4883 | |
@@ -4929,8 +4929,8 @@ discard block |
||
4929 | 4929 | $out = false; |
4930 | 4930 | |
4931 | 4931 | if (!empty($context)) { |
4932 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4933 | - $out = $_SESSION[$context . 'InternalKey']; |
|
4932 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4933 | + $out = $_SESSION[$context.'InternalKey']; |
|
4934 | 4934 | } |
4935 | 4935 | } else { |
4936 | 4936 | switch (true) { |
@@ -4958,8 +4958,8 @@ discard block |
||
4958 | 4958 | $out = false; |
4959 | 4959 | |
4960 | 4960 | if (!empty($context)) { |
4961 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
4962 | - $out = $_SESSION[$context . 'Shortname']; |
|
4961 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
4962 | + $out = $_SESSION[$context.'Shortname']; |
|
4963 | 4963 | } |
4964 | 4964 | } else { |
4965 | 4965 | switch (true) { |
@@ -5030,8 +5030,8 @@ discard block |
||
5030 | 5030 | */ |
5031 | 5031 | public function getWebUserInfo($uid) |
5032 | 5032 | { |
5033 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
5034 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5033 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
5034 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
5035 | 5035 | if ($row = $this->db->getRow($rs)) { |
5036 | 5036 | if (!isset($row['usertype']) or !$row["usertype"]) { |
5037 | 5037 | $row["usertype"] = "web"; |
@@ -5067,7 +5067,7 @@ discard block |
||
5067 | 5067 | } else if (is_array($dg)) { |
5068 | 5068 | // resolve ids to names |
5069 | 5069 | $dgn = array(); |
5070 | - $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); |
|
5070 | + $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); |
|
5071 | 5071 | while ($row = $this->db->getRow($ds)) { |
5072 | 5072 | $dgn[] = $row['name']; |
5073 | 5073 | } |
@@ -5095,7 +5095,7 @@ discard block |
||
5095 | 5095 | $rt = false; |
5096 | 5096 | if ($_SESSION["webValidated"] == 1) { |
5097 | 5097 | $tbl = $this->getFullTableName("web_users"); |
5098 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5098 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
5099 | 5099 | if ($row = $this->db->getRow($ds)) { |
5100 | 5100 | if ($row["password"] == md5($oldPwd)) { |
5101 | 5101 | if (strlen($newPwd) < 6) { |
@@ -5105,7 +5105,7 @@ discard block |
||
5105 | 5105 | } else { |
5106 | 5106 | $this->db->update(array( |
5107 | 5107 | 'password' => $this->db->escape($newPwd), |
5108 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
5108 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
5109 | 5109 | // invoke OnWebChangePassword event |
5110 | 5110 | $this->invokeEvent("OnWebChangePassword", array( |
5111 | 5111 | "userid" => $row["id"], |
@@ -5136,8 +5136,8 @@ discard block |
||
5136 | 5136 | // check cache |
5137 | 5137 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
5138 | 5138 | if (!is_array($grpNames)) { |
5139 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
5140 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
5139 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
5140 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
5141 | 5141 | $grpNames = $this->db->getColumn("name", $rs); |
5142 | 5142 | // save to cache |
5143 | 5143 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5170,7 +5170,7 @@ discard block |
||
5170 | 5170 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
5171 | 5171 | $this->sjscripts[$nextpos] = $src; |
5172 | 5172 | } else { |
5173 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
5173 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
5174 | 5174 | } |
5175 | 5175 | } |
5176 | 5176 | |
@@ -5249,7 +5249,7 @@ discard block |
||
5249 | 5249 | } |
5250 | 5250 | |
5251 | 5251 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
5252 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
5252 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
5253 | 5253 | } |
5254 | 5254 | if ($startup) { |
5255 | 5255 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5395,7 +5395,7 @@ discard block |
||
5395 | 5395 | $eventtime = $this->getMicroTime() - $eventtime; |
5396 | 5396 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
5397 | 5397 | foreach ($parameter as $k => $v) { |
5398 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
5398 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
5399 | 5399 | } |
5400 | 5400 | $this->pluginsCode .= '</fieldset><br />'; |
5401 | 5401 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5423,13 +5423,13 @@ discard block |
||
5423 | 5423 | $plugin = array(); |
5424 | 5424 | if (isset ($this->pluginCache[$pluginName])) { |
5425 | 5425 | $pluginCode = $this->pluginCache[$pluginName]; |
5426 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
5426 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
5427 | 5427 | } else { |
5428 | 5428 | $pluginName = $this->db->escape($pluginName); |
5429 | 5429 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
5430 | 5430 | if ($row = $this->db->getRow($result)) { |
5431 | 5431 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
5432 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
5432 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
5433 | 5433 | } else { |
5434 | 5434 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
5435 | 5435 | $pluginProperties = ''; |
@@ -5536,7 +5536,7 @@ discard block |
||
5536 | 5536 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
5537 | 5537 | { |
5538 | 5538 | $params = array(); |
5539 | - $fullpath = $element_dir . '/' . $filename; |
|
5539 | + $fullpath = $element_dir.'/'.$filename; |
|
5540 | 5540 | if (is_readable($fullpath)) { |
5541 | 5541 | $tpl = @fopen($fullpath, "r"); |
5542 | 5542 | if ($tpl) { |
@@ -5703,8 +5703,8 @@ discard block |
||
5703 | 5703 | $ph = array('site_url' => MODX_SITE_URL); |
5704 | 5704 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
5705 | 5705 | $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'; |
5706 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
5707 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
5706 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
5707 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
5708 | 5708 | foreach ($parsed as $key => $val) { |
5709 | 5709 | if (is_array($val)) { |
5710 | 5710 | foreach ($val as $key2 => $val2) { |
@@ -5713,7 +5713,7 @@ discard block |
||
5713 | 5713 | $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); |
5714 | 5714 | } |
5715 | 5715 | if (preg_match($regexEmail, $val2, $url)) { |
5716 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
5716 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
5717 | 5717 | } |
5718 | 5718 | $parsed[$key][$key2] = $val2; |
5719 | 5719 | } |
@@ -5723,7 +5723,7 @@ discard block |
||
5723 | 5723 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
5724 | 5724 | } |
5725 | 5725 | if (preg_match($regexEmail, $val, $url)) { |
5726 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
5726 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
5727 | 5727 | } |
5728 | 5728 | $parsed[$key] = $val; |
5729 | 5729 | } |
@@ -5737,32 +5737,32 @@ discard block |
||
5737 | 5737 | ); |
5738 | 5738 | |
5739 | 5739 | $nl = "\n"; |
5740 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
5741 | - $list .= '<p>' . $nl; |
|
5742 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
5743 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
5744 | - $list .= '</p><br/>' . $nl; |
|
5745 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
5746 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
5747 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
5748 | - $list .= '<br/>' . $nl; |
|
5740 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
5741 | + $list .= '<p>'.$nl; |
|
5742 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
5743 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
5744 | + $list .= '</p><br/>'.$nl; |
|
5745 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
5746 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
5747 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
5748 | + $list .= '<br/>'.$nl; |
|
5749 | 5749 | $first = true; |
5750 | 5750 | foreach ($arrayParams as $param => $label) { |
5751 | 5751 | if (isset($parsed[$param])) { |
5752 | 5752 | if ($first) { |
5753 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
5754 | - $list .= '<ul class="docBlockList">' . $nl; |
|
5753 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
5754 | + $list .= '<ul class="docBlockList">'.$nl; |
|
5755 | 5755 | $first = false; |
5756 | 5756 | } |
5757 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
5758 | - $list .= ' <ul>' . $nl; |
|
5757 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
5758 | + $list .= ' <ul>'.$nl; |
|
5759 | 5759 | foreach ($parsed[$param] as $val) { |
5760 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
5760 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
5761 | 5761 | } |
5762 | - $list .= ' </ul></li>' . $nl; |
|
5762 | + $list .= ' </ul></li>'.$nl; |
|
5763 | 5763 | } |
5764 | 5764 | } |
5765 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
5765 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
5766 | 5766 | |
5767 | 5767 | return $list; |
5768 | 5768 | } |
@@ -5838,7 +5838,7 @@ discard block |
||
5838 | 5838 | */ |
5839 | 5839 | public function addSnippet($name, $phpCode) |
5840 | 5840 | { |
5841 | - $this->snippetCache['#' . $name] = $phpCode; |
|
5841 | + $this->snippetCache['#'.$name] = $phpCode; |
|
5842 | 5842 | } |
5843 | 5843 | |
5844 | 5844 | /** |
@@ -5847,7 +5847,7 @@ discard block |
||
5847 | 5847 | */ |
5848 | 5848 | public function addChunk($name, $text) |
5849 | 5849 | { |
5850 | - $this->chunkCache['#' . $name] = $text; |
|
5850 | + $this->chunkCache['#'.$name] = $text; |
|
5851 | 5851 | } |
5852 | 5852 | |
5853 | 5853 | /** |
@@ -5883,7 +5883,7 @@ discard block |
||
5883 | 5883 | } |
5884 | 5884 | |
5885 | 5885 | if (!$isSafe) { |
5886 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
5886 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
5887 | 5887 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
5888 | 5888 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
5889 | 5889 | return; |
@@ -5897,7 +5897,7 @@ discard block |
||
5897 | 5897 | return 'array()'; |
5898 | 5898 | } |
5899 | 5899 | |
5900 | - $output = $echo . $return; |
|
5900 | + $output = $echo.$return; |
|
5901 | 5901 | modx_sanitize_gpc($output); |
5902 | 5902 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
5903 | 5903 | } |
@@ -5915,8 +5915,8 @@ discard block |
||
5915 | 5915 | |
5916 | 5916 | $safe = explode(',', $safe_functions); |
5917 | 5917 | |
5918 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
5919 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
5918 | + $phpcode = rtrim($phpcode, ';').';'; |
|
5919 | + $tokens = token_get_all('<?php '.$phpcode); |
|
5920 | 5920 | foreach ($tokens as $i => $token) { |
5921 | 5921 | if (!is_array($token)) { |
5922 | 5922 | continue; |
@@ -5952,7 +5952,7 @@ discard block |
||
5952 | 5952 | public function atBindFileContent($str = '') |
5953 | 5953 | { |
5954 | 5954 | |
5955 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); |
|
5955 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); |
|
5956 | 5956 | |
5957 | 5957 | if (stripos($str, '@FILE') !== 0) { |
5958 | 5958 | return $str; |
@@ -5975,7 +5975,7 @@ discard block |
||
5975 | 5975 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
5976 | 5976 | |
5977 | 5977 | foreach ($search_path as $path) { |
5978 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
5978 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
5979 | 5979 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
5980 | 5980 | return $errorMsg; |
5981 | 5981 | } elseif (is_file($file_path)) { |
@@ -5989,7 +5989,7 @@ discard block |
||
5989 | 5989 | return $errorMsg; |
5990 | 5990 | } |
5991 | 5991 | |
5992 | - $content = (string)file_get_contents($file_path); |
|
5992 | + $content = (string) file_get_contents($file_path); |
|
5993 | 5993 | if ($content === false) { |
5994 | 5994 | return $errorMsg; |
5995 | 5995 | } |
@@ -6102,22 +6102,22 @@ discard block |
||
6102 | 6102 | |
6103 | 6103 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
6104 | 6104 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
6105 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
6105 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
6106 | 6106 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
6107 | 6107 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
6108 | 6108 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
6109 | 6109 | if ($is_error) { |
6110 | 6110 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
6111 | 6111 | if ($msg != 'PHP Parse Error') { |
6112 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
6112 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
6113 | 6113 | } |
6114 | 6114 | } else { |
6115 | 6115 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
6116 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
6116 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
6117 | 6117 | } |
6118 | 6118 | |
6119 | 6119 | if (!empty ($query)) { |
6120 | - $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>'; |
|
6120 | + $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>'; |
|
6121 | 6121 | } |
6122 | 6122 | |
6123 | 6123 | $errortype = array( |
@@ -6140,13 +6140,13 @@ discard block |
||
6140 | 6140 | |
6141 | 6141 | if (!empty($nr) || !empty($file)) { |
6142 | 6142 | if ($text != '') { |
6143 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
6143 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
6144 | 6144 | } |
6145 | 6145 | if ($output != '') { |
6146 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
6146 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
6147 | 6147 | } |
6148 | 6148 | if ($nr !== '') { |
6149 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
6149 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
6150 | 6150 | } |
6151 | 6151 | if ($file) { |
6152 | 6152 | $table[] = array('File', $file); |
@@ -6166,7 +6166,7 @@ discard block |
||
6166 | 6166 | } |
6167 | 6167 | |
6168 | 6168 | if (!empty($this->event->activePlugin)) { |
6169 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
6169 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
6170 | 6170 | } |
6171 | 6171 | |
6172 | 6172 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6176,17 +6176,17 @@ discard block |
||
6176 | 6176 | $table[] = array('REQUEST_URI', $request_uri); |
6177 | 6177 | |
6178 | 6178 | if ($this->manager->action) { |
6179 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
6179 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
6180 | 6180 | global $action_list; |
6181 | 6181 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
6182 | 6182 | |
6183 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
6183 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
6184 | 6184 | } |
6185 | 6185 | |
6186 | 6186 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
6187 | 6187 | $resource = $this->getDocumentObject('id', $this->documentIdentifier); |
6188 | 6188 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
6189 | - $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); |
|
6189 | + $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); |
|
6190 | 6190 | } |
6191 | 6191 | $table[] = array('Referer', $referer); |
6192 | 6192 | $table[] = array('User Agent', $ua); |
@@ -6207,7 +6207,7 @@ discard block |
||
6207 | 6207 | |
6208 | 6208 | $mem = memory_get_peak_usage(true); |
6209 | 6209 | $total_mem = $mem - $this->mstart; |
6210 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
6210 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
6211 | 6211 | |
6212 | 6212 | $queryTime = $this->queryTime; |
6213 | 6213 | $phpTime = $totalTime - $queryTime; |
@@ -6228,18 +6228,18 @@ discard block |
||
6228 | 6228 | $str .= $this->get_backtrace(debug_backtrace()); |
6229 | 6229 | // Log error |
6230 | 6230 | if (!empty($this->currentSnippet)) { |
6231 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
6231 | + $source = 'Snippet - '.$this->currentSnippet; |
|
6232 | 6232 | } elseif (!empty($this->event->activePlugin)) { |
6233 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
6233 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
6234 | 6234 | } elseif ($source !== '') { |
6235 | - $source = 'Parser - ' . $source; |
|
6235 | + $source = 'Parser - '.$source; |
|
6236 | 6236 | } elseif ($query !== '') { |
6237 | 6237 | $source = 'SQL Query'; |
6238 | 6238 | } else { |
6239 | 6239 | $source = 'Parser'; |
6240 | 6240 | } |
6241 | 6241 | if ($msg) { |
6242 | - $source .= ' / ' . $msg; |
|
6242 | + $source .= ' / '.$msg; |
|
6243 | 6243 | } |
6244 | 6244 | if (isset($actionName) && !empty($actionName)) { |
6245 | 6245 | $source .= $actionName; |
@@ -6271,12 +6271,12 @@ discard block |
||
6271 | 6271 | |
6272 | 6272 | // Display error |
6273 | 6273 | if (isset($_SESSION['mgrValidated'])) { |
6274 | - 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> |
|
6274 | + 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> |
|
6275 | 6275 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
6276 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
6276 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
6277 | 6277 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
6278 | 6278 | </head><body> |
6279 | - ' . $str . '</body></html>'; |
|
6279 | + ' . $str.'</body></html>'; |
|
6280 | 6280 | |
6281 | 6281 | } else { |
6282 | 6282 | echo 'Error'; |
@@ -6314,7 +6314,7 @@ discard block |
||
6314 | 6314 | switch ($val['type']) { |
6315 | 6315 | case '->': |
6316 | 6316 | case '::': |
6317 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
6317 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
6318 | 6318 | break; |
6319 | 6319 | default: |
6320 | 6320 | $functionName = $val['function']; |
@@ -6324,7 +6324,7 @@ discard block |
||
6324 | 6324 | $args = array_pad(array(), $_, '$var'); |
6325 | 6325 | $args = implode(", ", $args); |
6326 | 6326 | $modx = &$this; |
6327 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6327 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
6328 | 6328 | $arg = $val['args'][$tmp - 1]; |
6329 | 6329 | switch (true) { |
6330 | 6330 | case is_null($arg): { |
@@ -6336,7 +6336,7 @@ discard block |
||
6336 | 6336 | break; |
6337 | 6337 | } |
6338 | 6338 | case is_scalar($arg): { |
6339 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); |
|
6339 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); |
|
6340 | 6340 | break; |
6341 | 6341 | } |
6342 | 6342 | case is_bool($arg): { |
@@ -6344,23 +6344,23 @@ discard block |
||
6344 | 6344 | break; |
6345 | 6345 | } |
6346 | 6346 | case is_array($arg): { |
6347 | - $out = 'array $var' . $tmp; |
|
6347 | + $out = 'array $var'.$tmp; |
|
6348 | 6348 | break; |
6349 | 6349 | } |
6350 | 6350 | case is_object($arg): { |
6351 | - $out = get_class($arg) . ' $var' . $tmp; |
|
6351 | + $out = get_class($arg).' $var'.$tmp; |
|
6352 | 6352 | break; |
6353 | 6353 | } |
6354 | 6354 | default: { |
6355 | - $out = '$var' . $tmp; |
|
6355 | + $out = '$var'.$tmp; |
|
6356 | 6356 | } |
6357 | 6357 | } |
6358 | 6358 | $tmp++; |
6359 | 6359 | return $out; |
6360 | 6360 | }, $args); |
6361 | 6361 | $line = array( |
6362 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
6363 | - $path . " on line " . $val['line'] |
|
6362 | + "<strong>".$functionName."</strong>(".$args.")", |
|
6363 | + $path." on line ".$val['line'] |
|
6364 | 6364 | ); |
6365 | 6365 | $table[] = array(implode("<br />", $line)); |
6366 | 6366 | } |
@@ -6401,7 +6401,7 @@ discard block |
||
6401 | 6401 | $alias = strip_tags($alias); // strip HTML |
6402 | 6402 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
6403 | 6403 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
6404 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6404 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
6405 | 6405 | $alias = trim($alias, '-'); // trim excess |
6406 | 6406 | return $alias; |
6407 | 6407 | } |
@@ -6417,7 +6417,7 @@ discard block |
||
6417 | 6417 | $precisions = count($sizes) - 1; |
6418 | 6418 | foreach ($sizes as $unit => $bytes) { |
6419 | 6419 | if ($size >= $bytes) { |
6420 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
6420 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
6421 | 6421 | } |
6422 | 6422 | $precisions--; |
6423 | 6423 | } |
@@ -6521,10 +6521,10 @@ discard block |
||
6521 | 6521 | |
6522 | 6522 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
6523 | 6523 | return false; |
6524 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
6525 | - $file_path = MODX_BASE_PATH . $str; |
|
6526 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
6527 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
6524 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
6525 | + $file_path = MODX_BASE_PATH.$str; |
|
6526 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
6527 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
6528 | 6528 | } else { |
6529 | 6529 | return false; |
6530 | 6530 | } |
@@ -6565,7 +6565,7 @@ discard block |
||
6565 | 6565 | * |
6566 | 6566 | * @param boolean $state State of ajaxMode |
6567 | 6567 | */ |
6568 | - function setAjaxMode($state) { |
|
6568 | + function setAjaxMode($state){ |
|
6569 | 6569 | $this->ajaxMode = $state === true ? true : false; |
6570 | 6570 | } |
6571 | 6571 | |
@@ -6574,7 +6574,7 @@ discard block |
||
6574 | 6574 | * |
6575 | 6575 | * @param array $array Array to convert |
6576 | 6576 | */ |
6577 | - function jsonResponse($array) { |
|
6577 | + function jsonResponse($array){ |
|
6578 | 6578 | header('content-type: application/json'); |
6579 | 6579 | exit(json_encode($array, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)); |
6580 | 6580 | } |
@@ -6669,7 +6669,7 @@ discard block |
||
6669 | 6669 | $title = 'no title'; |
6670 | 6670 | } |
6671 | 6671 | if (is_array($msg)) { |
6672 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
6672 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
6673 | 6673 | } elseif ($msg === '') { |
6674 | 6674 | $msg = $_SERVER['REQUEST_URI']; |
6675 | 6675 | } |
@@ -6714,7 +6714,7 @@ discard block |
||
6714 | 6714 | if (is_array($SystemAlertMsgQueque)) { |
6715 | 6715 | $title = ''; |
6716 | 6716 | if ($this->name && $this->activePlugin) { |
6717 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
6717 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
6718 | 6718 | } |
6719 | 6719 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
6720 | 6720 | } |
@@ -696,13 +696,15 @@ discard block |
||
696 | 696 | $this->virtualDir = ''; |
697 | 697 | } |
698 | 698 | |
699 | - 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 */ |
|
699 | + if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { |
|
700 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
700 | 701 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
701 | 702 | if ($this->config['use_alias_path'] == 1) { |
702 | 703 | 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))))) { |
703 | 704 | $this->documentMethod = 'id'; |
704 | 705 | return $q; |
705 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
706 | + } else { |
|
707 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
706 | 708 | $this->documentMethod = 'alias'; |
707 | 709 | return $q; |
708 | 710 | } |
@@ -710,7 +712,8 @@ discard block |
||
710 | 712 | $this->documentMethod = 'id'; |
711 | 713 | return $q; |
712 | 714 | } |
713 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
715 | + } else { |
|
716 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
714 | 717 | if ($this->config['friendly_alias_urls'] != 1) { |
715 | 718 | $q = $qOrig; |
716 | 719 | } |
@@ -740,13 +743,14 @@ discard block |
||
740 | 743 | * @param $id |
741 | 744 | * @return array|mixed|null|string |
742 | 745 | */ |
743 | - public function makePageCacheKey($id){ |
|
746 | + public function makePageCacheKey($id) |
|
747 | + { |
|
744 | 748 | $hash = $id; |
745 | 749 | $tmp = null; |
746 | 750 | $params = array(); |
747 | - if(!empty($this->systemCacheKey)){ |
|
751 | + if(!empty($this->systemCacheKey)) { |
|
748 | 752 | $hash = $this->systemCacheKey; |
749 | - }else { |
|
753 | + } else { |
|
750 | 754 | if (!empty($_GET)) { |
751 | 755 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
752 | 756 | $params = $_GET; |
@@ -755,7 +759,7 @@ discard block |
||
755 | 759 | } |
756 | 760 | } |
757 | 761 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
758 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
762 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
759 | 763 | $tmp = array_pop($evtOut); |
760 | 764 | } |
761 | 765 | return empty($tmp) ? $hash : $tmp; |
@@ -1166,10 +1170,18 @@ discard block |
||
1166 | 1170 | return array(); |
1167 | 1171 | } |
1168 | 1172 | $spacer = md5('<<<EVO>>>'); |
1169 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1170 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1171 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1172 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1173 | + if($left==='{{' && strpos($content,';}}')!==false) { |
|
1174 | + $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
1175 | + } |
|
1176 | + if($left==='{{' && strpos($content,'{{}}')!==false) { |
|
1177 | + $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
1178 | + } |
|
1179 | + if($left==='[[' && strpos($content,']]]]')!==false) { |
|
1180 | + $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
1181 | + } |
|
1182 | + if($left==='[[' && strpos($content,']]]')!==false) { |
|
1183 | + $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
1184 | + } |
|
1173 | 1185 | |
1174 | 1186 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
1175 | 1187 | $pos[']]>'] = strpos($content, ']]>'); |
@@ -1222,7 +1234,8 @@ discard block |
||
1222 | 1234 | } |
1223 | 1235 | } |
1224 | 1236 | |
1225 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
1237 | + if (!in_array($fetch, $tags)) { |
|
1238 | +// Avoid double Matches |
|
1226 | 1239 | $tags[] = $fetch; // Fetch |
1227 | 1240 | }; |
1228 | 1241 | $fetch = ''; // and reset |
@@ -1240,7 +1253,9 @@ discard block |
||
1240 | 1253 | } |
1241 | 1254 | } |
1242 | 1255 | foreach($tags as $i=>$tag) { |
1243 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
1256 | + if(strpos($tag,$spacer)!==false) { |
|
1257 | + $tags[$i] = str_replace($spacer, '', $tag); |
|
1258 | + } |
|
1244 | 1259 | } |
1245 | 1260 | return $tags; |
1246 | 1261 | } |
@@ -1280,7 +1295,10 @@ discard block |
||
1280 | 1295 | } |
1281 | 1296 | |
1282 | 1297 | foreach ($matches[1] as $i => $key) { |
1283 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1298 | + if(strpos($key,'[+')!==false) { |
|
1299 | + continue; |
|
1300 | + } |
|
1301 | + // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
1284 | 1302 | if (substr($key, 0, 1) == '#') { |
1285 | 1303 | $key = substr($key, 1); |
1286 | 1304 | } // remove # for QuickEdit format |
@@ -2005,7 +2023,8 @@ discard block |
||
2005 | 2023 | * @return mixed|string |
2006 | 2024 | */ |
2007 | 2025 | public function _getSGVar($value) |
2008 | - { // Get super globals |
|
2026 | + { |
|
2027 | +// Get super globals |
|
2009 | 2028 | $key = $value; |
2010 | 2029 | $_ = $this->config['enable_filter']; |
2011 | 2030 | $this->config['enable_filter'] = 1; |
@@ -2410,7 +2429,8 @@ discard block |
||
2410 | 2429 | if ($this->config['friendly_urls'] == 1) { |
2411 | 2430 | $aliases = array(); |
2412 | 2431 | if (is_array($this->documentListing)) { |
2413 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
2432 | + foreach ($this->documentListing as $path => $docid) { |
|
2433 | +// This is big Loop on large site! |
|
2414 | 2434 | $aliases[$docid] = $path; |
2415 | 2435 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
2416 | 2436 | } |
@@ -2443,7 +2463,7 @@ discard block |
||
2443 | 2463 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
2444 | 2464 | $pref = $this->config['friendly_url_prefix']; |
2445 | 2465 | $suff = $this->config['friendly_url_suffix']; |
2446 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
2466 | + $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
2447 | 2467 | global $modx; |
2448 | 2468 | $thealias = $aliases[$m[1]]; |
2449 | 2469 | $thefolder = $isfolder[$m[1]]; |
@@ -3120,7 +3140,9 @@ discard block |
||
3120 | 3140 | public function webAlertAndQuit($msg, $url = "") |
3121 | 3141 | { |
3122 | 3142 | global $modx_manager_charset; |
3123 | - if($this->ajaxMode === true) $this->jsonResponse(array('error'=>$msg)); |
|
3143 | + if($this->ajaxMode === true) { |
|
3144 | + $this->jsonResponse(array('error'=>$msg)); |
|
3145 | + } |
|
3124 | 3146 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
3125 | 3147 | $fnc = substr($url, 11); |
3126 | 3148 | } elseif ($url) { |
@@ -4216,7 +4238,8 @@ discard block |
||
4216 | 4238 | if (isset ($this->snippetCache[$snippetName])) { |
4217 | 4239 | $snippet = $this->snippetCache[$snippetName]; |
4218 | 4240 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
4219 | - } else { // not in cache so let's check the db |
|
4241 | + } else { |
|
4242 | +// not in cache so let's check the db |
|
4220 | 4243 | $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "' AND ss.disabled=0;"; |
4221 | 4244 | $result = $this->db->query($sql); |
4222 | 4245 | if ($this->db->getRecordCount($result) == 1) { |
@@ -4720,7 +4743,7 @@ discard block |
||
4720 | 4743 | $result = $this->db->makeArray($rs); |
4721 | 4744 | |
4722 | 4745 | // get default/built-in template variables |
4723 | - if(is_array($docRow)){ |
|
4746 | + if(is_array($docRow)) { |
|
4724 | 4747 | ksort($docRow); |
4725 | 4748 | |
4726 | 4749 | foreach ($docRow as $key => $value) { |
@@ -5199,12 +5222,16 @@ discard block |
||
5199 | 5222 | return ''; |
5200 | 5223 | } // nothing to register |
5201 | 5224 | if (!is_array($options)) { |
5202 | - if (is_bool($options)) // backward compatibility with old plaintext parameter |
|
5225 | + if (is_bool($options)) { |
|
5226 | + // backward compatibility with old plaintext parameter |
|
5203 | 5227 | { |
5204 | 5228 | $options = array('plaintext' => $options); |
5205 | - } elseif (is_string($options)) // Also allow script name as 2nd param |
|
5229 | + } |
|
5230 | + } elseif (is_string($options)) { |
|
5231 | + // Also allow script name as 2nd param |
|
5206 | 5232 | { |
5207 | 5233 | $options = array('name' => $options); |
5234 | + } |
|
5208 | 5235 | } else { |
5209 | 5236 | $options = array(); |
5210 | 5237 | } |
@@ -5216,7 +5243,8 @@ discard block |
||
5216 | 5243 | unset($overwritepos); // probably unnecessary--just making sure |
5217 | 5244 | |
5218 | 5245 | $useThisVer = true; |
5219 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
5246 | + if (isset($this->loadedjscripts[$key])) { |
|
5247 | +// a matching script was found |
|
5220 | 5248 | // if existing script is a startup script, make sure the candidate is also a startup script |
5221 | 5249 | if ($this->loadedjscripts[$key]['startup']) { |
5222 | 5250 | $startup = true; |
@@ -5236,7 +5264,8 @@ discard block |
||
5236 | 5264 | // overwrite the old script (the position may be important for dependent scripts) |
5237 | 5265 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
5238 | 5266 | } |
5239 | - } else { // Use the original version |
|
5267 | + } else { |
|
5268 | +// Use the original version |
|
5240 | 5269 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
5241 | 5270 | // need to move the exisiting script to the head |
5242 | 5271 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5360,7 +5389,8 @@ discard block |
||
5360 | 5389 | } |
5361 | 5390 | |
5362 | 5391 | $results = null; |
5363 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
5392 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
5393 | +// start for loop |
|
5364 | 5394 | if ($this->dumpPlugins) { |
5365 | 5395 | $eventtime = $this->getMicroTime(); |
5366 | 5396 | } |
@@ -5908,7 +5938,8 @@ discard block |
||
5908 | 5938 | * @return bool |
5909 | 5939 | */ |
5910 | 5940 | public function isSafeCode($phpcode = '', $safe_functions = '') |
5911 | - { // return true or false |
|
5941 | + { |
|
5942 | +// return true or false |
|
5912 | 5943 | if ($safe_functions == '') { |
5913 | 5944 | return false; |
5914 | 5945 | } |
@@ -6324,7 +6355,7 @@ discard block |
||
6324 | 6355 | $args = array_pad(array(), $_, '$var'); |
6325 | 6356 | $args = implode(", ", $args); |
6326 | 6357 | $modx = &$this; |
6327 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
6358 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
6328 | 6359 | $arg = $val['args'][$tmp - 1]; |
6329 | 6360 | switch (true) { |
6330 | 6361 | case is_null($arg): { |
@@ -6565,7 +6596,8 @@ discard block |
||
6565 | 6596 | * |
6566 | 6597 | * @param boolean $state State of ajaxMode |
6567 | 6598 | */ |
6568 | - function setAjaxMode($state) { |
|
6599 | + function setAjaxMode($state) |
|
6600 | + { |
|
6569 | 6601 | $this->ajaxMode = $state === true ? true : false; |
6570 | 6602 | } |
6571 | 6603 | |
@@ -6574,7 +6606,8 @@ discard block |
||
6574 | 6606 | * |
6575 | 6607 | * @param array $array Array to convert |
6576 | 6608 | */ |
6577 | - function jsonResponse($array) { |
|
6609 | + function jsonResponse($array) |
|
6610 | + { |
|
6578 | 6611 | header('content-type: application/json'); |
6579 | 6612 | exit(json_encode($array, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE)); |
6580 | 6613 | } |
@@ -1,30 +1,30 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | - /** |
|
4 | - * System Alert Message Queue Display file |
|
5 | - * Written By Raymond Irving, April, 2005 |
|
6 | - * |
|
7 | - * Used to display system alert messages inside the browser |
|
8 | - * |
|
9 | - */ |
|
3 | + /** |
|
4 | + * System Alert Message Queue Display file |
|
5 | + * Written By Raymond Irving, April, 2005 |
|
6 | + * |
|
7 | + * Used to display system alert messages inside the browser |
|
8 | + * |
|
9 | + */ |
|
10 | 10 | |
11 | - require_once(dirname(__FILE__).'/protect.inc.php'); |
|
11 | + require_once(dirname(__FILE__).'/protect.inc.php'); |
|
12 | 12 | |
13 | - $sysMsgs = ""; |
|
14 | - $limit = count($SystemAlertMsgQueque); |
|
15 | - for($i=0;$i<$limit;$i++) { |
|
16 | - $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
17 | - } |
|
18 | - // reset message queque |
|
19 | - unset($_SESSION['SystemAlertMsgQueque']); |
|
20 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
21 | - $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
13 | + $sysMsgs = ""; |
|
14 | + $limit = count($SystemAlertMsgQueque); |
|
15 | + for($i=0;$i<$limit;$i++) { |
|
16 | + $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
|
17 | + } |
|
18 | + // reset message queque |
|
19 | + unset($_SESSION['SystemAlertMsgQueque']); |
|
20 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
21 | + $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
|
22 | 22 | |
23 | - if($sysMsgs!="") { |
|
23 | + if($sysMsgs!="") { |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <?php // fetch the styles |
27 | - echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
27 | + echo '<link rel="stylesheet" type="text/css" href="'.MODX_MANAGER_URL.'media/style/'.$manager_theme.'/style.css'.'" />'; |
|
28 | 28 | ?> |
29 | 29 | <script type="text/javascript"> |
30 | 30 | // <![CDATA[ |
@@ -42,5 +42,5 @@ discard block |
||
42 | 42 | // ]]> |
43 | 43 | </script> |
44 | 44 | <?php |
45 | - } |
|
45 | + } |
|
46 | 46 | ?> |
47 | 47 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | $sysMsgs = ""; |
14 | 14 | $limit = count($SystemAlertMsgQueque); |
15 | - for($i=0;$i<$limit;$i++) { |
|
15 | + for ($i = 0; $i < $limit; $i++) { |
|
16 | 16 | $sysMsgs .= $SystemAlertMsgQueque[$i]."<hr sys/>"; |
17 | 17 | } |
18 | 18 | // reset message queque |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $_SESSION['SystemAlertMsgQueque'] = array(); |
21 | 21 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
22 | 22 | |
23 | - if($sysMsgs!="") { |
|
23 | + if ($sysMsgs != "") { |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <?php // fetch the styles |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | var sysAlert = new Element('div').setProperties({ |
33 | 33 | 'class': 'sysAlert' |
34 | 34 | }); |
35 | - sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs);?>'; |
|
35 | + sysAlert.innerHTML = '<?php echo $modx->db->escape($sysMsgs); ?>'; |
|
36 | 36 | var boxHtml = new MooPrompt('<?php echo $_lang['sys_alert']; ?>', sysAlert, { |
37 | 37 | buttons: 1, |
38 | 38 | button1: 'Ok', |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | class Paging |
32 | 32 | { |
33 | 33 | |
34 | - var $int_num_result; // Number of result to show per page (decided by user) |
|
35 | - var $int_nbr_row; // Total number of items (SQL count from db) |
|
36 | - var $int_cur_position;// Current position in recordset |
|
37 | - var $str_ext_argv; // Extra argv of query string |
|
34 | + var $int_num_result; // Number of result to show per page (decided by user) |
|
35 | + var $int_nbr_row; // Total number of items (SQL count from db) |
|
36 | + var $int_cur_position; // Current position in recordset |
|
37 | + var $str_ext_argv; // Extra argv of query string |
|
38 | 38 | |
39 | 39 | // ------------------------------------------------------------------------ Constructor |
40 | 40 | // |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | $array_paging['total'] = $this->int_nbr_row; |
65 | 65 | |
66 | 66 | if ($this->int_cur_position != 0) { |
67 | - $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0" . $this->str_ext_argv . "\">"; |
|
68 | - $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . ($this->int_cur_position - $this->int_num_result) . $this->str_ext_argv . "\">"; |
|
67 | + $array_paging['first_link'] = "<a href=\"$PHP_SELF?int_cur_position=0".$this->str_ext_argv."\">"; |
|
68 | + $array_paging['previous_link'] = "<a href=\"$PHP_SELF?int_cur_position=".($this->int_cur_position - $this->int_num_result).$this->str_ext_argv."\">"; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if (($this->int_nbr_row - $this->int_cur_position) > $this->int_num_result) { |
72 | 72 | $int_new_position = $this->int_cur_position + $this->int_num_result; |
73 | - $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=" . $this->int_nbr_row . $this->str_ext_argv . "\">"; |
|
74 | - $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position" . $this->str_ext_argv . "\">"; |
|
73 | + $array_paging['last_link'] = "<a href=\"$PHP_SELF?int_cur_position=".$this->int_nbr_row.$this->str_ext_argv."\">"; |
|
74 | + $array_paging['next_link'] = "<a href=\"$PHP_SELF?int_cur_position=$int_new_position".$this->str_ext_argv."\">"; |
|
75 | 75 | } |
76 | 76 | return $array_paging; |
77 | 77 | } // end function |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | for ($i = 0; $i < $this->getNumberOfPage(); $i++) { |
87 | 87 | // if current page, do not make a link |
88 | 88 | if ($i == $this->getCurrentPage()) { |
89 | - $array_all_page[$i] = "<b>" . ($i + 1) . "</b> "; |
|
89 | + $array_all_page[$i] = "<b>".($i + 1)."</b> "; |
|
90 | 90 | } else { |
91 | 91 | $int_new_position = ($i * $this->int_num_result); |
92 | - $array_all_page[$i] = "<a href=\"" . $PHP_SELF . "?int_cur_position=$int_new_position$this->str_ext_argv\">" . ($i + 1) . "</a> "; |
|
92 | + $array_all_page[$i] = "<a href=\"".$PHP_SELF."?int_cur_position=$int_new_position$this->str_ext_argv\">".($i + 1)."</a> "; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | return $array_all_page; |
@@ -21,5 +21,5 @@ |
||
21 | 21 | if($ok) { |
22 | 22 | echo '{status:"ok"}'; |
23 | 23 | } else { |
24 | - echo '{status:"null"}'; |
|
24 | + echo '{status:"null"}'; |
|
25 | 25 | } |
@@ -12,13 +12,13 @@ |
||
12 | 12 | $modx->invokeEvent('OnManagerPageInit'); |
13 | 13 | $ok = false; |
14 | 14 | |
15 | -if($modx->elementIsLocked($_GET['type'], $_GET['id'], true)) { |
|
15 | +if ($modx->elementIsLocked($_GET['type'], $_GET['id'], true)) { |
|
16 | 16 | $modx->lockElement($_GET['type'], $_GET['id'], true); |
17 | 17 | $ok = true; |
18 | 18 | } |
19 | 19 | |
20 | 20 | header('Content-type: application/json'); |
21 | -if($ok) { |
|
21 | +if ($ok) { |
|
22 | 22 | echo '{status:"ok"}'; |
23 | 23 | } else { |
24 | 24 | echo '{status:"null"}'; |
@@ -12,24 +12,24 @@ discard block |
||
12 | 12 | |
13 | 13 | */ |
14 | 14 | |
15 | -class logHandler { |
|
15 | +class logHandler{ |
|
16 | 16 | // Single variable for a log entry |
17 | 17 | var $entry = array(); |
18 | 18 | |
19 | - function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") { |
|
19 | + function initAndWriteLog($msg = "", $internalKey = "", $username = "", $action = "", $itemid = "", $itemname = ""){ |
|
20 | 20 | global $modx; |
21 | 21 | $this->entry['msg'] = $msg; // writes testmessage to the object |
22 | - $this->entry['action'] = empty($action)? $modx->manager->action : $action; // writes the action to the object |
|
22 | + $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object |
|
23 | 23 | |
24 | 24 | // User Credentials |
25 | 25 | $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey; |
26 | 26 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
27 | 27 | |
28 | - $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
|
29 | - if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
28 | + $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object |
|
29 | + if ($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
30 | 30 | |
31 | - $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object |
|
32 | - if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
31 | + $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname'])) ? $_SESSION['itemname'] : $itemname; // writes the id to the object |
|
32 | + if ($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
33 | 33 | |
34 | 34 | $this->writeToLog(); |
35 | 35 | return; |
@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | // function to write to the log |
39 | 39 | // collects all required info, and |
40 | 40 | // writes it to the logging table |
41 | - function writeToLog() { |
|
41 | + function writeToLog(){ |
|
42 | 42 | global $modx; |
43 | 43 | $tbl_manager_log = $modx->getFullTableName('manager_log'); |
44 | 44 | |
45 | - if($this->entry['internalKey'] == "") { |
|
45 | + if ($this->entry['internalKey'] == "") { |
|
46 | 46 | $modx->webAlertAndQuit("Logging error: internalKey not set."); |
47 | 47 | } |
48 | - if(empty($this->entry['action'])) { |
|
48 | + if (empty($this->entry['action'])) { |
|
49 | 49 | $modx->webAlertAndQuit("Logging error: action not set."); |
50 | 50 | } |
51 | - if($this->entry['msg'] == "") { |
|
51 | + if ($this->entry['msg'] == "") { |
|
52 | 52 | include_once "actionlist.inc.php"; |
53 | 53 | $this->entry['msg'] = getAction($this->entry['action'], $this->entry['itemId']); |
54 | - if($this->entry['msg'] == "") { |
|
54 | + if ($this->entry['msg'] == "") { |
|
55 | 55 | $modx->webAlertAndQuit("Logging error: couldn't find message to write to log."); |
56 | 56 | } |
57 | 57 | } |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | $fields['itemid'] = $this->entry['itemId']; |
64 | 64 | $fields['itemname'] = $modx->db->escape($this->entry['itemName']); |
65 | 65 | $fields['message'] = $modx->db->escape($this->entry['msg']); |
66 | - $insert_id = $modx->db->insert($fields,$tbl_manager_log); |
|
67 | - if(!$insert_id) { |
|
66 | + $insert_id = $modx->db->insert($fields, $tbl_manager_log); |
|
67 | + if (!$insert_id) { |
|
68 | 68 | $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError()); |
69 | 69 | } else { |
70 | 70 | $limit = (isset($modx->config['manager_log_limit'])) ? intval($modx->config['manager_log_limit']) : 3000; |
71 | - $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
72 | - if(($insert_id % $trim) === 0) { |
|
73 | - $modx->rotate_log('manager_log',$limit,$trim); |
|
71 | + $trim = (isset($modx->config['manager_log_trim'])) ? intval($modx->config['manager_log_trim']) : 100; |
|
72 | + if (($insert_id % $trim) === 0) { |
|
73 | + $modx->rotate_log('manager_log', $limit, $trim); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -12,11 +12,13 @@ discard block |
||
12 | 12 | |
13 | 13 | */ |
14 | 14 | |
15 | -class logHandler { |
|
15 | +class logHandler |
|
16 | +{ |
|
16 | 17 | // Single variable for a log entry |
17 | 18 | var $entry = array(); |
18 | 19 | |
19 | - function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") { |
|
20 | + function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") |
|
21 | + { |
|
20 | 22 | global $modx; |
21 | 23 | $this->entry['msg'] = $msg; // writes testmessage to the object |
22 | 24 | $this->entry['action'] = empty($action)? $modx->manager->action : $action; // writes the action to the object |
@@ -26,10 +28,16 @@ discard block |
||
26 | 28 | $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username; |
27 | 29 | |
28 | 30 | $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object |
29 | - if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0 |
|
31 | + if($this->entry['itemId'] == 0) { |
|
32 | + $this->entry['itemId'] = "-"; |
|
33 | + } |
|
34 | + // to stop items having id 0 |
|
30 | 35 | |
31 | 36 | $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object |
32 | - if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty |
|
37 | + if($this->entry['itemName'] == "") { |
|
38 | + $this->entry['itemName'] = "-"; |
|
39 | + } |
|
40 | + // to stop item name being empty |
|
33 | 41 | |
34 | 42 | $this->writeToLog(); |
35 | 43 | return; |
@@ -38,7 +46,8 @@ discard block |
||
38 | 46 | // function to write to the log |
39 | 47 | // collects all required info, and |
40 | 48 | // writes it to the logging table |
41 | - function writeToLog() { |
|
49 | + function writeToLog() |
|
50 | + { |
|
42 | 51 | global $modx; |
43 | 52 | $tbl_manager_log = $modx->getFullTableName('manager_log'); |
44 | 53 |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | |
4 | 4 | // PROCESSOR FIRST |
5 | 5 | if($_SESSION['mgrRole'] == 1) { |
6 | - if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
7 | - $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
8 | - if(!empty($current)) { |
|
9 | - $modx->manager->setSystemChecksum($current); |
|
10 | - $modx->clearCache('full'); |
|
11 | - $modx->config['sys_files_checksum'] = $current; |
|
12 | - }; |
|
13 | - } |
|
6 | + if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
7 | + $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
|
8 | + if(!empty($current)) { |
|
9 | + $modx->manager->setSystemChecksum($current); |
|
10 | + $modx->clearCache('full'); |
|
11 | + $modx->config['sys_files_checksum'] = $current; |
|
12 | + }; |
|
13 | + } |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | // NOW CHECK CONFIG |
@@ -18,15 +18,15 @@ discard block |
||
18 | 18 | |
19 | 19 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
20 | 20 | if ($sysfiles_check!=='0'){ |
21 | - $warningspresent = 1; |
|
22 | - $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
21 | + $warningspresent = 1; |
|
22 | + $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | if (is_writable("includes/config.inc.php")){ |
26 | 26 | // Warn if world writable |
27 | 27 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
28 | - $warningspresent = 1; |
|
29 | - $warnings[] = array($_lang['configcheck_configinc']); |
|
28 | + $warningspresent = 1; |
|
29 | + $warnings[] = array($_lang['configcheck_configinc']); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
@@ -177,10 +177,10 @@ discard block |
||
177 | 177 | break; |
178 | 178 | case $_lang['configcheck_sysfiles_mod']: |
179 | 179 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
180 | - $warnings[$i][2] = '<ul><li>'. join('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
181 | - if($modx->hasPermission('settings')) { |
|
182 | - $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
183 | - } |
|
180 | + $warnings[$i][2] = '<ul><li>'. join('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
181 | + if($modx->hasPermission('settings')) { |
|
182 | + $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
183 | + } |
|
184 | 184 | if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
185 | 185 | break; |
186 | 186 | case $_lang['configcheck_lang_difference'] : |
@@ -88,7 +88,7 @@ |
||
88 | 88 | } |
89 | 89 | </script> |
90 | 90 | |
91 | -JS; |
|
91 | +js; |
|
92 | 92 | $modx->regClientScript($script); |
93 | 93 | } |
94 | 94 | } |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | 6 | // PROCESSOR FIRST |
7 | -if($_SESSION['mgrRole'] == 1) { |
|
8 | - if($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
7 | +if ($_SESSION['mgrRole'] == 1) { |
|
8 | + if ($_REQUEST['b'] == 'resetSysfilesChecksum' && $modx->hasPermission('settings')) { |
|
9 | 9 | $current = $modx->manager->getSystemChecksum($modx->config['check_files_onlogin']); |
10 | - if(!empty($current)) { |
|
10 | + if (!empty($current)) { |
|
11 | 11 | $modx->manager->setSystemChecksum($current); |
12 | 12 | $modx->clearCache('full'); |
13 | 13 | $modx->config['sys_files_checksum'] = $current; |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | $warningspresent = 0; |
20 | 20 | |
21 | 21 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
22 | -if ($sysfiles_check!=='0'){ |
|
22 | +if ($sysfiles_check !== '0') { |
|
23 | 23 | $warningspresent = 1; |
24 | 24 | $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
25 | 25 | } |
26 | 26 | |
27 | -if (is_writable("includes/config.inc.php")){ |
|
27 | +if (is_writable("includes/config.inc.php")) { |
|
28 | 28 | // Warn if world writable |
29 | - if(@fileperms('includes/config.inc.php') & 0x0002) { |
|
29 | + if (@fileperms('includes/config.inc.php') & 0x0002) { |
|
30 | 30 | $warningspresent = 1; |
31 | 31 | $warnings[] = array($_lang['configcheck_configinc']); |
32 | 32 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | $warnings[] = array($_lang['configcheck_php_gdzip']); |
43 | 43 | } |
44 | 44 | |
45 | -if(!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') { |
|
46 | - if(isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') { |
|
45 | +if (!isset($modx->config['_hide_configcheck_validate_referer']) || $modx->config['_hide_configcheck_validate_referer'] !== '1') { |
|
46 | + if (isset($_SESSION['mgrPermissions']['settings']) && $_SESSION['mgrPermissions']['settings'] == '1') { |
|
47 | 47 | if ($modx->db->getValue($modx->db->select('COUNT(setting_value)', $modx->getFullTableName('system_settings'), "setting_name='validate_referer' AND setting_value='0'"))) { |
48 | 48 | $warningspresent = 1; |
49 | 49 | $warnings[] = array($_lang['configcheck_validate_referer']); |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | // check for Template Switcher plugin |
55 | -if(!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') { |
|
56 | - if(isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') { |
|
55 | +if (!isset($modx->config['_hide_configcheck_templateswitcher_present']) || $modx->config['_hide_configcheck_templateswitcher_present'] !== '1') { |
|
56 | + if (isset($_SESSION['mgrPermissions']['edit_plugin']) && $_SESSION['mgrPermissions']['edit_plugin'] == '1') { |
|
57 | 57 | $rs = $modx->db->select('name, disabled', $modx->getFullTableName('site_plugins'), "name IN ('TemplateSwitcher', 'Template Switcher', 'templateswitcher', 'template_switcher', 'template switcher') OR plugincode LIKE '%TemplateSwitcher%'"); |
58 | 58 | $row = $modx->db->getRow($rs); |
59 | - if($row && $row['disabled'] == 0) { |
|
59 | + if ($row && $row['disabled'] == 0) { |
|
60 | 60 | $warningspresent = 1; |
61 | 61 | $warnings[] = array($_lang['configcheck_templateswitcher_present']); |
62 | 62 | $tplName = $row['name']; |
@@ -117,36 +117,36 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | if (!function_exists('checkSiteCache')) { |
120 | - function checkSiteCache() { |
|
120 | + function checkSiteCache(){ |
|
121 | 121 | global $modx; |
122 | - $checked= true; |
|
123 | - if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
|
124 | - $checked= @include_once ($modx->config['base_path'] . 'assets/cache/siteCache.idx.php'); |
|
122 | + $checked = true; |
|
123 | + if (file_exists($modx->config['base_path'].'assets/cache/siteCache.idx.php')) { |
|
124 | + $checked = @include_once ($modx->config['base_path'].'assets/cache/siteCache.idx.php'); |
|
125 | 125 | } |
126 | 126 | return $checked; |
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | -if (!is_writable(MODX_BASE_PATH . "assets/cache/")) { |
|
130 | +if (!is_writable(MODX_BASE_PATH."assets/cache/")) { |
|
131 | 131 | $warningspresent = 1; |
132 | 132 | $warnings[] = array($_lang['configcheck_cache']); |
133 | 133 | } |
134 | 134 | |
135 | 135 | if (!checkSiteCache()) { |
136 | 136 | $warningspresent = 1; |
137 | - $warnings[]= array($lang['configcheck_sitecache_integrity']); |
|
137 | + $warnings[] = array($lang['configcheck_sitecache_integrity']); |
|
138 | 138 | } |
139 | 139 | |
140 | -if (!is_writable(MODX_BASE_PATH . "assets/images/")) { |
|
140 | +if (!is_writable(MODX_BASE_PATH."assets/images/")) { |
|
141 | 141 | $warningspresent = 1; |
142 | 142 | $warnings[] = array($_lang['configcheck_images']); |
143 | 143 | } |
144 | 144 | |
145 | -if(strpos($modx->config['rb_base_dir'],MODX_BASE_PATH)!==0) { |
|
145 | +if (strpos($modx->config['rb_base_dir'], MODX_BASE_PATH) !== 0) { |
|
146 | 146 | $warningspresent = 1; |
147 | 147 | $warnings[] = array($_lang['configcheck_rb_base_dir']); |
148 | 148 | } |
149 | -if(strpos($modx->config['filemanager_path'],MODX_BASE_PATH)!==0) { |
|
149 | +if (strpos($modx->config['filemanager_path'], MODX_BASE_PATH) !== 0) { |
|
150 | 150 | $warningspresent = 1; |
151 | 151 | $warnings[] = array($_lang['configcheck_filemanager_path']); |
152 | 152 | } |
@@ -154,36 +154,36 @@ discard block |
||
154 | 154 | // clear file info cache |
155 | 155 | clearstatcache(); |
156 | 156 | |
157 | -if ($warningspresent==1) { |
|
157 | +if ($warningspresent == 1) { |
|
158 | 158 | |
159 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
159 | +if (!isset($modx->config['send_errormail'])) $modx->config['send_errormail'] = '3'; |
|
160 | 160 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
161 | 161 | |
162 | -for ($i=0;$i<count($warnings);$i++) { |
|
162 | +for ($i = 0; $i < count($warnings); $i++) { |
|
163 | 163 | switch ($warnings[$i][0]) { |
164 | 164 | case $_lang['configcheck_configinc']; |
165 | 165 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
166 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
166 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_configinc']); |
|
167 | 167 | break; |
168 | 168 | case $_lang['configcheck_installer'] : |
169 | 169 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
170 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
170 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1], $_lang['configcheck_installer']); |
|
171 | 171 | break; |
172 | 172 | case $_lang['configcheck_cache'] : |
173 | 173 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
174 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
174 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_cache']); |
|
175 | 175 | break; |
176 | 176 | case $_lang['configcheck_images'] : |
177 | 177 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
178 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
178 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 2, $warnings[$i][1], $_lang['configcheck_images']); |
|
179 | 179 | break; |
180 | 180 | case $_lang['configcheck_sysfiles_mod']: |
181 | 181 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
182 | - $warnings[$i][2] = '<ul><li>'. join('</li><li>', $sysfiles_check) .'</li></ul>'; |
|
183 | - if($modx->hasPermission('settings')) { |
|
184 | - $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
|
182 | + $warnings[$i][2] = '<ul><li>'.join('</li><li>', $sysfiles_check).'</li></ul>'; |
|
183 | + if ($modx->hasPermission('settings')) { |
|
184 | + $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\''.$_lang["reset_sysfiles_checksum_alert"].'\')">'.$_lang["reset_sysfiles_checksum_button"].'</a></li></ul>'; |
|
185 | 185 | } |
186 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
186 | + if (!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0, 3, $warnings[$i][1]." ".join(', ', $sysfiles_check), $_lang['configcheck_sysfiles_mod']); |
|
187 | 187 | break; |
188 | 188 | case $_lang['configcheck_lang_difference'] : |
189 | 189 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -205,18 +205,18 @@ discard block |
||
205 | 205 | break; |
206 | 206 | case $_lang['configcheck_validate_referer'] : |
207 | 207 | $msg = $_lang['configcheck_validate_referer_msg']; |
208 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
208 | + $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'validate_referer'); |
|
209 | 209 | $warnings[$i][1] = "<span id=\"validate_referer_warning_wrapper\">{$msg}</span>\n"; |
210 | 210 | break; |
211 | 211 | case $_lang['configcheck_templateswitcher_present'] : |
212 | 212 | $msg = $_lang["configcheck_templateswitcher_present_msg"]; |
213 | - if(isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
214 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_disable"]; |
|
213 | + if (isset($_SESSION['mgrPermissions']['save_plugin']) && $_SESSION['mgrPermissions']['save_plugin'] == '1') { |
|
214 | + $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_disable"]; |
|
215 | 215 | } |
216 | - if(isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
217 | - $msg .= '<br />' . $_lang["configcheck_templateswitcher_present_delete"]; |
|
216 | + if (isset($_SESSION['mgrPermissions']['delete_plugin']) && $_SESSION['mgrPermissions']['delete_plugin'] == '1') { |
|
217 | + $msg .= '<br />'.$_lang["configcheck_templateswitcher_present_delete"]; |
|
218 | 218 | } |
219 | - $msg .= '<br />' . sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
219 | + $msg .= '<br />'.sprintf($_lang["configcheck_hide_warning"], 'templateswitcher_present'); |
|
220 | 220 | $warnings[$i][1] = "<span id=\"templateswitcher_present_warning_wrapper\">{$msg}</span>\n"; |
221 | 221 | break; |
222 | 222 | case $_lang['configcheck_rb_base_dir'] : |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $warnings[$i][1] = $_lang['configcheck_default_msg']; |
230 | 230 | } |
231 | 231 | |
232 | - $admin_warning = $_SESSION['mgrRole']!=1 ? $_lang['configcheck_admin'] : "" ; |
|
232 | + $admin_warning = $_SESSION['mgrRole'] != 1 ? $_lang['configcheck_admin'] : ""; |
|
233 | 233 | $config_check_results .= " |
234 | 234 | <fieldset> |
235 | 235 | <p><strong>".$_lang['configcheck_warning']."</strong> '".$warnings[$i][0]."'</p> |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | ".(isset($warnings[$i][2]) ? '<div style="padding-left:1em">'.$warnings[$i][2].'</div>' : '')." |
239 | 239 | </fieldset> |
240 | 240 | "; |
241 | - if ($i!=count($warnings)-1) { |
|
241 | + if ($i != count($warnings) - 1) { |
|
242 | 242 | $config_check_results .= "<br />"; |
243 | 243 | } |
244 | 244 | } |
245 | - $_SESSION["mgrConfigCheck"]=true; |
|
245 | + $_SESSION["mgrConfigCheck"] = true; |
|
246 | 246 | } else { |
247 | 247 | $config_check_results = $_lang['configcheck_ok']; |
248 | 248 | } |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | $warningspresent = 0; |
20 | 20 | |
21 | 21 | $sysfiles_check = $modx->manager->checkSystemChecksum(); |
22 | -if ($sysfiles_check!=='0'){ |
|
22 | +if ($sysfiles_check!=='0') { |
|
23 | 23 | $warningspresent = 1; |
24 | 24 | $warnings[] = array($_lang['configcheck_sysfiles_mod']); |
25 | 25 | } |
26 | 26 | |
27 | -if (is_writable("includes/config.inc.php")){ |
|
27 | +if (is_writable("includes/config.inc.php")) { |
|
28 | 28 | // Warn if world writable |
29 | 29 | if(@fileperms('includes/config.inc.php') & 0x0002) { |
30 | 30 | $warningspresent = 1; |
@@ -117,7 +117,8 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | if (!function_exists('checkSiteCache')) { |
120 | - function checkSiteCache() { |
|
120 | + function checkSiteCache() |
|
121 | + { |
|
121 | 122 | global $modx; |
122 | 123 | $checked= true; |
123 | 124 | if (file_exists($modx->config['base_path'] . 'assets/cache/siteCache.idx.php')) { |
@@ -156,26 +157,36 @@ discard block |
||
156 | 157 | |
157 | 158 | if ($warningspresent==1) { |
158 | 159 | |
159 | -if(!isset($modx->config['send_errormail'])) $modx->config['send_errormail']='3'; |
|
160 | +if(!isset($modx->config['send_errormail'])) { |
|
161 | + $modx->config['send_errormail']='3'; |
|
162 | +} |
|
160 | 163 | $config_check_results = "<h3>".$_lang['configcheck_notok']."</h3>"; |
161 | 164 | |
162 | 165 | for ($i=0;$i<count($warnings);$i++) { |
163 | 166 | switch ($warnings[$i][0]) { |
164 | 167 | case $_lang['configcheck_configinc']; |
165 | 168 | $warnings[$i][1] = $_lang['configcheck_configinc_msg']; |
166 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
169 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
170 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_configinc']); |
|
171 | + } |
|
167 | 172 | break; |
168 | 173 | case $_lang['configcheck_installer'] : |
169 | 174 | $warnings[$i][1] = $_lang['configcheck_installer_msg']; |
170 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
175 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
176 | + $modx->logEvent(0,3,$warnings[$i][1],$_lang['configcheck_installer']); |
|
177 | + } |
|
171 | 178 | break; |
172 | 179 | case $_lang['configcheck_cache'] : |
173 | 180 | $warnings[$i][1] = $_lang['configcheck_cache_msg']; |
174 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
181 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
182 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_cache']); |
|
183 | + } |
|
175 | 184 | break; |
176 | 185 | case $_lang['configcheck_images'] : |
177 | 186 | $warnings[$i][1] = $_lang['configcheck_images_msg']; |
178 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
187 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
188 | + $modx->logEvent(0,2,$warnings[$i][1],$_lang['configcheck_images']); |
|
189 | + } |
|
179 | 190 | break; |
180 | 191 | case $_lang['configcheck_sysfiles_mod']: |
181 | 192 | $warnings[$i][1] = $_lang["configcheck_sysfiles_mod_msg"]; |
@@ -183,7 +194,9 @@ discard block |
||
183 | 194 | if($modx->hasPermission('settings')) { |
184 | 195 | $warnings[$i][2] .= '<ul class="actionButtons" style="float:right"><li><a href="index.php?a=2&b=resetSysfilesChecksum" onclick="return confirm(\'' . $_lang["reset_sysfiles_checksum_alert"] . '\')">' . $_lang["reset_sysfiles_checksum_button"] . '</a></li></ul>'; |
185 | 196 | } |
186 | - if(!$_SESSION["mgrConfigCheck"]) $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
197 | + if(!$_SESSION["mgrConfigCheck"]) { |
|
198 | + $modx->logEvent(0,3,$warnings[$i][1]." ".join(', ',$sysfiles_check),$_lang['configcheck_sysfiles_mod']); |
|
199 | + } |
|
187 | 200 | break; |
188 | 201 | case $_lang['configcheck_lang_difference'] : |
189 | 202 | $warnings[$i][1] = $_lang['configcheck_lang_difference_msg']; |
@@ -9,178 +9,178 @@ |
||
9 | 9 | |
10 | 10 | Class TemplateParser { |
11 | 11 | |
12 | - function __construct() { |
|
13 | - } |
|
14 | - |
|
15 | - /** |
|
16 | - * @param array $config [action, tabs, toArray] |
|
17 | - * @param array $data |
|
18 | - * @return string |
|
19 | - */ |
|
20 | - public function output($config = array(), $data = array()) { |
|
21 | - global $modx; |
|
22 | - |
|
23 | - $output = ''; |
|
24 | - $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
25 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
26 | - |
|
27 | - if($action) { |
|
28 | - $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
|
12 | + function __construct() { |
|
13 | + } |
|
14 | + |
|
15 | + /** |
|
16 | + * @param array $config [action, tabs, toArray] |
|
17 | + * @param array $data |
|
18 | + * @return string |
|
19 | + */ |
|
20 | + public function output($config = array(), $data = array()) { |
|
21 | + global $modx; |
|
22 | + |
|
23 | + $output = ''; |
|
24 | + $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
|
25 | + $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
26 | + |
|
27 | + if($action) { |
|
28 | + $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
|
29 | 29 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
30 | 30 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
31 | 31 | WHERE t1.action IN(' . $action . ') ' . $tab . ' |
32 | 32 | ORDER BY t1.tab ASC, t1.rank ASC'); |
33 | 33 | |
34 | - if($modx->db->getRecordCount($sql)) { |
|
35 | - $tabs = array(); |
|
36 | - while($row = $modx->db->getRow($sql)) { |
|
37 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
38 | - $row['value'] = $data[$row['name']]; |
|
39 | - } |
|
40 | - $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
41 | - $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
42 | - } |
|
43 | - |
|
44 | - if(!empty($config['toArray'])) { |
|
45 | - $output = $tabs; |
|
46 | - } else { |
|
47 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
48 | - $output .= ' |
|
34 | + if($modx->db->getRecordCount($sql)) { |
|
35 | + $tabs = array(); |
|
36 | + while($row = $modx->db->getRow($sql)) { |
|
37 | + if(!$row['value'] && !empty($data[$row['name']])) { |
|
38 | + $row['value'] = $data[$row['name']]; |
|
39 | + } |
|
40 | + $tabs[$row['tab']]['category_name'] = $row['category_name']; |
|
41 | + $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
|
42 | + } |
|
43 | + |
|
44 | + if(!empty($config['toArray'])) { |
|
45 | + $output = $tabs; |
|
46 | + } else { |
|
47 | + $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
48 | + $output .= ' |
|
49 | 49 | <script type="text/javascript"> |
50 | 50 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
51 | 51 | </script>'; |
52 | 52 | |
53 | - foreach($tabs as $idTab => $tab) { |
|
54 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
55 | - $output .= ' |
|
53 | + foreach($tabs as $idTab => $tab) { |
|
54 | + $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
55 | + $output .= ' |
|
56 | 56 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
57 | 57 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
58 | - unset($tab['category_name']); |
|
59 | - foreach($tab as $item) { |
|
60 | - $output .= $item; |
|
61 | - } |
|
62 | - $output .= '</div>'; |
|
63 | - } |
|
64 | - $output .= '</div>'; |
|
65 | - } |
|
66 | - } |
|
67 | - } |
|
68 | - |
|
69 | - return $output; |
|
70 | - } |
|
71 | - |
|
72 | - private function render($data) { |
|
73 | - global $modx, $_lang, $_country_lang; |
|
74 | - |
|
75 | - $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
76 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
77 | - $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
78 | - |
|
79 | - $output = ''; |
|
80 | - $output .= '<div class="form-group row">'; |
|
81 | - |
|
82 | - switch($data['type']) { |
|
83 | - |
|
84 | - case 'text': |
|
85 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
58 | + unset($tab['category_name']); |
|
59 | + foreach($tab as $item) { |
|
60 | + $output .= $item; |
|
61 | + } |
|
62 | + $output .= '</div>'; |
|
63 | + } |
|
64 | + $output .= '</div>'; |
|
65 | + } |
|
66 | + } |
|
67 | + } |
|
68 | + |
|
69 | + return $output; |
|
70 | + } |
|
71 | + |
|
72 | + private function render($data) { |
|
73 | + global $modx, $_lang, $_country_lang; |
|
74 | + |
|
75 | + $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
|
76 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $_POST[$data['name']][$data['value']] : (isset($data['value']) ? $modx->htmlspecialchars($data['value']) : '')); |
|
77 | + $data['readonly'] = ($data['readonly'] ? ' readonly' : ''); |
|
78 | + |
|
79 | + $output = ''; |
|
80 | + $output .= '<div class="form-group row">'; |
|
81 | + |
|
82 | + switch($data['type']) { |
|
83 | + |
|
84 | + case 'text': |
|
85 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
86 | 86 | <div class="col-sm-7"> |
87 | 87 | <input type="text" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
88 | - $output .= $data['content']; |
|
89 | - $output .= '</div>'; |
|
88 | + $output .= $data['content']; |
|
89 | + $output .= '</div>'; |
|
90 | 90 | |
91 | - break; |
|
91 | + break; |
|
92 | 92 | |
93 | - case 'textarea': |
|
94 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
93 | + case 'textarea': |
|
94 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
95 | 95 | <div class="col-sm-7"> |
96 | 96 | <textarea name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;"[+readonly+]>[+value+]</textarea>'; |
97 | - $output .= $data['content']; |
|
98 | - $output .= '</div>'; |
|
97 | + $output .= $data['content']; |
|
98 | + $output .= '</div>'; |
|
99 | 99 | |
100 | - break; |
|
100 | + break; |
|
101 | 101 | |
102 | - case 'date': |
|
103 | - $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
104 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
102 | + case 'date': |
|
103 | + $data['value'] = (isset($_POST[$data['name']][$data['value']]) ? $modx->toDateFormat($_POST[$data['name']][$data['value']]) : (isset($data['value']) ? $modx->toDateFormat($data['value']) : '')); |
|
104 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
|
105 | 105 | <div class="col-sm-7"> |
106 | 106 | <input type="text" name="[+name+]" class="form-control DatePicker" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
107 | - $output .= $data['content']; |
|
108 | - $output .= '</div>'; |
|
109 | - |
|
110 | - break; |
|
111 | - |
|
112 | - case 'select': |
|
113 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
114 | - $output .= '<div class="col-sm-7">'; |
|
115 | - $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
116 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | - $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
118 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
119 | - foreach($_country_lang as $key => $value) { |
|
120 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
121 | - } |
|
122 | - } else { |
|
123 | - if($data['elements']) { |
|
124 | - $elements = explode('||', $data['elements']); |
|
125 | - foreach($elements as $key => $value) { |
|
126 | - $value = explode('==', $value); |
|
127 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
128 | - } |
|
129 | - } |
|
130 | - } |
|
131 | - $output .= '</select>'; |
|
132 | - $output .= $data['content']; |
|
133 | - $output .= '</div>'; |
|
134 | - |
|
135 | - break; |
|
136 | - |
|
137 | - case 'checkbox': |
|
138 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
139 | - $output .= '<div class="col-sm-7">'; |
|
140 | - $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
141 | - if($data['elements']) { |
|
142 | - $elements = explode('||', $data['elements']); |
|
143 | - foreach($elements as $key => $value) { |
|
144 | - $value = explode('==', $value); |
|
145 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
146 | - } |
|
147 | - } |
|
148 | - $output .= $data['content']; |
|
149 | - $output .= '</div>'; |
|
150 | - |
|
151 | - break; |
|
152 | - |
|
153 | - case 'radio': |
|
154 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
155 | - $output .= '<div class="col-sm-7">'; |
|
156 | - $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
157 | - if($data['elements']) { |
|
158 | - $elements = explode('||', $data['elements']); |
|
159 | - foreach($elements as $key => $value) { |
|
160 | - $value = explode('==', $value); |
|
161 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
162 | - } |
|
163 | - } |
|
164 | - $output .= $data['content']; |
|
165 | - $output .= '</div>'; |
|
166 | - |
|
167 | - break; |
|
168 | - |
|
169 | - case 'custom': |
|
170 | - $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
171 | - $output .= '<div class="col-sm-7">'; |
|
172 | - $output .= $data['content']; |
|
173 | - $output .= '</div>'; |
|
174 | - |
|
175 | - break; |
|
176 | - } |
|
177 | - |
|
178 | - $output .= '</div>'; |
|
179 | - |
|
180 | - $output = $modx->parseText($output, $data); |
|
181 | - |
|
182 | - return $output; |
|
183 | - } |
|
107 | + $output .= $data['content']; |
|
108 | + $output .= '</div>'; |
|
109 | + |
|
110 | + break; |
|
111 | + |
|
112 | + case 'select': |
|
113 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
114 | + $output .= '<div class="col-sm-7">'; |
|
115 | + $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
|
116 | + if($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | + $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
|
118 | + $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
119 | + foreach($_country_lang as $key => $value) { |
|
120 | + $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
121 | + } |
|
122 | + } else { |
|
123 | + if($data['elements']) { |
|
124 | + $elements = explode('||', $data['elements']); |
|
125 | + foreach($elements as $key => $value) { |
|
126 | + $value = explode('==', $value); |
|
127 | + $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
128 | + } |
|
129 | + } |
|
130 | + } |
|
131 | + $output .= '</select>'; |
|
132 | + $output .= $data['content']; |
|
133 | + $output .= '</div>'; |
|
134 | + |
|
135 | + break; |
|
136 | + |
|
137 | + case 'checkbox': |
|
138 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
139 | + $output .= '<div class="col-sm-7">'; |
|
140 | + $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
141 | + if($data['elements']) { |
|
142 | + $elements = explode('||', $data['elements']); |
|
143 | + foreach($elements as $key => $value) { |
|
144 | + $value = explode('==', $value); |
|
145 | + $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
146 | + } |
|
147 | + } |
|
148 | + $output .= $data['content']; |
|
149 | + $output .= '</div>'; |
|
150 | + |
|
151 | + break; |
|
152 | + |
|
153 | + case 'radio': |
|
154 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
155 | + $output .= '<div class="col-sm-7">'; |
|
156 | + $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
|
157 | + if($data['elements']) { |
|
158 | + $elements = explode('||', $data['elements']); |
|
159 | + foreach($elements as $key => $value) { |
|
160 | + $value = explode('==', $value); |
|
161 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
162 | + } |
|
163 | + } |
|
164 | + $output .= $data['content']; |
|
165 | + $output .= '</div>'; |
|
166 | + |
|
167 | + break; |
|
168 | + |
|
169 | + case 'custom': |
|
170 | + $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
|
171 | + $output .= '<div class="col-sm-7">'; |
|
172 | + $output .= $data['content']; |
|
173 | + $output .= '</div>'; |
|
174 | + |
|
175 | + break; |
|
176 | + } |
|
177 | + |
|
178 | + $output .= '</div>'; |
|
179 | + |
|
180 | + $output = $modx->parseText($output, $data); |
|
181 | + |
|
182 | + return $output; |
|
183 | + } |
|
184 | 184 | |
185 | 185 | } |
186 | 186 |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +Class TemplateParser{ |
|
11 | 11 | |
12 | - function __construct() { |
|
12 | + function __construct(){ |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
@@ -17,46 +17,46 @@ discard block |
||
17 | 17 | * @param array $data |
18 | 18 | * @return string |
19 | 19 | */ |
20 | - public function output($config = array(), $data = array()) { |
|
20 | + public function output($config = array(), $data = array()){ |
|
21 | 21 | global $modx; |
22 | 22 | |
23 | 23 | $output = ''; |
24 | 24 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
25 | - $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
|
25 | + $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : ''; |
|
26 | 26 | |
27 | - if($action) { |
|
27 | + if ($action) { |
|
28 | 28 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
29 | - FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
|
30 | - INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
|
31 | - WHERE t1.action IN(' . $action . ') ' . $tab . ' |
|
29 | + FROM ' . $modx->getFullTableName('system_templates').' AS t1 |
|
30 | + INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category |
|
31 | + WHERE t1.action IN(' . $action.') '.$tab.' |
|
32 | 32 | ORDER BY t1.tab ASC, t1.rank ASC'); |
33 | 33 | |
34 | - if($modx->db->getRecordCount($sql)) { |
|
34 | + if ($modx->db->getRecordCount($sql)) { |
|
35 | 35 | $tabs = array(); |
36 | - while($row = $modx->db->getRow($sql)) { |
|
37 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
36 | + while ($row = $modx->db->getRow($sql)) { |
|
37 | + if (!$row['value'] && !empty($data[$row['name']])) { |
|
38 | 38 | $row['value'] = $data[$row['name']]; |
39 | 39 | } |
40 | 40 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
41 | 41 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
42 | 42 | } |
43 | 43 | |
44 | - if(!empty($config['toArray'])) { |
|
44 | + if (!empty($config['toArray'])) { |
|
45 | 45 | $output = $tabs; |
46 | 46 | } else { |
47 | - $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
|
47 | + $output .= '<div class="tab-pane" id="pane_'.$action.'">'; |
|
48 | 48 | $output .= ' |
49 | 49 | <script type="text/javascript"> |
50 | - var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
50 | + var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
51 | 51 | </script>'; |
52 | 52 | |
53 | - foreach($tabs as $idTab => $tab) { |
|
54 | - $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
|
53 | + foreach ($tabs as $idTab => $tab) { |
|
54 | + $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">'; |
|
55 | 55 | $output .= ' |
56 | - <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
|
57 | - <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
|
56 | + <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2> |
|
57 | + <script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>'; |
|
58 | 58 | unset($tab['category_name']); |
59 | - foreach($tab as $item) { |
|
59 | + foreach ($tab as $item) { |
|
60 | 60 | $output .= $item; |
61 | 61 | } |
62 | 62 | $output .= '</div>'; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | return $output; |
70 | 70 | } |
71 | 71 | |
72 | - private function render($data) { |
|
72 | + private function render($data){ |
|
73 | 73 | global $modx, $_lang, $_country_lang; |
74 | 74 | |
75 | 75 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $output = ''; |
80 | 80 | $output .= '<div class="form-group row">'; |
81 | 81 | |
82 | - switch($data['type']) { |
|
82 | + switch ($data['type']) { |
|
83 | 83 | |
84 | 84 | case 'text': |
85 | 85 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
114 | 114 | $output .= '<div class="col-sm-7">'; |
115 | 115 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
116 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
116 | + if ($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | 117 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
118 | - $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
|
119 | - foreach($_country_lang as $key => $value) { |
|
120 | - $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
|
118 | + $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'> </option>'; |
|
119 | + foreach ($_country_lang as $key => $value) { |
|
120 | + $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>'; |
|
121 | 121 | } |
122 | 122 | } else { |
123 | - if($data['elements']) { |
|
123 | + if ($data['elements']) { |
|
124 | 124 | $elements = explode('||', $data['elements']); |
125 | - foreach($elements as $key => $value) { |
|
125 | + foreach ($elements as $key => $value) { |
|
126 | 126 | $value = explode('==', $value); |
127 | - $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
|
127 | + $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>'; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | } |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
139 | 139 | $output .= '<div class="col-sm-7">'; |
140 | 140 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
141 | - if($data['elements']) { |
|
141 | + if ($data['elements']) { |
|
142 | 142 | $elements = explode('||', $data['elements']); |
143 | - foreach($elements as $key => $value) { |
|
143 | + foreach ($elements as $key => $value) { |
|
144 | 144 | $value = explode('==', $value); |
145 | - $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
145 | + $output .= '<br /><input type="checkbox" name="'.$value[0].'" class="form-control" id="'.$value[0].'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | $output .= $data['content']; |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
155 | 155 | $output .= '<div class="col-sm-7">'; |
156 | 156 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
157 | - if($data['elements']) { |
|
157 | + if ($data['elements']) { |
|
158 | 158 | $elements = explode('||', $data['elements']); |
159 | - foreach($elements as $key => $value) { |
|
159 | + foreach ($elements as $key => $value) { |
|
160 | 160 | $value = explode('==', $value); |
161 | - $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
161 | + $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_'.$key.'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | $output .= $data['content']; |
@@ -7,9 +7,11 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +Class TemplateParser |
|
11 | +{ |
|
11 | 12 | |
12 | - function __construct() { |
|
13 | + function __construct() |
|
14 | + { |
|
13 | 15 | } |
14 | 16 | |
15 | 17 | /** |
@@ -17,46 +19,47 @@ discard block |
||
17 | 19 | * @param array $data |
18 | 20 | * @return string |
19 | 21 | */ |
20 | - public function output($config = array(), $data = array()) { |
|
22 | + public function output($config = array(), $data = array()) |
|
23 | + { |
|
21 | 24 | global $modx; |
22 | 25 | |
23 | 26 | $output = ''; |
24 | 27 | $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : ''); |
25 | 28 | $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : ''; |
26 | 29 | |
27 | - if($action) { |
|
30 | + if($action) { |
|
28 | 31 | $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name |
29 | 32 | FROM ' . $modx->getFullTableName('system_templates') . ' AS t1 |
30 | 33 | INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category |
31 | 34 | WHERE t1.action IN(' . $action . ') ' . $tab . ' |
32 | 35 | ORDER BY t1.tab ASC, t1.rank ASC'); |
33 | 36 | |
34 | - if($modx->db->getRecordCount($sql)) { |
|
37 | + if($modx->db->getRecordCount($sql)) { |
|
35 | 38 | $tabs = array(); |
36 | - while($row = $modx->db->getRow($sql)) { |
|
37 | - if(!$row['value'] && !empty($data[$row['name']])) { |
|
39 | + while($row = $modx->db->getRow($sql)) { |
|
40 | + if(!$row['value'] && !empty($data[$row['name']])) { |
|
38 | 41 | $row['value'] = $data[$row['name']]; |
39 | 42 | } |
40 | 43 | $tabs[$row['tab']]['category_name'] = $row['category_name']; |
41 | 44 | $tabs[$row['tab']][$row['name']] = TemplateParser::render($row); |
42 | 45 | } |
43 | 46 | |
44 | - if(!empty($config['toArray'])) { |
|
47 | + if(!empty($config['toArray'])) { |
|
45 | 48 | $output = $tabs; |
46 | - } else { |
|
49 | + } else { |
|
47 | 50 | $output .= '<div class="tab-pane" id="pane_' . $action . '">'; |
48 | 51 | $output .= ' |
49 | 52 | <script type="text/javascript"> |
50 | 53 | var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
51 | 54 | </script>'; |
52 | 55 | |
53 | - foreach($tabs as $idTab => $tab) { |
|
56 | + foreach($tabs as $idTab => $tab) { |
|
54 | 57 | $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">'; |
55 | 58 | $output .= ' |
56 | 59 | <h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2> |
57 | 60 | <script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>'; |
58 | 61 | unset($tab['category_name']); |
59 | - foreach($tab as $item) { |
|
62 | + foreach($tab as $item) { |
|
60 | 63 | $output .= $item; |
61 | 64 | } |
62 | 65 | $output .= '</div>'; |
@@ -69,7 +72,8 @@ discard block |
||
69 | 72 | return $output; |
70 | 73 | } |
71 | 74 | |
72 | - private function render($data) { |
|
75 | + private function render($data) |
|
76 | + { |
|
73 | 77 | global $modx, $_lang, $_country_lang; |
74 | 78 | |
75 | 79 | $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']); |
@@ -79,7 +83,7 @@ discard block |
||
79 | 83 | $output = ''; |
80 | 84 | $output .= '<div class="form-group row">'; |
81 | 85 | |
82 | - switch($data['type']) { |
|
86 | + switch($data['type']) { |
|
83 | 87 | |
84 | 88 | case 'text': |
85 | 89 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label> |
@@ -113,16 +117,16 @@ discard block |
||
113 | 117 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
114 | 118 | $output .= '<div class="col-sm-7">'; |
115 | 119 | $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">'; |
116 | - if($data['name'] == 'country' && isset($_country_lang)) { |
|
120 | + if($data['name'] == 'country' && isset($_country_lang)) { |
|
117 | 121 | $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country']; |
118 | 122 | $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '> </option>'; |
119 | - foreach($_country_lang as $key => $value) { |
|
123 | + foreach($_country_lang as $key => $value) { |
|
120 | 124 | $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>'; |
121 | 125 | } |
122 | - } else { |
|
123 | - if($data['elements']) { |
|
126 | + } else { |
|
127 | + if($data['elements']) { |
|
124 | 128 | $elements = explode('||', $data['elements']); |
125 | - foreach($elements as $key => $value) { |
|
129 | + foreach($elements as $key => $value) { |
|
126 | 130 | $value = explode('==', $value); |
127 | 131 | $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>'; |
128 | 132 | } |
@@ -138,9 +142,9 @@ discard block |
||
138 | 142 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
139 | 143 | $output .= '<div class="col-sm-7">'; |
140 | 144 | $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
141 | - if($data['elements']) { |
|
145 | + if($data['elements']) { |
|
142 | 146 | $elements = explode('||', $data['elements']); |
143 | - foreach($elements as $key => $value) { |
|
147 | + foreach($elements as $key => $value) { |
|
144 | 148 | $value = explode('==', $value); |
145 | 149 | $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
146 | 150 | } |
@@ -154,9 +158,9 @@ discard block |
||
154 | 158 | $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>'; |
155 | 159 | $output .= '<div class="col-sm-7">'; |
156 | 160 | $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />'; |
157 | - if($data['elements']) { |
|
161 | + if($data['elements']) { |
|
158 | 162 | $elements = explode('||', $data['elements']); |
159 | - foreach($elements as $key => $value) { |
|
163 | + foreach($elements as $key => $value) { |
|
160 | 164 | $value = explode('==', $value); |
161 | 165 | $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]); |
162 | 166 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -Class TemplateParser { |
|
10 | +class TemplateParser { |
|
11 | 11 | |
12 | 12 | function __construct() { |
13 | 13 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | // show debug information |
5 | 5 | if(isset($enable_debug) && $enable_debug==true) { |
6 | - ?> |
|
6 | + ?> |
|
7 | 7 | <script language="javascript"> |
8 | 8 | //document.onload = removeDebug(); |
9 | 9 | |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | } |
34 | 34 | </style> |
35 | 35 | <?php |
36 | - $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
37 | - ?> |
|
36 | + $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
37 | + ?> |
|
38 | 38 | <div class='debug' id='debug' name='debug' onClick="removeDebugDiv();"> |
39 | 39 | <table border="0" cellspacing="0" cellpadding="0"> |
40 | 40 | <tr> |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | 6 | // show debug information |
7 | -if(isset($enable_debug) && $enable_debug==true) { |
|
7 | +if (isset($enable_debug) && $enable_debug == true) { |
|
8 | 8 | ?> |
9 | 9 | <script language="javascript"> |
10 | 10 | //document.onload = removeDebug(); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | </style> |
37 | 37 | <?php |
38 | - $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
38 | + $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $tend = $mtime; $totaltime = ($tend - $tstart); |
|
39 | 39 | ?> |
40 | 40 | <div class='debug' id='debug' name='debug' onClick="removeDebugDiv();"> |
41 | 41 | <table border="0" cellspacing="0" cellpadding="0"> |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | </tr> |
45 | 45 | <tr> |
46 | 46 | <td width="70">Time taken</td> |
47 | - <td width="80"><?php echo printf ("%6.5f s", $totaltime); ?></td> |
|
47 | + <td width="80"><?php echo printf("%6.5f s", $totaltime); ?></td> |
|
48 | 48 | </tr> |
49 | 49 | </table> |
50 | 50 | </div> |
@@ -4,59 +4,59 @@ |
||
4 | 4 | $ContextMenuCnt = 0; |
5 | 5 | |
6 | 6 | class ContextMenu { |
7 | - var $id; |
|
7 | + var $id; |
|
8 | 8 | |
9 | - function __construct($id = '', $width = 120, $visible = false) { |
|
10 | - global $ContextMenuCnt; |
|
11 | - $ContextMenuCnt++; |
|
12 | - $this->html = ""; |
|
13 | - $this->visible = $visible ? $visible : false; |
|
14 | - $this->width = is_numeric($width) ? intval($width) : 120; |
|
15 | - $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
16 | - } |
|
9 | + function __construct($id = '', $width = 120, $visible = false) { |
|
10 | + global $ContextMenuCnt; |
|
11 | + $ContextMenuCnt++; |
|
12 | + $this->html = ""; |
|
13 | + $this->visible = $visible ? $visible : false; |
|
14 | + $this->width = is_numeric($width) ? intval($width) : 120; |
|
15 | + $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
16 | + } |
|
17 | 17 | |
18 | - function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
19 | - global $base_url, $_style; |
|
18 | + function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
19 | + global $base_url, $_style; |
|
20 | 20 | if($disabled) { |
21 | 21 | return; |
22 | 22 | } |
23 | - if(!$img) { |
|
24 | - $img = $base_url . $_style['tx']; |
|
25 | - } |
|
26 | - if(substr($action, 0, 3) == "js:") { |
|
27 | - $action = substr($action, 3); |
|
28 | - } else if(substr($action, 0, 3) == "hl:") { |
|
29 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
30 | - } else { |
|
31 | - $action = "window.location.href='" . $action . "'"; |
|
32 | - } |
|
33 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
34 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
23 | + if(!$img) { |
|
24 | + $img = $base_url . $_style['tx']; |
|
25 | + } |
|
26 | + if(substr($action, 0, 3) == "js:") { |
|
27 | + $action = substr($action, 3); |
|
28 | + } else if(substr($action, 0, 3) == "hl:") { |
|
29 | + $action = "window.location.href='" . substr($action, 3) . "'"; |
|
30 | + } else { |
|
31 | + $action = "window.location.href='" . $action . "'"; |
|
32 | + } |
|
33 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
34 | + $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
35 | 35 | if(substr($img, 0, 5) == 'fa fa') { |
36 | 36 | $img = '<i class="' . $img . '"></i>'; |
37 | 37 | } else if(substr($img, 0, 1) != '<') { |
38 | 38 | $img = '<img src="' . $img . '" />'; |
39 | 39 | } |
40 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
41 | - } |
|
40 | + $this->html .= $img . ' ' . $text . '</div>'; |
|
41 | + } |
|
42 | 42 | |
43 | - function addSeparator() { |
|
44 | - $this->html .= " |
|
43 | + function addSeparator() { |
|
44 | + $this->html .= " |
|
45 | 45 | <div class='cntxMnuSeparator'></div> |
46 | 46 | "; |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | - function render() { |
|
50 | - global $ContextMenuScript; |
|
49 | + function render() { |
|
50 | + global $ContextMenuScript; |
|
51 | 51 | |
52 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
53 | - $ContextMenuScript = ""; // reset css |
|
54 | - return $html; |
|
55 | - } |
|
52 | + $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
53 | + $ContextMenuScript = ""; // reset css |
|
54 | + return $html; |
|
55 | + } |
|
56 | 56 | |
57 | - function getClientScriptObject() { |
|
58 | - return "getCntxMenu('" . $this->id . "')"; |
|
59 | - } |
|
57 | + function getClientScriptObject() { |
|
58 | + return "getCntxMenu('" . $this->id . "')"; |
|
59 | + } |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $ContextMenuScript = <<<BLOCK |
@@ -3,59 +3,59 @@ |
||
3 | 3 | global $ContextMenuCnt; |
4 | 4 | $ContextMenuCnt = 0; |
5 | 5 | |
6 | -class ContextMenu { |
|
6 | +class ContextMenu{ |
|
7 | 7 | var $id; |
8 | 8 | |
9 | - function __construct($id = '', $width = 120, $visible = false) { |
|
9 | + function __construct($id = '', $width = 120, $visible = false){ |
|
10 | 10 | global $ContextMenuCnt; |
11 | 11 | $ContextMenuCnt++; |
12 | 12 | $this->html = ""; |
13 | 13 | $this->visible = $visible ? $visible : false; |
14 | 14 | $this->width = is_numeric($width) ? intval($width) : 120; |
15 | - $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
|
15 | + $this->id = $id ? $id : "cntxMnu".$ContextMenuCnt; // set id |
|
16 | 16 | } |
17 | 17 | |
18 | - function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
18 | + function addItem($text, $action = "", $img = "", $disabled = 0){ |
|
19 | 19 | global $base_url, $_style; |
20 | - if($disabled) { |
|
20 | + if ($disabled) { |
|
21 | 21 | return; |
22 | 22 | } |
23 | - if(!$img) { |
|
24 | - $img = $base_url . $_style['tx']; |
|
23 | + if (!$img) { |
|
24 | + $img = $base_url.$_style['tx']; |
|
25 | 25 | } |
26 | - if(substr($action, 0, 3) == "js:") { |
|
26 | + if (substr($action, 0, 3) == "js:") { |
|
27 | 27 | $action = substr($action, 3); |
28 | - } else if(substr($action, 0, 3) == "hl:") { |
|
29 | - $action = "window.location.href='" . substr($action, 3) . "'"; |
|
28 | + } else if (substr($action, 0, 3) == "hl:") { |
|
29 | + $action = "window.location.href='".substr($action, 3)."'"; |
|
30 | 30 | } else { |
31 | - $action = "window.location.href='" . $action . "'"; |
|
31 | + $action = "window.location.href='".$action."'"; |
|
32 | 32 | } |
33 | - $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\""; |
|
34 | - $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>"; |
|
35 | - if(substr($img, 0, 5) == 'fa fa') { |
|
36 | - $img = '<i class="' . $img . '"></i>'; |
|
37 | - } else if(substr($img, 0, 1) != '<') { |
|
38 | - $img = '<img src="' . $img . '" />'; |
|
33 | + $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('".$this->id."');\""; |
|
34 | + $this->html .= "<div class='".($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem")."' $action>"; |
|
35 | + if (substr($img, 0, 5) == 'fa fa') { |
|
36 | + $img = '<i class="'.$img.'"></i>'; |
|
37 | + } else if (substr($img, 0, 1) != '<') { |
|
38 | + $img = '<img src="'.$img.'" />'; |
|
39 | 39 | } |
40 | - $this->html .= $img . ' ' . $text . '</div>'; |
|
40 | + $this->html .= $img.' '.$text.'</div>'; |
|
41 | 41 | } |
42 | 42 | |
43 | - function addSeparator() { |
|
43 | + function addSeparator(){ |
|
44 | 44 | $this->html .= " |
45 | 45 | <div class='cntxMnuSeparator'></div> |
46 | 46 | "; |
47 | 47 | } |
48 | 48 | |
49 | - function render() { |
|
49 | + function render(){ |
|
50 | 50 | global $ContextMenuScript; |
51 | 51 | |
52 | - $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
|
52 | + $html = $ContextMenuScript."<div id='".$this->id."' class='contextMenu' style='width:".$this->width."px; visibility:".($this->visible ? 'visible' : 'hidden')."'>".$this->html."</div>"; |
|
53 | 53 | $ContextMenuScript = ""; // reset css |
54 | 54 | return $html; |
55 | 55 | } |
56 | 56 | |
57 | - function getClientScriptObject() { |
|
58 | - return "getCntxMenu('" . $this->id . "')"; |
|
57 | + function getClientScriptObject(){ |
|
58 | + return "getCntxMenu('".$this->id."')"; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 |
@@ -3,10 +3,12 @@ discard block |
||
3 | 3 | global $ContextMenuCnt; |
4 | 4 | $ContextMenuCnt = 0; |
5 | 5 | |
6 | -class ContextMenu { |
|
6 | +class ContextMenu |
|
7 | +{ |
|
7 | 8 | var $id; |
8 | 9 | |
9 | - function __construct($id = '', $width = 120, $visible = false) { |
|
10 | + function __construct($id = '', $width = 120, $visible = false) |
|
11 | + { |
|
10 | 12 | global $ContextMenuCnt; |
11 | 13 | $ContextMenuCnt++; |
12 | 14 | $this->html = ""; |
@@ -15,7 +17,8 @@ discard block |
||
15 | 17 | $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt; // set id |
16 | 18 | } |
17 | 19 | |
18 | - function addItem($text, $action = "", $img = "", $disabled = 0) { |
|
20 | + function addItem($text, $action = "", $img = "", $disabled = 0) |
|
21 | + { |
|
19 | 22 | global $base_url, $_style; |
20 | 23 | if($disabled) { |
21 | 24 | return; |
@@ -40,13 +43,15 @@ discard block |
||
40 | 43 | $this->html .= $img . ' ' . $text . '</div>'; |
41 | 44 | } |
42 | 45 | |
43 | - function addSeparator() { |
|
46 | + function addSeparator() |
|
47 | + { |
|
44 | 48 | $this->html .= " |
45 | 49 | <div class='cntxMnuSeparator'></div> |
46 | 50 | "; |
47 | 51 | } |
48 | 52 | |
49 | - function render() { |
|
53 | + function render() |
|
54 | + { |
|
50 | 55 | global $ContextMenuScript; |
51 | 56 | |
52 | 57 | $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>"; |
@@ -54,7 +59,8 @@ discard block |
||
54 | 59 | return $html; |
55 | 60 | } |
56 | 61 | |
57 | - function getClientScriptObject() { |
|
62 | + function getClientScriptObject() |
|
63 | + { |
|
58 | 64 | return "getCntxMenu('" . $this->id . "')"; |
59 | 65 | } |
60 | 66 | } |
@@ -69,4 +69,4 @@ |
||
69 | 69 | cm.style.visibility = 'hidden'; |
70 | 70 | } |
71 | 71 | </script> |
72 | -BLOCK; |
|
72 | +block; |