@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class DATEPICKER {
|
|
| 4 | - function __construct() {
|
|
| 3 | +class DATEPICKER{
|
|
| 4 | + function __construct(){
|
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | - function getDP() {
|
|
| 7 | + function getDP(){
|
|
| 8 | 8 | global $modx, $_lang; |
| 9 | 9 | |
| 10 | - $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
| 10 | + $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
|
| 11 | 11 | return $modx->parseText($tpl, $_lang, '[%', '%]'); |
| 12 | 12 | } |
| 13 | 13 | } |
@@ -1,10 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class DATEPICKER {
|
|
| 4 | - function __construct() {
|
|
| 3 | +class DATEPICKER |
|
| 4 | +{ |
|
| 5 | + function __construct() |
|
| 6 | + { |
|
| 5 | 7 | } |
| 6 | 8 | |
| 7 | - function getDP() {
|
|
| 9 | + function getDP() |
|
| 10 | + { |
|
| 8 | 11 | global $modx, $_lang; |
| 9 | 12 | |
| 10 | 13 | $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class uploader { |
|
| 15 | +class uploader{ |
|
| 16 | 16 | |
| 17 | 17 | /** Release version */ |
| 18 | 18 | const VERSION = "2.54"; |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | /** Next three properties are got from the current language file |
| 74 | 74 | * @var string */ |
| 75 | - protected $dateTimeFull; // Currently not used |
|
| 76 | - protected $dateTimeMid; // Currently not used |
|
| 75 | + protected $dateTimeFull; // Currently not used |
|
| 76 | + protected $dateTimeMid; // Currently not used |
|
| 77 | 77 | protected $dateTimeSmall; |
| 78 | 78 | |
| 79 | 79 | /** Contain Specified language labels |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
| 105 | 105 | * @param string $property |
| 106 | 106 | * @return mixed */ |
| 107 | - public function __get($property) { |
|
| 107 | + public function __get($property){ |
|
| 108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function __construct($modx) { |
|
| 111 | + public function __construct($modx){ |
|
| 112 | 112 | |
| 113 | 113 | //MODX |
| 114 | 114 | try { |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | // COOKIES INIT |
| 208 | 208 | $ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'; |
| 209 | - $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/'; |
|
| 209 | + $ip = '/^'.implode('\.', array($ip, $ip, $ip, $ip)).'$/'; |
|
| 210 | 210 | if (preg_match($ip, $_SERVER['HTTP_HOST']) || |
| 211 | 211 | preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST']) |
| 212 | 212 | ) |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | ) { |
| 225 | 225 | list($unused, $protocol, $domain, $unused, $port, $path) = $patt; |
| 226 | 226 | $path = path::normalize($path); |
| 227 | - $this->config['uploadURL'] = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/$path"; |
|
| 227 | + $this->config['uploadURL'] = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/$path"; |
|
| 228 | 228 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
| 229 | 229 | ? path::normalize($this->config['uploadDir']) |
| 230 | 230 | : path::url2fullPath("/$path"); |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | foreach ($this->langInputNames as $key) |
| 268 | 268 | if (isset($this->get[$key]) && |
| 269 | 269 | preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) && |
| 270 | - file_exists("lang/" . strtolower($this->get[$key]) . ".php") |
|
| 270 | + file_exists("lang/".strtolower($this->get[$key]).".php") |
|
| 271 | 271 | ) { |
| 272 | 272 | $this->lang = $this->get[$key]; |
| 273 | 273 | break; |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | $this->backMsg("Cannot read upload folder."); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - public function upload() { |
|
| 301 | + public function upload(){ |
|
| 302 | 302 | $config = &$this->config; |
| 303 | 303 | $file = &$this->file; |
| 304 | 304 | $url = $message = ""; |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | @mkdir(path::normalize($dir), $this->config['dirPerms'], true); |
| 330 | 330 | |
| 331 | 331 | $filename = $this->normalizeFilename($file['name']); |
| 332 | - $target = file::getInexistantFilename($dir . $filename); |
|
| 332 | + $target = file::getInexistantFilename($dir.$filename); |
|
| 333 | 333 | |
| 334 | 334 | if (!@move_uploaded_file($file['tmp_name'], $target) && |
| 335 | 335 | !@rename($file['tmp_name'], $target) && |
@@ -342,11 +342,11 @@ discard block |
||
| 342 | 342 | $this->makeThumb($target); |
| 343 | 343 | $url = $this->typeURL; |
| 344 | 344 | if (isset($udir)) $url .= "/$udir"; |
| 345 | - $url .= "/" . basename($target); |
|
| 345 | + $url .= "/".basename($target); |
|
| 346 | 346 | if (preg_match('/^([a-z]+)\:\/\/([^\/^\:]+)(\:(\d+))?\/(.+)$/', $url, $patt)) { |
| 347 | 347 | list($unused, $protocol, $domain, $unused, $port, $path) = $patt; |
| 348 | - $base = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/"; |
|
| 349 | - $url = $base . path::urlPathEncode($path); |
|
| 348 | + $base = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/"; |
|
| 349 | + $url = $base.path::urlPathEncode($path); |
|
| 350 | 350 | } else |
| 351 | 351 | $url = path::urlPathEncode($url); |
| 352 | 352 | } |
@@ -365,12 +365,12 @@ discard block |
||
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | |
| 368 | - protected function getTransaliasSettings() { |
|
| 368 | + protected function getTransaliasSettings(){ |
|
| 369 | 369 | global $modx; |
| 370 | 370 | |
| 371 | 371 | // Cleaning uploaded filename? |
| 372 | 372 | $setting = $modx->db->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
| 373 | - if ($modx->db->getValue($setting)>0) { |
|
| 373 | + if ($modx->db->getValue($setting) > 0) { |
|
| 374 | 374 | // Transalias plugin active? |
| 375 | 375 | $res = $modx->db->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
| 376 | 376 | if ($properties = $modx->db->getValue($res)) { |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | |
| 388 | - protected function normalizeFilename($filename) { |
|
| 388 | + protected function normalizeFilename($filename){ |
|
| 389 | 389 | if ($this->getTransaliasSettings()) { |
| 390 | 390 | $format = strrchr($filename, "."); |
| 391 | 391 | $filename = str_replace($format, "", $filename); |
@@ -394,11 +394,11 @@ discard block |
||
| 394 | 394 | return $filename; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - protected function normalizeDirname($dirname) { |
|
| 397 | + protected function normalizeDirname($dirname){ |
|
| 398 | 398 | return $this->modx->stripAlias($dirname); |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | - protected function checkUploadedFile(array $aFile=null) { |
|
| 401 | + protected function checkUploadedFile(array $aFile = null){ |
|
| 402 | 402 | $config = &$this->config; |
| 403 | 403 | $file = ($aFile === null) ? $this->file : $aFile; |
| 404 | 404 | |
@@ -437,8 +437,7 @@ discard block |
||
| 437 | 437 | ($file['error'] == UPLOAD_ERR_NO_TMP_DIR) ? |
| 438 | 438 | $this->label("Missing a temporary folder.") : ( |
| 439 | 439 | ($file['error'] == UPLOAD_ERR_CANT_WRITE) ? |
| 440 | - $this->label("Failed to write file.") : |
|
| 441 | - $this->label("Unknown error.") |
|
| 440 | + $this->label("Failed to write file.") : $this->label("Unknown error.") |
|
| 442 | 441 | ))))); |
| 443 | 442 | |
| 444 | 443 | // HIDDEN FILENAMES CHECK |
@@ -473,14 +472,14 @@ discard block |
||
| 473 | 472 | |
| 474 | 473 | |
| 475 | 474 | // CHECK FOR MODX MAX FILE SIZE |
| 476 | - $actualfilesize=filesize($file['tmp_name']); |
|
| 475 | + $actualfilesize = filesize($file['tmp_name']); |
|
| 477 | 476 | if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
| 478 | 477 | return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
| 479 | 478 | |
| 480 | 479 | return true; |
| 481 | 480 | } |
| 482 | 481 | |
| 483 | - protected function checkInputDir($dir, $inclType=true, $existing=true) { |
|
| 482 | + protected function checkInputDir($dir, $inclType = true, $existing = true){ |
|
| 484 | 483 | $dir = path::normalize($dir); |
| 485 | 484 | if (substr($dir, 0, 1) == "/") |
| 486 | 485 | $dir = substr($dir, 1); |
@@ -506,7 +505,7 @@ discard block |
||
| 506 | 505 | return (is_dir($path) && is_readable($path)) ? $return : false; |
| 507 | 506 | } |
| 508 | 507 | |
| 509 | - protected function validateExtension($ext, $type) { |
|
| 508 | + protected function validateExtension($ext, $type){ |
|
| 510 | 509 | $ext = trim(strtolower($ext)); |
| 511 | 510 | if (!isset($this->types[$type])) |
| 512 | 511 | return false; |
@@ -531,17 +530,17 @@ discard block |
||
| 531 | 530 | return in_array($ext, $exts); |
| 532 | 531 | } |
| 533 | 532 | |
| 534 | - protected function getTypeFromPath($path) { |
|
| 533 | + protected function getTypeFromPath($path){ |
|
| 535 | 534 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
| 536 | 535 | ? $patt[1] : $path; |
| 537 | 536 | } |
| 538 | 537 | |
| 539 | - protected function removeTypeFromPath($path) { |
|
| 538 | + protected function removeTypeFromPath($path){ |
|
| 540 | 539 | return preg_match('/^[^\/]*\/(.*)$/', $path, $patt) |
| 541 | 540 | ? $patt[1] : ""; |
| 542 | 541 | } |
| 543 | 542 | |
| 544 | - protected function imageResize($image, $file=null) { |
|
| 543 | + protected function imageResize($image, $file = null){ |
|
| 545 | 544 | |
| 546 | 545 | if (!($image instanceof image)) { |
| 547 | 546 | $img = image::factory($this->imageDriver, $image); |
@@ -629,24 +628,24 @@ discard block |
||
| 629 | 628 | $img->watermark($this->config['watermark']['file'], $left, $top); |
| 630 | 629 | } |
| 631 | 630 | |
| 632 | - $options = array( 'file' => $file ); |
|
| 631 | + $options = array('file' => $file); |
|
| 633 | 632 | |
| 634 | - $type = exif_imagetype( $file ); |
|
| 633 | + $type = exif_imagetype($file); |
|
| 635 | 634 | |
| 636 | - switch ( $type ) { |
|
| 635 | + switch ($type) { |
|
| 637 | 636 | case IMAGETYPE_GIF: |
| 638 | - return $img->output( 'gif', $options ); |
|
| 637 | + return $img->output('gif', $options); |
|
| 639 | 638 | |
| 640 | 639 | case IMAGETYPE_PNG: |
| 641 | - return $img->output( 'png', $options ); |
|
| 640 | + return $img->output('png', $options); |
|
| 642 | 641 | |
| 643 | 642 | default: |
| 644 | - return $img->output( 'jpeg', array_merge( $options, array( 'quality' => $this->config['jpegQuality'] ) ) ); |
|
| 643 | + return $img->output('jpeg', array_merge($options, array('quality' => $this->config['jpegQuality']))); |
|
| 645 | 644 | } |
| 646 | 645 | |
| 647 | 646 | } |
| 648 | 647 | |
| 649 | - protected function makeThumb($file, $overwrite=true) { |
|
| 648 | + protected function makeThumb($file, $overwrite = true){ |
|
| 650 | 649 | $img = image::factory($this->imageDriver, $file); |
| 651 | 650 | |
| 652 | 651 | // Drop files which are not images |
@@ -654,7 +653,7 @@ discard block |
||
| 654 | 653 | return true; |
| 655 | 654 | |
| 656 | 655 | $thumb = substr($file, strlen($this->config['uploadDir'])); |
| 657 | - $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb; |
|
| 656 | + $thumb = $this->config['uploadDir']."/".$this->config['thumbsDir']."/".$thumb; |
|
| 658 | 657 | $thumb = path::normalize($thumb); |
| 659 | 658 | $thumbDir = dirname($thumb); |
| 660 | 659 | if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) |
@@ -677,15 +676,15 @@ discard block |
||
| 677 | 676 | if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) |
| 678 | 677 | return false; |
| 679 | 678 | |
| 680 | - if ( $this->imageDriver == 'gd' ) { |
|
| 681 | - $width = imagesx( $img->image ); |
|
| 682 | - $height = imagesy( $img->image ); |
|
| 683 | - $back = image::factory( $this->imageDriver, array( $width, $height ) ); |
|
| 684 | - $tile = image::factory( $this->imageDriver, __DIR__ . '/../themes/' . $this->config['theme'] . '/img/bg_transparent.png' ); |
|
| 679 | + if ($this->imageDriver == 'gd') { |
|
| 680 | + $width = imagesx($img->image); |
|
| 681 | + $height = imagesy($img->image); |
|
| 682 | + $back = image::factory($this->imageDriver, array($width, $height)); |
|
| 683 | + $tile = image::factory($this->imageDriver, __DIR__.'/../themes/'.$this->config['theme'].'/img/bg_transparent.png'); |
|
| 685 | 684 | |
| 686 | - imagesettile( $back->image, $tile->image ); |
|
| 687 | - imagefilledrectangle( $back->image, 0, 0, $width, $height, IMG_COLOR_TILED ); |
|
| 688 | - imagecopy( $back->image, $img->image, 0, 0, 0, 0, $width, $height ); |
|
| 685 | + imagesettile($back->image, $tile->image); |
|
| 686 | + imagefilledrectangle($back->image, 0, 0, $width, $height, IMG_COLOR_TILED); |
|
| 687 | + imagecopy($back->image, $img->image, 0, 0, 0, 0, $width, $height); |
|
| 689 | 688 | |
| 690 | 689 | $img = $back; |
| 691 | 690 | } |
@@ -697,7 +696,7 @@ discard block |
||
| 697 | 696 | )); |
| 698 | 697 | } |
| 699 | 698 | |
| 700 | - protected function localize($langCode) { |
|
| 699 | + protected function localize($langCode){ |
|
| 701 | 700 | require "lang/{$langCode}.php"; |
| 702 | 701 | setlocale(LC_ALL, $lang['_locale']); |
| 703 | 702 | $this->charset = $lang['_charset']; |
@@ -712,7 +711,7 @@ discard block |
||
| 712 | 711 | $this->labels = $lang; |
| 713 | 712 | } |
| 714 | 713 | |
| 715 | - protected function label($string, array $data=null) { |
|
| 714 | + protected function label($string, array $data = null){ |
|
| 716 | 715 | $return = isset($this->labels[$string]) ? $this->labels[$string] : $string; |
| 717 | 716 | if (is_array($data)) |
| 718 | 717 | foreach ($data as $key => $val) |
@@ -720,7 +719,7 @@ discard block |
||
| 720 | 719 | return $return; |
| 721 | 720 | } |
| 722 | 721 | |
| 723 | - protected function backMsg($message, array $data=null) { |
|
| 722 | + protected function backMsg($message, array $data = null){ |
|
| 724 | 723 | $message = $this->label($message, $data); |
| 725 | 724 | if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) |
| 726 | 725 | @unlink($this->file['tmp_name']); |
@@ -728,7 +727,7 @@ discard block |
||
| 728 | 727 | die; |
| 729 | 728 | } |
| 730 | 729 | |
| 731 | - protected function callBack($url, $message="") { |
|
| 730 | + protected function callBack($url, $message = ""){ |
|
| 732 | 731 | $message = text::jsValue($message); |
| 733 | 732 | $CKfuncNum = isset($this->opener['CKEditor']['funcNum']) |
| 734 | 733 | ? $this->opener['CKEditor']['funcNum'] : 0; |
@@ -769,7 +768,7 @@ discard block |
||
| 769 | 768 | |
| 770 | 769 | } |
| 771 | 770 | |
| 772 | - protected function get_htaccess() { |
|
| 771 | + protected function get_htaccess(){ |
|
| 773 | 772 | return "<IfModule mod_php4.c> |
| 774 | 773 | php_value engine off |
| 775 | 774 | </IfModule> |
@@ -12,7 +12,8 @@ discard block |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class uploader { |
|
| 15 | +class uploader |
|
| 16 | +{ |
|
| 16 | 17 | |
| 17 | 18 | /** Release version */ |
| 18 | 19 | const VERSION = "2.54"; |
@@ -104,17 +105,21 @@ discard block |
||
| 104 | 105 | /** Magic method which allows read-only access to protected or private class properties |
| 105 | 106 | * @param string $property |
| 106 | 107 | * @return mixed */ |
| 107 | - public function __get($property) { |
|
| 108 | + public function __get($property) |
|
| 109 | + { |
|
| 108 | 110 | return property_exists($this, $property) ? $this->$property : null; |
| 109 | 111 | } |
| 110 | 112 | |
| 111 | - public function __construct($modx) { |
|
| 113 | + public function __construct($modx) |
|
| 114 | + { |
|
| 112 | 115 | |
| 113 | 116 | //MODX |
| 114 | 117 | try { |
| 115 | 118 | if ($modx instanceof DocumentParser) { |
| 116 | 119 | $this->modx = $modx; |
| 117 | - } else throw new Exception('MODX should be instance of DocumentParser'); |
|
| 120 | + } else { |
|
| 121 | + throw new Exception('MODX should be instance of DocumentParser'); |
|
| 122 | + } |
|
| 118 | 123 | } catch (Exception $e) { |
| 119 | 124 | die($e->getMessage()); |
| 120 | 125 | } |
@@ -129,26 +134,34 @@ discard block |
||
| 129 | 134 | // SET CMS INTEGRATION ATTRIBUTE |
| 130 | 135 | if (isset($this->get['cms']) && |
| 131 | 136 | in_array($this->get['cms'], array("drupal")) |
| 132 | - ) |
|
| 133 | - $this->cms = $this->get['cms']; |
|
| 137 | + ) { |
|
| 138 | + $this->cms = $this->get['cms']; |
|
| 139 | + } |
|
| 134 | 140 | |
| 135 | 141 | // LINKING UPLOADED FILE |
| 136 | - if (count($_FILES)) |
|
| 137 | - $this->file = &$_FILES[key($_FILES)]; |
|
| 142 | + if (count($_FILES)) { |
|
| 143 | + $this->file = &$_FILES[key($_FILES)]; |
|
| 144 | + } |
|
| 138 | 145 | |
| 139 | 146 | // LOAD DEFAULT CONFIGURATION |
| 140 | 147 | require "config.php"; |
| 141 | 148 | |
| 142 | 149 | // SETTING UP SESSION |
| 143 | - if (isset($_CONFIG['_sessionLifetime'])) |
|
| 144 | - ini_set('session.gc_maxlifetime', $_CONFIG['_sessionLifetime'] * 60); |
|
| 145 | - if (isset($_CONFIG['_sessionDir'])) |
|
| 146 | - ini_set('session.save_path', $_CONFIG['_sessionDir']); |
|
| 147 | - if (isset($_CONFIG['_sessionDomain'])) |
|
| 148 | - ini_set('session.cookie_domain', $_CONFIG['_sessionDomain']); |
|
| 150 | + if (isset($_CONFIG['_sessionLifetime'])) { |
|
| 151 | + ini_set('session.gc_maxlifetime', $_CONFIG['_sessionLifetime'] * 60); |
|
| 152 | + } |
|
| 153 | + if (isset($_CONFIG['_sessionDir'])) { |
|
| 154 | + ini_set('session.save_path', $_CONFIG['_sessionDir']); |
|
| 155 | + } |
|
| 156 | + if (isset($_CONFIG['_sessionDomain'])) { |
|
| 157 | + ini_set('session.cookie_domain', $_CONFIG['_sessionDomain']); |
|
| 158 | + } |
|
| 149 | 159 | switch ($this->cms) { |
| 150 | 160 | case "drupal": break; |
| 151 | - default: if (!session_id()) session_start(); break; |
|
| 161 | + default: if (!session_id()) { |
|
| 162 | + session_start(); |
|
| 163 | + } |
|
| 164 | + break; |
|
| 152 | 165 | } |
| 153 | 166 | |
| 154 | 167 | // RELOAD DEFAULT CONFIGURATION |
@@ -159,31 +172,37 @@ discard block |
||
| 159 | 172 | if (isset($_CONFIG['_sessionVar']) && |
| 160 | 173 | is_array($_CONFIG['_sessionVar']) |
| 161 | 174 | ) { |
| 162 | - foreach ($_CONFIG['_sessionVar'] as $key => $val) |
|
| 163 | - if ((substr($key, 0, 1) != "_") && isset($_CONFIG[$key])) |
|
| 175 | + foreach ($_CONFIG['_sessionVar'] as $key => $val) { |
|
| 176 | + if ((substr($key, 0, 1) != "_") && isset($_CONFIG[$key])) |
|
| 164 | 177 | $this->config[$key] = $val; |
| 165 | - if (!isset($this->config['_sessionVar']['self'])) |
|
| 166 | - $this->config['_sessionVar']['self'] = array(); |
|
| 178 | + } |
|
| 179 | + if (!isset($this->config['_sessionVar']['self'])) { |
|
| 180 | + $this->config['_sessionVar']['self'] = array(); |
|
| 181 | + } |
|
| 167 | 182 | $this->session = &$this->config['_sessionVar']['self']; |
| 168 | - } else |
|
| 169 | - $this->session = &$_SESSION; |
|
| 183 | + } else { |
|
| 184 | + $this->session = &$_SESSION; |
|
| 185 | + } |
|
| 170 | 186 | |
| 171 | 187 | // IMAGE DRIVER INIT |
| 172 | 188 | if (isset($this->config['imageDriversPriority'])) { |
| 173 | 189 | $this->config['imageDriversPriority'] = |
| 174 | 190 | text::clearWhitespaces($this->config['imageDriversPriority']); |
| 175 | 191 | $driver = image::getDriver(explode(' ', $this->config['imageDriversPriority'])); |
| 176 | - if ($driver !== false) |
|
| 177 | - $this->imageDriver = $driver; |
|
| 192 | + if ($driver !== false) { |
|
| 193 | + $this->imageDriver = $driver; |
|
| 194 | + } |
|
| 178 | 195 | } |
| 179 | 196 | if ((!isset($driver) || ($driver === false)) && |
| 180 | 197 | (image::getDriver(array($this->imageDriver)) === false) |
| 181 | - ) |
|
| 182 | - die("Cannot find any of the supported PHP image extensions!"); |
|
| 198 | + ) { |
|
| 199 | + die("Cannot find any of the supported PHP image extensions!"); |
|
| 200 | + } |
|
| 183 | 201 | |
| 184 | 202 | // WATERMARK INIT |
| 185 | - if (isset($this->config['watermark']) && is_string($this->config['watermark'])) |
|
| 186 | - $this->config['watermark'] = array('file' => $this->config['watermark']); |
|
| 203 | + if (isset($this->config['watermark']) && is_string($this->config['watermark'])) { |
|
| 204 | + $this->config['watermark'] = array('file' => $this->config['watermark']); |
|
| 205 | + } |
|
| 187 | 206 | |
| 188 | 207 | // GET TYPE DIRECTORY |
| 189 | 208 | $this->types = &$this->config['types']; |
@@ -197,9 +216,10 @@ discard block |
||
| 197 | 216 | |
| 198 | 217 | // LOAD TYPE DIRECTORY SPECIFIC CONFIGURATION IF EXISTS |
| 199 | 218 | if (is_array($this->types[$this->type])) { |
| 200 | - foreach ($this->types[$this->type] as $key => $val) |
|
| 201 | - if (in_array($key, $this->typeSettings)) |
|
| 219 | + foreach ($this->types[$this->type] as $key => $val) { |
|
| 220 | + if (in_array($key, $this->typeSettings)) |
|
| 202 | 221 | $this->config[$key] = $val; |
| 222 | + } |
|
| 203 | 223 | $this->types[$this->type] = isset($this->types[$this->type]['type']) |
| 204 | 224 | ? $this->types[$this->type]['type'] : ""; |
| 205 | 225 | } |
@@ -209,12 +229,14 @@ discard block |
||
| 209 | 229 | $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/'; |
| 210 | 230 | if (preg_match($ip, $_SERVER['HTTP_HOST']) || |
| 211 | 231 | preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST']) |
| 212 | - ) |
|
| 213 | - $this->config['cookieDomain'] = ""; |
|
| 214 | - elseif (!strlen($this->config['cookieDomain'])) |
|
| 215 | - $this->config['cookieDomain'] = $_SERVER['HTTP_HOST']; |
|
| 216 | - if (!strlen($this->config['cookiePath'])) |
|
| 217 | - $this->config['cookiePath'] = "/"; |
|
| 232 | + ) { |
|
| 233 | + $this->config['cookieDomain'] = ""; |
|
| 234 | + } elseif (!strlen($this->config['cookieDomain'])) { |
|
| 235 | + $this->config['cookieDomain'] = $_SERVER['HTTP_HOST']; |
|
| 236 | + } |
|
| 237 | + if (!strlen($this->config['cookiePath'])) { |
|
| 238 | + $this->config['cookiePath'] = "/"; |
|
| 239 | + } |
|
| 218 | 240 | |
| 219 | 241 | // UPLOAD FOLDER INIT |
| 220 | 242 | |
@@ -250,26 +272,30 @@ discard block |
||
| 250 | 272 | $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
| 251 | 273 | $this->typeURL = "{$this->config['uploadURL']}/{$this->type}"; |
| 252 | 274 | } |
| 253 | - if (!is_dir($this->config['uploadDir'])) |
|
| 254 | - @mkdir($this->config['uploadDir'], $this->config['dirPerms']); |
|
| 275 | + if (!is_dir($this->config['uploadDir'])) { |
|
| 276 | + @mkdir($this->config['uploadDir'], $this->config['dirPerms']); |
|
| 277 | + } |
|
| 255 | 278 | |
| 256 | 279 | // HOST APPLICATIONS INIT |
| 257 | - if (isset($this->get['CKEditorFuncNum'])) |
|
| 258 | - $this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum']; |
|
| 280 | + if (isset($this->get['CKEditorFuncNum'])) { |
|
| 281 | + $this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum']; |
|
| 282 | + } |
|
| 259 | 283 | if (isset($this->get['opener']) && |
| 260 | 284 | (strtolower($this->get['opener']) == "tinymce") && |
| 261 | 285 | isset($this->config['_tinyMCEPath']) && |
| 262 | 286 | strlen($this->config['_tinyMCEPath']) |
| 263 | - ) |
|
| 264 | - $this->opener['TinyMCE'] = true; |
|
| 287 | + ) { |
|
| 288 | + $this->opener['TinyMCE'] = true; |
|
| 289 | + } |
|
| 265 | 290 | |
| 266 | 291 | // LOCALIZATION |
| 267 | - foreach ($this->langInputNames as $key) |
|
| 268 | - if (isset($this->get[$key]) && |
|
| 292 | + foreach ($this->langInputNames as $key) { |
|
| 293 | + if (isset($this->get[$key]) && |
|
| 269 | 294 | preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) && |
| 270 | 295 | file_exists("lang/" . strtolower($this->get[$key]) . ".php") |
| 271 | 296 | ) { |
| 272 | 297 | $this->lang = $this->get[$key]; |
| 298 | + } |
|
| 273 | 299 | break; |
| 274 | 300 | } |
| 275 | 301 | $this->localize($this->lang); |
@@ -280,31 +306,39 @@ discard block |
||
| 280 | 306 | ) { |
| 281 | 307 | $htaccess = "{$this->config['uploadDir']}/.htaccess"; |
| 282 | 308 | if (!file_exists($htaccess)) { |
| 283 | - if (!@file_put_contents($htaccess, $this->get_htaccess())) |
|
| 284 | - $this->backMsg("Cannot write to upload folder. {$this->config['uploadDir']}"); |
|
| 309 | + if (!@file_put_contents($htaccess, $this->get_htaccess())) { |
|
| 310 | + $this->backMsg("Cannot write to upload folder. {$this->config['uploadDir']}"); |
|
| 311 | + } |
|
| 285 | 312 | } else { |
| 286 | - if (false === ($data = @file_get_contents($htaccess))) |
|
| 287 | - $this->backMsg("Cannot read .htaccess"); |
|
| 288 | - if (($data != $this->get_htaccess()) && !@file_put_contents($htaccess, $data)) |
|
| 289 | - $this->backMsg("Incorrect .htaccess file. Cannot rewrite it!"); |
|
| 313 | + if (false === ($data = @file_get_contents($htaccess))) { |
|
| 314 | + $this->backMsg("Cannot read .htaccess"); |
|
| 315 | + } |
|
| 316 | + if (($data != $this->get_htaccess()) && !@file_put_contents($htaccess, $data)) { |
|
| 317 | + $this->backMsg("Incorrect .htaccess file. Cannot rewrite it!"); |
|
| 318 | + } |
|
| 290 | 319 | } |
| 291 | 320 | } |
| 292 | 321 | |
| 293 | 322 | // CHECK & CREATE UPLOAD FOLDER |
| 294 | 323 | if (!is_dir($this->typeDir)) { |
| 295 | - if (!mkdir($this->typeDir, $this->config['dirPerms'])) |
|
| 296 | - $this->backMsg("Cannot create {dir} folder.", array('dir' => $this->type)); |
|
| 297 | - } elseif (!is_readable($this->typeDir)) |
|
| 298 | - $this->backMsg("Cannot read upload folder."); |
|
| 324 | + if (!mkdir($this->typeDir, $this->config['dirPerms'])) { |
|
| 325 | + $this->backMsg("Cannot create {dir} folder.", array('dir' => $this->type)); |
|
| 326 | + } |
|
| 327 | + } elseif (!is_readable($this->typeDir)) { |
|
| 328 | + $this->backMsg("Cannot read upload folder."); |
|
| 329 | + } |
|
| 299 | 330 | } |
| 300 | 331 | |
| 301 | - public function upload() { |
|
| 332 | + public function upload() |
|
| 333 | + { |
|
| 302 | 334 | $config = &$this->config; |
| 303 | 335 | $file = &$this->file; |
| 304 | 336 | $url = $message = ""; |
| 305 | 337 | |
| 306 | 338 | if ($config['disabled'] || !$config['access']['files']['upload']) { |
| 307 | - if (isset($file['tmp_name'])) @unlink($file['tmp_name']); |
|
| 339 | + if (isset($file['tmp_name'])) { |
|
| 340 | + @unlink($file['tmp_name']); |
|
| 341 | + } |
|
| 308 | 342 | $message = $this->label("You don't have permissions to upload files."); |
| 309 | 343 | |
| 310 | 344 | } elseif (true === ($message = $this->checkUploadedFile())) { |
@@ -315,9 +349,9 @@ discard block |
||
| 315 | 349 | (false !== ($gdir = $this->checkInputDir($this->get['dir']))) |
| 316 | 350 | ) { |
| 317 | 351 | $udir = path::normalize("$dir$gdir"); |
| 318 | - if (substr($udir, 0, strlen($dir)) !== $dir) |
|
| 319 | - $message = $this->label("Unknown error."); |
|
| 320 | - else { |
|
| 352 | + if (substr($udir, 0, strlen($dir)) !== $dir) { |
|
| 353 | + $message = $this->label("Unknown error."); |
|
| 354 | + } else { |
|
| 321 | 355 | $l = strlen($dir); |
| 322 | 356 | $dir = "$udir/"; |
| 323 | 357 | $udir = substr($udir, $l); |
@@ -325,8 +359,9 @@ discard block |
||
| 325 | 359 | } |
| 326 | 360 | |
| 327 | 361 | if (!strlen($message)) { |
| 328 | - if (!is_dir(path::normalize($dir))) |
|
| 329 | - @mkdir(path::normalize($dir), $this->config['dirPerms'], true); |
|
| 362 | + if (!is_dir(path::normalize($dir))) { |
|
| 363 | + @mkdir(path::normalize($dir), $this->config['dirPerms'], true); |
|
| 364 | + } |
|
| 330 | 365 | |
| 331 | 366 | $filename = $this->normalizeFilename($file['name']); |
| 332 | 367 | $target = file::getInexistantFilename($dir . $filename); |
@@ -334,21 +369,25 @@ discard block |
||
| 334 | 369 | if (!@move_uploaded_file($file['tmp_name'], $target) && |
| 335 | 370 | !@rename($file['tmp_name'], $target) && |
| 336 | 371 | !@copy($file['tmp_name'], $target) |
| 337 | - ) |
|
| 338 | - $message = $this->label("Cannot move uploaded file to target folder."); |
|
| 339 | - else { |
|
| 340 | - if (function_exists('chmod')) |
|
| 341 | - @chmod($target, $this->config['filePerms']); |
|
| 372 | + ) { |
|
| 373 | + $message = $this->label("Cannot move uploaded file to target folder."); |
|
| 374 | + } else { |
|
| 375 | + if (function_exists('chmod')) { |
|
| 376 | + @chmod($target, $this->config['filePerms']); |
|
| 377 | + } |
|
| 342 | 378 | $this->makeThumb($target); |
| 343 | 379 | $url = $this->typeURL; |
| 344 | - if (isset($udir)) $url .= "/$udir"; |
|
| 380 | + if (isset($udir)) { |
|
| 381 | + $url .= "/$udir"; |
|
| 382 | + } |
|
| 345 | 383 | $url .= "/" . basename($target); |
| 346 | 384 | if (preg_match('/^([a-z]+)\:\/\/([^\/^\:]+)(\:(\d+))?\/(.+)$/', $url, $patt)) { |
| 347 | 385 | list($unused, $protocol, $domain, $unused, $port, $path) = $patt; |
| 348 | 386 | $base = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/"; |
| 349 | 387 | $url = $base . path::urlPathEncode($path); |
| 350 | - } else |
|
| 351 | - $url = path::urlPathEncode($url); |
|
| 388 | + } else { |
|
| 389 | + $url = path::urlPathEncode($url); |
|
| 390 | + } |
|
| 352 | 391 | } |
| 353 | 392 | } |
| 354 | 393 | } |
@@ -356,16 +395,19 @@ discard block |
||
| 356 | 395 | if (strlen($message) && |
| 357 | 396 | isset($this->file['tmp_name']) && |
| 358 | 397 | file_exists($this->file['tmp_name']) |
| 359 | - ) |
|
| 360 | - @unlink($this->file['tmp_name']); |
|
| 398 | + ) { |
|
| 399 | + @unlink($this->file['tmp_name']); |
|
| 400 | + } |
|
| 361 | 401 | |
| 362 | - if (strlen($message) && method_exists($this, 'errorMsg')) |
|
| 363 | - $this->errorMsg($message); |
|
| 402 | + if (strlen($message) && method_exists($this, 'errorMsg')) { |
|
| 403 | + $this->errorMsg($message); |
|
| 404 | + } |
|
| 364 | 405 | $this->callBack($url, $message); |
| 365 | 406 | } |
| 366 | 407 | |
| 367 | 408 | |
| 368 | - protected function getTransaliasSettings() { |
|
| 409 | + protected function getTransaliasSettings() |
|
| 410 | + { |
|
| 369 | 411 | global $modx; |
| 370 | 412 | |
| 371 | 413 | // Cleaning uploaded filename? |
@@ -385,7 +427,8 @@ discard block |
||
| 385 | 427 | } |
| 386 | 428 | |
| 387 | 429 | |
| 388 | - protected function normalizeFilename($filename) { |
|
| 430 | + protected function normalizeFilename($filename) |
|
| 431 | + { |
|
| 389 | 432 | if ($this->getTransaliasSettings()) { |
| 390 | 433 | $format = strrchr($filename, "."); |
| 391 | 434 | $filename = str_replace($format, "", $filename); |
@@ -394,16 +437,19 @@ discard block |
||
| 394 | 437 | return $filename; |
| 395 | 438 | } |
| 396 | 439 | |
| 397 | - protected function normalizeDirname($dirname) { |
|
| 440 | + protected function normalizeDirname($dirname) |
|
| 441 | + { |
|
| 398 | 442 | return $this->modx->stripAlias($dirname); |
| 399 | 443 | } |
| 400 | 444 | |
| 401 | - protected function checkUploadedFile(array $aFile=null) { |
|
| 445 | + protected function checkUploadedFile(array $aFile=null) |
|
| 446 | + { |
|
| 402 | 447 | $config = &$this->config; |
| 403 | 448 | $file = ($aFile === null) ? $this->file : $aFile; |
| 404 | 449 | |
| 405 | - if (!is_array($file) || !isset($file['name'])) |
|
| 406 | - return $this->label("Unknown error"); |
|
| 450 | + if (!is_array($file) || !isset($file['name'])) { |
|
| 451 | + return $this->label("Unknown error"); |
|
| 452 | + } |
|
| 407 | 453 | |
| 408 | 454 | if (is_array($file['name'])) { |
| 409 | 455 | foreach ($file['name'] as $i => $name) { |
@@ -412,8 +458,9 @@ discard block |
||
| 412 | 458 | 'tmp_name' => $file['tmp_name'][$i], |
| 413 | 459 | 'error' => $file['error'][$i] |
| 414 | 460 | )); |
| 415 | - if ($return !== true) |
|
| 416 | - return "$name: $return"; |
|
| 461 | + if ($return !== true) { |
|
| 462 | + return "$name: $return"; |
|
| 463 | + } |
|
| 417 | 464 | } |
| 418 | 465 | return true; |
| 419 | 466 | } |
@@ -422,8 +469,8 @@ discard block |
||
| 422 | 469 | $typePatt = strtolower(text::clearWhitespaces($this->types[$this->type])); |
| 423 | 470 | |
| 424 | 471 | // CHECK FOR UPLOAD ERRORS |
| 425 | - if ($file['error']) |
|
| 426 | - return |
|
| 472 | + if ($file['error']) { |
|
| 473 | + return |
|
| 427 | 474 | ($file['error'] == UPLOAD_ERR_INI_SIZE) ? |
| 428 | 475 | $this->label("The uploaded file exceeds {size} bytes.", |
| 429 | 476 | array('size' => ini_get('upload_max_filesize'))) : ( |
@@ -440,14 +487,17 @@ discard block |
||
| 440 | 487 | $this->label("Failed to write file.") : |
| 441 | 488 | $this->label("Unknown error.") |
| 442 | 489 | ))))); |
| 490 | + } |
|
| 443 | 491 | |
| 444 | 492 | // HIDDEN FILENAMES CHECK |
| 445 | - elseif (substr($file['name'], 0, 1) == ".") |
|
| 446 | - return $this->label("File name shouldn't begins with '.'"); |
|
| 493 | + elseif (substr($file['name'], 0, 1) == ".") { |
|
| 494 | + return $this->label("File name shouldn't begins with '.'"); |
|
| 495 | + } |
|
| 447 | 496 | |
| 448 | 497 | // EXTENSION CHECK |
| 449 | - elseif (!$this->validateExtension($extension, $this->type)) |
|
| 450 | - return $this->label("Denied file extension."); |
|
| 498 | + elseif (!$this->validateExtension($extension, $this->type)) { |
|
| 499 | + return $this->label("Denied file extension."); |
|
| 500 | + } |
|
| 451 | 501 | |
| 452 | 502 | // SPECIAL DIRECTORY TYPES CHECK (e.g. *img) |
| 453 | 503 | elseif (preg_match('/^\*([^ ]+)(.*)?$/s', $typePatt, $patt)) { |
@@ -457,70 +507,84 @@ discard block |
||
| 457 | 507 | $type = new $class(); |
| 458 | 508 | $cfg = $config; |
| 459 | 509 | $cfg['filename'] = $file['name']; |
| 460 | - if (strlen($params)) |
|
| 461 | - $cfg['params'] = trim($params); |
|
| 510 | + if (strlen($params)) { |
|
| 511 | + $cfg['params'] = trim($params); |
|
| 512 | + } |
|
| 462 | 513 | $response = $type->checkFile($file['tmp_name'], $cfg); |
| 463 | - if ($response !== true) |
|
| 464 | - return $this->label($response); |
|
| 465 | - } else |
|
| 466 | - return $this->label("Non-existing directory type."); |
|
| 514 | + if ($response !== true) { |
|
| 515 | + return $this->label($response); |
|
| 516 | + } |
|
| 517 | + } else { |
|
| 518 | + return $this->label("Non-existing directory type."); |
|
| 519 | + } |
|
| 467 | 520 | } |
| 468 | 521 | |
| 469 | 522 | // IMAGE RESIZE |
| 470 | 523 | $img = image::factory($this->imageDriver, $file['tmp_name']); |
| 471 | - if (!$img->initError && !$this->imageResize($img, $file['tmp_name'])) |
|
| 472 | - return $this->label("The image is too big and/or cannot be resized."); |
|
| 524 | + if (!$img->initError && !$this->imageResize($img, $file['tmp_name'])) { |
|
| 525 | + return $this->label("The image is too big and/or cannot be resized."); |
|
| 526 | + } |
|
| 473 | 527 | |
| 474 | 528 | |
| 475 | 529 | // CHECK FOR MODX MAX FILE SIZE |
| 476 | 530 | $actualfilesize=filesize($file['tmp_name']); |
| 477 | - if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
| 478 | - return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
| 531 | + if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) { |
|
| 532 | + return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
| 533 | + } |
|
| 479 | 534 | |
| 480 | 535 | return true; |
| 481 | 536 | } |
| 482 | 537 | |
| 483 | - protected function checkInputDir($dir, $inclType=true, $existing=true) { |
|
| 538 | + protected function checkInputDir($dir, $inclType=true, $existing=true) |
|
| 539 | + { |
|
| 484 | 540 | $dir = path::normalize($dir); |
| 485 | - if (substr($dir, 0, 1) == "/") |
|
| 486 | - $dir = substr($dir, 1); |
|
| 541 | + if (substr($dir, 0, 1) == "/") { |
|
| 542 | + $dir = substr($dir, 1); |
|
| 543 | + } |
|
| 487 | 544 | |
| 488 | - if ((substr($dir, 0, 1) == ".") || (substr(basename($dir), 0, 1) == ".")) |
|
| 489 | - return false; |
|
| 545 | + if ((substr($dir, 0, 1) == ".") || (substr(basename($dir), 0, 1) == ".")) { |
|
| 546 | + return false; |
|
| 547 | + } |
|
| 490 | 548 | |
| 491 | 549 | if ($inclType) { |
| 492 | 550 | $first = explode("/", $dir); |
| 493 | 551 | $first = $first[0]; |
| 494 | - if ($first != $this->type) |
|
| 495 | - return false; |
|
| 552 | + if ($first != $this->type) { |
|
| 553 | + return false; |
|
| 554 | + } |
|
| 496 | 555 | $return = $this->removeTypeFromPath($dir); |
| 497 | 556 | } else { |
| 498 | 557 | $return = $dir; |
| 499 | 558 | $dir = "{$this->type}/$dir"; |
| 500 | 559 | } |
| 501 | 560 | |
| 502 | - if (!$existing) |
|
| 503 | - return $return; |
|
| 561 | + if (!$existing) { |
|
| 562 | + return $return; |
|
| 563 | + } |
|
| 504 | 564 | |
| 505 | 565 | $path = "{$this->config['uploadDir']}/$dir"; |
| 506 | 566 | return (is_dir($path) && is_readable($path)) ? $return : false; |
| 507 | 567 | } |
| 508 | 568 | |
| 509 | - protected function validateExtension($ext, $type) { |
|
| 569 | + protected function validateExtension($ext, $type) |
|
| 570 | + { |
|
| 510 | 571 | $ext = trim(strtolower($ext)); |
| 511 | - if (!isset($this->types[$type])) |
|
| 512 | - return false; |
|
| 572 | + if (!isset($this->types[$type])) { |
|
| 573 | + return false; |
|
| 574 | + } |
|
| 513 | 575 | |
| 514 | 576 | $exts = strtolower(text::clearWhitespaces($this->config['deniedExts'])); |
| 515 | 577 | if (strlen($exts)) { |
| 516 | 578 | $exts = explode(" ", $exts); |
| 517 | - if (in_array($ext, $exts)) |
|
| 518 | - return false; |
|
| 579 | + if (in_array($ext, $exts)) { |
|
| 580 | + return false; |
|
| 581 | + } |
|
| 519 | 582 | } |
| 520 | 583 | |
| 521 | 584 | $exts = trim($this->types[$type]); |
| 522 | - if (!strlen($exts) || substr($exts, 0, 1) == "*") |
|
| 523 | - return true; |
|
| 585 | + if (!strlen($exts) || substr($exts, 0, 1) == "*") { |
|
| 586 | + return true; |
|
| 587 | + } |
|
| 524 | 588 | |
| 525 | 589 | if (substr($exts, 0, 1) == "!") { |
| 526 | 590 | $exts = explode(" ", trim(strtolower(substr($exts, 1)))); |
@@ -531,26 +595,32 @@ discard block |
||
| 531 | 595 | return in_array($ext, $exts); |
| 532 | 596 | } |
| 533 | 597 | |
| 534 | - protected function getTypeFromPath($path) { |
|
| 598 | + protected function getTypeFromPath($path) |
|
| 599 | + { |
|
| 535 | 600 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
| 536 | 601 | ? $patt[1] : $path; |
| 537 | 602 | } |
| 538 | 603 | |
| 539 | - protected function removeTypeFromPath($path) { |
|
| 604 | + protected function removeTypeFromPath($path) |
|
| 605 | + { |
|
| 540 | 606 | return preg_match('/^[^\/]*\/(.*)$/', $path, $patt) |
| 541 | 607 | ? $patt[1] : ""; |
| 542 | 608 | } |
| 543 | 609 | |
| 544 | - protected function imageResize($image, $file=null) { |
|
| 610 | + protected function imageResize($image, $file=null) |
|
| 611 | + { |
|
| 545 | 612 | |
| 546 | 613 | if (!($image instanceof image)) { |
| 547 | 614 | $img = image::factory($this->imageDriver, $image); |
| 548 | - if ($img->initError) return false; |
|
| 615 | + if ($img->initError) { |
|
| 616 | + return false; |
|
| 617 | + } |
|
| 549 | 618 | $file = $image; |
| 550 | - } elseif ($file === null) |
|
| 551 | - return false; |
|
| 552 | - else |
|
| 553 | - $img = $image; |
|
| 619 | + } elseif ($file === null) { |
|
| 620 | + return false; |
|
| 621 | + } else { |
|
| 622 | + $img = $image; |
|
| 623 | + } |
|
| 554 | 624 | |
| 555 | 625 | $orientation = 1; |
| 556 | 626 | if (function_exists("exif_read_data")) { |
@@ -572,8 +642,9 @@ discard block |
||
| 572 | 642 | ) |
| 573 | 643 | ) && |
| 574 | 644 | ($orientation == 1) |
| 575 | - ) |
|
| 576 | - return true; |
|
| 645 | + ) { |
|
| 646 | + return true; |
|
| 647 | + } |
|
| 577 | 648 | |
| 578 | 649 | |
| 579 | 650 | // PROPORTIONAL RESIZE |
@@ -593,15 +664,17 @@ discard block |
||
| 593 | 664 | $width = $img->getPropWidth($height); |
| 594 | 665 | } |
| 595 | 666 | |
| 596 | - if (isset($width) && isset($height) && !$img->resize($width, $height)) |
|
| 597 | - return false; |
|
| 667 | + if (isset($width) && isset($height) && !$img->resize($width, $height)) { |
|
| 668 | + return false; |
|
| 669 | + } |
|
| 598 | 670 | |
| 599 | 671 | // RESIZE TO FIT |
| 600 | 672 | } elseif ( |
| 601 | 673 | $this->config['maxImageWidth'] && $this->config['maxImageHeight'] && |
| 602 | 674 | !$img->resizeFit($this->config['maxImageWidth'], $this->config['maxImageHeight']) |
| 603 | - ) |
|
| 604 | - return false; |
|
| 675 | + ) { |
|
| 676 | + return false; |
|
| 677 | + } |
|
| 605 | 678 | |
| 606 | 679 | // AUTO FLIP AND ROTATE FROM EXIF |
| 607 | 680 | if ((($orientation == 2) && !$img->flipHorizontal()) || |
@@ -611,11 +684,13 @@ discard block |
||
| 611 | 684 | (($orientation == 6) && !$img->rotate(90)) || |
| 612 | 685 | (($orientation == 7) && (!$img->flipHorizontal() || !$img->rotate(90))) || |
| 613 | 686 | (($orientation == 8) && !$img->rotate(270)) |
| 614 | - ) |
|
| 615 | - return false; |
|
| 616 | - if (($orientation >= 2) && ($orientation <= 8) && ($this->imageDriver == "imagick")) |
|
| 617 | - try { |
|
| 687 | + ) { |
|
| 688 | + return false; |
|
| 689 | + } |
|
| 690 | + if (($orientation >= 2) && ($orientation <= 8) && ($this->imageDriver == "imagick")) { |
|
| 691 | + try { |
|
| 618 | 692 | $img->image->setImageProperty('exif:Orientation', "1"); |
| 693 | + } |
|
| 619 | 694 | } catch (Exception $e) {} |
| 620 | 695 | |
| 621 | 696 | // WATERMARK |
@@ -646,22 +721,26 @@ discard block |
||
| 646 | 721 | |
| 647 | 722 | } |
| 648 | 723 | |
| 649 | - protected function makeThumb($file, $overwrite=true) { |
|
| 724 | + protected function makeThumb($file, $overwrite=true) |
|
| 725 | + { |
|
| 650 | 726 | $img = image::factory($this->imageDriver, $file); |
| 651 | 727 | |
| 652 | 728 | // Drop files which are not images |
| 653 | - if ($img->initError) |
|
| 654 | - return true; |
|
| 729 | + if ($img->initError) { |
|
| 730 | + return true; |
|
| 731 | + } |
|
| 655 | 732 | |
| 656 | 733 | $thumb = substr($file, strlen($this->config['uploadDir'])); |
| 657 | 734 | $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb; |
| 658 | 735 | $thumb = path::normalize($thumb); |
| 659 | 736 | $thumbDir = dirname($thumb); |
| 660 | - if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) |
|
| 661 | - return false; |
|
| 737 | + if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) { |
|
| 738 | + return false; |
|
| 739 | + } |
|
| 662 | 740 | |
| 663 | - if (!$overwrite && is_file($thumb)) |
|
| 664 | - return true; |
|
| 741 | + if (!$overwrite && is_file($thumb)) { |
|
| 742 | + return true; |
|
| 743 | + } |
|
| 665 | 744 | |
| 666 | 745 | // Images with smaller resolutions than thumbnails |
| 667 | 746 | /*if (($img->width <= $this->config['thumbWidth']) && |
@@ -674,8 +753,9 @@ discard block |
||
| 674 | 753 | |
| 675 | 754 | // Resize image |
| 676 | 755 | } else */ |
| 677 | - if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) |
|
| 678 | - return false; |
|
| 756 | + if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) { |
|
| 757 | + return false; |
|
| 758 | + } |
|
| 679 | 759 | |
| 680 | 760 | if ( $this->imageDriver == 'gd' ) { |
| 681 | 761 | $width = imagesx( $img->image ); |
@@ -697,7 +777,8 @@ discard block |
||
| 697 | 777 | )); |
| 698 | 778 | } |
| 699 | 779 | |
| 700 | - protected function localize($langCode) { |
|
| 780 | + protected function localize($langCode) |
|
| 781 | + { |
|
| 701 | 782 | require "lang/{$langCode}.php"; |
| 702 | 783 | setlocale(LC_ALL, $lang['_locale']); |
| 703 | 784 | $this->charset = $lang['_charset']; |
@@ -712,27 +793,34 @@ discard block |
||
| 712 | 793 | $this->labels = $lang; |
| 713 | 794 | } |
| 714 | 795 | |
| 715 | - protected function label($string, array $data=null) { |
|
| 796 | + protected function label($string, array $data=null) |
|
| 797 | + { |
|
| 716 | 798 | $return = isset($this->labels[$string]) ? $this->labels[$string] : $string; |
| 717 | - if (is_array($data)) |
|
| 718 | - foreach ($data as $key => $val) |
|
| 799 | + if (is_array($data)) { |
|
| 800 | + foreach ($data as $key => $val) |
|
| 719 | 801 | $return = str_replace("{{$key}}", $val, $return); |
| 802 | + } |
|
| 720 | 803 | return $return; |
| 721 | 804 | } |
| 722 | 805 | |
| 723 | - protected function backMsg($message, array $data=null) { |
|
| 806 | + protected function backMsg($message, array $data=null) |
|
| 807 | + { |
|
| 724 | 808 | $message = $this->label($message, $data); |
| 725 | - if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) |
|
| 726 | - @unlink($this->file['tmp_name']); |
|
| 809 | + if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) { |
|
| 810 | + @unlink($this->file['tmp_name']); |
|
| 811 | + } |
|
| 727 | 812 | $this->callBack("", $message); |
| 728 | 813 | die; |
| 729 | 814 | } |
| 730 | 815 | |
| 731 | - protected function callBack($url, $message="") { |
|
| 816 | + protected function callBack($url, $message="") |
|
| 817 | + { |
|
| 732 | 818 | $message = text::jsValue($message); |
| 733 | 819 | $CKfuncNum = isset($this->opener['CKEditor']['funcNum']) |
| 734 | 820 | ? $this->opener['CKEditor']['funcNum'] : 0; |
| 735 | - if (!$CKfuncNum) $CKfuncNum = 0; |
|
| 821 | + if (!$CKfuncNum) { |
|
| 822 | + $CKfuncNum = 0; |
|
| 823 | + } |
|
| 736 | 824 | header("Content-Type: text/html; charset={$this->charset}"); |
| 737 | 825 | |
| 738 | 826 | ?><html> |
@@ -769,7 +857,8 @@ discard block |
||
| 769 | 857 | |
| 770 | 858 | } |
| 771 | 859 | |
| 772 | - protected function get_htaccess() { |
|
| 860 | + protected function get_htaccess() |
|
| 861 | + { |
|
| 773 | 862 | return "<IfModule mod_php4.c> |
| 774 | 863 | php_value engine off |
| 775 | 864 | </IfModule> |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | -class DATEPICKER { |
|
| 3 | - function __construct() { |
|
| 2 | +class DATEPICKER{ |
|
| 3 | + function __construct(){ |
|
| 4 | 4 | } |
| 5 | - function getDP() { |
|
| 6 | - global $modx,$_lang; |
|
| 5 | + function getDP(){ |
|
| 6 | + global $modx, $_lang; |
|
| 7 | 7 | |
| 8 | 8 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
| 9 | - return $modx->parseText($tpl,$_lang,'[%','%]'); |
|
| 9 | + return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
| 10 | 10 | } |
| 11 | 11 | } |
@@ -1,8 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | -class DATEPICKER { |
|
| 3 | - function __construct() { |
|
| 2 | +class DATEPICKER |
|
| 3 | +{ |
|
| 4 | + function __construct() |
|
| 5 | + { |
|
| 4 | 6 | } |
| 5 | - function getDP() { |
|
| 7 | + function getDP() |
|
| 8 | + { |
|
| 6 | 9 | global $modx,$_lang; |
| 7 | 10 | |
| 8 | 11 | $tpl = file_get_contents(dirname(__FILE__).'/datepicker.tpl'); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $modx = new DocumentParser; |
| 27 | 27 | $modx->db->connect(); |
| 28 | 28 | startCMSSession(); |
| 29 | -if(!isset($_SESSION['mgrValidated'])) { |
|
| 29 | +if (!isset($_SESSION['mgrValidated'])) { |
|
| 30 | 30 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
| 31 | 31 | } |
| 32 | 32 | define('IN_MANAGER_MODE', true); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $manager_language = $modx->config['manager_language']; |
| 36 | 36 | // Pass language code from MODX to KCFinder |
| 37 | -if(!file_exists("../../../includes/lang/".$manager_language.".inc.php")) { |
|
| 37 | +if (!file_exists("../../../includes/lang/".$manager_language.".inc.php")) { |
|
| 38 | 38 | $manager_language = "english"; // if not set, get the english language file. |
| 39 | 39 | } |
| 40 | 40 | include_once "../../../includes/lang/".$manager_language.".inc.php"; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | // PHP VERSION CHECK |
| 44 | 44 | if (substr(PHP_VERSION, 0, strpos(PHP_VERSION, '.')) < 5) |
| 45 | - die("You are using PHP " . PHP_VERSION . " when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution."); |
|
| 45 | + die("You are using PHP ".PHP_VERSION." when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution."); |
|
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | // SAFE MODE CHECK |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | // MAGIC AUTOLOAD CLASSES FUNCTION |
| 54 | -function autoloadda9d06472ccb71b84928677ce2a6ca89($class) { |
|
| 54 | +function autoloadda9d06472ccb71b84928677ce2a6ca89($class){ |
|
| 55 | 55 | static $classes = null; |
| 56 | 56 | if ($classes === null) { |
| 57 | 57 | $classes = array( |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ); |
| 76 | 76 | } |
| 77 | 77 | if (isset($classes[$class])) { |
| 78 | - require dirname(__FILE__) . $classes[$class]; |
|
| 78 | + require dirname(__FILE__).$classes[$class]; |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | spl_autoload_register('autoloadda9d06472ccb71b84928677ce2a6ca89', true); |
@@ -84,18 +84,18 @@ discard block |
||
| 84 | 84 | // json_encode() IMPLEMENTATION IF JSON EXTENSION IS MISSING |
| 85 | 85 | if (!function_exists("json_encode")) { |
| 86 | 86 | |
| 87 | - function kcfinder_json_string_encode($string) { |
|
| 88 | - return '"' . |
|
| 87 | + function kcfinder_json_string_encode($string){ |
|
| 88 | + return '"'. |
|
| 89 | 89 | str_replace('/', "\\/", |
| 90 | 90 | str_replace("\t", "\\t", |
| 91 | 91 | str_replace("\r", "\\r", |
| 92 | 92 | str_replace("\n", "\\n", |
| 93 | 93 | str_replace('"', "\\\"", |
| 94 | 94 | str_replace("\\", "\\\\", |
| 95 | - $string)))))) . '"'; |
|
| 95 | + $string)))))).'"'; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - function json_encode($data) { |
|
| 98 | + function json_encode($data){ |
|
| 99 | 99 | |
| 100 | 100 | if (is_array($data)) { |
| 101 | 101 | $ret = array(); |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | // OBJECT |
| 104 | 104 | if (array_keys($data) !== range(0, count($data) - 1)) { |
| 105 | 105 | foreach ($data as $key => $val) |
| 106 | - $ret[] = kcfinder_json_string_encode($key) . ':' . json_encode($val); |
|
| 107 | - return "{" . implode(",", $ret) . "}"; |
|
| 106 | + $ret[] = kcfinder_json_string_encode($key).':'.json_encode($val); |
|
| 107 | + return "{".implode(",", $ret)."}"; |
|
| 108 | 108 | |
| 109 | 109 | // ARRAY |
| 110 | 110 | } else { |
| 111 | 111 | foreach ($data as $val) |
| 112 | 112 | $ret[] = json_encode($val); |
| 113 | - return "[" . implode(",", $ret) . "]"; |
|
| 113 | + return "[".implode(",", $ret)."]"; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // BOOLEAN OR NULL |
@@ -695,13 +695,15 @@ discard block |
||
| 695 | 695 | $this->virtualDir = ''; |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | - 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 */ |
|
| 698 | + if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { |
|
| 699 | +/* we got an ID returned, check to make sure it's not an alias */ |
|
| 699 | 700 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
| 700 | 701 | if ($this->config['use_alias_path'] == 1) { |
| 701 | 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 | 703 | $this->documentMethod = 'id'; |
| 703 | 704 | return $q; |
| 704 | - } else { /* not a valid id in terms of virtualDir, treat as alias */ |
|
| 705 | + } else { |
|
| 706 | +/* not a valid id in terms of virtualDir, treat as alias */ |
|
| 705 | 707 | $this->documentMethod = 'alias'; |
| 706 | 708 | return $q; |
| 707 | 709 | } |
@@ -709,7 +711,8 @@ discard block |
||
| 709 | 711 | $this->documentMethod = 'id'; |
| 710 | 712 | return $q; |
| 711 | 713 | } |
| 712 | - } else { /* we didn't get an ID back, so instead we assume it's an alias */ |
|
| 714 | + } else { |
|
| 715 | +/* we didn't get an ID back, so instead we assume it's an alias */ |
|
| 713 | 716 | if ($this->config['friendly_alias_urls'] != 1) { |
| 714 | 717 | $q = $qOrig; |
| 715 | 718 | } |
@@ -739,13 +742,14 @@ discard block |
||
| 739 | 742 | * @param $id |
| 740 | 743 | * @return array|mixed|null|string |
| 741 | 744 | */ |
| 742 | - public function makePageCacheKey($id){ |
|
| 745 | + public function makePageCacheKey($id) |
|
| 746 | + { |
|
| 743 | 747 | $hash = $id; |
| 744 | 748 | $tmp = null; |
| 745 | 749 | $params = array(); |
| 746 | - if(!empty($this->systemCacheKey)){ |
|
| 750 | + if(!empty($this->systemCacheKey)) { |
|
| 747 | 751 | $hash = $this->systemCacheKey; |
| 748 | - }else { |
|
| 752 | + } else { |
|
| 749 | 753 | if (!empty($_GET)) { |
| 750 | 754 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
| 751 | 755 | $params = $_GET; |
@@ -754,7 +758,7 @@ discard block |
||
| 754 | 758 | } |
| 755 | 759 | } |
| 756 | 760 | $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
| 757 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
| 761 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
| 758 | 762 | $tmp = array_pop($evtOut); |
| 759 | 763 | } |
| 760 | 764 | return empty($tmp) ? $hash : $tmp; |
@@ -1165,10 +1169,18 @@ discard block |
||
| 1165 | 1169 | return array(); |
| 1166 | 1170 | } |
| 1167 | 1171 | $spacer = md5('<<<EVO>>>'); |
| 1168 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1169 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1170 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1171 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1172 | + if($left==='{{' && strpos($content,';}}')!==false) { |
|
| 1173 | + $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1174 | + } |
|
| 1175 | + if($left==='{{' && strpos($content,'{{}}')!==false) { |
|
| 1176 | + $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1177 | + } |
|
| 1178 | + if($left==='[[' && strpos($content,']]]]')!==false) { |
|
| 1179 | + $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1180 | + } |
|
| 1181 | + if($left==='[[' && strpos($content,']]]')!==false) { |
|
| 1182 | + $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1183 | + } |
|
| 1172 | 1184 | |
| 1173 | 1185 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
| 1174 | 1186 | $pos[']]>'] = strpos($content, ']]>'); |
@@ -1221,7 +1233,8 @@ discard block |
||
| 1221 | 1233 | } |
| 1222 | 1234 | } |
| 1223 | 1235 | |
| 1224 | - if (!in_array($fetch, $tags)) { // Avoid double Matches |
|
| 1236 | + if (!in_array($fetch, $tags)) { |
|
| 1237 | +// Avoid double Matches |
|
| 1225 | 1238 | $tags[] = $fetch; // Fetch |
| 1226 | 1239 | }; |
| 1227 | 1240 | $fetch = ''; // and reset |
@@ -1239,7 +1252,9 @@ discard block |
||
| 1239 | 1252 | } |
| 1240 | 1253 | } |
| 1241 | 1254 | foreach($tags as $i=>$tag) { |
| 1242 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1255 | + if(strpos($tag,$spacer)!==false) { |
|
| 1256 | + $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1257 | + } |
|
| 1243 | 1258 | } |
| 1244 | 1259 | return $tags; |
| 1245 | 1260 | } |
@@ -1279,7 +1294,10 @@ discard block |
||
| 1279 | 1294 | } |
| 1280 | 1295 | |
| 1281 | 1296 | foreach ($matches[1] as $i => $key) { |
| 1282 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1297 | + if(strpos($key,'[+')!==false) { |
|
| 1298 | + continue; |
|
| 1299 | + } |
|
| 1300 | + // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1283 | 1301 | if (substr($key, 0, 1) == '#') { |
| 1284 | 1302 | $key = substr($key, 1); |
| 1285 | 1303 | } // remove # for QuickEdit format |
@@ -2004,7 +2022,8 @@ discard block |
||
| 2004 | 2022 | * @return mixed|string |
| 2005 | 2023 | */ |
| 2006 | 2024 | public function _getSGVar($value) |
| 2007 | - { // Get super globals |
|
| 2025 | + { |
|
| 2026 | +// Get super globals |
|
| 2008 | 2027 | $key = $value; |
| 2009 | 2028 | $_ = $this->config['enable_filter']; |
| 2010 | 2029 | $this->config['enable_filter'] = 1; |
@@ -2409,7 +2428,8 @@ discard block |
||
| 2409 | 2428 | if ($this->config['friendly_urls'] == 1) { |
| 2410 | 2429 | $aliases = array(); |
| 2411 | 2430 | if (is_array($this->documentListing)) { |
| 2412 | - foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site! |
|
| 2431 | + foreach ($this->documentListing as $path => $docid) { |
|
| 2432 | +// This is big Loop on large site! |
|
| 2413 | 2433 | $aliases[$docid] = $path; |
| 2414 | 2434 | $isfolder[$docid] = $this->aliasListing[$docid]['isfolder']; |
| 2415 | 2435 | } |
@@ -2442,7 +2462,7 @@ discard block |
||
| 2442 | 2462 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
| 2443 | 2463 | $pref = $this->config['friendly_url_prefix']; |
| 2444 | 2464 | $suff = $this->config['friendly_url_suffix']; |
| 2445 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
| 2465 | + $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){ |
|
| 2446 | 2466 | global $modx; |
| 2447 | 2467 | $thealias = $aliases[$m[1]]; |
| 2448 | 2468 | $thefolder = $isfolder[$m[1]]; |
@@ -4214,7 +4234,8 @@ discard block |
||
| 4214 | 4234 | if (isset ($this->snippetCache[$snippetName])) { |
| 4215 | 4235 | $snippet = $this->snippetCache[$snippetName]; |
| 4216 | 4236 | $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
| 4217 | - } else { // not in cache so let's check the db |
|
| 4237 | + } else { |
|
| 4238 | +// not in cache so let's check the db |
|
| 4218 | 4239 | $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;"; |
| 4219 | 4240 | $result = $this->db->query($sql); |
| 4220 | 4241 | if ($this->db->getRecordCount($result) == 1) { |
@@ -4718,7 +4739,7 @@ discard block |
||
| 4718 | 4739 | $result = $this->db->makeArray($rs); |
| 4719 | 4740 | |
| 4720 | 4741 | // get default/built-in template variables |
| 4721 | - if(is_array($docRow)){ |
|
| 4742 | + if(is_array($docRow)) { |
|
| 4722 | 4743 | ksort($docRow); |
| 4723 | 4744 | |
| 4724 | 4745 | foreach ($docRow as $key => $value) { |
@@ -5197,12 +5218,16 @@ discard block |
||
| 5197 | 5218 | return ''; |
| 5198 | 5219 | } // nothing to register |
| 5199 | 5220 | if (!is_array($options)) { |
| 5200 | - if (is_bool($options)) // backward compatibility with old plaintext parameter |
|
| 5221 | + if (is_bool($options)) { |
|
| 5222 | + // backward compatibility with old plaintext parameter |
|
| 5201 | 5223 | { |
| 5202 | 5224 | $options = array('plaintext' => $options); |
| 5203 | - } elseif (is_string($options)) // Also allow script name as 2nd param |
|
| 5225 | + } |
|
| 5226 | + } elseif (is_string($options)) { |
|
| 5227 | + // Also allow script name as 2nd param |
|
| 5204 | 5228 | { |
| 5205 | 5229 | $options = array('name' => $options); |
| 5230 | + } |
|
| 5206 | 5231 | } else { |
| 5207 | 5232 | $options = array(); |
| 5208 | 5233 | } |
@@ -5214,7 +5239,8 @@ discard block |
||
| 5214 | 5239 | unset($overwritepos); // probably unnecessary--just making sure |
| 5215 | 5240 | |
| 5216 | 5241 | $useThisVer = true; |
| 5217 | - if (isset($this->loadedjscripts[$key])) { // a matching script was found |
|
| 5242 | + if (isset($this->loadedjscripts[$key])) { |
|
| 5243 | +// a matching script was found |
|
| 5218 | 5244 | // if existing script is a startup script, make sure the candidate is also a startup script |
| 5219 | 5245 | if ($this->loadedjscripts[$key]['startup']) { |
| 5220 | 5246 | $startup = true; |
@@ -5234,7 +5260,8 @@ discard block |
||
| 5234 | 5260 | // overwrite the old script (the position may be important for dependent scripts) |
| 5235 | 5261 | $overwritepos = $this->loadedjscripts[$key]['pos']; |
| 5236 | 5262 | } |
| 5237 | - } else { // Use the original version |
|
| 5263 | + } else { |
|
| 5264 | +// Use the original version |
|
| 5238 | 5265 | if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) { |
| 5239 | 5266 | // need to move the exisiting script to the head |
| 5240 | 5267 | $version = $this->loadedjscripts[$key][$version]; |
@@ -5358,7 +5385,8 @@ discard block |
||
| 5358 | 5385 | } |
| 5359 | 5386 | |
| 5360 | 5387 | $results = null; |
| 5361 | - foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop |
|
| 5388 | + foreach ($this->pluginEvent[$evtName] as $pluginName) { |
|
| 5389 | +// start for loop |
|
| 5362 | 5390 | if ($this->dumpPlugins) { |
| 5363 | 5391 | $eventtime = $this->getMicroTime(); |
| 5364 | 5392 | } |
@@ -5906,7 +5934,8 @@ discard block |
||
| 5906 | 5934 | * @return bool |
| 5907 | 5935 | */ |
| 5908 | 5936 | public function isSafeCode($phpcode = '', $safe_functions = '') |
| 5909 | - { // return true or false |
|
| 5937 | + { |
|
| 5938 | +// return true or false |
|
| 5910 | 5939 | if ($safe_functions == '') { |
| 5911 | 5940 | return false; |
| 5912 | 5941 | } |
@@ -6322,7 +6351,7 @@ discard block |
||
| 6322 | 6351 | $args = array_pad(array(), $_, '$var'); |
| 6323 | 6352 | $args = implode(", ", $args); |
| 6324 | 6353 | $modx = &$this; |
| 6325 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
| 6354 | + $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){ |
|
| 6326 | 6355 | $arg = $val['args'][$tmp - 1]; |
| 6327 | 6356 | switch (true) { |
| 6328 | 6357 | case is_null($arg): { |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | function __call($method_name, $arguments) |
| 207 | 207 | { |
| 208 | - include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php'); |
|
| 208 | + include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php'); |
|
| 209 | 209 | if (method_exists($this->old, $method_name)) { |
| 210 | 210 | $error_type = 1; |
| 211 | 211 | } else { |
@@ -223,12 +223,12 @@ discard block |
||
| 223 | 223 | $info = debug_backtrace(); |
| 224 | 224 | $m[] = $msg; |
| 225 | 225 | if (!empty($this->currentSnippet)) { |
| 226 | - $m[] = 'Snippet - ' . $this->currentSnippet; |
|
| 226 | + $m[] = 'Snippet - '.$this->currentSnippet; |
|
| 227 | 227 | } elseif (!empty($this->event->activePlugin)) { |
| 228 | - $m[] = 'Plugin - ' . $this->event->activePlugin; |
|
| 228 | + $m[] = 'Plugin - '.$this->event->activePlugin; |
|
| 229 | 229 | } |
| 230 | 230 | $m[] = $this->decoded_request_uri; |
| 231 | - $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')'; |
|
| 231 | + $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')'; |
|
| 232 | 232 | $msg = implode('<br />', $m); |
| 233 | 233 | $this->logEvent(0, $error_type, $msg, $title); |
| 234 | 234 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | { |
| 246 | 246 | $flag = false; |
| 247 | 247 | if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) { |
| 248 | - $flag = (bool)$this->{$connector}->conn; |
|
| 248 | + $flag = (bool) $this->{$connector}->conn; |
|
| 249 | 249 | } |
| 250 | 250 | return $flag; |
| 251 | 251 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | if (!$out && $flag) { |
| 274 | 274 | $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname))); |
| 275 | - $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php"; |
|
| 275 | + $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"; |
|
| 276 | 276 | $out = is_file($filename) ? include $filename : false; |
| 277 | 277 | } |
| 278 | 278 | if ($out && !in_array($extname, $this->extensions)) { |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | public function getMicroTime() |
| 290 | 290 | { |
| 291 | 291 | list ($usec, $sec) = explode(' ', microtime()); |
| 292 | - return ((float)$usec + (float)$sec); |
|
| 292 | + return ((float) $usec + (float) $sec); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | /** |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | // append the redirect count string to the url |
| 314 | 314 | $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0; |
| 315 | 315 | if ($currentNumberOfRedirects > 3) { |
| 316 | - $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>'); |
|
| 316 | + $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>'); |
|
| 317 | 317 | } else { |
| 318 | 318 | $currentNumberOfRedirects += 1; |
| 319 | 319 | if (strpos($url, "?") > 0) { |
@@ -324,9 +324,9 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | if ($type == 'REDIRECT_REFRESH') { |
| 327 | - $header = 'Refresh: 0;URL=' . $url; |
|
| 327 | + $header = 'Refresh: 0;URL='.$url; |
|
| 328 | 328 | } elseif ($type == 'REDIRECT_META') { |
| 329 | - $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />'; |
|
| 329 | + $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />'; |
|
| 330 | 330 | echo $header; |
| 331 | 331 | exit; |
| 332 | 332 | } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) { |
@@ -334,10 +334,10 @@ discard block |
||
| 334 | 334 | global $base_url, $site_url; |
| 335 | 335 | if (substr($url, 0, strlen($base_url)) == $base_url) { |
| 336 | 336 | // append $site_url to make it work with Location: |
| 337 | - $url = $site_url . substr($url, strlen($base_url)); |
|
| 337 | + $url = $site_url.substr($url, strlen($base_url)); |
|
| 338 | 338 | } |
| 339 | 339 | if (strpos($url, "\n") === false) { |
| 340 | - $header = 'Location: ' . $url; |
|
| 340 | + $header = 'Location: '.$url; |
|
| 341 | 341 | } else { |
| 342 | 342 | $this->messageQuit('No newline allowed in redirect url.'); |
| 343 | 343 | } |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | header($responseCode); |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | - if(!empty($header)) { |
|
| 349 | + if (!empty($header)) { |
|
| 350 | 350 | header($header); |
| 351 | 351 | } |
| 352 | 352 | |
@@ -451,8 +451,8 @@ discard block |
||
| 451 | 451 | |
| 452 | 452 | private function recoverySiteCache() |
| 453 | 453 | { |
| 454 | - $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
| 455 | - $site_cache_path = $site_cache_dir . 'siteCache.idx.php'; |
|
| 454 | + $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
| 455 | + $site_cache_path = $site_cache_dir.'siteCache.idx.php'; |
|
| 456 | 456 | |
| 457 | 457 | if (is_file($site_cache_path)) { |
| 458 | 458 | include($site_cache_path); |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | return; |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
| 464 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
| 465 | 465 | $cache = new synccache(); |
| 466 | 466 | $cache->setCachepath($site_cache_dir); |
| 467 | 467 | $cache->setReport(false); |
@@ -513,8 +513,8 @@ discard block |
||
| 513 | 513 | $this->invokeEvent("OnBeforeManagerPageInit"); |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) { |
|
| 517 | - $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet']; |
|
| 516 | + if (isset ($_SESSION[$usrType.'UsrConfigSet'])) { |
|
| 517 | + $usrSettings = &$_SESSION[$usrType.'UsrConfigSet']; |
|
| 518 | 518 | } else { |
| 519 | 519 | if ($usrType == 'web') { |
| 520 | 520 | $from = $tbl_web_user_settings; |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | $usrSettings[$row['setting_name']] = $row['setting_value']; |
| 535 | 535 | } |
| 536 | 536 | if (isset ($usrType)) { |
| 537 | - $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; |
|
| 537 | + $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings; |
|
| 538 | 538 | } // store user settings in session |
| 539 | 539 | } |
| 540 | 540 | } |
@@ -679,10 +679,10 @@ discard block |
||
| 679 | 679 | $suf = $this->config['friendly_url_suffix']; |
| 680 | 680 | $pre = preg_quote($pre, '/'); |
| 681 | 681 | $suf = preg_quote($suf, '/'); |
| 682 | - if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) { |
|
| 682 | + if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) { |
|
| 683 | 683 | $q = $_[1]; |
| 684 | 684 | } |
| 685 | - if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) { |
|
| 685 | + if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) { |
|
| 686 | 686 | $q = $_[1]; |
| 687 | 687 | } |
| 688 | 688 | |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */ |
| 705 | 705 | /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */ |
| 706 | 706 | if ($this->config['use_alias_path'] == 1) { |
| 707 | - if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
|
| 707 | + if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) { |
|
| 708 | 708 | $this->documentMethod = 'id'; |
| 709 | 709 | return $q; |
| 710 | 710 | } else { /* not a valid id in terms of virtualDir, treat as alias */ |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | */ |
| 739 | 739 | public function getHashFile($key) |
| 740 | 740 | { |
| 741 | - return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php"; |
|
| 741 | + return $this->getCacheFolder()."docid_".$key.".pageCache.php"; |
|
| 742 | 742 | } |
| 743 | 743 | |
| 744 | 744 | /** |
@@ -749,9 +749,9 @@ discard block |
||
| 749 | 749 | $hash = $id; |
| 750 | 750 | $tmp = null; |
| 751 | 751 | $params = array(); |
| 752 | - if(!empty($this->systemCacheKey)){ |
|
| 752 | + if (!empty($this->systemCacheKey)) { |
|
| 753 | 753 | $hash = $this->systemCacheKey; |
| 754 | - }else { |
|
| 754 | + } else { |
|
| 755 | 755 | if (!empty($_GET)) { |
| 756 | 756 | // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID. |
| 757 | 757 | $params = $_GET; |
@@ -759,8 +759,8 @@ discard block |
||
| 759 | 759 | $hash .= '_'.md5(http_build_query($params)); |
| 760 | 760 | } |
| 761 | 761 | } |
| 762 | - $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params)); |
|
| 763 | - if (is_array($evtOut) && count($evtOut) > 0){ |
|
| 762 | + $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params)); |
|
| 763 | + if (is_array($evtOut) && count($evtOut) > 0) { |
|
| 764 | 764 | $tmp = array_pop($evtOut); |
| 765 | 765 | } |
| 766 | 766 | return empty($tmp) ? $hash : $tmp; |
@@ -902,12 +902,12 @@ discard block |
||
| 902 | 902 | if ($js = $this->getRegisteredClientStartupScripts()) { |
| 903 | 903 | // change to just before closing </head> |
| 904 | 904 | // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent); |
| 905 | - $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput); |
|
| 905 | + $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput); |
|
| 906 | 906 | } |
| 907 | 907 | |
| 908 | 908 | // Insert jscripts & html block into template - template must have a </body> tag |
| 909 | 909 | if ($js = $this->getRegisteredClientScripts()) { |
| 910 | - $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput); |
|
| 910 | + $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput); |
|
| 911 | 911 | } |
| 912 | 912 | // End fix by sirlancelot |
| 913 | 913 | |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | // send out content-type and content-disposition headers |
| 919 | 919 | if (IN_PARSER_MODE == "true") { |
| 920 | 920 | $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html"; |
| 921 | - header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']); |
|
| 921 | + header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']); |
|
| 922 | 922 | // if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error) |
| 923 | 923 | // header('HTTP/1.0 404 Not Found'); |
| 924 | 924 | if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) { |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | $name = preg_replace('|-+|', '-', $name); |
| 937 | 937 | $name = trim($name, '-'); |
| 938 | 938 | } |
| 939 | - $header = 'Content-Disposition: attachment; filename=' . $name; |
|
| 939 | + $header = 'Content-Disposition: attachment; filename='.$name; |
|
| 940 | 940 | header($header); |
| 941 | 941 | } |
| 942 | 942 | } |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | |
| 945 | 945 | $stats = $this->getTimerStats($this->tstart); |
| 946 | 946 | |
| 947 | - $out =& $this->documentOutput; |
|
| 947 | + $out = & $this->documentOutput; |
|
| 948 | 948 | $out = str_replace("[^q^]", $stats['queries'], $out); |
| 949 | 949 | $out = str_replace("[^qt^]", $stats['queryTime'], $out); |
| 950 | 950 | $out = str_replace("[^p^]", $stats['phpTime'], $out); |
@@ -983,17 +983,17 @@ discard block |
||
| 983 | 983 | $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet |
| 984 | 984 | $tt += $t; |
| 985 | 985 | } |
| 986 | - echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />"; |
|
| 986 | + echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />"; |
|
| 987 | 987 | echo $this->snippetsCode; |
| 988 | 988 | } |
| 989 | 989 | if ($this->dumpPlugins) { |
| 990 | 990 | $ps = ""; |
| 991 | 991 | $tt = 0; |
| 992 | 992 | foreach ($this->pluginsTime as $s => $t) { |
| 993 | - $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>"; |
|
| 993 | + $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>"; |
|
| 994 | 994 | $tt += $t; |
| 995 | 995 | } |
| 996 | - echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />"; |
|
| 996 | + echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />"; |
|
| 997 | 997 | echo $this->pluginsCode; |
| 998 | 998 | } |
| 999 | 999 | |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | $srcTags = explode(',', $tags); |
| 1020 | 1020 | $repTags = array(); |
| 1021 | 1021 | foreach ($srcTags as $tag) { |
| 1022 | - $repTags[] = '\\' . $tag[0] . '\\' . $tag[1]; |
|
| 1022 | + $repTags[] = '\\'.$tag[0].'\\'.$tag[1]; |
|
| 1023 | 1023 | } |
| 1024 | 1024 | return array($srcTags, $repTags); |
| 1025 | 1025 | } |
@@ -1041,7 +1041,7 @@ discard block |
||
| 1041 | 1041 | $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']); |
| 1042 | 1042 | $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache"; |
| 1043 | 1043 | $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0; |
| 1044 | - $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb"; |
|
| 1044 | + $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb"; |
|
| 1045 | 1045 | |
| 1046 | 1046 | return $stats; |
| 1047 | 1047 | } |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | { |
| 1075 | 1075 | $cacheRefreshTime = 0; |
| 1076 | 1076 | $recent_update = 0; |
| 1077 | - @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php'); |
|
| 1077 | + @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php'); |
|
| 1078 | 1078 | $this->recentUpdate = $recent_update; |
| 1079 | 1079 | |
| 1080 | 1080 | $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time']; |
@@ -1128,8 +1128,8 @@ discard block |
||
| 1128 | 1128 | } |
| 1129 | 1129 | |
| 1130 | 1130 | $docObjSerial = serialize($this->documentObject); |
| 1131 | - $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent; |
|
| 1132 | - $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey); |
|
| 1131 | + $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent; |
|
| 1132 | + $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey); |
|
| 1133 | 1133 | file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent"); |
| 1134 | 1134 | } |
| 1135 | 1135 | } |
@@ -1171,16 +1171,16 @@ discard block |
||
| 1171 | 1171 | return array(); |
| 1172 | 1172 | } |
| 1173 | 1173 | $spacer = md5('<<<EVO>>>'); |
| 1174 | - if($left==='{{' && strpos($content,';}}')!==false) $content = str_replace(';}}', sprintf(';}%s}', $spacer),$content); |
|
| 1175 | - if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content); |
|
| 1176 | - if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]', $spacer),$content); |
|
| 1177 | - if($left==='[[' && strpos($content,']]]')!==false) $content = str_replace(']]]', sprintf(']%s]]', $spacer),$content); |
|
| 1174 | + if ($left === '{{' && strpos($content, ';}}') !== false) $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content); |
|
| 1175 | + if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content); |
|
| 1176 | + if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content); |
|
| 1177 | + if ($left === '[[' && strpos($content, ']]]') !== false) $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content); |
|
| 1178 | 1178 | |
| 1179 | 1179 | $pos['<![CDATA['] = strpos($content, '<![CDATA['); |
| 1180 | 1180 | $pos[']]>'] = strpos($content, ']]>'); |
| 1181 | 1181 | |
| 1182 | 1182 | if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) { |
| 1183 | - $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3); |
|
| 1183 | + $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3); |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | $lp = explode($left, $content); |
@@ -1244,8 +1244,8 @@ discard block |
||
| 1244 | 1244 | } |
| 1245 | 1245 | } |
| 1246 | 1246 | } |
| 1247 | - foreach($tags as $i=>$tag) { |
|
| 1248 | - if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1247 | + foreach ($tags as $i=>$tag) { |
|
| 1248 | + if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag); |
|
| 1249 | 1249 | } |
| 1250 | 1250 | return $tags; |
| 1251 | 1251 | } |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | 1287 | foreach ($matches[1] as $i => $key) { |
| 1288 | - if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1288 | + if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?¶m=`xxx`}} with [*tv_name_[+param+]*] as content |
|
| 1289 | 1289 | if (substr($key, 0, 1) == '#') { |
| 1290 | 1290 | $key = substr($key, 1); |
| 1291 | 1291 | } // remove # for QuickEdit format |
@@ -1305,8 +1305,8 @@ discard block |
||
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | 1307 | if (is_array($value)) { |
| 1308 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php'); |
|
| 1309 | - include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php'); |
|
| 1308 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php'); |
|
| 1309 | + include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php'); |
|
| 1310 | 1310 | $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]); |
| 1311 | 1311 | } |
| 1312 | 1312 | |
@@ -1317,8 +1317,8 @@ discard block |
||
| 1317 | 1317 | |
| 1318 | 1318 | if (strpos($content, $s) !== false) { |
| 1319 | 1319 | $content = str_replace($s, $value, $content); |
| 1320 | - } elseif($this->debug) { |
|
| 1321 | - $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1320 | + } elseif ($this->debug) { |
|
| 1321 | + $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1322 | 1322 | } |
| 1323 | 1323 | } |
| 1324 | 1324 | |
@@ -1485,8 +1485,8 @@ discard block |
||
| 1485 | 1485 | $s = &$matches[0][$i]; |
| 1486 | 1486 | if (strpos($content, $s) !== false) { |
| 1487 | 1487 | $content = str_replace($s, $value, $content); |
| 1488 | - } elseif($this->debug) { |
|
| 1489 | - $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1488 | + } elseif ($this->debug) { |
|
| 1489 | + $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1490 | 1490 | } |
| 1491 | 1491 | } |
| 1492 | 1492 | return $content; |
@@ -1539,7 +1539,7 @@ discard block |
||
| 1539 | 1539 | } |
| 1540 | 1540 | |
| 1541 | 1541 | $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags |
| 1542 | - $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
| 1542 | + $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers |
|
| 1543 | 1543 | if ($this->config['enable_at_syntax']) { |
| 1544 | 1544 | $value = $this->mergeConditionalTagsContent($value); |
| 1545 | 1545 | } |
@@ -1554,8 +1554,8 @@ discard block |
||
| 1554 | 1554 | $s = &$matches[0][$i]; |
| 1555 | 1555 | if (strpos($content, $s) !== false) { |
| 1556 | 1556 | $content = str_replace($s, $value, $content); |
| 1557 | - } elseif($this->debug) { |
|
| 1558 | - $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1557 | + } elseif ($this->debug) { |
|
| 1558 | + $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1559 | 1559 | } |
| 1560 | 1560 | } |
| 1561 | 1561 | return $content; |
@@ -1613,8 +1613,8 @@ discard block |
||
| 1613 | 1613 | $s = &$matches[0][$i]; |
| 1614 | 1614 | if (strpos($content, $s) !== false) { |
| 1615 | 1615 | $content = str_replace($s, $value, $content); |
| 1616 | - } elseif($this->debug) { |
|
| 1617 | - $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1616 | + } elseif ($this->debug) { |
|
| 1617 | + $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1618 | 1618 | } |
| 1619 | 1619 | } |
| 1620 | 1620 | return $content; |
@@ -1638,7 +1638,7 @@ discard block |
||
| 1638 | 1638 | return $content; |
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | - $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#'; |
|
| 1641 | + $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#'; |
|
| 1642 | 1642 | $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content); |
| 1643 | 1643 | |
| 1644 | 1644 | $pieces = explode('<@IF:', $content); |
@@ -1649,7 +1649,7 @@ discard block |
||
| 1649 | 1649 | } |
| 1650 | 1650 | list($cmd, $text) = explode('>', $split, 2); |
| 1651 | 1651 | $cmd = str_replace("'", "\'", $cmd); |
| 1652 | - $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
| 1652 | + $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
| 1653 | 1653 | $content .= $text; |
| 1654 | 1654 | } |
| 1655 | 1655 | $pieces = explode('<@ELSEIF:', $content); |
@@ -1660,13 +1660,13 @@ discard block |
||
| 1660 | 1660 | } |
| 1661 | 1661 | list($cmd, $text) = explode('>', $split, 2); |
| 1662 | 1662 | $cmd = str_replace("'", "\'", $cmd); |
| 1663 | - $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>"; |
|
| 1663 | + $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>"; |
|
| 1664 | 1664 | $content .= $text; |
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content); |
| 1668 | 1668 | ob_start(); |
| 1669 | - $content = eval('?>' . $content); |
|
| 1669 | + $content = eval('?>'.$content); |
|
| 1670 | 1670 | $content = ob_get_clean(); |
| 1671 | 1671 | $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content); |
| 1672 | 1672 | |
@@ -1791,7 +1791,7 @@ discard block |
||
| 1791 | 1791 | $matches = $this->getTagsFromContent($content, $left, $right); |
| 1792 | 1792 | if (!empty($matches)) { |
| 1793 | 1793 | foreach ($matches[0] as $i => $v) { |
| 1794 | - $addBreakMatches[$i] = $v . "\n"; |
|
| 1794 | + $addBreakMatches[$i] = $v."\n"; |
|
| 1795 | 1795 | } |
| 1796 | 1796 | $content = str_replace($addBreakMatches, '', $content); |
| 1797 | 1797 | if (strpos($content, $left) !== false) { |
@@ -1824,8 +1824,8 @@ discard block |
||
| 1824 | 1824 | $s = &$matches[0][$i]; |
| 1825 | 1825 | if (strpos($content, $s) !== false) { |
| 1826 | 1826 | $content = str_replace($s, $v, $content); |
| 1827 | - } elseif($this->debug) { |
|
| 1828 | - $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1827 | + } elseif ($this->debug) { |
|
| 1828 | + $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1829 | 1829 | } |
| 1830 | 1830 | } |
| 1831 | 1831 | return $content; |
@@ -1889,7 +1889,7 @@ discard block |
||
| 1889 | 1889 | $msg = ($msg === false) ? 'ob_get_contents() error' : $msg; |
| 1890 | 1890 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg); |
| 1891 | 1891 | if ($this->isBackend()) { |
| 1892 | - $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>'); |
|
| 1892 | + $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>'); |
|
| 1893 | 1893 | } |
| 1894 | 1894 | } |
| 1895 | 1895 | } else { |
@@ -1935,7 +1935,7 @@ discard block |
||
| 1935 | 1935 | $echo = ($echo === false) ? 'ob_get_contents() error' : $echo; |
| 1936 | 1936 | $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo); |
| 1937 | 1937 | if ($this->isBackend()) { |
| 1938 | - $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>'); |
|
| 1938 | + $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>'); |
|
| 1939 | 1939 | } |
| 1940 | 1940 | } |
| 1941 | 1941 | } |
@@ -1943,7 +1943,7 @@ discard block |
||
| 1943 | 1943 | if (is_array($return) || is_object($return)) { |
| 1944 | 1944 | return $return; |
| 1945 | 1945 | } else { |
| 1946 | - return $echo . $return; |
|
| 1946 | + return $echo.$return; |
|
| 1947 | 1947 | } |
| 1948 | 1948 | } |
| 1949 | 1949 | |
@@ -1981,8 +1981,8 @@ discard block |
||
| 1981 | 1981 | } |
| 1982 | 1982 | if (strpos($content, $s) !== false) { |
| 1983 | 1983 | $content = str_replace($s, $value, $content); |
| 1984 | - } elseif($this->debug) { |
|
| 1985 | - $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1984 | + } elseif ($this->debug) { |
|
| 1985 | + $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1986 | 1986 | } |
| 1987 | 1987 | continue; |
| 1988 | 1988 | } |
@@ -1993,8 +1993,8 @@ discard block |
||
| 1993 | 1993 | |
| 1994 | 1994 | if (strpos($content, $s) !== false) { |
| 1995 | 1995 | $content = str_replace($s, $value, $content); |
| 1996 | - } elseif($this->debug) { |
|
| 1997 | - $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 1996 | + } elseif ($this->debug) { |
|
| 1997 | + $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 1998 | 1998 | } |
| 1999 | 1999 | } |
| 2000 | 2000 | |
@@ -2085,7 +2085,7 @@ discard block |
||
| 2085 | 2085 | $eventtime = sprintf('%2.2f ms', $eventtime * 1000); |
| 2086 | 2086 | $code = str_replace("\t", ' ', $this->htmlspecialchars($value)); |
| 2087 | 2087 | $piece = str_replace("\t", ' ', $this->htmlspecialchars($piece)); |
| 2088 | - $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true))); |
|
| 2088 | + $print_r_params = str_replace("\t", ' ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true))); |
|
| 2089 | 2089 | $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); |
| 2090 | 2090 | $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime); |
| 2091 | 2091 | } |
@@ -2329,7 +2329,7 @@ discard block |
||
| 2329 | 2329 | $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where); |
| 2330 | 2330 | $count = $this->db->getRecordCount($rs); |
| 2331 | 2331 | if (1 < $count) { |
| 2332 | - exit('Error $modx->_getSnippetObject()' . $snip_name); |
|
| 2332 | + exit('Error $modx->_getSnippetObject()'.$snip_name); |
|
| 2333 | 2333 | } |
| 2334 | 2334 | if ($count) { |
| 2335 | 2335 | $row = $this->db->getRow($rs); |
@@ -2355,7 +2355,7 @@ discard block |
||
| 2355 | 2355 | public function toAlias($text) |
| 2356 | 2356 | { |
| 2357 | 2357 | $suff = $this->config['friendly_url_suffix']; |
| 2358 | - 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); |
|
| 2358 | + 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); |
|
| 2359 | 2359 | } |
| 2360 | 2360 | |
| 2361 | 2361 | /** |
@@ -2387,7 +2387,7 @@ discard block |
||
| 2387 | 2387 | $suff = '/'; |
| 2388 | 2388 | } |
| 2389 | 2389 | |
| 2390 | - $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff; |
|
| 2390 | + $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff; |
|
| 2391 | 2391 | } |
| 2392 | 2392 | |
| 2393 | 2393 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -2424,7 +2424,7 @@ discard block |
||
| 2424 | 2424 | preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match); |
| 2425 | 2425 | $ids = implode(',', array_unique($match['1'])); |
| 2426 | 2426 | if ($ids) { |
| 2427 | - $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'"); |
|
| 2427 | + $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'"); |
|
| 2428 | 2428 | while ($row = $this->db->getRow($res)) { |
| 2429 | 2429 | if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) { |
| 2430 | 2430 | $parent = $row['parent']; |
@@ -2435,7 +2435,7 @@ discard block |
||
| 2435 | 2435 | $parent = $this->aliasListing[$parent]['parent']; |
| 2436 | 2436 | } |
| 2437 | 2437 | |
| 2438 | - $aliases[$row['id']] = $path . '/' . $row['alias']; |
|
| 2438 | + $aliases[$row['id']] = $path.'/'.$row['alias']; |
|
| 2439 | 2439 | } else { |
| 2440 | 2440 | $aliases[$row['id']] = $row['alias']; |
| 2441 | 2441 | } |
@@ -2447,7 +2447,7 @@ discard block |
||
| 2447 | 2447 | $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0); |
| 2448 | 2448 | $pref = $this->config['friendly_url_prefix']; |
| 2449 | 2449 | $suff = $this->config['friendly_url_suffix']; |
| 2450 | - $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
| 2450 | + $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) { |
|
| 2451 | 2451 | global $modx; |
| 2452 | 2452 | $thealias = $aliases[$m[1]]; |
| 2453 | 2453 | $thefolder = $isfolder[$m[1]]; |
@@ -2463,7 +2463,7 @@ discard block |
||
| 2463 | 2463 | |
| 2464 | 2464 | } else { |
| 2465 | 2465 | $in = '!\[\~([0-9]+)\~\]!is'; |
| 2466 | - $out = "index.php?id=" . '\1'; |
|
| 2466 | + $out = "index.php?id=".'\1'; |
|
| 2467 | 2467 | $documentSource = preg_replace($in, $out, $documentSource); |
| 2468 | 2468 | } |
| 2469 | 2469 | |
@@ -2484,7 +2484,7 @@ discard block |
||
| 2484 | 2484 | $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; |
| 2485 | 2485 | $len_base_url = strlen($this->config['base_url']); |
| 2486 | 2486 | |
| 2487 | - $url_path = $q;//LANG |
|
| 2487 | + $url_path = $q; //LANG |
|
| 2488 | 2488 | |
| 2489 | 2489 | if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) { |
| 2490 | 2490 | $url_path = substr($url_path, $len_base_url); |
@@ -2496,7 +2496,7 @@ discard block |
||
| 2496 | 2496 | $strictURL = substr($strictURL, $len_base_url); |
| 2497 | 2497 | } |
| 2498 | 2498 | $http_host = $_SERVER['HTTP_HOST']; |
| 2499 | - $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG |
|
| 2499 | + $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG |
|
| 2500 | 2500 | |
| 2501 | 2501 | $site_url = $this->config['site_url']; |
| 2502 | 2502 | |
@@ -2512,7 +2512,7 @@ discard block |
||
| 2512 | 2512 | } |
| 2513 | 2513 | if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) { |
| 2514 | 2514 | if (empty($_POST)) { |
| 2515 | - if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) { |
|
| 2515 | + if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) { |
|
| 2516 | 2516 | $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently'); |
| 2517 | 2517 | exit(0); |
| 2518 | 2518 | } |
@@ -2575,7 +2575,7 @@ discard block |
||
| 2575 | 2575 | $docgrp = implode(",", $docgrp); |
| 2576 | 2576 | } |
| 2577 | 2577 | // get document |
| 2578 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 2578 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 2579 | 2579 | $rs = $this->db->select('sc.*', "{$tblsc} sc |
| 2580 | 2580 | LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1); |
| 2581 | 2581 | if ($this->db->getRecordCount($rs) < 1) { |
@@ -2611,9 +2611,9 @@ discard block |
||
| 2611 | 2611 | } |
| 2612 | 2612 | if ($documentObject['template']) { |
| 2613 | 2613 | // load TVs and merge with document - Orig by Apodigm - Docvars |
| 2614 | - $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv |
|
| 2615 | - INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
| 2616 | - LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
| 2614 | + $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv |
|
| 2615 | + INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id |
|
| 2616 | + LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'"); |
|
| 2617 | 2617 | $tmplvars = array(); |
| 2618 | 2618 | while ($row = $this->db->getRow($rs)) { |
| 2619 | 2619 | $tmplvars[$row['name']] = array( |
@@ -2659,7 +2659,7 @@ discard block |
||
| 2659 | 2659 | $st = md5($source); |
| 2660 | 2660 | } |
| 2661 | 2661 | if ($this->dumpSnippets == 1) { |
| 2662 | - $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>"; |
|
| 2662 | + $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>"; |
|
| 2663 | 2663 | } |
| 2664 | 2664 | |
| 2665 | 2665 | // invoke OnParseDocument event |
@@ -2701,7 +2701,7 @@ discard block |
||
| 2701 | 2701 | */ |
| 2702 | 2702 | public function executeParser() |
| 2703 | 2703 | { |
| 2704 | - if(MODX_CLI) { |
|
| 2704 | + if (MODX_CLI) { |
|
| 2705 | 2705 | throw new RuntimeException('Call DocumentParser::executeParser on CLI mode'); |
| 2706 | 2706 | } |
| 2707 | 2707 | |
@@ -2747,7 +2747,7 @@ discard block |
||
| 2747 | 2747 | |
| 2748 | 2748 | // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path |
| 2749 | 2749 | if ($this->config['use_alias_path'] == 1) { |
| 2750 | - $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier; |
|
| 2750 | + $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier; |
|
| 2751 | 2751 | if (isset($this->documentListing[$alias])) { |
| 2752 | 2752 | $this->documentIdentifier = $this->documentListing[$alias]; |
| 2753 | 2753 | } else { |
@@ -2808,7 +2808,7 @@ discard block |
||
| 2808 | 2808 | } else { |
| 2809 | 2809 | $docAlias = $this->db->escape($this->documentIdentifier); |
| 2810 | 2810 | $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'"); |
| 2811 | - $this->documentIdentifier = (int)$this->db->getValue($rs); |
|
| 2811 | + $this->documentIdentifier = (int) $this->db->getValue($rs); |
|
| 2812 | 2812 | } |
| 2813 | 2813 | } |
| 2814 | 2814 | $this->documentMethod = 'id'; |
@@ -2861,7 +2861,7 @@ discard block |
||
| 2861 | 2861 | $_REQUEST[$n] = $_GET[$n] = $v; |
| 2862 | 2862 | } |
| 2863 | 2863 | } |
| 2864 | - $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path']; |
|
| 2864 | + $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path']; |
|
| 2865 | 2865 | $this->q = $qp['path']; |
| 2866 | 2866 | return $qp['path']; |
| 2867 | 2867 | } |
@@ -2955,7 +2955,7 @@ discard block |
||
| 2955 | 2955 | $this->sendErrorPage(); |
| 2956 | 2956 | } else { |
| 2957 | 2957 | // Inculde the necessary files to check document permissions |
| 2958 | - include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php'); |
|
| 2958 | + include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php'); |
|
| 2959 | 2959 | $udperms = new udperms(); |
| 2960 | 2960 | $udperms->user = $this->getLoginUserID(); |
| 2961 | 2961 | $udperms->document = $this->documentIdentifier; |
@@ -3009,7 +3009,7 @@ discard block |
||
| 3009 | 3009 | while ($id && $height--) { |
| 3010 | 3010 | $thisid = $id; |
| 3011 | 3011 | if ($this->config['aliaslistingfolder'] == 1) { |
| 3012 | - $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"); |
|
| 3012 | + $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"); |
|
| 3013 | 3013 | if (!$id || $id == '0') { |
| 3014 | 3014 | break; |
| 3015 | 3015 | } |
@@ -3060,15 +3060,15 @@ discard block |
||
| 3060 | 3060 | |
| 3061 | 3061 | if ($this->config['aliaslistingfolder'] == 1) { |
| 3062 | 3062 | |
| 3063 | - $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'"); |
|
| 3063 | + $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'"); |
|
| 3064 | 3064 | $idx = array(); |
| 3065 | 3065 | while ($row = $this->db->getRow($res)) { |
| 3066 | 3066 | $pAlias = ''; |
| 3067 | 3067 | if (isset($this->aliasListing[$row['parent']])) { |
| 3068 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : ''; |
|
| 3069 | - $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : ''; |
|
| 3068 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : ''; |
|
| 3069 | + $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : ''; |
|
| 3070 | 3070 | }; |
| 3071 | - $children[$pAlias . $row['alias']] = $row['id']; |
|
| 3071 | + $children[$pAlias.$row['alias']] = $row['id']; |
|
| 3072 | 3072 | if ($row['isfolder'] == 1) { |
| 3073 | 3073 | $idx[] = $row['id']; |
| 3074 | 3074 | } |
@@ -3100,7 +3100,7 @@ discard block |
||
| 3100 | 3100 | $depth--; |
| 3101 | 3101 | |
| 3102 | 3102 | foreach ($documentMap_cache[$id] as $childId) { |
| 3103 | - $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias']; |
|
| 3103 | + $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias']; |
|
| 3104 | 3104 | if (!strlen($pkey)) { |
| 3105 | 3105 | $pkey = "{$childId}"; |
| 3106 | 3106 | } |
@@ -3129,7 +3129,7 @@ discard block |
||
| 3129 | 3129 | if (substr(strtolower($url), 0, 11) == "javascript:") { |
| 3130 | 3130 | $fnc = substr($url, 11); |
| 3131 | 3131 | } elseif ($url) { |
| 3132 | - $fnc = "window.location.href='" . addslashes($url) . "';"; |
|
| 3132 | + $fnc = "window.location.href='".addslashes($url)."';"; |
|
| 3133 | 3133 | } else { |
| 3134 | 3134 | $fnc = "history.back(-1);"; |
| 3135 | 3135 | } |
@@ -3138,7 +3138,7 @@ discard block |
||
| 3138 | 3138 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\"> |
| 3139 | 3139 | <script> |
| 3140 | 3140 | function __alertQuit() { |
| 3141 | - alert('" . addslashes($msg) . "'); |
|
| 3141 | + alert('".addslashes($msg)."'); |
|
| 3142 | 3142 | {$fnc} |
| 3143 | 3143 | } |
| 3144 | 3144 | window.setTimeout('__alertQuit();',100); |
@@ -3160,9 +3160,9 @@ discard block |
||
| 3160 | 3160 | $state = 0; |
| 3161 | 3161 | $pms = $_SESSION['mgrPermissions']; |
| 3162 | 3162 | if ($pms) { |
| 3163 | - $state = ((bool)$pms[$pm] === true); |
|
| 3163 | + $state = ((bool) $pms[$pm] === true); |
|
| 3164 | 3164 | } |
| 3165 | - return (int)$state; |
|
| 3165 | + return (int) $state; |
|
| 3166 | 3166 | } |
| 3167 | 3167 | |
| 3168 | 3168 | /** |
@@ -3175,8 +3175,8 @@ discard block |
||
| 3175 | 3175 | */ |
| 3176 | 3176 | public function elementIsLocked($type, $id, $includeThisUser = false) |
| 3177 | 3177 | { |
| 3178 | - $id = (int)$id; |
|
| 3179 | - $type = (int)$type; |
|
| 3178 | + $id = (int) $id; |
|
| 3179 | + $type = (int) $type; |
|
| 3180 | 3180 | if (!$type || !$id) { |
| 3181 | 3181 | return null; |
| 3182 | 3182 | } |
@@ -3226,7 +3226,7 @@ discard block |
||
| 3226 | 3226 | return $lockedElements; |
| 3227 | 3227 | } |
| 3228 | 3228 | |
| 3229 | - $type = (int)$type; |
|
| 3229 | + $type = (int) $type; |
|
| 3230 | 3230 | if (isset($lockedElements[$type])) { |
| 3231 | 3231 | return $lockedElements[$type]; |
| 3232 | 3232 | } else { |
@@ -3243,7 +3243,7 @@ discard block |
||
| 3243 | 3243 | $this->lockedElements = array(); |
| 3244 | 3244 | $this->cleanupExpiredLocks(); |
| 3245 | 3245 | |
| 3246 | - $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul |
|
| 3246 | + $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul |
|
| 3247 | 3247 | LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id"); |
| 3248 | 3248 | while ($row = $this->db->getRow($rs)) { |
| 3249 | 3249 | $this->lockedElements[$row['elementType']][$row['elementId']] = array( |
@@ -3266,7 +3266,7 @@ discard block |
||
| 3266 | 3266 | public function cleanupExpiredLocks() |
| 3267 | 3267 | { |
| 3268 | 3268 | // Clean-up active_user_sessions first |
| 3269 | - $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
| 3269 | + $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum |
|
| 3270 | 3270 | $validSessionTimeLimit = $this->time - $timeout; |
| 3271 | 3271 | $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}"); |
| 3272 | 3272 | |
@@ -3279,7 +3279,7 @@ discard block |
||
| 3279 | 3279 | foreach ($rs as $row) { |
| 3280 | 3280 | $userSids[] = $row['sid']; |
| 3281 | 3281 | } |
| 3282 | - $userSids = "'" . implode("','", $userSids) . "'"; |
|
| 3282 | + $userSids = "'".implode("','", $userSids)."'"; |
|
| 3283 | 3283 | $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})"); |
| 3284 | 3284 | } else { |
| 3285 | 3285 | $this->db->delete($this->getFullTableName('active_user_locks')); |
@@ -3363,8 +3363,8 @@ discard block |
||
| 3363 | 3363 | public function lockElement($type, $id) |
| 3364 | 3364 | { |
| 3365 | 3365 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
| 3366 | - $type = (int)$type; |
|
| 3367 | - $id = (int)$id; |
|
| 3366 | + $type = (int) $type; |
|
| 3367 | + $id = (int) $id; |
|
| 3368 | 3368 | if (!$type || !$id || !$userId) { |
| 3369 | 3369 | return false; |
| 3370 | 3370 | } |
@@ -3385,8 +3385,8 @@ discard block |
||
| 3385 | 3385 | public function unlockElement($type, $id, $includeAllUsers = false) |
| 3386 | 3386 | { |
| 3387 | 3387 | $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0; |
| 3388 | - $type = (int)$type; |
|
| 3389 | - $id = (int)$id; |
|
| 3388 | + $type = (int) $type; |
|
| 3389 | + $id = (int) $id; |
|
| 3390 | 3390 | if (!$type || !$id) { |
| 3391 | 3391 | return false; |
| 3392 | 3392 | } |
@@ -3453,8 +3453,8 @@ discard block |
||
| 3453 | 3453 | } |
| 3454 | 3454 | |
| 3455 | 3455 | $usertype = $this->isFrontend() ? 1 : 0; |
| 3456 | - $evtid = (int)$evtid; |
|
| 3457 | - $type = (int)$type; |
|
| 3456 | + $evtid = (int) $evtid; |
|
| 3457 | + $type = (int) $type; |
|
| 3458 | 3458 | |
| 3459 | 3459 | // Types: 1 = information, 2 = warning, 3 = error |
| 3460 | 3460 | if ($type < 1) { |
@@ -3476,8 +3476,8 @@ discard block |
||
| 3476 | 3476 | if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') { |
| 3477 | 3477 | if ($this->config['send_errormail'] <= $type) { |
| 3478 | 3478 | $this->sendmail(array( |
| 3479 | - 'subject' => 'MODX System Error on ' . $this->config['site_name'], |
|
| 3480 | - 'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.', |
|
| 3479 | + 'subject' => 'MODX System Error on '.$this->config['site_name'], |
|
| 3480 | + 'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.', |
|
| 3481 | 3481 | 'type' => 'text' |
| 3482 | 3482 | )); |
| 3483 | 3483 | } |
@@ -3525,7 +3525,7 @@ discard block |
||
| 3525 | 3525 | $p['fromname'] = $userinfo['username']; |
| 3526 | 3526 | } |
| 3527 | 3527 | if ($msg === '' && !isset($p['body'])) { |
| 3528 | - $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER']; |
|
| 3528 | + $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER']; |
|
| 3529 | 3529 | } elseif (is_string($msg) && 0 < strlen($msg)) { |
| 3530 | 3530 | $p['body'] = $msg; |
| 3531 | 3531 | } |
@@ -3565,8 +3565,8 @@ discard block |
||
| 3565 | 3565 | $files = array(); |
| 3566 | 3566 | } |
| 3567 | 3567 | foreach ($files as $f) { |
| 3568 | - if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) { |
|
| 3569 | - $this->mail->AddAttachment(MODX_BASE_PATH . $f); |
|
| 3568 | + if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) { |
|
| 3569 | + $this->mail->AddAttachment(MODX_BASE_PATH.$f); |
|
| 3570 | 3570 | } |
| 3571 | 3571 | } |
| 3572 | 3572 | $rs = $this->mail->send(); |
@@ -3611,7 +3611,7 @@ discard block |
||
| 3611 | 3611 | */ |
| 3612 | 3612 | public function isFrontend() |
| 3613 | 3613 | { |
| 3614 | - return ! $this->isBackend(); |
|
| 3614 | + return !$this->isBackend(); |
|
| 3615 | 3615 | } |
| 3616 | 3616 | |
| 3617 | 3617 | /** |
@@ -3636,14 +3636,14 @@ discard block |
||
| 3636 | 3636 | $tblsc = $this->getFullTableName("site_content"); |
| 3637 | 3637 | $tbldg = $this->getFullTableName("document_groups"); |
| 3638 | 3638 | // modify field names to use sc. table reference |
| 3639 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3640 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3639 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3640 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3641 | 3641 | // get document groups for current user |
| 3642 | 3642 | if ($docgrp = $this->getUserDocGroups()) { |
| 3643 | 3643 | $docgrp = implode(",", $docgrp); |
| 3644 | 3644 | } |
| 3645 | 3645 | // build query |
| 3646 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3646 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3647 | 3647 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
| 3648 | 3648 | LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}"); |
| 3649 | 3649 | $resourceArray = $this->db->makeArray($result); |
@@ -3673,14 +3673,14 @@ discard block |
||
| 3673 | 3673 | $tbldg = $this->getFullTableName("document_groups"); |
| 3674 | 3674 | |
| 3675 | 3675 | // modify field names to use sc. table reference |
| 3676 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3677 | - $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3676 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3677 | + $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3678 | 3678 | // get document groups for current user |
| 3679 | 3679 | if ($docgrp = $this->getUserDocGroups()) { |
| 3680 | 3680 | $docgrp = implode(",", $docgrp); |
| 3681 | 3681 | } |
| 3682 | 3682 | // build query |
| 3683 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3683 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3684 | 3684 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
| 3685 | 3685 | 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}"); |
| 3686 | 3686 | $resourceArray = $this->db->makeArray($result); |
@@ -3715,16 +3715,16 @@ discard block |
||
| 3715 | 3715 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
| 3716 | 3716 | } |
| 3717 | 3717 | |
| 3718 | - $published = ($published !== 'all') ? 'AND sc.published = ' . $published : ''; |
|
| 3719 | - $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : ''; |
|
| 3718 | + $published = ($published !== 'all') ? 'AND sc.published = '.$published : ''; |
|
| 3719 | + $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : ''; |
|
| 3720 | 3720 | |
| 3721 | 3721 | if ($where != '') { |
| 3722 | - $where = 'AND ' . $where; |
|
| 3722 | + $where = 'AND '.$where; |
|
| 3723 | 3723 | } |
| 3724 | 3724 | |
| 3725 | 3725 | // modify field names to use sc. table reference |
| 3726 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3727 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3726 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3727 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3728 | 3728 | |
| 3729 | 3729 | // get document groups for current user |
| 3730 | 3730 | if ($docgrp = $this->getUserDocGroups()) { |
@@ -3732,7 +3732,7 @@ discard block |
||
| 3732 | 3732 | } |
| 3733 | 3733 | |
| 3734 | 3734 | // build query |
| 3735 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
| 3735 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
| 3736 | 3736 | |
| 3737 | 3737 | $tblsc = $this->getFullTableName('site_content'); |
| 3738 | 3738 | $tbldg = $this->getFullTableName('document_groups'); |
@@ -3784,10 +3784,10 @@ discard block |
||
| 3784 | 3784 | return false; |
| 3785 | 3785 | } else { |
| 3786 | 3786 | // modify field names to use sc. table reference |
| 3787 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3788 | - $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3787 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3788 | + $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 3789 | 3789 | if ($where != '') { |
| 3790 | - $where = 'AND ' . $where; |
|
| 3790 | + $where = 'AND '.$where; |
|
| 3791 | 3791 | } |
| 3792 | 3792 | |
| 3793 | 3793 | $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : ''; |
@@ -3798,13 +3798,13 @@ discard block |
||
| 3798 | 3798 | $docgrp = implode(',', $docgrp); |
| 3799 | 3799 | } |
| 3800 | 3800 | |
| 3801 | - $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')'); |
|
| 3801 | + $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')'); |
|
| 3802 | 3802 | |
| 3803 | 3803 | $tblsc = $this->getFullTableName('site_content'); |
| 3804 | 3804 | $tbldg = $this->getFullTableName('document_groups'); |
| 3805 | 3805 | |
| 3806 | 3806 | $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc |
| 3807 | - 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); |
|
| 3807 | + 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); |
|
| 3808 | 3808 | |
| 3809 | 3809 | $resourceArray = $this->db->makeArray($result); |
| 3810 | 3810 | |
@@ -3909,12 +3909,12 @@ discard block |
||
| 3909 | 3909 | $tbldg = $this->getFullTableName("document_groups"); |
| 3910 | 3910 | $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : ""; |
| 3911 | 3911 | // modify field names to use sc. table reference |
| 3912 | - $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3912 | + $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 3913 | 3913 | // get document groups for current user |
| 3914 | 3914 | if ($docgrp = $this->getUserDocGroups()) { |
| 3915 | 3915 | $docgrp = implode(",", $docgrp); |
| 3916 | 3916 | } |
| 3917 | - $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3917 | + $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)"); |
|
| 3918 | 3918 | $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1); |
| 3919 | 3919 | $pageInfo = $this->db->getRow($result); |
| 3920 | 3920 | |
@@ -3961,7 +3961,7 @@ discard block |
||
| 3961 | 3961 | { |
| 3962 | 3962 | if ($this->currentSnippet) { |
| 3963 | 3963 | $tbl = $this->getFullTableName("site_snippets"); |
| 3964 | - $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1); |
|
| 3964 | + $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1); |
|
| 3965 | 3965 | if ($snippetId = $this->db->getValue($rs)) { |
| 3966 | 3966 | return $snippetId; |
| 3967 | 3967 | } |
@@ -3988,23 +3988,23 @@ discard block |
||
| 3988 | 3988 | */ |
| 3989 | 3989 | public function clearCache($type = '', $report = false) |
| 3990 | 3990 | { |
| 3991 | - $cache_dir = MODX_BASE_PATH . $this->getCacheFolder(); |
|
| 3991 | + $cache_dir = MODX_BASE_PATH.$this->getCacheFolder(); |
|
| 3992 | 3992 | if (is_array($type)) { |
| 3993 | 3993 | foreach ($type as $_) { |
| 3994 | 3994 | $this->clearCache($_, $report); |
| 3995 | 3995 | } |
| 3996 | 3996 | } elseif ($type == 'full') { |
| 3997 | - include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'); |
|
| 3997 | + include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php'); |
|
| 3998 | 3998 | $sync = new synccache(); |
| 3999 | 3999 | $sync->setCachepath($cache_dir); |
| 4000 | 4000 | $sync->setReport($report); |
| 4001 | 4001 | $sync->emptyCache(); |
| 4002 | 4002 | } elseif (preg_match('@^[1-9][0-9]*$@', $type)) { |
| 4003 | 4003 | $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type; |
| 4004 | - $file_name = "docid_" . $key . "_*.pageCache.php"; |
|
| 4005 | - $cache_path = $cache_dir . $file_name; |
|
| 4004 | + $file_name = "docid_".$key."_*.pageCache.php"; |
|
| 4005 | + $cache_path = $cache_dir.$file_name; |
|
| 4006 | 4006 | $files = glob($cache_path); |
| 4007 | - $files[] = $cache_dir . "docid_" . $key . ".pageCache.php"; |
|
| 4007 | + $files[] = $cache_dir."docid_".$key.".pageCache.php"; |
|
| 4008 | 4008 | foreach ($files as $file) { |
| 4009 | 4009 | if (!is_file($file)) { |
| 4010 | 4010 | continue; |
@@ -4012,7 +4012,7 @@ discard block |
||
| 4012 | 4012 | unlink($file); |
| 4013 | 4013 | } |
| 4014 | 4014 | } else { |
| 4015 | - $files = glob($cache_dir . '*'); |
|
| 4015 | + $files = glob($cache_dir.'*'); |
|
| 4016 | 4016 | foreach ($files as $file) { |
| 4017 | 4017 | $name = basename($file); |
| 4018 | 4018 | if (strpos($name, '.pageCache.php') === false) { |
@@ -4081,7 +4081,7 @@ discard block |
||
| 4081 | 4081 | $f_url_suffix = '/'; |
| 4082 | 4082 | } |
| 4083 | 4083 | |
| 4084 | - $alPath = !empty ($al['path']) ? $al['path'] . '/' : ''; |
|
| 4084 | + $alPath = !empty ($al['path']) ? $al['path'].'/' : ''; |
|
| 4085 | 4085 | |
| 4086 | 4086 | if ($al && $al['alias']) { |
| 4087 | 4087 | $alias = $al['alias']; |
@@ -4089,7 +4089,7 @@ discard block |
||
| 4089 | 4089 | |
| 4090 | 4090 | } |
| 4091 | 4091 | |
| 4092 | - $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix; |
|
| 4092 | + $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix; |
|
| 4093 | 4093 | $url = "{$alias}{$args}"; |
| 4094 | 4094 | } else { |
| 4095 | 4095 | $url = "index.php?id={$id}{$args}"; |
@@ -4108,7 +4108,7 @@ discard block |
||
| 4108 | 4108 | } |
| 4109 | 4109 | |
| 4110 | 4110 | //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080) |
| 4111 | - $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host; |
|
| 4111 | + $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host; |
|
| 4112 | 4112 | } |
| 4113 | 4113 | |
| 4114 | 4114 | //fix strictUrl by Bumkaka |
@@ -4117,9 +4117,9 @@ discard block |
||
| 4117 | 4117 | } |
| 4118 | 4118 | |
| 4119 | 4119 | if ($this->config['xhtml_urls']) { |
| 4120 | - $url = preg_replace("/&(?!amp;)/", "&", $host . $virtualDir . $url); |
|
| 4120 | + $url = preg_replace("/&(?!amp;)/", "&", $host.$virtualDir.$url); |
|
| 4121 | 4121 | } else { |
| 4122 | - $url = $host . $virtualDir . $url; |
|
| 4122 | + $url = $host.$virtualDir.$url; |
|
| 4123 | 4123 | } |
| 4124 | 4124 | |
| 4125 | 4125 | $evtOut = $this->invokeEvent('OnMakeDocUrl', array( |
@@ -4143,21 +4143,21 @@ discard block |
||
| 4143 | 4143 | if (isset($this->aliasListing[$id])) { |
| 4144 | 4144 | $out = $this->aliasListing[$id]; |
| 4145 | 4145 | } else { |
| 4146 | - $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id); |
|
| 4146 | + $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id); |
|
| 4147 | 4147 | if ($this->db->getRecordCount($q) == '1') { |
| 4148 | 4148 | $q = $this->db->getRow($q); |
| 4149 | 4149 | $this->aliasListing[$id] = array( |
| 4150 | - 'id' => (int)$q['id'], |
|
| 4150 | + 'id' => (int) $q['id'], |
|
| 4151 | 4151 | 'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'], |
| 4152 | - 'parent' => (int)$q['parent'], |
|
| 4153 | - 'isfolder' => (int)$q['isfolder'], |
|
| 4152 | + 'parent' => (int) $q['parent'], |
|
| 4153 | + 'isfolder' => (int) $q['isfolder'], |
|
| 4154 | 4154 | ); |
| 4155 | 4155 | if ($this->aliasListing[$id]['parent'] > 0) { |
| 4156 | 4156 | //fix alias_path_usage |
| 4157 | 4157 | if ($this->config['use_alias_path'] == '1') { |
| 4158 | 4158 | //&& $tmp['path'] != '' - fix error slash with epty path |
| 4159 | 4159 | $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']); |
| 4160 | - $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : ''); |
|
| 4160 | + $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : ''); |
|
| 4161 | 4161 | } else { |
| 4162 | 4162 | $this->aliasListing[$id]['path'] = ''; |
| 4163 | 4163 | } |
@@ -4198,7 +4198,7 @@ discard block |
||
| 4198 | 4198 | $out = array(); |
| 4199 | 4199 | if (empty($this->version) || !is_array($this->version)) { |
| 4200 | 4200 | //include for compatibility modx version < 1.0.10 |
| 4201 | - include MODX_MANAGER_PATH . "includes/version.inc.php"; |
|
| 4201 | + include MODX_MANAGER_PATH."includes/version.inc.php"; |
|
| 4202 | 4202 | $this->version = array(); |
| 4203 | 4203 | $this->version['version'] = isset($modx_version) ? $modx_version : ''; |
| 4204 | 4204 | $this->version['branch'] = isset($modx_branch) ? $modx_branch : ''; |
@@ -4220,18 +4220,18 @@ discard block |
||
| 4220 | 4220 | { |
| 4221 | 4221 | if (isset ($this->snippetCache[$snippetName])) { |
| 4222 | 4222 | $snippet = $this->snippetCache[$snippetName]; |
| 4223 | - $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : ''; |
|
| 4223 | + $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : ''; |
|
| 4224 | 4224 | } else { // not in cache so let's check the db |
| 4225 | - $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;"; |
|
| 4225 | + $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;"; |
|
| 4226 | 4226 | $result = $this->db->query($sql); |
| 4227 | 4227 | if ($this->db->getRecordCount($result) == 1) { |
| 4228 | 4228 | $row = $this->db->getRow($result); |
| 4229 | 4229 | $snippet = $this->snippetCache[$snippetName] = $row['snippet']; |
| 4230 | 4230 | $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties'])); |
| 4231 | - $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties); |
|
| 4231 | + $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties); |
|
| 4232 | 4232 | } else { |
| 4233 | 4233 | $snippet = $this->snippetCache[$snippetName] = "return false;"; |
| 4234 | - $properties = $this->snippetCache[$snippetName . "Props"] = ''; |
|
| 4234 | + $properties = $this->snippetCache[$snippetName."Props"] = ''; |
|
| 4235 | 4235 | } |
| 4236 | 4236 | } |
| 4237 | 4237 | // load default params/properties |
@@ -4331,8 +4331,8 @@ discard block |
||
| 4331 | 4331 | } |
| 4332 | 4332 | if (strpos($tpl, $s) !== false) { |
| 4333 | 4333 | $tpl = str_replace($s, $value, $tpl); |
| 4334 | - } elseif($this->debug) { |
|
| 4335 | - $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2); |
|
| 4334 | + } elseif ($this->debug) { |
|
| 4335 | + $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2); |
|
| 4336 | 4336 | } |
| 4337 | 4337 | } |
| 4338 | 4338 | |
@@ -4381,7 +4381,7 @@ discard block |
||
| 4381 | 4381 | case 'CODE': |
| 4382 | 4382 | break; |
| 4383 | 4383 | case 'FILE': |
| 4384 | - $template = file_get_contents(MODX_BASE_PATH . $template); |
|
| 4384 | + $template = file_get_contents(MODX_BASE_PATH.$template); |
|
| 4385 | 4385 | break; |
| 4386 | 4386 | case 'CHUNK': |
| 4387 | 4387 | $template = $this->getChunk($template); |
@@ -4414,7 +4414,7 @@ discard block |
||
| 4414 | 4414 | if ($mode !== 'formatOnly' && empty($timestamp)) { |
| 4415 | 4415 | return '-'; |
| 4416 | 4416 | } |
| 4417 | - $timestamp = (int)$timestamp; |
|
| 4417 | + $timestamp = (int) $timestamp; |
|
| 4418 | 4418 | |
| 4419 | 4419 | switch ($this->config['datetime_format']) { |
| 4420 | 4420 | case 'YYYY/mm/dd': |
@@ -4434,7 +4434,7 @@ discard block |
||
| 4434 | 4434 | } |
| 4435 | 4435 | |
| 4436 | 4436 | if (empty($mode)) { |
| 4437 | - $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp); |
|
| 4437 | + $strTime = strftime($dateFormat." %H:%M:%S", $timestamp); |
|
| 4438 | 4438 | } elseif ($mode == 'dateOnly') { |
| 4439 | 4439 | $strTime = strftime($dateFormat, $timestamp); |
| 4440 | 4440 | } elseif ($mode == 'formatOnly') { |
@@ -4488,7 +4488,7 @@ discard block |
||
| 4488 | 4488 | $S = 0; |
| 4489 | 4489 | } |
| 4490 | 4490 | $timeStamp = mktime($H, $M, $S, $m, $d, $Y); |
| 4491 | - $timeStamp = (int)$timeStamp; |
|
| 4491 | + $timeStamp = (int) $timeStamp; |
|
| 4492 | 4492 | return $timeStamp; |
| 4493 | 4493 | } |
| 4494 | 4494 | |
@@ -4530,7 +4530,7 @@ discard block |
||
| 4530 | 4530 | if ($v === 'value') { |
| 4531 | 4531 | unset($_[$i]); |
| 4532 | 4532 | } else { |
| 4533 | - $_[$i] = 'tv.' . $v; |
|
| 4533 | + $_[$i] = 'tv.'.$v; |
|
| 4534 | 4534 | } |
| 4535 | 4535 | } |
| 4536 | 4536 | $fields = implode(',', $_); |
@@ -4539,12 +4539,12 @@ discard block |
||
| 4539 | 4539 | } |
| 4540 | 4540 | |
| 4541 | 4541 | if ($tvsort != '') { |
| 4542 | - $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
| 4542 | + $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort)))); |
|
| 4543 | 4543 | } |
| 4544 | 4544 | if ($tvidnames == "*") { |
| 4545 | 4545 | $query = "tv.id<>0"; |
| 4546 | 4546 | } else { |
| 4547 | - $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')"; |
|
| 4547 | + $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')"; |
|
| 4548 | 4548 | } |
| 4549 | 4549 | |
| 4550 | 4550 | $this->getUserDocGroups(); |
@@ -4688,7 +4688,7 @@ discard block |
||
| 4688 | 4688 | return $this->tmpCache[__FUNCTION__][$cacheKey]; |
| 4689 | 4689 | } |
| 4690 | 4690 | |
| 4691 | - if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) { |
|
| 4691 | + if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) { |
|
| 4692 | 4692 | return false; |
| 4693 | 4693 | } else { |
| 4694 | 4694 | |
@@ -4706,23 +4706,23 @@ discard block |
||
| 4706 | 4706 | } |
| 4707 | 4707 | |
| 4708 | 4708 | // get user defined template variables |
| 4709 | - $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 4710 | - $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 4709 | + $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields)))); |
|
| 4710 | + $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort)))); |
|
| 4711 | 4711 | |
| 4712 | 4712 | if ($idnames == '*') { |
| 4713 | 4713 | $query = 'tv.id<>0'; |
| 4714 | 4714 | } else { |
| 4715 | - $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')"; |
|
| 4715 | + $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')"; |
|
| 4716 | 4716 | } |
| 4717 | 4717 | |
| 4718 | - $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv |
|
| 4719 | - INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id |
|
| 4720 | - 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}" : "")); |
|
| 4718 | + $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv |
|
| 4719 | + INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id |
|
| 4720 | + 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}" : "")); |
|
| 4721 | 4721 | |
| 4722 | 4722 | $result = $this->db->makeArray($rs); |
| 4723 | 4723 | |
| 4724 | 4724 | // get default/built-in template variables |
| 4725 | - if(is_array($docRow)){ |
|
| 4725 | + if (is_array($docRow)) { |
|
| 4726 | 4726 | ksort($docRow); |
| 4727 | 4727 | |
| 4728 | 4728 | foreach ($docRow as $key => $value) { |
@@ -4760,22 +4760,22 @@ discard block |
||
| 4760 | 4760 | */ |
| 4761 | 4761 | public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '') |
| 4762 | 4762 | { |
| 4763 | - if (is_array($idnames) && empty($idnames) ) { |
|
| 4763 | + if (is_array($idnames) && empty($idnames)) { |
|
| 4764 | 4764 | return false; |
| 4765 | 4765 | } else { |
| 4766 | 4766 | $output = array(); |
| 4767 | 4767 | $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames); |
| 4768 | 4768 | |
| 4769 | - $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier; |
|
| 4769 | + $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier; |
|
| 4770 | 4770 | // remove sort for speed |
| 4771 | 4771 | $result = $this->getTemplateVars($vars, '*', $docid, $published, '', ''); |
| 4772 | 4772 | |
| 4773 | 4773 | if ($result == false) { |
| 4774 | 4774 | return false; |
| 4775 | 4775 | } else { |
| 4776 | - $baspath = MODX_MANAGER_PATH . 'includes'; |
|
| 4777 | - include_once $baspath . '/tmplvars.format.inc.php'; |
|
| 4778 | - include_once $baspath . '/tmplvars.commands.inc.php'; |
|
| 4776 | + $baspath = MODX_MANAGER_PATH.'includes'; |
|
| 4777 | + include_once $baspath.'/tmplvars.format.inc.php'; |
|
| 4778 | + include_once $baspath.'/tmplvars.commands.inc.php'; |
|
| 4779 | 4779 | |
| 4780 | 4780 | for ($i = 0; $i < count($result); $i++) { |
| 4781 | 4781 | $row = $result[$i]; |
@@ -4800,7 +4800,7 @@ discard block |
||
| 4800 | 4800 | */ |
| 4801 | 4801 | public function getFullTableName($tbl) |
| 4802 | 4802 | { |
| 4803 | - return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`"; |
|
| 4803 | + return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`"; |
|
| 4804 | 4804 | } |
| 4805 | 4805 | |
| 4806 | 4806 | /** |
@@ -4879,7 +4879,7 @@ discard block |
||
| 4879 | 4879 | public function getCachePath() |
| 4880 | 4880 | { |
| 4881 | 4881 | global $base_url; |
| 4882 | - $pth = $base_url . $this->getCacheFolder(); |
|
| 4882 | + $pth = $base_url.$this->getCacheFolder(); |
|
| 4883 | 4883 | return $pth; |
| 4884 | 4884 | } |
| 4885 | 4885 | |
@@ -4931,8 +4931,8 @@ discard block |
||
| 4931 | 4931 | $out = false; |
| 4932 | 4932 | |
| 4933 | 4933 | if (!empty($context)) { |
| 4934 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
| 4935 | - $out = $_SESSION[$context . 'InternalKey']; |
|
| 4934 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
| 4935 | + $out = $_SESSION[$context.'InternalKey']; |
|
| 4936 | 4936 | } |
| 4937 | 4937 | } else { |
| 4938 | 4938 | switch (true) { |
@@ -4960,8 +4960,8 @@ discard block |
||
| 4960 | 4960 | $out = false; |
| 4961 | 4961 | |
| 4962 | 4962 | if (!empty($context)) { |
| 4963 | - if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) { |
|
| 4964 | - $out = $_SESSION[$context . 'Shortname']; |
|
| 4963 | + if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) { |
|
| 4964 | + $out = $_SESSION[$context.'Shortname']; |
|
| 4965 | 4965 | } |
| 4966 | 4966 | } else { |
| 4967 | 4967 | switch (true) { |
@@ -5032,8 +5032,8 @@ discard block |
||
| 5032 | 5032 | */ |
| 5033 | 5033 | public function getWebUserInfo($uid) |
| 5034 | 5034 | { |
| 5035 | - $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu |
|
| 5036 | - INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
| 5035 | + $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu |
|
| 5036 | + INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'"); |
|
| 5037 | 5037 | if ($row = $this->db->getRow($rs)) { |
| 5038 | 5038 | if (!isset($row['usertype']) or !$row["usertype"]) { |
| 5039 | 5039 | $row["usertype"] = "web"; |
@@ -5069,7 +5069,7 @@ discard block |
||
| 5069 | 5069 | } else if (is_array($dg)) { |
| 5070 | 5070 | // resolve ids to names |
| 5071 | 5071 | $dgn = array(); |
| 5072 | - $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")"); |
|
| 5072 | + $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")"); |
|
| 5073 | 5073 | while ($row = $this->db->getRow($ds)) { |
| 5074 | 5074 | $dgn[] = $row['name']; |
| 5075 | 5075 | } |
@@ -5097,7 +5097,7 @@ discard block |
||
| 5097 | 5097 | $rt = false; |
| 5098 | 5098 | if ($_SESSION["webValidated"] == 1) { |
| 5099 | 5099 | $tbl = $this->getFullTableName("web_users"); |
| 5100 | - $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
| 5100 | + $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'"); |
|
| 5101 | 5101 | if ($row = $this->db->getRow($ds)) { |
| 5102 | 5102 | if ($row["password"] == md5($oldPwd)) { |
| 5103 | 5103 | if (strlen($newPwd) < 6) { |
@@ -5107,7 +5107,7 @@ discard block |
||
| 5107 | 5107 | } else { |
| 5108 | 5108 | $this->db->update(array( |
| 5109 | 5109 | 'password' => $this->db->escape($newPwd), |
| 5110 | - ), $tbl, "id='" . $this->getLoginUserID() . "'"); |
|
| 5110 | + ), $tbl, "id='".$this->getLoginUserID()."'"); |
|
| 5111 | 5111 | // invoke OnWebChangePassword event |
| 5112 | 5112 | $this->invokeEvent("OnWebChangePassword", array( |
| 5113 | 5113 | "userid" => $row["id"], |
@@ -5138,8 +5138,8 @@ discard block |
||
| 5138 | 5138 | // check cache |
| 5139 | 5139 | $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false; |
| 5140 | 5140 | if (!is_array($grpNames)) { |
| 5141 | - $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn |
|
| 5142 | - INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'"); |
|
| 5141 | + $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn |
|
| 5142 | + INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'"); |
|
| 5143 | 5143 | $grpNames = $this->db->getColumn("name", $rs); |
| 5144 | 5144 | // save to cache |
| 5145 | 5145 | $_SESSION['webUserGroupNames'] = $grpNames; |
@@ -5172,7 +5172,7 @@ discard block |
||
| 5172 | 5172 | if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) { |
| 5173 | 5173 | $this->sjscripts[$nextpos] = $src; |
| 5174 | 5174 | } else { |
| 5175 | - $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>'; |
|
| 5175 | + $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>'; |
|
| 5176 | 5176 | } |
| 5177 | 5177 | } |
| 5178 | 5178 | |
@@ -5251,7 +5251,7 @@ discard block |
||
| 5251 | 5251 | } |
| 5252 | 5252 | |
| 5253 | 5253 | if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) { |
| 5254 | - $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>'; |
|
| 5254 | + $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>'; |
|
| 5255 | 5255 | } |
| 5256 | 5256 | if ($startup) { |
| 5257 | 5257 | $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1; |
@@ -5398,7 +5398,7 @@ discard block |
||
| 5398 | 5398 | $eventtime = $this->getMicroTime() - $eventtime; |
| 5399 | 5399 | $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000); |
| 5400 | 5400 | foreach ($parameter as $k => $v) { |
| 5401 | - $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>'; |
|
| 5401 | + $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>'; |
|
| 5402 | 5402 | } |
| 5403 | 5403 | $this->pluginsCode .= '</fieldset><br />'; |
| 5404 | 5404 | $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime; |
@@ -5426,13 +5426,13 @@ discard block |
||
| 5426 | 5426 | $plugin = array(); |
| 5427 | 5427 | if (isset ($this->pluginCache[$pluginName])) { |
| 5428 | 5428 | $pluginCode = $this->pluginCache[$pluginName]; |
| 5429 | - $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : ''; |
|
| 5429 | + $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : ''; |
|
| 5430 | 5430 | } else { |
| 5431 | 5431 | $pluginName = $this->db->escape($pluginName); |
| 5432 | 5432 | $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0"); |
| 5433 | 5433 | if ($row = $this->db->getRow($result)) { |
| 5434 | 5434 | $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode']; |
| 5435 | - $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties']; |
|
| 5435 | + $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties']; |
|
| 5436 | 5436 | } else { |
| 5437 | 5437 | $pluginCode = $this->pluginCache[$pluginName] = "return false;"; |
| 5438 | 5438 | $pluginProperties = ''; |
@@ -5539,7 +5539,7 @@ discard block |
||
| 5539 | 5539 | public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false) |
| 5540 | 5540 | { |
| 5541 | 5541 | $params = array(); |
| 5542 | - $fullpath = $element_dir . '/' . $filename; |
|
| 5542 | + $fullpath = $element_dir.'/'.$filename; |
|
| 5543 | 5543 | if (is_readable($fullpath)) { |
| 5544 | 5544 | $tpl = @fopen($fullpath, "r"); |
| 5545 | 5545 | if ($tpl) { |
@@ -5706,8 +5706,8 @@ discard block |
||
| 5706 | 5706 | $ph = array('site_url' => MODX_SITE_URL); |
| 5707 | 5707 | $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/"; |
| 5708 | 5708 | $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'; |
| 5709 | - $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : ''; |
|
| 5710 | - $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : ''; |
|
| 5709 | + $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : ''; |
|
| 5710 | + $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : ''; |
|
| 5711 | 5711 | foreach ($parsed as $key => $val) { |
| 5712 | 5712 | if (is_array($val)) { |
| 5713 | 5713 | foreach ($val as $key2 => $val2) { |
@@ -5716,7 +5716,7 @@ discard block |
||
| 5716 | 5716 | $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2); |
| 5717 | 5717 | } |
| 5718 | 5718 | if (preg_match($regexEmail, $val2, $url)) { |
| 5719 | - $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2); |
|
| 5719 | + $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2); |
|
| 5720 | 5720 | } |
| 5721 | 5721 | $parsed[$key][$key2] = $val2; |
| 5722 | 5722 | } |
@@ -5726,7 +5726,7 @@ discard block |
||
| 5726 | 5726 | $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val); |
| 5727 | 5727 | } |
| 5728 | 5728 | if (preg_match($regexEmail, $val, $url)) { |
| 5729 | - $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val); |
|
| 5729 | + $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val); |
|
| 5730 | 5730 | } |
| 5731 | 5731 | $parsed[$key] = $val; |
| 5732 | 5732 | } |
@@ -5740,32 +5740,32 @@ discard block |
||
| 5740 | 5740 | ); |
| 5741 | 5741 | |
| 5742 | 5742 | $nl = "\n"; |
| 5743 | - $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : ''; |
|
| 5744 | - $list .= '<p>' . $nl; |
|
| 5745 | - $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : ''; |
|
| 5746 | - $list .= isset($parsed['description']) ? $parsed['description'] . $nl : ''; |
|
| 5747 | - $list .= '</p><br/>' . $nl; |
|
| 5748 | - $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : ''; |
|
| 5749 | - $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : ''; |
|
| 5750 | - $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : ''; |
|
| 5751 | - $list .= '<br/>' . $nl; |
|
| 5743 | + $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : ''; |
|
| 5744 | + $list .= '<p>'.$nl; |
|
| 5745 | + $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : ''; |
|
| 5746 | + $list .= isset($parsed['description']) ? $parsed['description'].$nl : ''; |
|
| 5747 | + $list .= '</p><br/>'.$nl; |
|
| 5748 | + $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : ''; |
|
| 5749 | + $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : ''; |
|
| 5750 | + $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : ''; |
|
| 5751 | + $list .= '<br/>'.$nl; |
|
| 5752 | 5752 | $first = true; |
| 5753 | 5753 | foreach ($arrayParams as $param => $label) { |
| 5754 | 5754 | if (isset($parsed[$param])) { |
| 5755 | 5755 | if ($first) { |
| 5756 | - $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl; |
|
| 5757 | - $list .= '<ul class="docBlockList">' . $nl; |
|
| 5756 | + $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl; |
|
| 5757 | + $list .= '<ul class="docBlockList">'.$nl; |
|
| 5758 | 5758 | $first = false; |
| 5759 | 5759 | } |
| 5760 | - $list .= ' <li><strong>' . $label . '</strong>' . $nl; |
|
| 5761 | - $list .= ' <ul>' . $nl; |
|
| 5760 | + $list .= ' <li><strong>'.$label.'</strong>'.$nl; |
|
| 5761 | + $list .= ' <ul>'.$nl; |
|
| 5762 | 5762 | foreach ($parsed[$param] as $val) { |
| 5763 | - $list .= ' <li>' . $val . '</li>' . $nl; |
|
| 5763 | + $list .= ' <li>'.$val.'</li>'.$nl; |
|
| 5764 | 5764 | } |
| 5765 | - $list .= ' </ul></li>' . $nl; |
|
| 5765 | + $list .= ' </ul></li>'.$nl; |
|
| 5766 | 5766 | } |
| 5767 | 5767 | } |
| 5768 | - $list .= !$first ? '</ul>' . $nl : ''; |
|
| 5768 | + $list .= !$first ? '</ul>'.$nl : ''; |
|
| 5769 | 5769 | |
| 5770 | 5770 | return $list; |
| 5771 | 5771 | } |
@@ -5841,7 +5841,7 @@ discard block |
||
| 5841 | 5841 | */ |
| 5842 | 5842 | public function addSnippet($name, $phpCode) |
| 5843 | 5843 | { |
| 5844 | - $this->snippetCache['#' . $name] = $phpCode; |
|
| 5844 | + $this->snippetCache['#'.$name] = $phpCode; |
|
| 5845 | 5845 | } |
| 5846 | 5846 | |
| 5847 | 5847 | /** |
@@ -5850,7 +5850,7 @@ discard block |
||
| 5850 | 5850 | */ |
| 5851 | 5851 | public function addChunk($name, $text) |
| 5852 | 5852 | { |
| 5853 | - $this->chunkCache['#' . $name] = $text; |
|
| 5853 | + $this->chunkCache['#'.$name] = $text; |
|
| 5854 | 5854 | } |
| 5855 | 5855 | |
| 5856 | 5856 | /** |
@@ -5886,7 +5886,7 @@ discard block |
||
| 5886 | 5886 | } |
| 5887 | 5887 | |
| 5888 | 5888 | if (!$isSafe) { |
| 5889 | - $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true); |
|
| 5889 | + $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true); |
|
| 5890 | 5890 | $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50))); |
| 5891 | 5891 | $this->messageQuit($title, '', true, '', '', 'Parser', $msg); |
| 5892 | 5892 | return; |
@@ -5900,7 +5900,7 @@ discard block |
||
| 5900 | 5900 | return 'array()'; |
| 5901 | 5901 | } |
| 5902 | 5902 | |
| 5903 | - $output = $echo . $return; |
|
| 5903 | + $output = $echo.$return; |
|
| 5904 | 5904 | modx_sanitize_gpc($output); |
| 5905 | 5905 | return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous |
| 5906 | 5906 | } |
@@ -5918,8 +5918,8 @@ discard block |
||
| 5918 | 5918 | |
| 5919 | 5919 | $safe = explode(',', $safe_functions); |
| 5920 | 5920 | |
| 5921 | - $phpcode = rtrim($phpcode, ';') . ';'; |
|
| 5922 | - $tokens = token_get_all('<?php ' . $phpcode); |
|
| 5921 | + $phpcode = rtrim($phpcode, ';').';'; |
|
| 5922 | + $tokens = token_get_all('<?php '.$phpcode); |
|
| 5923 | 5923 | foreach ($tokens as $i => $token) { |
| 5924 | 5924 | if (!is_array($token)) { |
| 5925 | 5925 | continue; |
@@ -5955,7 +5955,7 @@ discard block |
||
| 5955 | 5955 | public function atBindFileContent($str = '') |
| 5956 | 5956 | { |
| 5957 | 5957 | |
| 5958 | - $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', ''); |
|
| 5958 | + $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', ''); |
|
| 5959 | 5959 | |
| 5960 | 5960 | if (stripos($str, '@FILE') !== 0) { |
| 5961 | 5961 | return $str; |
@@ -5978,7 +5978,7 @@ discard block |
||
| 5978 | 5978 | $errorMsg = sprintf("Could not retrieve string '%s'.", $str); |
| 5979 | 5979 | |
| 5980 | 5980 | foreach ($search_path as $path) { |
| 5981 | - $file_path = MODX_BASE_PATH . $path . $str; |
|
| 5981 | + $file_path = MODX_BASE_PATH.$path.$str; |
|
| 5982 | 5982 | if (strpos($file_path, MODX_MANAGER_PATH) === 0) { |
| 5983 | 5983 | return $errorMsg; |
| 5984 | 5984 | } elseif (is_file($file_path)) { |
@@ -5992,7 +5992,7 @@ discard block |
||
| 5992 | 5992 | return $errorMsg; |
| 5993 | 5993 | } |
| 5994 | 5994 | |
| 5995 | - $content = (string)file_get_contents($file_path); |
|
| 5995 | + $content = (string) file_get_contents($file_path); |
|
| 5996 | 5996 | if ($content === false) { |
| 5997 | 5997 | return $errorMsg; |
| 5998 | 5998 | } |
@@ -6105,22 +6105,22 @@ discard block |
||
| 6105 | 6105 | |
| 6106 | 6106 | $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : ''; |
| 6107 | 6107 | $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : ''; |
| 6108 | - $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI']; |
|
| 6108 | + $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI']; |
|
| 6109 | 6109 | $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']); |
| 6110 | 6110 | $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']); |
| 6111 | 6111 | $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']); |
| 6112 | 6112 | if ($is_error) { |
| 6113 | 6113 | $str = '<h2 style="color:red">« Evo Parse Error »</h2>'; |
| 6114 | 6114 | if ($msg != 'PHP Parse Error') { |
| 6115 | - $str .= '<h3 style="color:red">' . $msg . '</h3>'; |
|
| 6115 | + $str .= '<h3 style="color:red">'.$msg.'</h3>'; |
|
| 6116 | 6116 | } |
| 6117 | 6117 | } else { |
| 6118 | 6118 | $str = '<h2 style="color:#003399">« Evo Debug/ stop message »</h2>'; |
| 6119 | - $str .= '<h3 style="color:#003399">' . $msg . '</h3>'; |
|
| 6119 | + $str .= '<h3 style="color:#003399">'.$msg.'</h3>'; |
|
| 6120 | 6120 | } |
| 6121 | 6121 | |
| 6122 | 6122 | if (!empty ($query)) { |
| 6123 | - $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>'; |
|
| 6123 | + $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>'; |
|
| 6124 | 6124 | } |
| 6125 | 6125 | |
| 6126 | 6126 | $errortype = array( |
@@ -6143,13 +6143,13 @@ discard block |
||
| 6143 | 6143 | |
| 6144 | 6144 | if (!empty($nr) || !empty($file)) { |
| 6145 | 6145 | if ($text != '') { |
| 6146 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>'; |
|
| 6146 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>'; |
|
| 6147 | 6147 | } |
| 6148 | 6148 | if ($output != '') { |
| 6149 | - $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>'; |
|
| 6149 | + $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>'; |
|
| 6150 | 6150 | } |
| 6151 | 6151 | if ($nr !== '') { |
| 6152 | - $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]"); |
|
| 6152 | + $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]"); |
|
| 6153 | 6153 | } |
| 6154 | 6154 | if ($file) { |
| 6155 | 6155 | $table[] = array('File', $file); |
@@ -6169,7 +6169,7 @@ discard block |
||
| 6169 | 6169 | } |
| 6170 | 6170 | |
| 6171 | 6171 | if (!empty($this->event->activePlugin)) { |
| 6172 | - $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')'); |
|
| 6172 | + $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')'); |
|
| 6173 | 6173 | } |
| 6174 | 6174 | |
| 6175 | 6175 | $str .= $MakeTable->create($table, array('Error information', '')); |
@@ -6179,17 +6179,17 @@ discard block |
||
| 6179 | 6179 | $table[] = array('REQUEST_URI', $request_uri); |
| 6180 | 6180 | |
| 6181 | 6181 | if ($this->manager->action) { |
| 6182 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 6182 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
| 6183 | 6183 | global $action_list; |
| 6184 | 6184 | $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : ''; |
| 6185 | 6185 | |
| 6186 | - $table[] = array('Manager action', $this->manager->action . $actionName); |
|
| 6186 | + $table[] = array('Manager action', $this->manager->action.$actionName); |
|
| 6187 | 6187 | } |
| 6188 | 6188 | |
| 6189 | 6189 | if (preg_match('@^[0-9]+@', $this->documentIdentifier)) { |
| 6190 | 6190 | $resource = $this->getDocumentObject('id', $this->documentIdentifier); |
| 6191 | 6191 | $url = $this->makeUrl($this->documentIdentifier, '', '', 'full'); |
| 6192 | - $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'); |
|
| 6192 | + $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'); |
|
| 6193 | 6193 | } |
| 6194 | 6194 | $table[] = array('Referer', $referer); |
| 6195 | 6195 | $table[] = array('User Agent', $ua); |
@@ -6210,7 +6210,7 @@ discard block |
||
| 6210 | 6210 | |
| 6211 | 6211 | $mem = memory_get_peak_usage(true); |
| 6212 | 6212 | $total_mem = $mem - $this->mstart; |
| 6213 | - $total_mem = ($total_mem / 1024 / 1024) . ' mb'; |
|
| 6213 | + $total_mem = ($total_mem / 1024 / 1024).' mb'; |
|
| 6214 | 6214 | |
| 6215 | 6215 | $queryTime = $this->queryTime; |
| 6216 | 6216 | $phpTime = $totalTime - $queryTime; |
@@ -6231,18 +6231,18 @@ discard block |
||
| 6231 | 6231 | $str .= $this->get_backtrace(debug_backtrace()); |
| 6232 | 6232 | // Log error |
| 6233 | 6233 | if (!empty($this->currentSnippet)) { |
| 6234 | - $source = 'Snippet - ' . $this->currentSnippet; |
|
| 6234 | + $source = 'Snippet - '.$this->currentSnippet; |
|
| 6235 | 6235 | } elseif (!empty($this->event->activePlugin)) { |
| 6236 | - $source = 'Plugin - ' . $this->event->activePlugin; |
|
| 6236 | + $source = 'Plugin - '.$this->event->activePlugin; |
|
| 6237 | 6237 | } elseif ($source !== '') { |
| 6238 | - $source = 'Parser - ' . $source; |
|
| 6238 | + $source = 'Parser - '.$source; |
|
| 6239 | 6239 | } elseif ($query !== '') { |
| 6240 | 6240 | $source = 'SQL Query'; |
| 6241 | 6241 | } else { |
| 6242 | 6242 | $source = 'Parser'; |
| 6243 | 6243 | } |
| 6244 | 6244 | if ($msg) { |
| 6245 | - $source .= ' / ' . $msg; |
|
| 6245 | + $source .= ' / '.$msg; |
|
| 6246 | 6246 | } |
| 6247 | 6247 | if (isset($actionName) && !empty($actionName)) { |
| 6248 | 6248 | $source .= $actionName; |
@@ -6274,12 +6274,12 @@ discard block |
||
| 6274 | 6274 | |
| 6275 | 6275 | // Display error |
| 6276 | 6276 | if (isset($_SESSION['mgrValidated'])) { |
| 6277 | - 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> |
|
| 6277 | + 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> |
|
| 6278 | 6278 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6279 | - <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" /> |
|
| 6279 | + <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" /> |
|
| 6280 | 6280 | <style type="text/css">body { padding:10px; } td {font:inherit;}</style> |
| 6281 | 6281 | </head><body> |
| 6282 | - ' . $str . '</body></html>'; |
|
| 6282 | + ' . $str.'</body></html>'; |
|
| 6283 | 6283 | |
| 6284 | 6284 | } else { |
| 6285 | 6285 | echo 'Error'; |
@@ -6317,7 +6317,7 @@ discard block |
||
| 6317 | 6317 | switch ($val['type']) { |
| 6318 | 6318 | case '->': |
| 6319 | 6319 | case '::': |
| 6320 | - $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function']; |
|
| 6320 | + $functionName = $val['function'] = $val['class'].$val['type'].$val['function']; |
|
| 6321 | 6321 | break; |
| 6322 | 6322 | default: |
| 6323 | 6323 | $functionName = $val['function']; |
@@ -6327,7 +6327,7 @@ discard block |
||
| 6327 | 6327 | $args = array_pad(array(), $_, '$var'); |
| 6328 | 6328 | $args = implode(", ", $args); |
| 6329 | 6329 | $modx = &$this; |
| 6330 | - $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) { |
|
| 6330 | + $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) { |
|
| 6331 | 6331 | $arg = $val['args'][$tmp - 1]; |
| 6332 | 6332 | switch (true) { |
| 6333 | 6333 | case is_null($arg): { |
@@ -6339,7 +6339,7 @@ discard block |
||
| 6339 | 6339 | break; |
| 6340 | 6340 | } |
| 6341 | 6341 | case is_scalar($arg): { |
| 6342 | - $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'"); |
|
| 6342 | + $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'"); |
|
| 6343 | 6343 | break; |
| 6344 | 6344 | } |
| 6345 | 6345 | case is_bool($arg): { |
@@ -6347,23 +6347,23 @@ discard block |
||
| 6347 | 6347 | break; |
| 6348 | 6348 | } |
| 6349 | 6349 | case is_array($arg): { |
| 6350 | - $out = 'array $var' . $tmp; |
|
| 6350 | + $out = 'array $var'.$tmp; |
|
| 6351 | 6351 | break; |
| 6352 | 6352 | } |
| 6353 | 6353 | case is_object($arg): { |
| 6354 | - $out = get_class($arg) . ' $var' . $tmp; |
|
| 6354 | + $out = get_class($arg).' $var'.$tmp; |
|
| 6355 | 6355 | break; |
| 6356 | 6356 | } |
| 6357 | 6357 | default: { |
| 6358 | - $out = '$var' . $tmp; |
|
| 6358 | + $out = '$var'.$tmp; |
|
| 6359 | 6359 | } |
| 6360 | 6360 | } |
| 6361 | 6361 | $tmp++; |
| 6362 | 6362 | return $out; |
| 6363 | 6363 | }, $args); |
| 6364 | 6364 | $line = array( |
| 6365 | - "<strong>" . $functionName . "</strong>(" . $args . ")", |
|
| 6366 | - $path . " on line " . $val['line'] |
|
| 6365 | + "<strong>".$functionName."</strong>(".$args.")", |
|
| 6366 | + $path." on line ".$val['line'] |
|
| 6367 | 6367 | ); |
| 6368 | 6368 | $table[] = array(implode("<br />", $line)); |
| 6369 | 6369 | } |
@@ -6404,7 +6404,7 @@ discard block |
||
| 6404 | 6404 | $alias = strip_tags($alias); // strip HTML |
| 6405 | 6405 | $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters |
| 6406 | 6406 | $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash |
| 6407 | - $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
| 6407 | + $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one |
|
| 6408 | 6408 | $alias = trim($alias, '-'); // trim excess |
| 6409 | 6409 | return $alias; |
| 6410 | 6410 | } |
@@ -6420,7 +6420,7 @@ discard block |
||
| 6420 | 6420 | $precisions = count($sizes) - 1; |
| 6421 | 6421 | foreach ($sizes as $unit => $bytes) { |
| 6422 | 6422 | if ($size >= $bytes) { |
| 6423 | - return number_format($size / $bytes, $precisions) . ' ' . $unit; |
|
| 6423 | + return number_format($size / $bytes, $precisions).' '.$unit; |
|
| 6424 | 6424 | } |
| 6425 | 6425 | $precisions--; |
| 6426 | 6426 | } |
@@ -6524,10 +6524,10 @@ discard block |
||
| 6524 | 6524 | |
| 6525 | 6525 | if (strpos($str, MODX_MANAGER_PATH) === 0) { |
| 6526 | 6526 | return false; |
| 6527 | - } elseif (is_file(MODX_BASE_PATH . $str)) { |
|
| 6528 | - $file_path = MODX_BASE_PATH . $str; |
|
| 6529 | - } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) { |
|
| 6530 | - $file_path = MODX_BASE_PATH . $tpl_dir . $str; |
|
| 6527 | + } elseif (is_file(MODX_BASE_PATH.$str)) { |
|
| 6528 | + $file_path = MODX_BASE_PATH.$str; |
|
| 6529 | + } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) { |
|
| 6530 | + $file_path = MODX_BASE_PATH.$tpl_dir.$str; |
|
| 6531 | 6531 | } else { |
| 6532 | 6532 | return false; |
| 6533 | 6533 | } |
@@ -6653,7 +6653,7 @@ discard block |
||
| 6653 | 6653 | $title = 'no title'; |
| 6654 | 6654 | } |
| 6655 | 6655 | if (is_array($msg)) { |
| 6656 | - $msg = '<pre>' . print_r($msg, true) . '</pre>'; |
|
| 6656 | + $msg = '<pre>'.print_r($msg, true).'</pre>'; |
|
| 6657 | 6657 | } elseif ($msg === '') { |
| 6658 | 6658 | $msg = $_SERVER['REQUEST_URI']; |
| 6659 | 6659 | } |
@@ -6698,7 +6698,7 @@ discard block |
||
| 6698 | 6698 | if (is_array($SystemAlertMsgQueque)) { |
| 6699 | 6699 | $title = ''; |
| 6700 | 6700 | if ($this->name && $this->activePlugin) { |
| 6701 | - $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>"; |
|
| 6701 | + $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>"; |
|
| 6702 | 6702 | } |
| 6703 | 6703 | $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>"; |
| 6704 | 6704 | } |
@@ -10,14 +10,14 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | $__DataGridCnt = 0; |
| 12 | 12 | |
| 13 | -class DataGrid { |
|
| 13 | +class DataGrid{ |
|
| 14 | 14 | |
| 15 | 15 | public $ds; // datasource |
| 16 | 16 | public $id; |
| 17 | - public $pageSize; // pager settings |
|
| 17 | + public $pageSize; // pager settings |
|
| 18 | 18 | public $pageNumber; |
| 19 | 19 | public $pager; |
| 20 | - public $pagerLocation; // top-right, top-left, bottom-left, bottom-right, both-left, both-right |
|
| 20 | + public $pagerLocation; // top-right, top-left, bottom-left, bottom-right, both-left, both-right |
|
| 21 | 21 | |
| 22 | 22 | public $cssStyle; |
| 23 | 23 | public $cssClass; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | public $colAligns; |
| 36 | 36 | public $colWraps; |
| 37 | 37 | public $colColors; |
| 38 | - public $colTypes; // coltype1, coltype2, etc or coltype1:format1, e.g. date:%Y %m |
|
| 38 | + public $colTypes; // coltype1, coltype2, etc or coltype1:format1, e.g. date:%Y %m |
|
| 39 | 39 | // data type: integer,float,currency,date |
| 40 | 40 | |
| 41 | 41 | public $header; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public $cellPadding; |
| 44 | 44 | public $cellSpacing; |
| 45 | 45 | |
| 46 | - public $rowAlign; // vertical alignment: top, middle, bottom |
|
| 46 | + public $rowAlign; // vertical alignment: top, middle, bottom |
|
| 47 | 47 | public $rowIdField; |
| 48 | 48 | |
| 49 | 49 | public $pagerStyle; |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public $cdelim; |
| 74 | 74 | |
| 75 | - public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) { |
|
| 75 | + public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1){ |
|
| 76 | 76 | global $__DataGridCnt; |
| 77 | 77 | |
| 78 | 78 | // set id |
| 79 | 79 | $__DataGridCnt++; |
| 80 | - $this->id = $this->id ? empty($id) : "dg" . $__DataGridCnt; |
|
| 80 | + $this->id = $this->id ? empty($id) : "dg".$__DataGridCnt; |
|
| 81 | 81 | |
| 82 | 82 | // set datasource |
| 83 | 83 | $this->ds = $ds; |
@@ -88,50 +88,50 @@ discard block |
||
| 88 | 88 | $this->pagerLocation = 'top-right'; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function setDataSource($ds) { |
|
| 91 | + public function setDataSource($ds){ |
|
| 92 | 92 | $this->ds = $ds; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public function render() { |
|
| 95 | + public function render(){ |
|
| 96 | 96 | global $modx; |
| 97 | - $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : ''; |
|
| 98 | - $columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : ""; |
|
| 99 | - $cssStyle = ($this->cssStyle) ? "style='" . $this->cssStyle . "'" : ''; |
|
| 100 | - $cssClass = ($this->cssClass) ? "class='" . $this->cssClass . "'" : ''; |
|
| 97 | + $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='".$this->columnHeaderStyle."'" : ''; |
|
| 98 | + $columnHeaderClass = ($this->columnHeaderClass) ? "class='".$this->columnHeaderClass."'" : ""; |
|
| 99 | + $cssStyle = ($this->cssStyle) ? "style='".$this->cssStyle."'" : ''; |
|
| 100 | + $cssClass = ($this->cssClass) ? "class='".$this->cssClass."'" : ''; |
|
| 101 | 101 | |
| 102 | - $pagerClass = ($this->pagerClass) ? "class='" . $this->pagerClass . "'" : ''; |
|
| 103 | - $pagerStyle = ($this->pagerStyle) ? "style='" . $this->pagerStyle . "'" : "style='background-color:#ffffff;'"; |
|
| 102 | + $pagerClass = ($this->pagerClass) ? "class='".$this->pagerClass."'" : ''; |
|
| 103 | + $pagerStyle = ($this->pagerStyle) ? "style='".$this->pagerStyle."'" : "style='background-color:#ffffff;'"; |
|
| 104 | 104 | |
| 105 | - $this->_itemStyle = ($this->itemStyle) ? "style='" . $this->itemStyle . "'" : ''; |
|
| 106 | - $this->_itemClass = ($this->itemClass) ? "class='" . $this->itemClass . "'" : ''; |
|
| 107 | - $this->_altItemStyle = ($this->altItemStyle) ? "style='" . $this->altItemStyle . "'" : ''; |
|
| 108 | - $this->_altItemClass = ($this->altItemClass) ? "class='" . $this->altItemClass . "'" : ''; |
|
| 105 | + $this->_itemStyle = ($this->itemStyle) ? "style='".$this->itemStyle."'" : ''; |
|
| 106 | + $this->_itemClass = ($this->itemClass) ? "class='".$this->itemClass."'" : ''; |
|
| 107 | + $this->_altItemStyle = ($this->altItemStyle) ? "style='".$this->altItemStyle."'" : ''; |
|
| 108 | + $this->_altItemClass = ($this->altItemClass) ? "class='".$this->altItemClass."'" : ''; |
|
| 109 | 109 | |
| 110 | 110 | $this->_alt = 0; |
| 111 | 111 | $this->_total = 0; |
| 112 | 112 | |
| 113 | 113 | $this->_isDataset = $modx->db->isResult($this->ds); // if not dataset then treat as array |
| 114 | 114 | |
| 115 | - if(!$cssStyle && !$cssClass) { |
|
| 115 | + if (!$cssStyle && !$cssClass) { |
|
| 116 | 116 | $cssStyle = "style='width:100%;border:1px solid silver;font-family:verdana,arial; font-size:11px;'"; |
| 117 | 117 | } |
| 118 | - if(!$columnHeaderStyle && !$columnHeaderClass) { |
|
| 118 | + if (!$columnHeaderStyle && !$columnHeaderClass) { |
|
| 119 | 119 | $columnHeaderStyle = "style='color:black;background-color:silver'"; |
| 120 | 120 | } |
| 121 | - if(!$this->_itemStyle && !$this->_itemClass) { |
|
| 121 | + if (!$this->_itemStyle && !$this->_itemClass) { |
|
| 122 | 122 | $this->_itemStyle = "style='color:black;'"; |
| 123 | 123 | } |
| 124 | - if(!$this->_altItemStyle && !$this->_altItemClass) { |
|
| 124 | + if (!$this->_altItemStyle && !$this->_altItemClass) { |
|
| 125 | 125 | $this->_altItemStyle = "style='color:black;background-color:#eeeeee'"; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - if($this->_isDataset && !$this->columns) { |
|
| 128 | + if ($this->_isDataset && !$this->columns) { |
|
| 129 | 129 | $cols = $modx->db->numFields($this->ds); |
| 130 | - for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
| 130 | + for ($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "").$modx->db->fieldName($this->ds, $i); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // start grid |
| 134 | - $tblStart = "<table $cssClass $cssStyle cellpadding='" . (isset($this->cellPadding) ? (int) $this->cellPadding : 1) . "' cellspacing='" . (isset($this->cellSpacing) ? (int) $this->cellSpacing : 1) . "'>"; |
|
| 134 | + $tblStart = "<table $cssClass $cssStyle cellpadding='".(isset($this->cellPadding) ? (int) $this->cellPadding : 1)."' cellspacing='".(isset($this->cellSpacing) ? (int) $this->cellSpacing : 1)."'>"; |
|
| 135 | 135 | $tblEnd = "</table>"; |
| 136 | 136 | |
| 137 | 137 | // build column header |
@@ -142,33 +142,33 @@ discard block |
||
| 142 | 142 | $this->_colcolors = explode((strstr($this->colColors, "||") !== false ? "||" : ","), $this->colColors); |
| 143 | 143 | $this->_coltypes = explode((strstr($this->colTypes, "||") !== false ? "||" : ","), $this->colTypes); |
| 144 | 144 | $this->_colcount = count($this->_colnames); |
| 145 | - if(!$this->_isDataset) { |
|
| 145 | + if (!$this->_isDataset) { |
|
| 146 | 146 | $this->ds = explode((strstr($this->ds, "||") !== false ? "||" : ","), $this->ds); |
| 147 | 147 | $this->ds = array_chunk($this->ds, $this->_colcount); |
| 148 | 148 | } |
| 149 | 149 | $tblColHdr = "<thead><tr>"; |
| 150 | - for($c = 0; $c < $this->_colcount; $c++) { |
|
| 150 | + for ($c = 0; $c < $this->_colcount; $c++) { |
|
| 151 | 151 | $name = $this->_colnames[$c]; |
| 152 | 152 | $width = $this->_colwidths[$c]; |
| 153 | - $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass" . ($width ? " width='$width'" : "") . ">$name</td>"; |
|
| 153 | + $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass".($width ? " width='$width'" : "").">$name</td>"; |
|
| 154 | 154 | } |
| 155 | 155 | $tblColHdr .= "</tr></thead>\n"; |
| 156 | 156 | |
| 157 | 157 | // build rows |
| 158 | 158 | $rowcount = $this->_isDataset ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
| 159 | 159 | $this->_fieldnames = explode(",", $this->fields); |
| 160 | - if($rowcount == 0) { |
|
| 161 | - $tblRows .= "<tr><td " . $this->_itemStyle . " " . $this->_itemClass . " colspan='" . $this->_colcount . "'>" . $this->noRecordMsg . "</td></tr>\n"; |
|
| 160 | + if ($rowcount == 0) { |
|
| 161 | + $tblRows .= "<tr><td ".$this->_itemStyle." ".$this->_itemClass." colspan='".$this->_colcount."'>".$this->noRecordMsg."</td></tr>\n"; |
|
| 162 | 162 | } else { |
| 163 | 163 | // render grid items |
| 164 | - if($this->pageSize <= 0) { |
|
| 165 | - for($r = 0; $r < $rowcount; $r++) { |
|
| 164 | + if ($this->pageSize <= 0) { |
|
| 165 | + for ($r = 0; $r < $rowcount; $r++) { |
|
| 166 | 166 | $row = $this->_isDataset ? $modx->db->getRow($this->ds) : $this->ds[$r]; |
| 167 | 167 | $tblRows .= $this->RenderRowFnc($r + 1, $row); |
| 168 | 168 | } |
| 169 | 169 | } else { |
| 170 | - if(!$this->pager) { |
|
| 171 | - include_once dirname(__FILE__) . "/datasetpager.class.php"; |
|
| 170 | + if (!$this->pager) { |
|
| 171 | + include_once dirname(__FILE__)."/datasetpager.class.php"; |
|
| 172 | 172 | $this->pager = new DataSetPager($this->id, $this->ds, $this->pageSize, $this->pageNumber); |
| 173 | 173 | $this->pager->setRenderRowFnc($this); // pass this object |
| 174 | 174 | $this->pager->cssStyle = $pagerStyle; |
@@ -188,18 +188,18 @@ discard block |
||
| 188 | 188 | $o = $tblStart; |
| 189 | 189 | $ptop = (substr($this->pagerLocation, 0, 3) == "top") || (substr($this->pagerLocation, 0, 4) == "both"); |
| 190 | 190 | $pbot = (substr($this->pagerLocation, 0, 3) == "bot") || (substr($this->pagerLocation, 0, 4) == "both"); |
| 191 | - if($this->header) { |
|
| 192 | - $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->header . "</td></tr>"; |
|
| 191 | + if ($this->header) { |
|
| 192 | + $o .= "<tr><td bgcolor='#ffffff' colspan='".$this->_colcount."'>".$this->header."</td></tr>"; |
|
| 193 | 193 | } |
| 194 | - if($tblPager && $ptop) { |
|
| 195 | - $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . " </td></tr>"; |
|
| 194 | + if ($tblPager && $ptop) { |
|
| 195 | + $o .= "<tr><td align='".(substr($this->pagerLocation, -4) == "left" ? "left" : "right")."' $pagerClass $pagerStyle colspan='".$this->_colcount."'>".$tblPager." </td></tr>"; |
|
| 196 | 196 | } |
| 197 | - $o .= $tblColHdr . $tblRows; |
|
| 198 | - if($tblPager && $pbot) { |
|
| 199 | - $o .= "<tr><td align='" . (substr($this->pagerLocation, -4) == "left" ? "left" : "right") . "' $pagerClass $pagerStyle colspan='" . $this->_colcount . "'>" . $tblPager . " </td></tr>"; |
|
| 197 | + $o .= $tblColHdr.$tblRows; |
|
| 198 | + if ($tblPager && $pbot) { |
|
| 199 | + $o .= "<tr><td align='".(substr($this->pagerLocation, -4) == "left" ? "left" : "right")."' $pagerClass $pagerStyle colspan='".$this->_colcount."'>".$tblPager." </td></tr>"; |
|
| 200 | 200 | } |
| 201 | - if($this->footer) { |
|
| 202 | - $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->footer . "</td></tr>"; |
|
| 201 | + if ($this->footer) { |
|
| 202 | + $o .= "<tr><td bgcolor='#ffffff' colspan='".$this->_colcount."'>".$this->footer."</td></tr>"; |
|
| 203 | 203 | } |
| 204 | 204 | $o .= $tblEnd; |
| 205 | 205 | return $o; |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | // format column values |
| 209 | 209 | |
| 210 | - public function RenderRowFnc($n, $row) { |
|
| 211 | - if($this->_alt == 0) { |
|
| 210 | + public function RenderRowFnc($n, $row){ |
|
| 211 | + if ($this->_alt == 0) { |
|
| 212 | 212 | $Style = $this->_itemStyle; |
| 213 | 213 | $Class = $this->_itemClass; |
| 214 | 214 | $this->_alt = 1; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $this->_alt = 0; |
| 219 | 219 | } |
| 220 | 220 | $o = "<tr>"; |
| 221 | - for($c = 0; $c < $this->_colcount; $c++) { |
|
| 221 | + for ($c = 0; $c < $this->_colcount; $c++) { |
|
| 222 | 222 | $colStyle = $Style; |
| 223 | 223 | $fld = trim($this->_fieldnames[$c]); |
| 224 | 224 | $width = isset($this->_colwidths[$c]) ? $this->_colwidths[$c] : null; |
@@ -227,67 +227,67 @@ discard block |
||
| 227 | 227 | $type = isset($this->_coltypes[$c]) ? $this->_coltypes[$c] : null; |
| 228 | 228 | $nowrap = isset($this->_colwraps[$c]) ? $this->_colwraps[$c] : null; |
| 229 | 229 | $value = $row[($this->_isDataset && $fld ? $fld : $c)]; |
| 230 | - if($color && $Style) { |
|
| 231 | - $colStyle = substr($colStyle, 0, -1) . ";background-color:$color;'"; |
|
| 230 | + if ($color && $Style) { |
|
| 231 | + $colStyle = substr($colStyle, 0, -1).";background-color:$color;'"; |
|
| 232 | 232 | } |
| 233 | 233 | $value = $this->formatColumnValue($row, $value, $type, $align); |
| 234 | - $o .= "<td $colStyle $Class" . ($align ? " align='$align'" : "") . ($color ? " bgcolor='$color'" : "") . ($nowrap ? " nowrap='$nowrap'" : "") . ($width ? " width='$width'" : "") . ">$value</td>"; |
|
| 234 | + $o .= "<td $colStyle $Class".($align ? " align='$align'" : "").($color ? " bgcolor='$color'" : "").($nowrap ? " nowrap='$nowrap'" : "").($width ? " width='$width'" : "").">$value</td>"; |
|
| 235 | 235 | } |
| 236 | 236 | $o .= "</tr>\n"; |
| 237 | 237 | return $o; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - public function formatColumnValue($row, $value, $type, &$align) { |
|
| 241 | - if(strpos($type, ":") !== false) { |
|
| 240 | + public function formatColumnValue($row, $value, $type, &$align){ |
|
| 241 | + if (strpos($type, ":") !== false) { |
|
| 242 | 242 | list($type, $type_format) = explode(":", $type, 2); |
| 243 | 243 | } |
| 244 | - switch(strtolower($type)) { |
|
| 244 | + switch (strtolower($type)) { |
|
| 245 | 245 | case "integer": |
| 246 | - if($align == "") { |
|
| 246 | + if ($align == "") { |
|
| 247 | 247 | $align = "right"; |
| 248 | 248 | } |
| 249 | 249 | $value = number_format($value); |
| 250 | 250 | break; |
| 251 | 251 | |
| 252 | 252 | case "float": |
| 253 | - if($align == "") { |
|
| 253 | + if ($align == "") { |
|
| 254 | 254 | $align = "right"; |
| 255 | 255 | } |
| 256 | - if(!$type_format) { |
|
| 256 | + if (!$type_format) { |
|
| 257 | 257 | $type_format = 2; |
| 258 | 258 | } |
| 259 | 259 | $value = number_format($value, $type_format); |
| 260 | 260 | break; |
| 261 | 261 | |
| 262 | 262 | case "currency": |
| 263 | - if($align == "") { |
|
| 263 | + if ($align == "") { |
|
| 264 | 264 | $align = "right"; |
| 265 | 265 | } |
| 266 | - if(!$type_format) { |
|
| 266 | + if (!$type_format) { |
|
| 267 | 267 | $type_format = 2; |
| 268 | 268 | } |
| 269 | - $value = "$" . number_format($value, $type_format); |
|
| 269 | + $value = "$".number_format($value, $type_format); |
|
| 270 | 270 | break; |
| 271 | 271 | |
| 272 | 272 | case "date": |
| 273 | - if($align == "") { |
|
| 273 | + if ($align == "") { |
|
| 274 | 274 | $align = "right"; |
| 275 | 275 | } |
| 276 | - if(!is_numeric($value)) { |
|
| 276 | + if (!is_numeric($value)) { |
|
| 277 | 277 | $value = strtotime($value); |
| 278 | 278 | } |
| 279 | - if(!$type_format) { |
|
| 279 | + if (!$type_format) { |
|
| 280 | 280 | $type_format = "%A %d, %B %Y"; |
| 281 | 281 | } |
| 282 | 282 | $value = strftime($type_format, $value); |
| 283 | 283 | break; |
| 284 | 284 | |
| 285 | 285 | case "boolean": |
| 286 | - if($align == '') { |
|
| 286 | + if ($align == '') { |
|
| 287 | 287 | $align = "center"; |
| 288 | 288 | } |
| 289 | 289 | $value = number_format($value); |
| 290 | - if($value) { |
|
| 290 | + if ($value) { |
|
| 291 | 291 | $value = '•'; |
| 292 | 292 | } else { |
| 293 | 293 | $value = ' '; |
@@ -298,8 +298,8 @@ discard block |
||
| 298 | 298 | // replace [+value+] first |
| 299 | 299 | $value = str_replace("[+value+]", $value, $type_format); |
| 300 | 300 | // replace other [+fields+] |
| 301 | - if(strpos($value, "[+") !== false) { |
|
| 302 | - foreach($row as $k => $v) { |
|
| 301 | + if (strpos($value, "[+") !== false) { |
|
| 302 | + foreach ($row as $k => $v) { |
|
| 303 | 303 | $value = str_replace("[+$k+]", $v, $value); |
| 304 | 304 | } |
| 305 | 305 | } |
@@ -10,7 +10,8 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | $__DataGridCnt = 0; |
| 12 | 12 | |
| 13 | -class DataGrid { |
|
| 13 | +class DataGrid |
|
| 14 | +{ |
|
| 14 | 15 | |
| 15 | 16 | public $ds; // datasource |
| 16 | 17 | public $id; |
@@ -72,7 +73,8 @@ discard block |
||
| 72 | 73 | */ |
| 73 | 74 | public $cdelim; |
| 74 | 75 | |
| 75 | - public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) { |
|
| 76 | + public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) |
|
| 77 | + { |
|
| 76 | 78 | global $__DataGridCnt; |
| 77 | 79 | |
| 78 | 80 | // set id |
@@ -88,11 +90,13 @@ discard block |
||
| 88 | 90 | $this->pagerLocation = 'top-right'; |
| 89 | 91 | } |
| 90 | 92 | |
| 91 | - public function setDataSource($ds) { |
|
| 93 | + public function setDataSource($ds) |
|
| 94 | + { |
|
| 92 | 95 | $this->ds = $ds; |
| 93 | 96 | } |
| 94 | 97 | |
| 95 | - public function render() { |
|
| 98 | + public function render() |
|
| 99 | + { |
|
| 96 | 100 | global $modx; |
| 97 | 101 | $columnHeaderStyle = ($this->columnHeaderStyle) ? "style='" . $this->columnHeaderStyle . "'" : ''; |
| 98 | 102 | $columnHeaderClass = ($this->columnHeaderClass) ? "class='" . $this->columnHeaderClass . "'" : ""; |
@@ -127,7 +131,9 @@ discard block |
||
| 127 | 131 | |
| 128 | 132 | if($this->_isDataset && !$this->columns) { |
| 129 | 133 | $cols = $modx->db->numFields($this->ds); |
| 130 | - for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
| 134 | + for($i = 0; $i < $cols; $i++) { |
|
| 135 | + $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
| 136 | + } |
|
| 131 | 137 | } |
| 132 | 138 | |
| 133 | 139 | // start grid |
@@ -207,7 +213,8 @@ discard block |
||
| 207 | 213 | |
| 208 | 214 | // format column values |
| 209 | 215 | |
| 210 | - public function RenderRowFnc($n, $row) { |
|
| 216 | + public function RenderRowFnc($n, $row) |
|
| 217 | + { |
|
| 211 | 218 | if($this->_alt == 0) { |
| 212 | 219 | $Style = $this->_itemStyle; |
| 213 | 220 | $Class = $this->_itemClass; |
@@ -237,7 +244,8 @@ discard block |
||
| 237 | 244 | return $o; |
| 238 | 245 | } |
| 239 | 246 | |
| 240 | - public function formatColumnValue($row, $value, $type, &$align) { |
|
| 247 | + public function formatColumnValue($row, $value, $type, &$align) |
|
| 248 | + { |
|
| 241 | 249 | if(strpos($type, ":") !== false) { |
| 242 | 250 | list($type, $type_format) = explode(":", $type, 2); |
| 243 | 251 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | $__DataSetPagerCnt = 0; |
| 12 | 12 | |
| 13 | -class DataSetPager { |
|
| 13 | +class DataSetPager{ |
|
| 14 | 14 | |
| 15 | 15 | public $ds; // datasource |
| 16 | 16 | public $pageSize; |
@@ -31,26 +31,26 @@ discard block |
||
| 31 | 31 | public $renderPagerFnc; |
| 32 | 32 | public $renderPagerFncArgs; |
| 33 | 33 | |
| 34 | - public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
|
| 34 | + public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1){ |
|
| 35 | 35 | global $_PAGE; // use view state object |
| 36 | 36 | |
| 37 | 37 | global $__DataSetPagerCnt; |
| 38 | 38 | |
| 39 | 39 | // set id |
| 40 | 40 | $__DataSetPagerCnt++; |
| 41 | - $this->id = !empty($id) ? $id : "dsp" . $__DataSetPagerCnt; |
|
| 41 | + $this->id = !empty($id) ? $id : "dsp".$__DataSetPagerCnt; |
|
| 42 | 42 | |
| 43 | 43 | // get pagenumber |
| 44 | 44 | // by setting pager to -1 cause pager to load it's last page number |
| 45 | - if($pageNumber == -1) { |
|
| 45 | + if ($pageNumber == -1) { |
|
| 46 | 46 | $pageNumber = 1; |
| 47 | - if(isset($_GET["dpgn" . $this->id])) { |
|
| 48 | - $pageNumber = $_GET["dpgn" . $this->id]; |
|
| 49 | - } elseif(isset($_PAGE['vs'][$id . '_dpgn'])) { |
|
| 50 | - $pageNumber = $_PAGE['vs'][$id . '_dpgn']; |
|
| 47 | + if (isset($_GET["dpgn".$this->id])) { |
|
| 48 | + $pageNumber = $_GET["dpgn".$this->id]; |
|
| 49 | + } elseif (isset($_PAGE['vs'][$id.'_dpgn'])) { |
|
| 50 | + $pageNumber = $_PAGE['vs'][$id.'_dpgn']; |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | - if(!is_numeric($pageNumber)) { |
|
| 53 | + if (!is_numeric($pageNumber)) { |
|
| 54 | 54 | $pageNumber = 1; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -61,40 +61,40 @@ discard block |
||
| 61 | 61 | $this->pager = ''; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function getRenderedPager() { |
|
| 64 | + public function getRenderedPager(){ |
|
| 65 | 65 | return $this->pager; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function getRenderedRows() { |
|
| 68 | + public function getRenderedRows(){ |
|
| 69 | 69 | return $this->rows; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function setDataSource($ds) { |
|
| 72 | + public function setDataSource($ds){ |
|
| 73 | 73 | $this->ds = $ds; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - public function setPageSize($ps) { |
|
| 76 | + public function setPageSize($ps){ |
|
| 77 | 77 | $this->pageSize = $ps; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function setRenderRowFnc($fncName, $args = "") { |
|
| 80 | + public function setRenderRowFnc($fncName, $args = ""){ |
|
| 81 | 81 | $this->renderRowFnc = &$fncName; |
| 82 | - $this->renderRowFncArgs = $args; // extra agruments |
|
| 82 | + $this->renderRowFncArgs = $args; // extra agruments |
|
| 83 | 83 | |
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function setRenderPagerFnc($fncName, $args = "") { |
|
| 87 | + public function setRenderPagerFnc($fncName, $args = ""){ |
|
| 88 | 88 | $this->renderPagerFnc = $fncName; |
| 89 | - $this->renderPagerFncArgs = $args; // extra agruments |
|
| 89 | + $this->renderPagerFncArgs = $args; // extra agruments |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function render() { |
|
| 92 | + public function render(){ |
|
| 93 | 93 | global $modx, $_PAGE; |
| 94 | 94 | |
| 95 | 95 | $isDataset = $modx->db->isResult($this->ds); |
| 96 | 96 | |
| 97 | - if(!$this->selPageStyle) { |
|
| 97 | + if (!$this->selPageStyle) { |
|
| 98 | 98 | $this->selPageStyle = "font-weight:bold"; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -102,11 +102,11 @@ discard block |
||
| 102 | 102 | $tnr = ($isDataset) ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
| 103 | 103 | |
| 104 | 104 | // render: no records found |
| 105 | - if($tnr <= 0) { |
|
| 105 | + if ($tnr <= 0) { |
|
| 106 | 106 | $fnc = $this->renderRowFnc; |
| 107 | 107 | $args = $this->renderRowFncArgs; |
| 108 | - if(isset($fnc)) { |
|
| 109 | - if($args != "") { |
|
| 108 | + if (isset($fnc)) { |
|
| 109 | + if ($args != "") { |
|
| 110 | 110 | $this->rows .= $fnc(0, null, $args); |
| 111 | 111 | } // if agrs was specified then we will pass three params |
| 112 | 112 | else { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | // get total pages |
| 120 | 120 | $tp = ceil($tnr / $this->pageSize); |
| 121 | - if($this->pageNumber > $tp) { |
|
| 121 | + if ($this->pageNumber > $tp) { |
|
| 122 | 122 | $this->pageNumber = 1; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -126,39 +126,39 @@ discard block |
||
| 126 | 126 | $p = $this->pageNumber; |
| 127 | 127 | |
| 128 | 128 | // save page number to view state if available |
| 129 | - if(isset($_PAGE['vs'])) { |
|
| 130 | - $_PAGE['vs'][$this->id . '_dpgn'] = $p; |
|
| 129 | + if (isset($_PAGE['vs'])) { |
|
| 130 | + $_PAGE['vs'][$this->id.'_dpgn'] = $p; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments=""); |
| 134 | - if($tp > 1) { |
|
| 134 | + if ($tp > 1) { |
|
| 135 | 135 | $url = ''; |
| 136 | 136 | $fnc = $this->renderPagerFnc; |
| 137 | 137 | $args = $this->renderPagerFncArgs; |
| 138 | - if(!isset($fnc)) { |
|
| 139 | - if($modx->isFrontend()) { |
|
| 140 | - $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?'; |
|
| 138 | + if (!isset($fnc)) { |
|
| 139 | + if ($modx->isFrontend()) { |
|
| 140 | + $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full').'?'; |
|
| 141 | 141 | } else { |
| 142 | - $url = $_SERVER['PHP_SELF'] . '?'; |
|
| 142 | + $url = $_SERVER['PHP_SELF'].'?'; |
|
| 143 | 143 | } |
| 144 | 144 | $i = 0; |
| 145 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
| 145 | + foreach ($_GET as $n => $v) if ($n != 'dpgn'.$this->id) { |
|
| 146 | 146 | $i++; |
| 147 | - $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
|
| 147 | + $url .= (($i > 1) ? "&" : "")."$n=$v"; |
|
| 148 | 148 | } |
| 149 | - if($i >= 1) { |
|
| 149 | + if ($i >= 1) { |
|
| 150 | 150 | $url .= "&"; |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | - for($i = 1; $i <= $tp; $i++) { |
|
| 154 | - if(isset($fnc)) { |
|
| 155 | - if($args != "") { |
|
| 153 | + for ($i = 1; $i <= $tp; $i++) { |
|
| 154 | + if (isset($fnc)) { |
|
| 155 | + if ($args != "") { |
|
| 156 | 156 | $this->pager .= $fnc($p, $i, $args); |
| 157 | 157 | } else { |
| 158 | 158 | $this->pager .= $fnc($p, $i); |
| 159 | 159 | } |
| 160 | 160 | } else { |
| 161 | - $this->pager .= ($p == $i) ? " <span class='" . $this->selPageClass . "' style='" . $this->selPageStyle . "'>$i</span> " : " <a href='" . $url . "dpgn" . $this->id . "=$i' class='" . $this->pageClass . "' style='" . $this->pageStyle . "'>$i</a> "; |
|
| 161 | + $this->pager .= ($p == $i) ? " <span class='".$this->selPageClass."' style='".$this->selPageStyle."'>$i</span> " : " <a href='".$url."dpgn".$this->id."=$i' class='".$this->pageClass."' style='".$this->pageStyle."'>$i</a> "; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | } |
@@ -167,21 +167,21 @@ discard block |
||
| 167 | 167 | $fnc = $this->renderRowFnc; |
| 168 | 168 | $args = $this->renderRowFncArgs; |
| 169 | 169 | |
| 170 | - if(isset($fnc)) { |
|
| 170 | + if (isset($fnc)) { |
|
| 171 | 171 | $i = 1; |
| 172 | 172 | $fncObject = is_object($fnc); |
| 173 | 173 | $minitems = (($p - 1) * $this->pageSize) + 1; |
| 174 | 174 | $maxitems = (($p - 1) * $this->pageSize) + $this->pageSize; |
| 175 | - while($i <= $maxitems && ($row = ($isDataset) ? $modx->db->getRow($this->ds) : $this->ds[$i - 1])) { |
|
| 176 | - if($i >= $minitems && $i <= $maxitems) { |
|
| 177 | - if($fncObject) { |
|
| 178 | - if($args != "") { |
|
| 175 | + while ($i <= $maxitems && ($row = ($isDataset) ? $modx->db->getRow($this->ds) : $this->ds[$i - 1])) { |
|
| 176 | + if ($i >= $minitems && $i <= $maxitems) { |
|
| 177 | + if ($fncObject) { |
|
| 178 | + if ($args != "") { |
|
| 179 | 179 | $this->rows .= $fnc->RenderRowFnc($i, $row, $args); |
| 180 | 180 | } else { |
| 181 | 181 | $this->rows .= $fnc->RenderRowFnc($i, $row); |
| 182 | 182 | } |
| 183 | 183 | } else { |
| 184 | - if($args != "") { |
|
| 184 | + if ($args != "") { |
|
| 185 | 185 | $this->rows .= $fnc($i, $row, $args); |
| 186 | 186 | } // if agrs was specified then we wil pass three params |
| 187 | 187 | else { |
@@ -10,7 +10,8 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | $__DataSetPagerCnt = 0; |
| 12 | 12 | |
| 13 | -class DataSetPager { |
|
| 13 | +class DataSetPager |
|
| 14 | +{ |
|
| 14 | 15 | |
| 15 | 16 | public $ds; // datasource |
| 16 | 17 | public $pageSize; |
@@ -31,7 +32,8 @@ discard block |
||
| 31 | 32 | public $renderPagerFnc; |
| 32 | 33 | public $renderPagerFncArgs; |
| 33 | 34 | |
| 34 | - public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
|
| 35 | + public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) |
|
| 36 | + { |
|
| 35 | 37 | global $_PAGE; // use view state object |
| 36 | 38 | |
| 37 | 39 | global $__DataSetPagerCnt; |
@@ -61,35 +63,42 @@ discard block |
||
| 61 | 63 | $this->pager = ''; |
| 62 | 64 | } |
| 63 | 65 | |
| 64 | - public function getRenderedPager() { |
|
| 66 | + public function getRenderedPager() |
|
| 67 | + { |
|
| 65 | 68 | return $this->pager; |
| 66 | 69 | } |
| 67 | 70 | |
| 68 | - public function getRenderedRows() { |
|
| 71 | + public function getRenderedRows() |
|
| 72 | + { |
|
| 69 | 73 | return $this->rows; |
| 70 | 74 | } |
| 71 | 75 | |
| 72 | - public function setDataSource($ds) { |
|
| 76 | + public function setDataSource($ds) |
|
| 77 | + { |
|
| 73 | 78 | $this->ds = $ds; |
| 74 | 79 | } |
| 75 | 80 | |
| 76 | - public function setPageSize($ps) { |
|
| 81 | + public function setPageSize($ps) |
|
| 82 | + { |
|
| 77 | 83 | $this->pageSize = $ps; |
| 78 | 84 | } |
| 79 | 85 | |
| 80 | - public function setRenderRowFnc($fncName, $args = "") { |
|
| 86 | + public function setRenderRowFnc($fncName, $args = "") |
|
| 87 | + { |
|
| 81 | 88 | $this->renderRowFnc = &$fncName; |
| 82 | 89 | $this->renderRowFncArgs = $args; // extra agruments |
| 83 | 90 | |
| 84 | 91 | |
| 85 | 92 | } |
| 86 | 93 | |
| 87 | - public function setRenderPagerFnc($fncName, $args = "") { |
|
| 94 | + public function setRenderPagerFnc($fncName, $args = "") |
|
| 95 | + { |
|
| 88 | 96 | $this->renderPagerFnc = $fncName; |
| 89 | 97 | $this->renderPagerFncArgs = $args; // extra agruments |
| 90 | 98 | } |
| 91 | 99 | |
| 92 | - public function render() { |
|
| 100 | + public function render() |
|
| 101 | + { |
|
| 93 | 102 | global $modx, $_PAGE; |
| 94 | 103 | |
| 95 | 104 | $isDataset = $modx->db->isResult($this->ds); |
@@ -142,8 +151,10 @@ discard block |
||
| 142 | 151 | $url = $_SERVER['PHP_SELF'] . '?'; |
| 143 | 152 | } |
| 144 | 153 | $i = 0; |
| 145 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
| 154 | + foreach($_GET as $n => $v) { |
|
| 155 | + if($n != 'dpgn' . $this->id) { |
|
| 146 | 156 | $i++; |
| 157 | + } |
|
| 147 | 158 | $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
| 148 | 159 | } |
| 149 | 160 | if($i >= 1) { |
@@ -177,7 +177,9 @@ discard block |
||
| 177 | 177 | // save selected system events |
| 178 | 178 | $formEventList = array(); |
| 179 | 179 | foreach ($sysevents as $evtId) { |
| 180 | - if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId); |
|
| 180 | + if(!preg_match('@^[1-9][0-9]*$@',$evtId)) { |
|
| 181 | + $evtId = getEventIdByName($evtId); |
|
| 182 | + } |
|
| 181 | 183 | if ($mode == '101') { |
| 182 | 184 | $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'"); |
| 183 | 185 | } else { |
@@ -203,10 +205,14 @@ discard block |
||
| 203 | 205 | $dbEventList = array(); |
| 204 | 206 | $del = array(); |
| 205 | 207 | while($row = $modx->db->getRow($rs)) { |
| 206 | - if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
| 208 | + if(!in_array($row['evtid'], $evtids)) { |
|
| 209 | + $del[] = $row['evtid']; |
|
| 210 | + } |
|
| 207 | 211 | } |
| 208 | 212 | |
| 209 | - if(empty($del)) return; |
|
| 213 | + if(empty($del)) { |
|
| 214 | + return; |
|
| 215 | + } |
|
| 210 | 216 | |
| 211 | 217 | foreach($del as $delid) { |
| 212 | 218 | $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id)); |
@@ -218,7 +224,9 @@ discard block |
||
| 218 | 224 | global $modx; |
| 219 | 225 | static $eventIds=array(); |
| 220 | 226 | |
| 221 | - if(isset($eventIds[$name])) return $eventIds[$name]; |
|
| 227 | + if(isset($eventIds[$name])) { |
|
| 228 | + return $eventIds[$name]; |
|
| 229 | + } |
|
| 222 | 230 | |
| 223 | 231 | $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames'); |
| 224 | 232 | while ($row = $modx->db->getRow($rs)) { |
@@ -1,12 +1,12 @@ 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 | if (!$modx->hasPermission('save_plugin')) { |
| 6 | 6 | $modx->webAlertAndQuit($_lang['error_no_privileges']); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = (int)$_POST['id']; |
|
| 9 | +$id = (int) $_POST['id']; |
|
| 10 | 10 | $name = $modx->db->escape(trim($_POST['name'])); |
| 11 | 11 | $description = $modx->db->escape($_POST['description']); |
| 12 | 12 | $locked = $_POST['locked'] == 'on' ? '1' : '0'; |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | //Kyle Jaebker - added category support |
| 22 | 22 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
| 23 | - $categoryid = (int)$_POST['categoryid']; |
|
| 23 | + $categoryid = (int) $_POST['categoryid']; |
|
| 24 | 24 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
| 25 | 25 | $categoryid = 0; |
| 26 | 26 | } else { |
| 27 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 27 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 28 | 28 | $categoryid = getCategory($_POST['newcategory']); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid; |
| 41 | 41 | |
| 42 | 42 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
| 43 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
| 43 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
| 44 | 44 | if ($version) { |
| 45 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 45 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 46 | 46 | } |
| 47 | 47 | if (isset($parsed['modx_category'])) { |
| 48 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 48 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 49 | 49 | $categoryid = getCategory($parsed['modx_category']); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | // finished emptying cache - redirect |
| 104 | 104 | if ($_POST['stay'] != '') { |
| 105 | 105 | $a = ($_POST['stay'] == '2') ? "102&id=$newid" : '101'; |
| 106 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
| 106 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
| 107 | 107 | header($header); |
| 108 | 108 | } else { |
| 109 | 109 | $header = 'Location: index.php?a=76&r=2'; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | // finished emptying cache - redirect |
| 159 | 159 | if ($_POST['stay'] != '') { |
| 160 | 160 | $a = ($_POST['stay'] == '2') ? "102&id=$id" : '101'; |
| 161 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
| 161 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
| 162 | 162 | header($header); |
| 163 | 163 | } else { |
| 164 | 164 | $modx->unlockElement(5, $id); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | // save selected system events |
| 178 | 178 | $formEventList = array(); |
| 179 | 179 | foreach ($sysevents as $evtId) { |
| 180 | - if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId); |
|
| 180 | + if (!preg_match('@^[1-9][0-9]*$@', $evtId)) $evtId = getEventIdByName($evtId); |
|
| 181 | 181 | if ($mode == '101') { |
| 182 | 182 | $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'"); |
| 183 | 183 | } else { |
@@ -202,13 +202,13 @@ discard block |
||
| 202 | 202 | $rs = $modx->db->select('*', '[+prefix+]site_plugin_events', sprintf("pluginid='%s'", $id)); |
| 203 | 203 | $dbEventList = array(); |
| 204 | 204 | $del = array(); |
| 205 | - while($row = $modx->db->getRow($rs)) { |
|
| 206 | - if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
| 205 | + while ($row = $modx->db->getRow($rs)) { |
|
| 206 | + if (!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if(empty($del)) return; |
|
| 209 | + if (empty($del)) return; |
|
| 210 | 210 | |
| 211 | - foreach($del as $delid) { |
|
| 211 | + foreach ($del as $delid) { |
|
| 212 | 212 | $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id)); |
| 213 | 213 | } |
| 214 | 214 | } |
@@ -216,9 +216,9 @@ discard block |
||
| 216 | 216 | function getEventIdByName($name) |
| 217 | 217 | { |
| 218 | 218 | global $modx; |
| 219 | - static $eventIds=array(); |
|
| 219 | + static $eventIds = array(); |
|
| 220 | 220 | |
| 221 | - if(isset($eventIds[$name])) return $eventIds[$name]; |
|
| 221 | + if (isset($eventIds[$name])) return $eventIds[$name]; |
|
| 222 | 222 | |
| 223 | 223 | $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames'); |
| 224 | 224 | while ($row = $modx->db->getRow($rs)) { |
@@ -1,11 +1,11 @@ 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 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 8 | +if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 9 | 9 | // seems to be a new install - send the user to the configuration page |
| 10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
| 11 | 11 | } |
@@ -16,50 +16,50 @@ discard block |
||
| 16 | 16 | $_SESSION['nrnewmessages'] = 0; |
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | -if($modx->hasPermission('messages')) {
|
|
| 20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
| 19 | +if ($modx->hasPermission('messages')) {
|
|
| 20 | + include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php'); |
|
| 21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
| 22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
| 23 | 23 | |
| 24 | 24 | $msg = array(); |
| 25 | 25 | $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
|
| 26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
| 26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : ''; |
|
| 27 | 27 | $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
|
| 28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
| 28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0'; |
|
| 29 | 29 | $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
| 30 | 30 | $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
|
| 31 | 31 | $ph['MessageInfo'] = implode("\n", $msg);
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 35 | +if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
| 37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
| 38 | 38 | } |
| 39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 39 | +if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
| 41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
| 42 | 42 | } |
| 43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 43 | +if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
| 45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
| 46 | 46 | } |
| 47 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
|
| 47 | +if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
|
| 48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
| 49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
| 50 | 50 | } |
| 51 | -if($modx->hasPermission('bk_manager')) {
|
|
| 51 | +if ($modx->hasPermission('bk_manager')) {
|
|
| 52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
| 53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
| 54 | 54 | } |
| 55 | -if($modx->hasPermission('help')) {
|
|
| 55 | +if ($modx->hasPermission('help')) {
|
|
| 56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
| 57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
| 58 | 58 | } |
| 59 | 59 | // do some config checks |
| 60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 61 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
| 62 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 60 | +if (($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 61 | + include_once(MODX_MANAGER_PATH.'includes/config_check.inc.php'); |
|
| 62 | + if ($config_check_results != $_lang['configcheck_ok']) {
|
|
| 63 | 63 | $ph['config_check_results'] = $config_check_results; |
| 64 | 64 | $ph['config_display'] = 'block'; |
| 65 | 65 | } else {
|
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check logout-reminder |
| 73 | -if(isset($_SESSION['show_logout_reminder'])) {
|
|
| 74 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 73 | +if (isset($_SESSION['show_logout_reminder'])) {
|
|
| 74 | + switch ($_SESSION['show_logout_reminder']['type']) {
|
|
| 75 | 75 | case 'logout_reminder': |
| 76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
| 77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | </tr> |
| 126 | 126 | </table>'; |
| 127 | 127 | |
| 128 | -$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
|
| 128 | +$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>'; |
|
| 129 | 129 | |
| 130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
| 131 | 131 | 'username' => $modx->getLoginUserName(), |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
| 141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 142 | 142 | |
| 143 | -if($modx->db->getRecordCount($rs) < 1) {
|
|
| 143 | +if ($modx->db->getRecordCount($rs) < 1) {
|
|
| 144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
| 145 | 145 | } else {
|
| 146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
| 146 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
| 147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
| 148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now);
|
| 149 | 149 | $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $userList = array(); |
| 169 | 169 | $userCount = array(); |
| 170 | 170 | // Create userlist with session-count first before output |
| 171 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 171 | + while ($activeusers = $modx->db->getRow($rs)) {
|
|
| 172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
| 173 | 173 | |
| 174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | $currentaction |
| 187 | 187 | ); |
| 188 | 188 | } |
| 189 | - foreach($userList as $params) {
|
|
| 189 | + foreach ($userList as $params) {
|
|
| 190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
| 191 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 191 | + $html .= "\n\t\t".vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $html .= ' |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $ph['OnlineInfo'] = $html; |
| 201 | 201 | |
| 202 | 202 | // include rss feeds for important forum topics |
| 203 | -include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php'); |
|
| 203 | +include_once(MODX_MANAGER_PATH.'includes/rss.inc.php'); |
|
| 204 | 204 | $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content']; |
| 205 | 205 | $ph['modx_news_content'] = $feedData['modx_news_content']; |
| 206 | 206 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | // invoke event OnManagerWelcomePrerender |
| 233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 234 | -if(is_array($evtOut)) {
|
|
| 234 | +if (is_array($evtOut)) {
|
|
| 235 | 235 | $output = implode('', $evtOut);
|
| 236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
| 237 | 237 | } |
@@ -365,57 +365,57 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | // invoke OnManagerWelcomeHome event |
| 367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 368 | -if(is_array($sitewidgets)) {
|
|
| 368 | +if (is_array($sitewidgets)) {
|
|
| 369 | 369 | $newwidgets = array(); |
| 370 | - foreach($sitewidgets as $widget){
|
|
| 370 | + foreach ($sitewidgets as $widget) {
|
|
| 371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 372 | 372 | } |
| 373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | -usort($widgets, function ($a, $b) {
|
|
| 376 | +usort($widgets, function($a, $b){
|
|
| 377 | 377 | return $a['menuindex'] - $b['menuindex']; |
| 378 | 378 | }); |
| 379 | 379 | |
| 380 | 380 | $tpl = getTplWidget(); |
| 381 | 381 | $output = ''; |
| 382 | -foreach($widgets as $widget) {
|
|
| 383 | - if ($widget['hide'] != '1'){
|
|
| 382 | +foreach ($widgets as $widget) {
|
|
| 383 | + if ($widget['hide'] != '1') {
|
|
| 384 | 384 | $output .= $modx->parseText($tpl, $widget); |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | $ph['widgets'] = $output; |
| 388 | 388 | |
| 389 | 389 | // load template |
| 390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 391 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
| 390 | +if (!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 391 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH.'media/style/common/welcome.tpl'; |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
| 395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
|
| 396 | 396 | $target = $modx->mergeSettingsContent($target); |
| 397 | 397 | |
| 398 | -if(substr($target, 0, 1) === '@') {
|
|
| 399 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 398 | +if (substr($target, 0, 1) === '@') {
|
|
| 399 | + if (substr($target, 0, 6) === '@CHUNK') {
|
|
| 400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
| 401 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 401 | + } elseif (substr($target, 0, 5) === '@FILE') {
|
|
| 402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
| 403 | 403 | } else {
|
| 404 | 404 | $content = ''; |
| 405 | 405 | } |
| 406 | 406 | } else {
|
| 407 | 407 | $chunk = $modx->getChunk($target); |
| 408 | - if($chunk !== false && !empty($chunk)) {
|
|
| 408 | + if ($chunk !== false && !empty($chunk)) {
|
|
| 409 | 409 | $content = $chunk; |
| 410 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 411 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
| 412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 413 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
| 414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 410 | + } elseif (is_file(MODX_BASE_PATH.$target)) {
|
|
| 411 | + $content = file_get_contents(MODX_BASE_PATH.$target); |
|
| 412 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl')) {
|
|
| 413 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl'); |
|
| 414 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html')) // ClipperCMS compatible |
|
| 415 | 415 | {
|
| 416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 416 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html'); |
|
| 417 | 417 | } else {
|
| 418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
| 418 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl'); |
|
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $content = $modx->mergeConditionalTagsContent($content); |
| 424 | 424 | $content = $modx->mergeSettingsContent($content); |
| 425 | 425 | $content = $modx->parseText($content, $ph); |
| 426 | -if(strpos($content, '[+') !== false) {
|
|
| 426 | +if (strpos($content, '[+') !== false) {
|
|
| 427 | 427 | $modx->toPlaceholders($ph); |
| 428 | 428 | $content = $modx->mergePlaceholderContent($content); |
| 429 | 429 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
| 433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 434 | 434 | |
| 435 | -if($js = $modx->getRegisteredClientScripts()) {
|
|
| 435 | +if ($js = $modx->getRegisteredClientScripts()) {
|
|
| 436 | 436 | $content .= $js; |
| 437 | 437 | } |
| 438 | 438 | |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
| 443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 444 | 444 | //</span> |
| 445 | -function getTplWidget() { // recent document info
|
|
| 445 | +function getTplWidget(){ // recent document info
|
|
| 446 | 446 | return ' |
| 447 | 447 | <div class="[+cols+]" id="[+id+]"> |
| 448 | 448 | <div class="card"[+cardAttr+]> |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | '; |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | -function getRecentInfo() { // recent document info
|
|
| 456 | +function getRecentInfo(){ // recent document info
|
|
| 457 | 457 | global $modx; |
| 458 | 458 | |
| 459 | 459 | $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
@@ -479,12 +479,12 @@ discard block |
||
| 479 | 479 | return $html; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | -function getRecentInfoList() {
|
|
| 482 | +function getRecentInfoList(){
|
|
| 483 | 483 | global $modx; |
| 484 | 484 | |
| 485 | 485 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
| 486 | 486 | |
| 487 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 487 | + if ($modx->db->getRecordCount($rs) < 1) {
|
|
| 488 | 488 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
| 489 | 489 | } |
| 490 | 490 | |
@@ -494,20 +494,20 @@ discard block |
||
| 494 | 494 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
| 495 | 495 | |
| 496 | 496 | $output = array(); |
| 497 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 497 | + while ($ph = $modx->db->getRow($rs)) {
|
|
| 498 | 498 | $docid = $ph['id']; |
| 499 | 499 | $_ = $modx->getUserInfo($ph['editedby']); |
| 500 | 500 | $ph['username'] = $_['username']; |
| 501 | 501 | |
| 502 | - if($ph['deleted'] == 1) {
|
|
| 502 | + if ($ph['deleted'] == 1) {
|
|
| 503 | 503 | $ph['status'] = 'deleted text-danger'; |
| 504 | - } elseif($ph['published'] == 0) {
|
|
| 504 | + } elseif ($ph['published'] == 0) {
|
|
| 505 | 505 | $ph['status'] = 'unpublished font-italic text-muted'; |
| 506 | 506 | } else {
|
| 507 | 507 | $ph['status'] = 'published'; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - if($modx->hasPermission('edit_document')) {
|
|
| 510 | + if ($modx->hasPermission('edit_document')) {
|
|
| 511 | 511 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
| 512 | 512 | } else {
|
| 513 | 513 | $ph['edit_btn'] = ''; |
@@ -522,8 +522,8 @@ discard block |
||
| 522 | 522 | $preview_disabled |
| 523 | 523 | ), $btntpl['preview_btn']); |
| 524 | 524 | |
| 525 | - if($modx->hasPermission('delete_document')) {
|
|
| 526 | - if($ph['deleted'] == 0) {
|
|
| 525 | + if ($modx->hasPermission('delete_document')) {
|
|
| 526 | + if ($ph['deleted'] == 0) {
|
|
| 527 | 527 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
| 528 | 528 | } else {
|
| 529 | 529 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
@@ -533,11 +533,11 @@ discard block |
||
| 533 | 533 | $ph['delete_btn'] = ''; |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 536 | + if ($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 537 | 537 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 538 | + } elseif ($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 539 | 539 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 540 | + } elseif ($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 541 | 541 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 542 | 542 | } else {
|
| 543 | 543 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
@@ -546,16 +546,16 @@ discard block |
||
| 546 | 546 | |
| 547 | 547 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
| 548 | 548 | |
| 549 | - if($ph['longtitle'] == '') {
|
|
| 549 | + if ($ph['longtitle'] == '') {
|
|
| 550 | 550 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
| 551 | 551 | } |
| 552 | - if($ph['description'] == '') {
|
|
| 552 | + if ($ph['description'] == '') {
|
|
| 553 | 553 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
| 554 | 554 | } |
| 555 | - if($ph['introtext'] == '') {
|
|
| 555 | + if ($ph['introtext'] == '') {
|
|
| 556 | 556 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
| 557 | 557 | } |
| 558 | - if($ph['alias'] == '') {
|
|
| 558 | + if ($ph['alias'] == '') {
|
|
| 559 | 559 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
| 560 | 560 | } |
| 561 | 561 | |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | return implode("\n", $output);
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | -function getRecentInfoRowTpl() {
|
|
| 567 | +function getRecentInfoRowTpl(){
|
|
| 568 | 568 | $tpl = ' |
| 569 | 569 | <tr> |
| 570 | 570 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +593,11 @@ discard block |
||
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | // setup icons |
| 596 | -function wrapIcon($i, $action) {
|
|
| 596 | +function wrapIcon($i, $action){
|
|
| 597 | 597 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | -function getStartUpScript() {
|
|
| 600 | +function getStartUpScript(){
|
|
| 601 | 601 | $script = ' |
| 602 | 602 | <script type="text/javascript"> |
| 603 | 603 | function hideConfigCheckWarning(key) {
|
@@ -1,11 +1,11 @@ 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 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
| 7 | 7 | |
| 8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
|
|
| 8 | +if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
| 9 | 9 | // seems to be a new install - send the user to the configuration page |
| 10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
|
| 11 | 11 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $_SESSION['nrnewmessages'] = 0; |
| 17 | 17 | |
| 18 | 18 | // setup message info |
| 19 | -if($modx->hasPermission('messages')) {
|
|
| 19 | +if($modx->hasPermission('messages')) { |
|
| 20 | 20 | include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
| 21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
| 22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
@@ -32,46 +32,46 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // setup icons |
| 35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
|
|
| 35 | +if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
| 36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
| 37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
| 38 | 38 | } |
| 39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
|
|
| 39 | +if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
| 40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
| 41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
| 42 | 42 | } |
| 43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
|
|
| 43 | +if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
| 44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
| 45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
| 46 | 46 | } |
| 47 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
|
|
| 47 | +if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
| 48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
| 49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
| 50 | 50 | } |
| 51 | -if($modx->hasPermission('bk_manager')) {
|
|
| 51 | +if($modx->hasPermission('bk_manager')) { |
|
| 52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
| 53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
| 54 | 54 | } |
| 55 | -if($modx->hasPermission('help')) {
|
|
| 55 | +if($modx->hasPermission('help')) { |
|
| 56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
| 57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
| 58 | 58 | } |
| 59 | 59 | // do some config checks |
| 60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
|
|
| 60 | +if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
| 61 | 61 | include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
| 62 | - if($config_check_results != $_lang['configcheck_ok']) {
|
|
| 62 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
| 63 | 63 | $ph['config_check_results'] = $config_check_results; |
| 64 | 64 | $ph['config_display'] = 'block'; |
| 65 | - } else {
|
|
| 65 | + } else { |
|
| 66 | 66 | $ph['config_display'] = 'none'; |
| 67 | 67 | } |
| 68 | -} else {
|
|
| 68 | +} else { |
|
| 69 | 69 | $ph['config_display'] = 'none'; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Check logout-reminder |
| 73 | -if(isset($_SESSION['show_logout_reminder'])) {
|
|
| 74 | - switch($_SESSION['show_logout_reminder']['type']) {
|
|
| 73 | +if(isset($_SESSION['show_logout_reminder'])) { |
|
| 74 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
| 75 | 75 | case 'logout_reminder': |
| 76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
| 77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
|
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | $ph['show_logout_reminder'] = 'block'; |
| 81 | 81 | unset($_SESSION['show_logout_reminder']); |
| 82 | -} else {
|
|
| 82 | +} else { |
|
| 83 | 83 | $ph['show_logout_reminder'] = 'none'; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
| 141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
|
| 142 | 142 | |
| 143 | -if($modx->db->getRecordCount($rs) < 1) {
|
|
| 143 | +if($modx->db->getRecordCount($rs) < 1) { |
|
| 144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
| 145 | -} else {
|
|
| 145 | +} else { |
|
| 146 | 146 | include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
| 147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
| 148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now);
|
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $userList = array(); |
| 169 | 169 | $userCount = array(); |
| 170 | 170 | // Create userlist with session-count first before output |
| 171 | - while($activeusers = $modx->db->getRow($rs)) {
|
|
| 171 | + while($activeusers = $modx->db->getRow($rs)) { |
|
| 172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
| 173 | 173 | |
| 174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $currentaction |
| 187 | 187 | ); |
| 188 | 188 | } |
| 189 | - foreach($userList as $params) {
|
|
| 189 | + foreach($userList as $params) { |
|
| 190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
| 191 | 191 | $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
|
| 192 | 192 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | // invoke event OnManagerWelcomePrerender |
| 233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
|
| 234 | -if(is_array($evtOut)) {
|
|
| 234 | +if(is_array($evtOut)) { |
|
| 235 | 235 | $output = implode('', $evtOut);
|
| 236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
| 237 | 237 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
| 341 | 341 | 'hide'=>'0' |
| 342 | 342 | ); |
| 343 | -if ($modx->config['rss_url_news']) {
|
|
| 343 | +if ($modx->config['rss_url_news']) { |
|
| 344 | 344 | $widgets['news'] = array( |
| 345 | 345 | 'menuindex' => '40', |
| 346 | 346 | 'id' => 'news', |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | 'hide'=>'0' |
| 352 | 352 | ); |
| 353 | 353 | } |
| 354 | -if ($modx->config['rss_url_security']) {
|
|
| 354 | +if ($modx->config['rss_url_security']) { |
|
| 355 | 355 | $widgets['security'] = array( |
| 356 | 356 | 'menuindex' => '50', |
| 357 | 357 | 'id' => 'security', |
@@ -365,29 +365,29 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | // invoke OnManagerWelcomeHome event |
| 367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
|
| 368 | -if(is_array($sitewidgets)) {
|
|
| 368 | +if(is_array($sitewidgets)) { |
|
| 369 | 369 | $newwidgets = array(); |
| 370 | - foreach($sitewidgets as $widget){
|
|
| 370 | + foreach($sitewidgets as $widget) { |
|
| 371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
| 372 | 372 | } |
| 373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | -usort($widgets, function ($a, $b) {
|
|
| 376 | +usort($widgets, function ($a, $b){ |
|
| 377 | 377 | return $a['menuindex'] - $b['menuindex']; |
| 378 | 378 | }); |
| 379 | 379 | |
| 380 | 380 | $tpl = getTplWidget(); |
| 381 | 381 | $output = ''; |
| 382 | -foreach($widgets as $widget) {
|
|
| 383 | - if ($widget['hide'] != '1'){
|
|
| 382 | +foreach($widgets as $widget) { |
|
| 383 | + if ($widget['hide'] != '1') { |
|
| 384 | 384 | $output .= $modx->parseText($tpl, $widget); |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | $ph['widgets'] = $output; |
| 388 | 388 | |
| 389 | 389 | // load template |
| 390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
|
|
| 390 | +if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
| 391 | 391 | $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
| 392 | 392 | } |
| 393 | 393 | |
@@ -395,26 +395,28 @@ discard block |
||
| 395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
|
| 396 | 396 | $target = $modx->mergeSettingsContent($target); |
| 397 | 397 | |
| 398 | -if(substr($target, 0, 1) === '@') {
|
|
| 399 | - if(substr($target, 0, 6) === '@CHUNK') {
|
|
| 398 | +if(substr($target, 0, 1) === '@') { |
|
| 399 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
| 400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
| 401 | - } elseif(substr($target, 0, 5) === '@FILE') {
|
|
| 401 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
| 402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
| 403 | - } else {
|
|
| 403 | + } else { |
|
| 404 | 404 | $content = ''; |
| 405 | 405 | } |
| 406 | -} else {
|
|
| 406 | +} else { |
|
| 407 | 407 | $chunk = $modx->getChunk($target); |
| 408 | - if($chunk !== false && !empty($chunk)) {
|
|
| 408 | + if($chunk !== false && !empty($chunk)) { |
|
| 409 | 409 | $content = $chunk; |
| 410 | - } elseif(is_file(MODX_BASE_PATH . $target)) {
|
|
| 410 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
| 411 | 411 | $content = file_get_contents(MODX_BASE_PATH . $target); |
| 412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
|
|
| 412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
| 413 | 413 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
| 414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
| 414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) { |
|
| 415 | + // ClipperCMS compatible |
|
| 415 | 416 | {
|
| 416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 417 | - } else {
|
|
| 417 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
| 418 | + } |
|
| 419 | + } else { |
|
| 418 | 420 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
| 419 | 421 | } |
| 420 | 422 | } |
@@ -423,7 +425,7 @@ discard block |
||
| 423 | 425 | $content = $modx->mergeConditionalTagsContent($content); |
| 424 | 426 | $content = $modx->mergeSettingsContent($content); |
| 425 | 427 | $content = $modx->parseText($content, $ph); |
| 426 | -if(strpos($content, '[+') !== false) {
|
|
| 428 | +if(strpos($content, '[+') !== false) { |
|
| 427 | 429 | $modx->toPlaceholders($ph); |
| 428 | 430 | $content = $modx->mergePlaceholderContent($content); |
| 429 | 431 | } |
@@ -432,7 +434,7 @@ discard block |
||
| 432 | 434 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
| 433 | 435 | $content = $modx->cleanUpMODXTags($content); //cleanup |
| 434 | 436 | |
| 435 | -if($js = $modx->getRegisteredClientScripts()) {
|
|
| 437 | +if($js = $modx->getRegisteredClientScripts()) { |
|
| 436 | 438 | $content .= $js; |
| 437 | 439 | } |
| 438 | 440 | |
@@ -442,7 +444,9 @@ discard block |
||
| 442 | 444 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
| 443 | 445 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
| 444 | 446 | //</span> |
| 445 | -function getTplWidget() { // recent document info
|
|
| 447 | +function getTplWidget() |
|
| 448 | +{ |
|
| 449 | +// recent document info |
|
| 446 | 450 | return ' |
| 447 | 451 | <div class="[+cols+]" id="[+id+]"> |
| 448 | 452 | <div class="card"[+cardAttr+]> |
@@ -453,7 +457,9 @@ discard block |
||
| 453 | 457 | '; |
| 454 | 458 | } |
| 455 | 459 | |
| 456 | -function getRecentInfo() { // recent document info
|
|
| 460 | +function getRecentInfo() |
|
| 461 | +{ |
|
| 462 | +// recent document info |
|
| 457 | 463 | global $modx; |
| 458 | 464 | |
| 459 | 465 | $modx->addSnippet('recentInfoList', 'getRecentInfoList');
|
@@ -479,12 +485,13 @@ discard block |
||
| 479 | 485 | return $html; |
| 480 | 486 | } |
| 481 | 487 | |
| 482 | -function getRecentInfoList() {
|
|
| 488 | +function getRecentInfoList() |
|
| 489 | +{ |
|
| 483 | 490 | global $modx; |
| 484 | 491 | |
| 485 | 492 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
|
| 486 | 493 | |
| 487 | - if($modx->db->getRecordCount($rs) < 1) {
|
|
| 494 | + if($modx->db->getRecordCount($rs) < 1) { |
|
| 488 | 495 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
| 489 | 496 | } |
| 490 | 497 | |
@@ -494,22 +501,22 @@ discard block |
||
| 494 | 501 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
| 495 | 502 | |
| 496 | 503 | $output = array(); |
| 497 | - while($ph = $modx->db->getRow($rs)) {
|
|
| 504 | + while($ph = $modx->db->getRow($rs)) { |
|
| 498 | 505 | $docid = $ph['id']; |
| 499 | 506 | $_ = $modx->getUserInfo($ph['editedby']); |
| 500 | 507 | $ph['username'] = $_['username']; |
| 501 | 508 | |
| 502 | - if($ph['deleted'] == 1) {
|
|
| 509 | + if($ph['deleted'] == 1) { |
|
| 503 | 510 | $ph['status'] = 'deleted text-danger'; |
| 504 | - } elseif($ph['published'] == 0) {
|
|
| 511 | + } elseif($ph['published'] == 0) { |
|
| 505 | 512 | $ph['status'] = 'unpublished font-italic text-muted'; |
| 506 | - } else {
|
|
| 513 | + } else { |
|
| 507 | 514 | $ph['status'] = 'published'; |
| 508 | 515 | } |
| 509 | 516 | |
| 510 | - if($modx->hasPermission('edit_document')) {
|
|
| 517 | + if($modx->hasPermission('edit_document')) { |
|
| 511 | 518 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
|
| 512 | - } else {
|
|
| 519 | + } else { |
|
| 513 | 520 | $ph['edit_btn'] = ''; |
| 514 | 521 | } |
| 515 | 522 | |
@@ -522,40 +529,40 @@ discard block |
||
| 522 | 529 | $preview_disabled |
| 523 | 530 | ), $btntpl['preview_btn']); |
| 524 | 531 | |
| 525 | - if($modx->hasPermission('delete_document')) {
|
|
| 526 | - if($ph['deleted'] == 0) {
|
|
| 532 | + if($modx->hasPermission('delete_document')) { |
|
| 533 | + if($ph['deleted'] == 0) { |
|
| 527 | 534 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
| 528 | - } else {
|
|
| 535 | + } else { |
|
| 529 | 536 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
| 530 | 537 | } |
| 531 | 538 | $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
|
| 532 | - } else {
|
|
| 539 | + } else { |
|
| 533 | 540 | $ph['delete_btn'] = ''; |
| 534 | 541 | } |
| 535 | 542 | |
| 536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) {
|
|
| 543 | + if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
| 537 | 544 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
|
|
| 545 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
| 539 | 546 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
|
|
| 547 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
| 541 | 548 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
| 542 | - } else {
|
|
| 549 | + } else { |
|
| 543 | 550 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
| 544 | 551 | } |
| 545 | 552 | $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
|
| 546 | 553 | |
| 547 | 554 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
|
| 548 | 555 | |
| 549 | - if($ph['longtitle'] == '') {
|
|
| 556 | + if($ph['longtitle'] == '') { |
|
| 550 | 557 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
| 551 | 558 | } |
| 552 | - if($ph['description'] == '') {
|
|
| 559 | + if($ph['description'] == '') { |
|
| 553 | 560 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
| 554 | 561 | } |
| 555 | - if($ph['introtext'] == '') {
|
|
| 562 | + if($ph['introtext'] == '') { |
|
| 556 | 563 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
| 557 | 564 | } |
| 558 | - if($ph['alias'] == '') {
|
|
| 565 | + if($ph['alias'] == '') { |
|
| 559 | 566 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
| 560 | 567 | } |
| 561 | 568 | |
@@ -564,7 +571,8 @@ discard block |
||
| 564 | 571 | return implode("\n", $output);
|
| 565 | 572 | } |
| 566 | 573 | |
| 567 | -function getRecentInfoRowTpl() {
|
|
| 574 | +function getRecentInfoRowTpl() |
|
| 575 | +{ |
|
| 568 | 576 | $tpl = ' |
| 569 | 577 | <tr> |
| 570 | 578 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +601,13 @@ discard block |
||
| 593 | 601 | } |
| 594 | 602 | |
| 595 | 603 | // setup icons |
| 596 | -function wrapIcon($i, $action) {
|
|
| 604 | +function wrapIcon($i, $action) |
|
| 605 | +{ |
|
| 597 | 606 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
|
| 598 | 607 | } |
| 599 | 608 | |
| 600 | -function getStartUpScript() {
|
|
| 609 | +function getStartUpScript() |
|
| 610 | +{ |
|
| 601 | 611 | $script = ' |
| 602 | 612 | <script type="text/javascript"> |
| 603 | 613 | function hideConfigCheckWarning(key) {
|