@@ -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 | } |
@@ -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> |
@@ -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 | } |
@@ -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 |
@@ -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,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 { |
@@ -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,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)) { |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | $modx->getSettings(); |
6 | 6 | $modx->invokeEvent('OnWebPageInit'); |
7 | 7 | |
8 | -$vword = new VeriWord(148,60); |
|
8 | +$vword = new VeriWord(148, 60); |
|
9 | 9 | $vword->output_image(); |
10 | 10 | $vword->destroy_image(); |
11 | 11 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ## see sample.php for test and usage |
42 | 42 | ## sample URL: http://www.program-ruti.org/veriword/ |
43 | 43 | #### |
44 | -class VeriWord { |
|
44 | +class VeriWord{ |
|
45 | 45 | |
46 | 46 | /* path to font directory*/ |
47 | 47 | public $dir_font = "ttf/"; |
@@ -52,44 +52,44 @@ discard block |
||
52 | 52 | public $im_height = 0; |
53 | 53 | public $im; |
54 | 54 | |
55 | - public function __construct($w=200, $h=80) { |
|
55 | + public function __construct($w = 200, $h = 80){ |
|
56 | 56 | /* create session to set word for verification */ |
57 | 57 | $this->set_veriword(); |
58 | - $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font; |
|
58 | + $this->dir_font = dirname(__FILE__).'/'.$this->dir_font; |
|
59 | 59 | $this->im_width = $w; |
60 | 60 | $this->im_height = $h; |
61 | 61 | } |
62 | 62 | |
63 | - public function set_veriword() { |
|
63 | + public function set_veriword(){ |
|
64 | 64 | /* create session variable for verification, |
65 | 65 | you may change the session variable name */ |
66 | 66 | $this->word = $this->pick_word(); |
67 | 67 | $_SESSION['veriword'] = $this->word; |
68 | 68 | } |
69 | 69 | |
70 | - public function output_image() { |
|
70 | + public function output_image(){ |
|
71 | 71 | /* output the image as jpeg */ |
72 | 72 | $this->draw_image(); |
73 | 73 | header("Content-type: image/jpeg"); |
74 | 74 | imagejpeg($this->im); |
75 | 75 | } |
76 | 76 | |
77 | - public function pick_word() { |
|
77 | + public function pick_word(){ |
|
78 | 78 | global $modx; |
79 | 79 | // set default words |
80 | - $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
|
80 | + $words = "MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
|
81 | 81 | $words = $modx->config['captcha_words'] ? $modx->config['captcha_words'] : $words; |
82 | 82 | $arr_words = array_filter(array_map('trim', explode(',', $words))); |
83 | 83 | |
84 | 84 | /* pick one randomly for text verification */ |
85 | - return (string) $arr_words[array_rand($arr_words)].rand(10,999); |
|
85 | + return (string) $arr_words[array_rand($arr_words)].rand(10, 999); |
|
86 | 86 | } |
87 | 87 | |
88 | - public function draw_text() { |
|
88 | + public function draw_text(){ |
|
89 | 89 | $dir = dir($this->dir_font); |
90 | 90 | $fontstmp = array(); |
91 | 91 | while (false !== ($file = $dir->read())) { |
92 | - if(substr($file, -4) == '.ttf') { |
|
92 | + if (substr($file, -4) == '.ttf') { |
|
93 | 93 | $fontstmp[] = $this->dir_font.$file; |
94 | 94 | } |
95 | 95 | } |
@@ -97,35 +97,35 @@ discard block |
||
97 | 97 | $text_font = (string) $fontstmp[array_rand($fontstmp)]; |
98 | 98 | |
99 | 99 | /* angle for text inclination */ |
100 | - $text_angle = rand(-9,9); |
|
100 | + $text_angle = rand(-9, 9); |
|
101 | 101 | /* initial text size */ |
102 | 102 | $text_size = 30; |
103 | 103 | /* calculate text width and height */ |
104 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
105 | - $text_width = $box[2]-$box[0]; //text width |
|
106 | - $text_height= $box[5]-$box[3]; //text height |
|
104 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
105 | + $text_width = $box[2] - $box[0]; //text width |
|
106 | + $text_height = $box[5] - $box[3]; //text height |
|
107 | 107 | |
108 | 108 | /* adjust text size */ |
109 | - $text_size = round((20 * $this->im_width)/$text_width); |
|
109 | + $text_size = round((20 * $this->im_width) / $text_width); |
|
110 | 110 | |
111 | 111 | /* recalculate text width and height */ |
112 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
113 | - $text_width = $box[2]-$box[0]; //text width |
|
114 | - $text_height= $box[5]-$box[3]; //text height |
|
112 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
113 | + $text_width = $box[2] - $box[0]; //text width |
|
114 | + $text_height = $box[5] - $box[3]; //text height |
|
115 | 115 | |
116 | 116 | /* calculate center position of text */ |
117 | - $text_x = ($this->im_width - $text_width)/2; |
|
118 | - $text_y = ($this->im_height - $text_height)/2; |
|
117 | + $text_x = ($this->im_width - $text_width) / 2; |
|
118 | + $text_y = ($this->im_height - $text_height) / 2; |
|
119 | 119 | |
120 | 120 | /* create canvas for text drawing */ |
121 | - $im_text = imagecreate ($this->im_width, $this->im_height); |
|
122 | - $bg_color = imagecolorallocate ($im_text, 255, 255, 255); |
|
121 | + $im_text = imagecreate($this->im_width, $this->im_height); |
|
122 | + $bg_color = imagecolorallocate($im_text, 255, 255, 255); |
|
123 | 123 | |
124 | 124 | /* pick color for text */ |
125 | - $text_color = imagecolorallocate ($im_text, 0, 51, 153); |
|
125 | + $text_color = imagecolorallocate($im_text, 0, 51, 153); |
|
126 | 126 | |
127 | 127 | /* draw text into canvas */ |
128 | - imagettftext ( $im_text, |
|
128 | + imagettftext($im_text, |
|
129 | 129 | $text_size, |
130 | 130 | $text_angle, |
131 | 131 | $text_x, |
@@ -140,19 +140,19 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | - public function draw_image() { |
|
143 | + public function draw_image(){ |
|
144 | 144 | |
145 | 145 | /* pick one background image randomly from image directory */ |
146 | - $img_file = $this->dir_noise."noise".rand(1,4).".jpg"; |
|
146 | + $img_file = $this->dir_noise."noise".rand(1, 4).".jpg"; |
|
147 | 147 | |
148 | 148 | /* create "noise" background image from your image stock*/ |
149 | - $noise_img = @imagecreatefromjpeg ($img_file); |
|
149 | + $noise_img = @imagecreatefromjpeg($img_file); |
|
150 | 150 | $noise_width = imagesx($noise_img); |
151 | 151 | $noise_height = imagesy($noise_img); |
152 | 152 | |
153 | 153 | /* resize the background image to fit the size of image output */ |
154 | - $this->im = imagecreatetruecolor($this->im_width,$this->im_height); |
|
155 | - imagecopyresampled ($this->im, |
|
154 | + $this->im = imagecreatetruecolor($this->im_width, $this->im_height); |
|
155 | + imagecopyresampled($this->im, |
|
156 | 156 | $noise_img, |
157 | 157 | 0, 0, 0, 0, |
158 | 158 | $this->im_width, |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | $noise_height); |
162 | 162 | |
163 | 163 | /* put text image into background image */ |
164 | - imagecopymerge ( $this->im, |
|
164 | + imagecopymerge($this->im, |
|
165 | 165 | $this->draw_text(), |
166 | 166 | 0, 0, 0, 0, |
167 | 167 | $this->im_width, |
168 | 168 | $this->im_height, |
169 | - 70 ); |
|
169 | + 70); |
|
170 | 170 | |
171 | 171 | return $this->im; |
172 | 172 | } |
173 | 173 | |
174 | - public function destroy_image() { |
|
174 | + public function destroy_image(){ |
|
175 | 175 | |
176 | 176 | imagedestroy($this->im); |
177 | 177 |