@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class DATEPICKER {
|
| 4 | - function __construct() {
|
|
| 5 | - } |
|
| 4 | + function __construct() {
|
|
| 5 | + } |
|
| 6 | 6 | |
| 7 | - function getDP() {
|
|
| 8 | - global $modx, $_lang; |
|
| 7 | + function getDP() {
|
|
| 8 | + global $modx, $_lang; |
|
| 9 | 9 | |
| 10 | - $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
| 11 | - return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
| 12 | - } |
|
| 10 | + $tpl = file_get_contents(dirname(__FILE__) . '/datepicker.tpl'); |
|
| 11 | + return $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
| 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'); |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** This file is part of KCFinder project |
| 4 | - * |
|
| 5 | - * @desc Uploader class |
|
| 6 | - * @package KCFinder |
|
| 7 | - * @version 2.54 |
|
| 8 | - * @author Pavel Tzonkov <[email protected]> |
|
| 9 | - * @copyright 2010-2014 KCFinder Project |
|
| 10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
| 11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
| 12 | - * @link http://kcfinder.sunhater.com |
|
| 13 | - */ |
|
| 4 | + * |
|
| 5 | + * @desc Uploader class |
|
| 6 | + * @package KCFinder |
|
| 7 | + * @version 2.54 |
|
| 8 | + * @author Pavel Tzonkov <[email protected]> |
|
| 9 | + * @copyright 2010-2014 KCFinder Project |
|
| 10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
| 11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
| 12 | + * @link http://kcfinder.sunhater.com |
|
| 13 | + */ |
|
| 14 | 14 | |
| 15 | 15 | class uploader { |
| 16 | 16 | |
@@ -18,92 +18,92 @@ discard block |
||
| 18 | 18 | const VERSION = "2.54"; |
| 19 | 19 | |
| 20 | 20 | /** Config session-overrided settings |
| 21 | - * @var array */ |
|
| 21 | + * @var array */ |
|
| 22 | 22 | protected $config = array(); |
| 23 | 23 | |
| 24 | 24 | /** Default image driver |
| 25 | - * @var string */ |
|
| 25 | + * @var string */ |
|
| 26 | 26 | protected $imageDriver = "gd"; |
| 27 | 27 | |
| 28 | 28 | /** Opener applocation properties |
| 29 | - * $opener['name'] Got from $_GET['opener']; |
|
| 30 | - * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
| 31 | - * $opener['TinyMCE'] Boolean |
|
| 32 | - * @var array */ |
|
| 29 | + * $opener['name'] Got from $_GET['opener']; |
|
| 30 | + * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
| 31 | + * $opener['TinyMCE'] Boolean |
|
| 32 | + * @var array */ |
|
| 33 | 33 | protected $opener = array(); |
| 34 | 34 | |
| 35 | 35 | /** Got from $_GET['type'] or first one $config['types'] array key, if inexistant |
| 36 | - * @var string */ |
|
| 36 | + * @var string */ |
|
| 37 | 37 | protected $type; |
| 38 | 38 | |
| 39 | 39 | /** Helper property. Local filesystem path to the Type Directory |
| 40 | - * Equivalent: $config['uploadDir'] . "/" . $type |
|
| 41 | - * @var string */ |
|
| 40 | + * Equivalent: $config['uploadDir'] . "/" . $type |
|
| 41 | + * @var string */ |
|
| 42 | 42 | protected $typeDir; |
| 43 | 43 | |
| 44 | 44 | /** Helper property. Web URL to the Type Directory |
| 45 | - * Equivalent: $config['uploadURL'] . "/" . $type |
|
| 46 | - * @var string */ |
|
| 45 | + * Equivalent: $config['uploadURL'] . "/" . $type |
|
| 46 | + * @var string */ |
|
| 47 | 47 | protected $typeURL; |
| 48 | 48 | |
| 49 | 49 | /** Linked to $config['types'] |
| 50 | - * @var array */ |
|
| 50 | + * @var array */ |
|
| 51 | 51 | protected $types = array(); |
| 52 | 52 | |
| 53 | 53 | /** Settings which can override default settings if exists as keys in $config['types'][$type] array |
| 54 | - * @var array */ |
|
| 54 | + * @var array */ |
|
| 55 | 55 | protected $typeSettings = array('disabled', 'theme', 'dirPerms', 'filePerms', 'denyZipDownload', 'maxImageWidth', 'maxImageHeight', 'thumbWidth', 'thumbHeight', 'jpegQuality', 'access', 'filenameChangeChars', 'dirnameChangeChars', 'denyExtensionRename', 'deniedExts', 'watermark'); |
| 56 | 56 | |
| 57 | 57 | /** Got from language file |
| 58 | - * @var string */ |
|
| 58 | + * @var string */ |
|
| 59 | 59 | protected $charset; |
| 60 | 60 | |
| 61 | 61 | /** The language got from $_GET['lng'] or $_GET['lang'] or... Please see next property |
| 62 | - * @var string */ |
|
| 62 | + * @var string */ |
|
| 63 | 63 | protected $lang = 'en'; |
| 64 | 64 | |
| 65 | 65 | /** Possible language $_GET keys |
| 66 | - * @var array */ |
|
| 66 | + * @var array */ |
|
| 67 | 67 | protected $langInputNames = array('lang', 'langCode', 'lng', 'language', 'lang_code'); |
| 68 | 68 | |
| 69 | 69 | /** Uploaded file(s) info. Linked to first $_FILES element |
| 70 | - * @var array */ |
|
| 70 | + * @var array */ |
|
| 71 | 71 | protected $file; |
| 72 | 72 | |
| 73 | 73 | /** Next three properties are got from the current language file |
| 74 | - * @var string */ |
|
| 74 | + * @var string */ |
|
| 75 | 75 | protected $dateTimeFull; // Currently not used |
| 76 | 76 | protected $dateTimeMid; // Currently not used |
| 77 | 77 | protected $dateTimeSmall; |
| 78 | 78 | |
| 79 | 79 | /** Contain Specified language labels |
| 80 | - * @var array */ |
|
| 80 | + * @var array */ |
|
| 81 | 81 | protected $labels = array(); |
| 82 | 82 | |
| 83 | 83 | /** Contain unprocessed $_GET array. Please use this instead of $_GET |
| 84 | - * @var array */ |
|
| 84 | + * @var array */ |
|
| 85 | 85 | protected $get; |
| 86 | 86 | |
| 87 | 87 | /** Contain unprocessed $_POST array. Please use this instead of $_POST |
| 88 | - * @var array */ |
|
| 88 | + * @var array */ |
|
| 89 | 89 | protected $post; |
| 90 | 90 | |
| 91 | 91 | /** Contain unprocessed $_COOKIE array. Please use this instead of $_COOKIE |
| 92 | - * @var array */ |
|
| 92 | + * @var array */ |
|
| 93 | 93 | protected $cookie; |
| 94 | 94 | |
| 95 | 95 | /** Session array. Please use this property instead of $_SESSION |
| 96 | - * @var array */ |
|
| 96 | + * @var array */ |
|
| 97 | 97 | protected $session; |
| 98 | 98 | |
| 99 | 99 | /** CMS integration attribute (got from $_GET['cms']) |
| 100 | - * @var string */ |
|
| 100 | + * @var string */ |
|
| 101 | 101 | protected $cms = ""; |
| 102 | 102 | |
| 103 | 103 | protected $modx = null; |
| 104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
| 105 | - * @param string $property |
|
| 106 | - * @return mixed */ |
|
| 105 | + * @param string $property |
|
| 106 | + * @return mixed */ |
|
| 107 | 107 | public function __get($property) { |
| 108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
| 109 | 109 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | ) |
| 133 | 133 | $this->cms = $this->get['cms']; |
| 134 | 134 | |
| 135 | - // LINKING UPLOADED FILE |
|
| 135 | + // LINKING UPLOADED FILE |
|
| 136 | 136 | if (count($_FILES)) |
| 137 | 137 | $this->file = &$_FILES[key($_FILES)]; |
| 138 | 138 | |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
| 229 | 229 | ? path::normalize($this->config['uploadDir']) |
| 230 | 230 | : path::url2fullPath("/$path"); |
| 231 | - $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
| 232 | - $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
| 231 | + $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
| 232 | + $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
| 233 | 233 | |
| 234 | 234 | // SITE ROOT |
| 235 | 235 | } elseif ($this->config['uploadURL'] == "/") { |
@@ -365,36 +365,36 @@ discard block |
||
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | |
| 368 | - protected function getTransaliasSettings() { |
|
| 369 | - global $modx; |
|
| 370 | - |
|
| 371 | - // Cleaning uploaded filename? |
|
| 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) { |
|
| 374 | - // Transalias plugin active? |
|
| 375 | - $res = $modx->db->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
| 376 | - if ($properties = $modx->db->getValue($res)) { |
|
| 377 | - $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
| 378 | - } else { |
|
| 379 | - $properties = NULL; |
|
| 380 | - } |
|
| 381 | - } else { |
|
| 382 | - $properties = NULL; |
|
| 383 | - } |
|
| 384 | - return $properties; |
|
| 385 | - } |
|
| 386 | - |
|
| 387 | - |
|
| 388 | - protected function normalizeFilename($filename) { |
|
| 389 | - if ($this->getTransaliasSettings()) { |
|
| 390 | - $format = strrchr($filename, "."); |
|
| 391 | - $filename = str_replace($format, "", $filename); |
|
| 392 | - $filename = $this->modx->stripAlias($filename).$format; |
|
| 393 | - } |
|
| 394 | - return $filename; |
|
| 395 | - } |
|
| 396 | - |
|
| 397 | - protected function normalizeDirname($dirname) { |
|
| 368 | + protected function getTransaliasSettings() { |
|
| 369 | + global $modx; |
|
| 370 | + |
|
| 371 | + // Cleaning uploaded filename? |
|
| 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) { |
|
| 374 | + // Transalias plugin active? |
|
| 375 | + $res = $modx->db->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
| 376 | + if ($properties = $modx->db->getValue($res)) { |
|
| 377 | + $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
| 378 | + } else { |
|
| 379 | + $properties = NULL; |
|
| 380 | + } |
|
| 381 | + } else { |
|
| 382 | + $properties = NULL; |
|
| 383 | + } |
|
| 384 | + return $properties; |
|
| 385 | + } |
|
| 386 | + |
|
| 387 | + |
|
| 388 | + protected function normalizeFilename($filename) { |
|
| 389 | + if ($this->getTransaliasSettings()) { |
|
| 390 | + $format = strrchr($filename, "."); |
|
| 391 | + $filename = str_replace($format, "", $filename); |
|
| 392 | + $filename = $this->modx->stripAlias($filename).$format; |
|
| 393 | + } |
|
| 394 | + return $filename; |
|
| 395 | + } |
|
| 396 | + |
|
| 397 | + protected function normalizeDirname($dirname) { |
|
| 398 | 398 | return $this->modx->stripAlias($dirname); |
| 399 | 399 | } |
| 400 | 400 | |
@@ -472,10 +472,10 @@ discard block |
||
| 472 | 472 | return $this->label("The image is too big and/or cannot be resized."); |
| 473 | 473 | |
| 474 | 474 | |
| 475 | - // CHECK FOR MODX MAX FILE SIZE |
|
| 476 | - $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)"); |
|
| 475 | + // CHECK FOR MODX MAX FILE SIZE |
|
| 476 | + $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)"); |
|
| 479 | 479 | |
| 480 | 480 | return true; |
| 481 | 481 | } |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | $top = isset($this->config['watermark']['top']) |
| 628 | 628 | ? $this->config['watermark']['top'] : false; |
| 629 | 629 | $img->watermark($this->config['watermark']['file'], $left, $top); |
| 630 | - } |
|
| 630 | + } |
|
| 631 | 631 | |
| 632 | 632 | $options = array( 'file' => $file ); |
| 633 | 633 | |
@@ -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,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'); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $autoloader = __DIR__.'/vendor/autoload.php'; |
| 49 | 49 | if (file_exists($autoloader) && is_readable($autoloader)) { |
| 50 | - include_once($autoloader); |
|
| 50 | + include_once($autoloader); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | if(is_file($base_path . 'assets/cache/siteManager.php')) |
| 57 | 57 | include_once($base_path . 'assets/cache/siteManager.php'); |
| 58 | 58 | if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) |
| 59 | - define('MGR_DIR', 'manager'); |
|
| 59 | + define('MGR_DIR', 'manager'); |
|
| 60 | 60 | if(is_file($base_path . 'assets/cache/siteHostnames.php')) |
| 61 | 61 | include_once($base_path . 'assets/cache/siteHostnames.php'); |
| 62 | 62 | if(!defined('MODX_SITE_HOSTNAMES')) |
| 63 | - define('MODX_SITE_HOSTNAMES', ''); |
|
| 63 | + define('MODX_SITE_HOSTNAMES', ''); |
|
| 64 | 64 | |
| 65 | 65 | // get start time |
| 66 | 66 | $mstart = memory_get_usage(); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | define('IN_PARSER_MODE', true); |
| 86 | 86 | if ( ! defined('IN_MANAGER_MODE')) { |
| 87 | - define('IN_MANAGER_MODE', false); |
|
| 87 | + define('IN_MANAGER_MODE', false); |
|
| 88 | 88 | } |
| 89 | 89 | if (!defined('MODX_API_MODE')) { |
| 90 | 90 | define('MODX_API_MODE', false); |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | // get the required includes |
| 94 | 94 | if(!isset($database_user) || $database_user=="") { |
| 95 | - $rt = @include_once(dirname(__FILE__).'/'.MGR_DIR.'/includes/config.inc.php'); |
|
| 96 | - // Be sure config.inc.php is there and that it contains some important values |
|
| 97 | - if(!$rt || !$database_type || !$database_server || !$database_user || !$dbase) { |
|
| 98 | - readfile('install/not_installed.tpl'); |
|
| 99 | - exit; |
|
| 100 | - } |
|
| 95 | + $rt = @include_once(dirname(__FILE__).'/'.MGR_DIR.'/includes/config.inc.php'); |
|
| 96 | + // Be sure config.inc.php is there and that it contains some important values |
|
| 97 | + if(!$rt || !$database_type || !$database_server || !$database_user || !$dbase) { |
|
| 98 | + readfile('install/not_installed.tpl'); |
|
| 99 | + exit; |
|
| 100 | + } |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // start session |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | // initiate a new document parser |
| 107 | 107 | if (isset($coreClass) && class_exists($coreClass)) { |
| 108 | - $modx = new $coreClass; |
|
| 108 | + $modx = new $coreClass; |
|
| 109 | 109 | } |
| 110 | 110 | if (!isset($modx) || !($modx instanceof \DocumentParser)) { |
| 111 | - include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
| 112 | - $modx = new \DocumentParser; |
|
| 111 | + include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
| 112 | + $modx = new \DocumentParser; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // set some parser options |
@@ -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): { |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class DataGrid { |
| 14 | 14 | |
| 15 | - public $ds; // datasource |
|
| 15 | + public $ds; // datasource |
|
| 16 | 16 | public $id; |
| 17 | 17 | public $pageSize; // pager settings |
| 18 | 18 | public $pageNumber; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | public $colWraps; |
| 37 | 37 | public $colColors; |
| 38 | 38 | public $colTypes; // coltype1, coltype2, etc or coltype1:format1, e.g. date:%Y %m |
| 39 | - // data type: integer,float,currency,date |
|
| 39 | + // data type: integer,float,currency,date |
|
| 40 | 40 | |
| 41 | 41 | public $header; |
| 42 | 42 | public $footer; |
@@ -73,239 +73,239 @@ discard block |
||
| 73 | 73 | public $cdelim; |
| 74 | 74 | |
| 75 | 75 | public function __construct($id, $ds, $pageSize = 20, $pageNumber = -1) { |
| 76 | - global $__DataGridCnt; |
|
| 76 | + global $__DataGridCnt; |
|
| 77 | 77 | |
| 78 | - // set id |
|
| 79 | - $__DataGridCnt++; |
|
| 80 | - $this->id = $this->id ? empty($id) : "dg" . $__DataGridCnt; |
|
| 78 | + // set id |
|
| 79 | + $__DataGridCnt++; |
|
| 80 | + $this->id = $this->id ? empty($id) : "dg" . $__DataGridCnt; |
|
| 81 | 81 | |
| 82 | - // set datasource |
|
| 83 | - $this->ds = $ds; |
|
| 82 | + // set datasource |
|
| 83 | + $this->ds = $ds; |
|
| 84 | 84 | |
| 85 | - // set pager |
|
| 86 | - $this->pageSize = $pageSize; |
|
| 87 | - $this->pageNumber = $pageNumber; // by setting pager to -1 will cause pager to load it's last page number |
|
| 88 | - $this->pagerLocation = 'top-right'; |
|
| 89 | - } |
|
| 85 | + // set pager |
|
| 86 | + $this->pageSize = $pageSize; |
|
| 87 | + $this->pageNumber = $pageNumber; // by setting pager to -1 will cause pager to load it's last page number |
|
| 88 | + $this->pagerLocation = 'top-right'; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | 91 | public function setDataSource($ds) { |
| 92 | - $this->ds = $ds; |
|
| 93 | - } |
|
| 92 | + $this->ds = $ds; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | 95 | public function render() { |
| 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 . "'" : ''; |
|
| 101 | - |
|
| 102 | - $pagerClass = ($this->pagerClass) ? "class='" . $this->pagerClass . "'" : ''; |
|
| 103 | - $pagerStyle = ($this->pagerStyle) ? "style='" . $this->pagerStyle . "'" : "style='background-color:#ffffff;'"; |
|
| 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 . "'" : ''; |
|
| 109 | - |
|
| 110 | - $this->_alt = 0; |
|
| 111 | - $this->_total = 0; |
|
| 112 | - |
|
| 113 | - $this->_isDataset = $modx->db->isResult($this->ds); // if not dataset then treat as array |
|
| 114 | - |
|
| 115 | - if(!$cssStyle && !$cssClass) { |
|
| 116 | - $cssStyle = "style='width:100%;border:1px solid silver;font-family:verdana,arial; font-size:11px;'"; |
|
| 117 | - } |
|
| 118 | - if(!$columnHeaderStyle && !$columnHeaderClass) { |
|
| 119 | - $columnHeaderStyle = "style='color:black;background-color:silver'"; |
|
| 120 | - } |
|
| 121 | - if(!$this->_itemStyle && !$this->_itemClass) { |
|
| 122 | - $this->_itemStyle = "style='color:black;'"; |
|
| 123 | - } |
|
| 124 | - if(!$this->_altItemStyle && !$this->_altItemClass) { |
|
| 125 | - $this->_altItemStyle = "style='color:black;background-color:#eeeeee'"; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - if($this->_isDataset && !$this->columns) { |
|
| 129 | - $cols = $modx->db->numFields($this->ds); |
|
| 130 | - for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - // start grid |
|
| 134 | - $tblStart = "<table $cssClass $cssStyle cellpadding='" . (isset($this->cellPadding) ? (int) $this->cellPadding : 1) . "' cellspacing='" . (isset($this->cellSpacing) ? (int) $this->cellSpacing : 1) . "'>"; |
|
| 135 | - $tblEnd = "</table>"; |
|
| 136 | - |
|
| 137 | - // build column header |
|
| 138 | - $this->_colnames = explode((strstr($this->columns, "||") !== false ? "||" : ","), $this->columns); |
|
| 139 | - $this->_colwidths = explode((strstr($this->colWidths, "||") !== false ? "||" : ","), $this->colWidths); |
|
| 140 | - $this->_colaligns = explode((strstr($this->colAligns, "||") !== false ? "||" : ","), $this->colAligns); |
|
| 141 | - $this->_colwraps = explode((strstr($this->colWraps, "||") !== false ? "||" : ","), $this->colWraps); |
|
| 142 | - $this->_colcolors = explode((strstr($this->colColors, "||") !== false ? "||" : ","), $this->colColors); |
|
| 143 | - $this->_coltypes = explode((strstr($this->colTypes, "||") !== false ? "||" : ","), $this->colTypes); |
|
| 144 | - $this->_colcount = count($this->_colnames); |
|
| 145 | - if(!$this->_isDataset) { |
|
| 146 | - $this->ds = explode((strstr($this->ds, "||") !== false ? "||" : ","), $this->ds); |
|
| 147 | - $this->ds = array_chunk($this->ds, $this->_colcount); |
|
| 148 | - } |
|
| 149 | - $tblColHdr = "<thead><tr>"; |
|
| 150 | - for($c = 0; $c < $this->_colcount; $c++) { |
|
| 151 | - $name = $this->_colnames[$c]; |
|
| 152 | - $width = $this->_colwidths[$c]; |
|
| 153 | - $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass" . ($width ? " width='$width'" : "") . ">$name</td>"; |
|
| 154 | - } |
|
| 155 | - $tblColHdr .= "</tr></thead>\n"; |
|
| 156 | - |
|
| 157 | - // build rows |
|
| 158 | - $rowcount = $this->_isDataset ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
|
| 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"; |
|
| 162 | - } else { |
|
| 163 | - // render grid items |
|
| 164 | - if($this->pageSize <= 0) { |
|
| 165 | - for($r = 0; $r < $rowcount; $r++) { |
|
| 166 | - $row = $this->_isDataset ? $modx->db->getRow($this->ds) : $this->ds[$r]; |
|
| 167 | - $tblRows .= $this->RenderRowFnc($r + 1, $row); |
|
| 168 | - } |
|
| 169 | - } else { |
|
| 170 | - if(!$this->pager) { |
|
| 171 | - include_once dirname(__FILE__) . "/datasetpager.class.php"; |
|
| 172 | - $this->pager = new DataSetPager($this->id, $this->ds, $this->pageSize, $this->pageNumber); |
|
| 173 | - $this->pager->setRenderRowFnc($this); // pass this object |
|
| 174 | - $this->pager->cssStyle = $pagerStyle; |
|
| 175 | - $this->pager->cssClass = $pagerClass; |
|
| 176 | - } else { |
|
| 177 | - $this->pager->pageSize = $this->pageSize; |
|
| 178 | - $this->pager->pageNumber = $this->pageNumber; |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - $this->pager->render(); |
|
| 182 | - $tblRows = $this->pager->getRenderedRows(); |
|
| 183 | - $tblPager = $this->pager->getRenderedPager(); |
|
| 184 | - } |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - // setup header,pager and footer |
|
| 188 | - $o = $tblStart; |
|
| 189 | - $ptop = (substr($this->pagerLocation, 0, 3) == "top") || (substr($this->pagerLocation, 0, 4) == "both"); |
|
| 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>"; |
|
| 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>"; |
|
| 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>"; |
|
| 200 | - } |
|
| 201 | - if($this->footer) { |
|
| 202 | - $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->footer . "</td></tr>"; |
|
| 203 | - } |
|
| 204 | - $o .= $tblEnd; |
|
| 205 | - return $o; |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - // format column values |
|
| 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 . "'" : ''; |
|
| 101 | + |
|
| 102 | + $pagerClass = ($this->pagerClass) ? "class='" . $this->pagerClass . "'" : ''; |
|
| 103 | + $pagerStyle = ($this->pagerStyle) ? "style='" . $this->pagerStyle . "'" : "style='background-color:#ffffff;'"; |
|
| 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 . "'" : ''; |
|
| 109 | + |
|
| 110 | + $this->_alt = 0; |
|
| 111 | + $this->_total = 0; |
|
| 112 | + |
|
| 113 | + $this->_isDataset = $modx->db->isResult($this->ds); // if not dataset then treat as array |
|
| 114 | + |
|
| 115 | + if(!$cssStyle && !$cssClass) { |
|
| 116 | + $cssStyle = "style='width:100%;border:1px solid silver;font-family:verdana,arial; font-size:11px;'"; |
|
| 117 | + } |
|
| 118 | + if(!$columnHeaderStyle && !$columnHeaderClass) { |
|
| 119 | + $columnHeaderStyle = "style='color:black;background-color:silver'"; |
|
| 120 | + } |
|
| 121 | + if(!$this->_itemStyle && !$this->_itemClass) { |
|
| 122 | + $this->_itemStyle = "style='color:black;'"; |
|
| 123 | + } |
|
| 124 | + if(!$this->_altItemStyle && !$this->_altItemClass) { |
|
| 125 | + $this->_altItemStyle = "style='color:black;background-color:#eeeeee'"; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + if($this->_isDataset && !$this->columns) { |
|
| 129 | + $cols = $modx->db->numFields($this->ds); |
|
| 130 | + for($i = 0; $i < $cols; $i++) $this->columns .= ($i ? "," : "") . $modx->db->fieldName($this->ds, $i); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + // start grid |
|
| 134 | + $tblStart = "<table $cssClass $cssStyle cellpadding='" . (isset($this->cellPadding) ? (int) $this->cellPadding : 1) . "' cellspacing='" . (isset($this->cellSpacing) ? (int) $this->cellSpacing : 1) . "'>"; |
|
| 135 | + $tblEnd = "</table>"; |
|
| 136 | + |
|
| 137 | + // build column header |
|
| 138 | + $this->_colnames = explode((strstr($this->columns, "||") !== false ? "||" : ","), $this->columns); |
|
| 139 | + $this->_colwidths = explode((strstr($this->colWidths, "||") !== false ? "||" : ","), $this->colWidths); |
|
| 140 | + $this->_colaligns = explode((strstr($this->colAligns, "||") !== false ? "||" : ","), $this->colAligns); |
|
| 141 | + $this->_colwraps = explode((strstr($this->colWraps, "||") !== false ? "||" : ","), $this->colWraps); |
|
| 142 | + $this->_colcolors = explode((strstr($this->colColors, "||") !== false ? "||" : ","), $this->colColors); |
|
| 143 | + $this->_coltypes = explode((strstr($this->colTypes, "||") !== false ? "||" : ","), $this->colTypes); |
|
| 144 | + $this->_colcount = count($this->_colnames); |
|
| 145 | + if(!$this->_isDataset) { |
|
| 146 | + $this->ds = explode((strstr($this->ds, "||") !== false ? "||" : ","), $this->ds); |
|
| 147 | + $this->ds = array_chunk($this->ds, $this->_colcount); |
|
| 148 | + } |
|
| 149 | + $tblColHdr = "<thead><tr>"; |
|
| 150 | + for($c = 0; $c < $this->_colcount; $c++) { |
|
| 151 | + $name = $this->_colnames[$c]; |
|
| 152 | + $width = $this->_colwidths[$c]; |
|
| 153 | + $tblColHdr .= "<td $columnHeaderStyle $columnHeaderClass" . ($width ? " width='$width'" : "") . ">$name</td>"; |
|
| 154 | + } |
|
| 155 | + $tblColHdr .= "</tr></thead>\n"; |
|
| 156 | + |
|
| 157 | + // build rows |
|
| 158 | + $rowcount = $this->_isDataset ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
|
| 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"; |
|
| 162 | + } else { |
|
| 163 | + // render grid items |
|
| 164 | + if($this->pageSize <= 0) { |
|
| 165 | + for($r = 0; $r < $rowcount; $r++) { |
|
| 166 | + $row = $this->_isDataset ? $modx->db->getRow($this->ds) : $this->ds[$r]; |
|
| 167 | + $tblRows .= $this->RenderRowFnc($r + 1, $row); |
|
| 168 | + } |
|
| 169 | + } else { |
|
| 170 | + if(!$this->pager) { |
|
| 171 | + include_once dirname(__FILE__) . "/datasetpager.class.php"; |
|
| 172 | + $this->pager = new DataSetPager($this->id, $this->ds, $this->pageSize, $this->pageNumber); |
|
| 173 | + $this->pager->setRenderRowFnc($this); // pass this object |
|
| 174 | + $this->pager->cssStyle = $pagerStyle; |
|
| 175 | + $this->pager->cssClass = $pagerClass; |
|
| 176 | + } else { |
|
| 177 | + $this->pager->pageSize = $this->pageSize; |
|
| 178 | + $this->pager->pageNumber = $this->pageNumber; |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + $this->pager->render(); |
|
| 182 | + $tblRows = $this->pager->getRenderedRows(); |
|
| 183 | + $tblPager = $this->pager->getRenderedPager(); |
|
| 184 | + } |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + // setup header,pager and footer |
|
| 188 | + $o = $tblStart; |
|
| 189 | + $ptop = (substr($this->pagerLocation, 0, 3) == "top") || (substr($this->pagerLocation, 0, 4) == "both"); |
|
| 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>"; |
|
| 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>"; |
|
| 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>"; |
|
| 200 | + } |
|
| 201 | + if($this->footer) { |
|
| 202 | + $o .= "<tr><td bgcolor='#ffffff' colspan='" . $this->_colcount . "'>" . $this->footer . "</td></tr>"; |
|
| 203 | + } |
|
| 204 | + $o .= $tblEnd; |
|
| 205 | + return $o; |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + // format column values |
|
| 209 | 209 | |
| 210 | 210 | public function RenderRowFnc($n, $row) { |
| 211 | - if($this->_alt == 0) { |
|
| 212 | - $Style = $this->_itemStyle; |
|
| 213 | - $Class = $this->_itemClass; |
|
| 214 | - $this->_alt = 1; |
|
| 215 | - } else { |
|
| 216 | - $Style = $this->_altItemStyle; |
|
| 217 | - $Class = $this->_altItemClass; |
|
| 218 | - $this->_alt = 0; |
|
| 219 | - } |
|
| 220 | - $o = "<tr>"; |
|
| 221 | - for($c = 0; $c < $this->_colcount; $c++) { |
|
| 222 | - $colStyle = $Style; |
|
| 223 | - $fld = trim($this->_fieldnames[$c]); |
|
| 224 | - $width = isset($this->_colwidths[$c]) ? $this->_colwidths[$c] : null; |
|
| 225 | - $align = isset($this->_colaligns[$c]) ? $this->_colaligns[$c] : null; |
|
| 226 | - $color = isset($this->_colcolors[$c]) ? $this->_colcolors[$c] : null; |
|
| 227 | - $type = isset($this->_coltypes[$c]) ? $this->_coltypes[$c] : null; |
|
| 228 | - $nowrap = isset($this->_colwraps[$c]) ? $this->_colwraps[$c] : null; |
|
| 229 | - $value = $row[($this->_isDataset && $fld ? $fld : $c)]; |
|
| 230 | - if($color && $Style) { |
|
| 231 | - $colStyle = substr($colStyle, 0, -1) . ";background-color:$color;'"; |
|
| 232 | - } |
|
| 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>"; |
|
| 235 | - } |
|
| 236 | - $o .= "</tr>\n"; |
|
| 237 | - return $o; |
|
| 238 | - } |
|
| 211 | + if($this->_alt == 0) { |
|
| 212 | + $Style = $this->_itemStyle; |
|
| 213 | + $Class = $this->_itemClass; |
|
| 214 | + $this->_alt = 1; |
|
| 215 | + } else { |
|
| 216 | + $Style = $this->_altItemStyle; |
|
| 217 | + $Class = $this->_altItemClass; |
|
| 218 | + $this->_alt = 0; |
|
| 219 | + } |
|
| 220 | + $o = "<tr>"; |
|
| 221 | + for($c = 0; $c < $this->_colcount; $c++) { |
|
| 222 | + $colStyle = $Style; |
|
| 223 | + $fld = trim($this->_fieldnames[$c]); |
|
| 224 | + $width = isset($this->_colwidths[$c]) ? $this->_colwidths[$c] : null; |
|
| 225 | + $align = isset($this->_colaligns[$c]) ? $this->_colaligns[$c] : null; |
|
| 226 | + $color = isset($this->_colcolors[$c]) ? $this->_colcolors[$c] : null; |
|
| 227 | + $type = isset($this->_coltypes[$c]) ? $this->_coltypes[$c] : null; |
|
| 228 | + $nowrap = isset($this->_colwraps[$c]) ? $this->_colwraps[$c] : null; |
|
| 229 | + $value = $row[($this->_isDataset && $fld ? $fld : $c)]; |
|
| 230 | + if($color && $Style) { |
|
| 231 | + $colStyle = substr($colStyle, 0, -1) . ";background-color:$color;'"; |
|
| 232 | + } |
|
| 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>"; |
|
| 235 | + } |
|
| 236 | + $o .= "</tr>\n"; |
|
| 237 | + return $o; |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | 240 | public function formatColumnValue($row, $value, $type, &$align) { |
| 241 | - if(strpos($type, ":") !== false) { |
|
| 242 | - list($type, $type_format) = explode(":", $type, 2); |
|
| 243 | - } |
|
| 244 | - switch(strtolower($type)) { |
|
| 245 | - case "integer": |
|
| 246 | - if($align == "") { |
|
| 247 | - $align = "right"; |
|
| 248 | - } |
|
| 249 | - $value = number_format($value); |
|
| 250 | - break; |
|
| 251 | - |
|
| 252 | - case "float": |
|
| 253 | - if($align == "") { |
|
| 254 | - $align = "right"; |
|
| 255 | - } |
|
| 256 | - if(!$type_format) { |
|
| 257 | - $type_format = 2; |
|
| 258 | - } |
|
| 259 | - $value = number_format($value, $type_format); |
|
| 260 | - break; |
|
| 261 | - |
|
| 262 | - case "currency": |
|
| 263 | - if($align == "") { |
|
| 264 | - $align = "right"; |
|
| 265 | - } |
|
| 266 | - if(!$type_format) { |
|
| 267 | - $type_format = 2; |
|
| 268 | - } |
|
| 269 | - $value = "$" . number_format($value, $type_format); |
|
| 270 | - break; |
|
| 271 | - |
|
| 272 | - case "date": |
|
| 273 | - if($align == "") { |
|
| 274 | - $align = "right"; |
|
| 275 | - } |
|
| 276 | - if(!is_numeric($value)) { |
|
| 277 | - $value = strtotime($value); |
|
| 278 | - } |
|
| 279 | - if(!$type_format) { |
|
| 280 | - $type_format = "%A %d, %B %Y"; |
|
| 281 | - } |
|
| 282 | - $value = strftime($type_format, $value); |
|
| 283 | - break; |
|
| 284 | - |
|
| 285 | - case "boolean": |
|
| 286 | - if($align == '') { |
|
| 287 | - $align = "center"; |
|
| 288 | - } |
|
| 289 | - $value = number_format($value); |
|
| 290 | - if($value) { |
|
| 291 | - $value = '•'; |
|
| 292 | - } else { |
|
| 293 | - $value = ' '; |
|
| 294 | - } |
|
| 295 | - break; |
|
| 296 | - |
|
| 297 | - case "template": |
|
| 298 | - // replace [+value+] first |
|
| 299 | - $value = str_replace("[+value+]", $value, $type_format); |
|
| 300 | - // replace other [+fields+] |
|
| 301 | - if(strpos($value, "[+") !== false) { |
|
| 302 | - foreach($row as $k => $v) { |
|
| 303 | - $value = str_replace("[+$k+]", $v, $value); |
|
| 304 | - } |
|
| 305 | - } |
|
| 306 | - break; |
|
| 307 | - |
|
| 308 | - } |
|
| 309 | - return $value; |
|
| 310 | - } |
|
| 241 | + if(strpos($type, ":") !== false) { |
|
| 242 | + list($type, $type_format) = explode(":", $type, 2); |
|
| 243 | + } |
|
| 244 | + switch(strtolower($type)) { |
|
| 245 | + case "integer": |
|
| 246 | + if($align == "") { |
|
| 247 | + $align = "right"; |
|
| 248 | + } |
|
| 249 | + $value = number_format($value); |
|
| 250 | + break; |
|
| 251 | + |
|
| 252 | + case "float": |
|
| 253 | + if($align == "") { |
|
| 254 | + $align = "right"; |
|
| 255 | + } |
|
| 256 | + if(!$type_format) { |
|
| 257 | + $type_format = 2; |
|
| 258 | + } |
|
| 259 | + $value = number_format($value, $type_format); |
|
| 260 | + break; |
|
| 261 | + |
|
| 262 | + case "currency": |
|
| 263 | + if($align == "") { |
|
| 264 | + $align = "right"; |
|
| 265 | + } |
|
| 266 | + if(!$type_format) { |
|
| 267 | + $type_format = 2; |
|
| 268 | + } |
|
| 269 | + $value = "$" . number_format($value, $type_format); |
|
| 270 | + break; |
|
| 271 | + |
|
| 272 | + case "date": |
|
| 273 | + if($align == "") { |
|
| 274 | + $align = "right"; |
|
| 275 | + } |
|
| 276 | + if(!is_numeric($value)) { |
|
| 277 | + $value = strtotime($value); |
|
| 278 | + } |
|
| 279 | + if(!$type_format) { |
|
| 280 | + $type_format = "%A %d, %B %Y"; |
|
| 281 | + } |
|
| 282 | + $value = strftime($type_format, $value); |
|
| 283 | + break; |
|
| 284 | + |
|
| 285 | + case "boolean": |
|
| 286 | + if($align == '') { |
|
| 287 | + $align = "center"; |
|
| 288 | + } |
|
| 289 | + $value = number_format($value); |
|
| 290 | + if($value) { |
|
| 291 | + $value = '•'; |
|
| 292 | + } else { |
|
| 293 | + $value = ' '; |
|
| 294 | + } |
|
| 295 | + break; |
|
| 296 | + |
|
| 297 | + case "template": |
|
| 298 | + // replace [+value+] first |
|
| 299 | + $value = str_replace("[+value+]", $value, $type_format); |
|
| 300 | + // replace other [+fields+] |
|
| 301 | + if(strpos($value, "[+") !== false) { |
|
| 302 | + foreach($row as $k => $v) { |
|
| 303 | + $value = str_replace("[+$k+]", $v, $value); |
|
| 304 | + } |
|
| 305 | + } |
|
| 306 | + break; |
|
| 307 | + |
|
| 308 | + } |
|
| 309 | + return $value; |
|
| 310 | + } |
|
| 311 | 311 | } |
@@ -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 | } |
@@ -12,18 +12,18 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class DataSetPager { |
| 14 | 14 | |
| 15 | - public $ds; // datasource |
|
| 15 | + public $ds; // datasource |
|
| 16 | 16 | public $pageSize; |
| 17 | 17 | public $pageNumber; |
| 18 | 18 | public $rows; |
| 19 | 19 | public $pager; |
| 20 | 20 | public $id; |
| 21 | 21 | |
| 22 | - // normal page |
|
| 22 | + // normal page |
|
| 23 | 23 | public $pageStyle; |
| 24 | 24 | public $pageClass; |
| 25 | 25 | |
| 26 | - // selected page |
|
| 26 | + // selected page |
|
| 27 | 27 | public $selPageStyle; |
| 28 | 28 | public $selPageClass; |
| 29 | 29 | public $renderRowFnc; |
@@ -32,166 +32,166 @@ discard block |
||
| 32 | 32 | public $renderPagerFncArgs; |
| 33 | 33 | |
| 34 | 34 | public function __construct($id, $ds, $pageSize = 10, $pageNumber = -1) { |
| 35 | - global $_PAGE; // use view state object |
|
| 36 | - |
|
| 37 | - global $__DataSetPagerCnt; |
|
| 38 | - |
|
| 39 | - // set id |
|
| 40 | - $__DataSetPagerCnt++; |
|
| 41 | - $this->id = !empty($id) ? $id : "dsp" . $__DataSetPagerCnt; |
|
| 42 | - |
|
| 43 | - // get pagenumber |
|
| 44 | - // by setting pager to -1 cause pager to load it's last page number |
|
| 45 | - if($pageNumber == -1) { |
|
| 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']; |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - if(!is_numeric($pageNumber)) { |
|
| 54 | - $pageNumber = 1; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - $this->ds = $ds; // datasource |
|
| 58 | - $this->pageSize = $pageSize; |
|
| 59 | - $this->pageNumber = $pageNumber; |
|
| 60 | - $this->rows = ''; |
|
| 61 | - $this->pager = ''; |
|
| 62 | - } |
|
| 35 | + global $_PAGE; // use view state object |
|
| 36 | + |
|
| 37 | + global $__DataSetPagerCnt; |
|
| 38 | + |
|
| 39 | + // set id |
|
| 40 | + $__DataSetPagerCnt++; |
|
| 41 | + $this->id = !empty($id) ? $id : "dsp" . $__DataSetPagerCnt; |
|
| 42 | + |
|
| 43 | + // get pagenumber |
|
| 44 | + // by setting pager to -1 cause pager to load it's last page number |
|
| 45 | + if($pageNumber == -1) { |
|
| 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']; |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + if(!is_numeric($pageNumber)) { |
|
| 54 | + $pageNumber = 1; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + $this->ds = $ds; // datasource |
|
| 58 | + $this->pageSize = $pageSize; |
|
| 59 | + $this->pageNumber = $pageNumber; |
|
| 60 | + $this->rows = ''; |
|
| 61 | + $this->pager = ''; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | public function getRenderedPager() { |
| 65 | - return $this->pager; |
|
| 66 | - } |
|
| 65 | + return $this->pager; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | public function getRenderedRows() { |
| 69 | - return $this->rows; |
|
| 70 | - } |
|
| 69 | + return $this->rows; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | 72 | public function setDataSource($ds) { |
| 73 | - $this->ds = $ds; |
|
| 74 | - } |
|
| 73 | + $this->ds = $ds; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | public function setPageSize($ps) { |
| 77 | - $this->pageSize = $ps; |
|
| 78 | - } |
|
| 77 | + $this->pageSize = $ps; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | 80 | public function setRenderRowFnc($fncName, $args = "") { |
| 81 | - $this->renderRowFnc = &$fncName; |
|
| 82 | - $this->renderRowFncArgs = $args; // extra agruments |
|
| 81 | + $this->renderRowFnc = &$fncName; |
|
| 82 | + $this->renderRowFncArgs = $args; // extra agruments |
|
| 83 | 83 | |
| 84 | 84 | |
| 85 | - } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | 87 | public function setRenderPagerFnc($fncName, $args = "") { |
| 88 | - $this->renderPagerFnc = $fncName; |
|
| 89 | - $this->renderPagerFncArgs = $args; // extra agruments |
|
| 90 | - } |
|
| 88 | + $this->renderPagerFnc = $fncName; |
|
| 89 | + $this->renderPagerFncArgs = $args; // extra agruments |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | 92 | public function render() { |
| 93 | - global $modx, $_PAGE; |
|
| 94 | - |
|
| 95 | - $isDataset = $modx->db->isResult($this->ds); |
|
| 96 | - |
|
| 97 | - if(!$this->selPageStyle) { |
|
| 98 | - $this->selPageStyle = "font-weight:bold"; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - // get total number of rows |
|
| 102 | - $tnr = ($isDataset) ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
|
| 103 | - |
|
| 104 | - // render: no records found |
|
| 105 | - if($tnr <= 0) { |
|
| 106 | - $fnc = $this->renderRowFnc; |
|
| 107 | - $args = $this->renderRowFncArgs; |
|
| 108 | - if(isset($fnc)) { |
|
| 109 | - if($args != "") { |
|
| 110 | - $this->rows .= $fnc(0, null, $args); |
|
| 111 | - } // if agrs was specified then we will pass three params |
|
| 112 | - else { |
|
| 113 | - $this->rows .= $fnc(0, null); |
|
| 114 | - } // otherwise two will be passed |
|
| 115 | - } |
|
| 116 | - return; |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - // get total pages |
|
| 120 | - $tp = ceil($tnr / $this->pageSize); |
|
| 121 | - if($this->pageNumber > $tp) { |
|
| 122 | - $this->pageNumber = 1; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - // get page number |
|
| 126 | - $p = $this->pageNumber; |
|
| 127 | - |
|
| 128 | - // save page number to view state if available |
|
| 129 | - if(isset($_PAGE['vs'])) { |
|
| 130 | - $_PAGE['vs'][$this->id . '_dpgn'] = $p; |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - // render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments=""); |
|
| 134 | - if($tp > 1) { |
|
| 135 | - $url = ''; |
|
| 136 | - $fnc = $this->renderPagerFnc; |
|
| 137 | - $args = $this->renderPagerFncArgs; |
|
| 138 | - if(!isset($fnc)) { |
|
| 139 | - if($modx->isFrontend()) { |
|
| 140 | - $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?'; |
|
| 141 | - } else { |
|
| 142 | - $url = $_SERVER['PHP_SELF'] . '?'; |
|
| 143 | - } |
|
| 144 | - $i = 0; |
|
| 145 | - foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
| 146 | - $i++; |
|
| 147 | - $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
|
| 148 | - } |
|
| 149 | - if($i >= 1) { |
|
| 150 | - $url .= "&"; |
|
| 151 | - } |
|
| 152 | - } |
|
| 153 | - for($i = 1; $i <= $tp; $i++) { |
|
| 154 | - if(isset($fnc)) { |
|
| 155 | - if($args != "") { |
|
| 156 | - $this->pager .= $fnc($p, $i, $args); |
|
| 157 | - } else { |
|
| 158 | - $this->pager .= $fnc($p, $i); |
|
| 159 | - } |
|
| 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> "; |
|
| 162 | - } |
|
| 163 | - } |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - // render row : renderRowFnc($rowNumber,$row,$arguments="") |
|
| 167 | - $fnc = $this->renderRowFnc; |
|
| 168 | - $args = $this->renderRowFncArgs; |
|
| 169 | - |
|
| 170 | - if(isset($fnc)) { |
|
| 171 | - $i = 1; |
|
| 172 | - $fncObject = is_object($fnc); |
|
| 173 | - $minitems = (($p - 1) * $this->pageSize) + 1; |
|
| 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 != "") { |
|
| 179 | - $this->rows .= $fnc->RenderRowFnc($i, $row, $args); |
|
| 180 | - } else { |
|
| 181 | - $this->rows .= $fnc->RenderRowFnc($i, $row); |
|
| 182 | - } |
|
| 183 | - } else { |
|
| 184 | - if($args != "") { |
|
| 185 | - $this->rows .= $fnc($i, $row, $args); |
|
| 186 | - } // if agrs was specified then we wil pass three params |
|
| 187 | - else { |
|
| 188 | - $this->rows .= $fnc($i, $row); |
|
| 189 | - } // otherwise two will be passed |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - } |
|
| 193 | - $i++; |
|
| 194 | - } |
|
| 195 | - } |
|
| 196 | - } |
|
| 93 | + global $modx, $_PAGE; |
|
| 94 | + |
|
| 95 | + $isDataset = $modx->db->isResult($this->ds); |
|
| 96 | + |
|
| 97 | + if(!$this->selPageStyle) { |
|
| 98 | + $this->selPageStyle = "font-weight:bold"; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + // get total number of rows |
|
| 102 | + $tnr = ($isDataset) ? $modx->db->getRecordCount($this->ds) : count($this->ds); |
|
| 103 | + |
|
| 104 | + // render: no records found |
|
| 105 | + if($tnr <= 0) { |
|
| 106 | + $fnc = $this->renderRowFnc; |
|
| 107 | + $args = $this->renderRowFncArgs; |
|
| 108 | + if(isset($fnc)) { |
|
| 109 | + if($args != "") { |
|
| 110 | + $this->rows .= $fnc(0, null, $args); |
|
| 111 | + } // if agrs was specified then we will pass three params |
|
| 112 | + else { |
|
| 113 | + $this->rows .= $fnc(0, null); |
|
| 114 | + } // otherwise two will be passed |
|
| 115 | + } |
|
| 116 | + return; |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + // get total pages |
|
| 120 | + $tp = ceil($tnr / $this->pageSize); |
|
| 121 | + if($this->pageNumber > $tp) { |
|
| 122 | + $this->pageNumber = 1; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + // get page number |
|
| 126 | + $p = $this->pageNumber; |
|
| 127 | + |
|
| 128 | + // save page number to view state if available |
|
| 129 | + if(isset($_PAGE['vs'])) { |
|
| 130 | + $_PAGE['vs'][$this->id . '_dpgn'] = $p; |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + // render pager : renderPagerFnc($cuurentPage,$pagerNumber,$arguments=""); |
|
| 134 | + if($tp > 1) { |
|
| 135 | + $url = ''; |
|
| 136 | + $fnc = $this->renderPagerFnc; |
|
| 137 | + $args = $this->renderPagerFncArgs; |
|
| 138 | + if(!isset($fnc)) { |
|
| 139 | + if($modx->isFrontend()) { |
|
| 140 | + $url = $modx->makeUrl($modx->documentIdentifier, '', '', 'full') . '?'; |
|
| 141 | + } else { |
|
| 142 | + $url = $_SERVER['PHP_SELF'] . '?'; |
|
| 143 | + } |
|
| 144 | + $i = 0; |
|
| 145 | + foreach($_GET as $n => $v) if($n != 'dpgn' . $this->id) { |
|
| 146 | + $i++; |
|
| 147 | + $url .= (($i > 1) ? "&" : "") . "$n=$v"; |
|
| 148 | + } |
|
| 149 | + if($i >= 1) { |
|
| 150 | + $url .= "&"; |
|
| 151 | + } |
|
| 152 | + } |
|
| 153 | + for($i = 1; $i <= $tp; $i++) { |
|
| 154 | + if(isset($fnc)) { |
|
| 155 | + if($args != "") { |
|
| 156 | + $this->pager .= $fnc($p, $i, $args); |
|
| 157 | + } else { |
|
| 158 | + $this->pager .= $fnc($p, $i); |
|
| 159 | + } |
|
| 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> "; |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + // render row : renderRowFnc($rowNumber,$row,$arguments="") |
|
| 167 | + $fnc = $this->renderRowFnc; |
|
| 168 | + $args = $this->renderRowFncArgs; |
|
| 169 | + |
|
| 170 | + if(isset($fnc)) { |
|
| 171 | + $i = 1; |
|
| 172 | + $fncObject = is_object($fnc); |
|
| 173 | + $minitems = (($p - 1) * $this->pageSize) + 1; |
|
| 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 != "") { |
|
| 179 | + $this->rows .= $fnc->RenderRowFnc($i, $row, $args); |
|
| 180 | + } else { |
|
| 181 | + $this->rows .= $fnc->RenderRowFnc($i, $row); |
|
| 182 | + } |
|
| 183 | + } else { |
|
| 184 | + if($args != "") { |
|
| 185 | + $this->rows .= $fnc($i, $row, $args); |
|
| 186 | + } // if agrs was specified then we wil pass three params |
|
| 187 | + else { |
|
| 188 | + $this->rows .= $fnc($i, $row); |
|
| 189 | + } // otherwise two will be passed |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + } |
|
| 193 | + $i++; |
|
| 194 | + } |
|
| 195 | + } |
|
| 196 | + } |
|
| 197 | 197 | } |
@@ -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) { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $autoloader = realpath(__DIR__.'/../vendor/autoload.php'); |
| 52 | 52 | if (file_exists($autoloader) && is_readable($autoloader)) { |
| 53 | - include_once($autoloader); |
|
| 53 | + include_once($autoloader); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // get start time |
@@ -65,22 +65,22 @@ discard block |
||
| 65 | 65 | $site_hostnames_path = $base_path . 'assets/cache/siteHostnames.php'; |
| 66 | 66 | if(is_file($site_hostnames_path)) include_once($site_hostnames_path); |
| 67 | 67 | if(!defined('MGR_DIR') || MGR_DIR!==$mgr_dir) { |
| 68 | - $src = "<?php\n"; |
|
| 69 | - $src .= "define('MGR_DIR', '{$mgr_dir}');\n"; |
|
| 70 | - $rs = file_put_contents($site_mgr_path,$src); |
|
| 71 | - if(!$rs) { |
|
| 72 | - echo 'siteManager.php write error'; |
|
| 73 | - exit; |
|
| 74 | - } |
|
| 75 | - sleep(1); |
|
| 76 | - header('Location:' . $_SERVER['REQUEST_URI']); |
|
| 77 | - exit; |
|
| 68 | + $src = "<?php\n"; |
|
| 69 | + $src .= "define('MGR_DIR', '{$mgr_dir}');\n"; |
|
| 70 | + $rs = file_put_contents($site_mgr_path,$src); |
|
| 71 | + if(!$rs) { |
|
| 72 | + echo 'siteManager.php write error'; |
|
| 73 | + exit; |
|
| 74 | + } |
|
| 75 | + sleep(1); |
|
| 76 | + header('Location:' . $_SERVER['REQUEST_URI']); |
|
| 77 | + exit; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // we use this to make sure files are accessed through |
| 81 | 81 | // the manager instead of seperately. |
| 82 | 82 | if ( ! defined('IN_MANAGER_MODE')) { |
| 83 | - define('IN_MANAGER_MODE', true); |
|
| 83 | + define('IN_MANAGER_MODE', true); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | // harden it |
@@ -101,16 +101,16 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | // check PHP version. EVO is compatible with php 5 (5.0.0+) |
| 103 | 103 | $php_ver_comp = version_compare(phpversion(), "5.0.0"); |
| 104 | - // -1 if left is less, 0 if equal, +1 if left is higher |
|
| 104 | + // -1 if left is less, 0 if equal, +1 if left is higher |
|
| 105 | 105 | if($php_ver_comp < 0) { |
| 106 | - echo sprintf($_lang['php_version_check'], phpversion()); |
|
| 107 | - exit; |
|
| 106 | + echo sprintf($_lang['php_version_check'], phpversion()); |
|
| 107 | + exit; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // check if iconv is installed |
| 111 | 111 | if(!function_exists('iconv')) { |
| 112 | - echo $_lang['iconv_not_available']; |
|
| 113 | - exit; |
|
| 112 | + echo $_lang['iconv_not_available']; |
|
| 113 | + exit; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // set some runtime options |
@@ -123,15 +123,15 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | // set the document_root :| |
| 125 | 125 | if(!isset($_SERVER['DOCUMENT_ROOT']) || empty($_SERVER['DOCUMENT_ROOT'])) { |
| 126 | - $_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['PATH_INFO'], "", preg_replace("/\\\\/", "/", $_SERVER['PATH_TRANSLATED']))."/"; |
|
| 126 | + $_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['PATH_INFO'], "", preg_replace("/\\\\/", "/", $_SERVER['PATH_TRANSLATED']))."/"; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | // include_once config file |
| 130 | 130 | $config_filename = "./includes/config.inc.php"; |
| 131 | 131 | if (!file_exists($config_filename)) { |
| 132 | - echo "<h3>Unable to load configuration settings</h3>"; |
|
| 133 | - echo "Please run the EVO <a href='../install'>install utility</a>"; |
|
| 134 | - exit; |
|
| 132 | + echo "<h3>Unable to load configuration settings</h3>"; |
|
| 133 | + echo "Please run the EVO <a href='../install'>install utility</a>"; |
|
| 134 | + exit; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // include the database configuration file |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | // initiate the content manager class |
| 141 | 141 | if (isset($coreClass) && class_exists($coreClass)) { |
| 142 | - $modx = new $coreClass; |
|
| 142 | + $modx = new $coreClass; |
|
| 143 | 143 | } |
| 144 | 144 | if (!isset($modx) || !($modx instanceof \DocumentParser)) { |
| 145 | - include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
| 146 | - $modx = new \DocumentParser; |
|
| 145 | + include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
| 146 | + $modx = new \DocumentParser; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | $modx->loadExtension("ManagerAPI"); |
@@ -166,25 +166,25 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | // now include_once different language file as english |
| 168 | 168 | if(!isset($manager_language) || !file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) { |
| 169 | - $manager_language = "english"; // if not set, get the english language file. |
|
| 169 | + $manager_language = "english"; // if not set, get the english language file. |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // $length_eng_lang = count($_lang); // Not used for now, required for difference-check with other languages than english (i.e. inside installer) |
| 173 | 173 | |
| 174 | 174 | if($manager_language!="english" && file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) { |
| 175 | - include_once "lang/".$manager_language.".inc.php"; |
|
| 175 | + include_once "lang/".$manager_language.".inc.php"; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | // allow custom language overrides not altered by future EVO-updates |
| 179 | 179 | if(file_exists(MODX_MANAGER_PATH."includes/lang/override/".$manager_language.".inc.php")) { |
| 180 | - include_once "lang/override/".$manager_language.".inc.php"; |
|
| 180 | + include_once "lang/override/".$manager_language.".inc.php"; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $s = array('[+MGR_DIR+]'); |
| 184 | 184 | $r = array(MGR_DIR); |
| 185 | 185 | foreach($_lang as $k=>$v) |
| 186 | 186 | { |
| 187 | - if(strpos($v,'[+')!==false) $_lang[$k] = str_replace($s, $r, $v); |
|
| 187 | + if(strpos($v,'[+')!==false) $_lang[$k] = str_replace($s, $r, $v); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | // send the charset header |
@@ -199,19 +199,19 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | // double check the session |
| 201 | 201 | if(!isset($_SESSION['mgrValidated'])){ |
| 202 | - echo "Not Logged In!"; |
|
| 203 | - exit; |
|
| 202 | + echo "Not Logged In!"; |
|
| 203 | + exit; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | // include_once the style variables file |
| 207 | 207 | if(isset($manager_theme) && !isset($_style)) { |
| 208 | - $_style = array(); |
|
| 209 | - include_once "media/style/".$manager_theme."/style.php"; |
|
| 208 | + $_style = array(); |
|
| 209 | + include_once "media/style/".$manager_theme."/style.php"; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | // check if user is allowed to access manager interface |
| 213 | 213 | if(isset($allow_manager_access) && $allow_manager_access==0) { |
| 214 | - include_once "manager.lockout.inc.php"; |
|
| 214 | + include_once "manager.lockout.inc.php"; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | // Initialize System Alert Message Queque |
@@ -220,13 +220,13 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | // first we check to see if this is a frameset request |
| 222 | 222 | if(!isset($_POST['a']) && !isset($_GET['a']) && !isset($_POST['updateMsgCount'])) { |
| 223 | - // this looks to be a top-level frameset request, so let's serve up a frameset |
|
| 224 | - if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/frames/1.php")) { |
|
| 225 | - include_once "media/style/".$manager_theme."/frames/1.php"; |
|
| 226 | - }else{ |
|
| 227 | - include_once "frames/1.php"; |
|
| 228 | - } |
|
| 229 | - exit; |
|
| 223 | + // this looks to be a top-level frameset request, so let's serve up a frameset |
|
| 224 | + if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/frames/1.php")) { |
|
| 225 | + include_once "media/style/".$manager_theme."/frames/1.php"; |
|
| 226 | + }else{ |
|
| 227 | + include_once "frames/1.php"; |
|
| 228 | + } |
|
| 229 | + exit; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | // OK, let's retrieve the action directive from the request |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | else $action = null; |
| 238 | 238 | |
| 239 | 239 | if (isset($_POST['updateMsgCount']) && $modx->hasPermission('messages')) { |
| 240 | - include_once 'messageCount.inc.php'; |
|
| 240 | + include_once 'messageCount.inc.php'; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // save page to manager object |
@@ -245,19 +245,19 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | // attempt to foil some simple types of CSRF attacks |
| 247 | 247 | if (isset($modx->config['validate_referer']) && (int)$modx->config['validate_referer']) { |
| 248 | - if (isset($_SERVER['HTTP_REFERER'])) { |
|
| 249 | - $referer = $_SERVER['HTTP_REFERER']; |
|
| 250 | - |
|
| 251 | - if (!empty($referer)) { |
|
| 252 | - if (!preg_match('/^'.preg_quote(MODX_SITE_URL, '/').'/i', $referer)) { |
|
| 253 | - $modx->webAlertAndQuit("A possible CSRF attempt was detected from referer: {$referer}.", "index.php"); |
|
| 254 | - } |
|
| 255 | - } else { |
|
| 256 | - $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the client.", "index.php"); |
|
| 257 | - } |
|
| 258 | - } else { |
|
| 259 | - $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the server.", "index.php"); |
|
| 260 | - } |
|
| 248 | + if (isset($_SERVER['HTTP_REFERER'])) { |
|
| 249 | + $referer = $_SERVER['HTTP_REFERER']; |
|
| 250 | + |
|
| 251 | + if (!empty($referer)) { |
|
| 252 | + if (!preg_match('/^'.preg_quote(MODX_SITE_URL, '/').'/i', $referer)) { |
|
| 253 | + $modx->webAlertAndQuit("A possible CSRF attempt was detected from referer: {$referer}.", "index.php"); |
|
| 254 | + } |
|
| 255 | + } else { |
|
| 256 | + $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the client.", "index.php"); |
|
| 257 | + } |
|
| 258 | + } else { |
|
| 259 | + $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the server.", "index.php"); |
|
| 260 | + } |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // invoke OnManagerPageInit event |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | // return element filepath |
| 267 | 267 | function includeFileProcessor ($filepath,$manager_theme) { |
| 268 | - $element = ""; |
|
| 269 | - if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath)) { |
|
| 270 | - $element = MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath; |
|
| 271 | - }else{ |
|
| 272 | - $element = $filepath; |
|
| 273 | - } |
|
| 274 | - return $element; |
|
| 268 | + $element = ""; |
|
| 269 | + if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath)) { |
|
| 270 | + $element = MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath; |
|
| 271 | + }else{ |
|
| 272 | + $element = $filepath; |
|
| 273 | + } |
|
| 274 | + return $element; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | // Now we decide what to do according to the action request. This is a BIG list :) |
@@ -279,714 +279,714 @@ discard block |
||
| 279 | 279 | /********************************************************************/ |
| 280 | 280 | /* frame management - show the requested frame */ |
| 281 | 281 | /********************************************************************/ |
| 282 | - case 1 : |
|
| 283 | - // get the requested frame |
|
| 284 | - $frame = preg_replace('/[^a-z0-9]/i','',$_REQUEST['f']); |
|
| 285 | - if($frame>9) { |
|
| 286 | - $enable_debug=false; // this is to stop the debug thingy being attached to the framesets |
|
| 287 | - } |
|
| 288 | - include_once(includeFileProcessor("frames/".$frame.".php",$manager_theme)); |
|
| 289 | - break; |
|
| 282 | + case 1 : |
|
| 283 | + // get the requested frame |
|
| 284 | + $frame = preg_replace('/[^a-z0-9]/i','',$_REQUEST['f']); |
|
| 285 | + if($frame>9) { |
|
| 286 | + $enable_debug=false; // this is to stop the debug thingy being attached to the framesets |
|
| 287 | + } |
|
| 288 | + include_once(includeFileProcessor("frames/".$frame.".php",$manager_theme)); |
|
| 289 | + break; |
|
| 290 | 290 | /********************************************************************/ |
| 291 | 291 | /* show the homepage */ |
| 292 | 292 | /********************************************************************/ |
| 293 | - case 2: |
|
| 294 | - // get the home page |
|
| 295 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 296 | - include_once(includeFileProcessor("actions/welcome.static.php",$manager_theme)); |
|
| 297 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 298 | - break; |
|
| 293 | + case 2: |
|
| 294 | + // get the home page |
|
| 295 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 296 | + include_once(includeFileProcessor("actions/welcome.static.php",$manager_theme)); |
|
| 297 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 298 | + break; |
|
| 299 | 299 | /********************************************************************/ |
| 300 | 300 | /* document data */ |
| 301 | 301 | /********************************************************************/ |
| 302 | - case 3: |
|
| 303 | - // get the page to show document's data |
|
| 304 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 305 | - include_once(includeFileProcessor("actions/document_data.static.php",$manager_theme)); |
|
| 306 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 307 | - break; |
|
| 302 | + case 3: |
|
| 303 | + // get the page to show document's data |
|
| 304 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 305 | + include_once(includeFileProcessor("actions/document_data.static.php",$manager_theme)); |
|
| 306 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 307 | + break; |
|
| 308 | 308 | /********************************************************************/ |
| 309 | 309 | /* content management */ |
| 310 | 310 | /********************************************************************/ |
| 311 | - case 85: |
|
| 312 | - // get the mutate page for adding a folder |
|
| 313 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 314 | - include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 315 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 316 | - break; |
|
| 317 | - case 27: |
|
| 318 | - // get the mutate page for changing content |
|
| 319 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 320 | - include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 321 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 322 | - break; |
|
| 323 | - case 4: |
|
| 324 | - // get the mutate page for adding content |
|
| 325 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 326 | - include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 327 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 328 | - break; |
|
| 329 | - case 5: |
|
| 330 | - // get the save processor |
|
| 331 | - include_once(includeFileProcessor("processors/save_content.processor.php",$manager_theme)); |
|
| 332 | - break; |
|
| 333 | - case 6: |
|
| 334 | - // get the delete processor |
|
| 335 | - include_once(includeFileProcessor("processors/delete_content.processor.php",$manager_theme)); |
|
| 336 | - break; |
|
| 337 | - case 63: |
|
| 338 | - // get the undelete processor |
|
| 339 | - include_once(includeFileProcessor("processors/undelete_content.processor.php",$manager_theme)); |
|
| 340 | - break; |
|
| 341 | - case 51: |
|
| 342 | - // get the move action |
|
| 343 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 344 | - include_once(includeFileProcessor("actions/move_document.dynamic.php",$manager_theme)); |
|
| 345 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 346 | - break; |
|
| 347 | - case 52: |
|
| 348 | - // get the move document processor |
|
| 349 | - include_once(includeFileProcessor("processors/move_document.processor.php",$manager_theme)); |
|
| 350 | - break; |
|
| 351 | - case 61: |
|
| 352 | - // get the processor for publishing content |
|
| 353 | - include_once(includeFileProcessor("processors/publish_content.processor.php",$manager_theme)); |
|
| 354 | - break; |
|
| 355 | - case 62: |
|
| 356 | - // get the processor for publishing content |
|
| 357 | - include_once(includeFileProcessor("processors/unpublish_content.processor.php",$manager_theme)); |
|
| 358 | - break; |
|
| 359 | - case 56: |
|
| 360 | - // get the sort menuindex action |
|
| 361 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 362 | - include_once(includeFileProcessor("actions/mutate_menuindex_sort.dynamic.php",$manager_theme)); |
|
| 363 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 364 | - break; |
|
| 311 | + case 85: |
|
| 312 | + // get the mutate page for adding a folder |
|
| 313 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 314 | + include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 315 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 316 | + break; |
|
| 317 | + case 27: |
|
| 318 | + // get the mutate page for changing content |
|
| 319 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 320 | + include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 321 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 322 | + break; |
|
| 323 | + case 4: |
|
| 324 | + // get the mutate page for adding content |
|
| 325 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 326 | + include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 327 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 328 | + break; |
|
| 329 | + case 5: |
|
| 330 | + // get the save processor |
|
| 331 | + include_once(includeFileProcessor("processors/save_content.processor.php",$manager_theme)); |
|
| 332 | + break; |
|
| 333 | + case 6: |
|
| 334 | + // get the delete processor |
|
| 335 | + include_once(includeFileProcessor("processors/delete_content.processor.php",$manager_theme)); |
|
| 336 | + break; |
|
| 337 | + case 63: |
|
| 338 | + // get the undelete processor |
|
| 339 | + include_once(includeFileProcessor("processors/undelete_content.processor.php",$manager_theme)); |
|
| 340 | + break; |
|
| 341 | + case 51: |
|
| 342 | + // get the move action |
|
| 343 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 344 | + include_once(includeFileProcessor("actions/move_document.dynamic.php",$manager_theme)); |
|
| 345 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 346 | + break; |
|
| 347 | + case 52: |
|
| 348 | + // get the move document processor |
|
| 349 | + include_once(includeFileProcessor("processors/move_document.processor.php",$manager_theme)); |
|
| 350 | + break; |
|
| 351 | + case 61: |
|
| 352 | + // get the processor for publishing content |
|
| 353 | + include_once(includeFileProcessor("processors/publish_content.processor.php",$manager_theme)); |
|
| 354 | + break; |
|
| 355 | + case 62: |
|
| 356 | + // get the processor for publishing content |
|
| 357 | + include_once(includeFileProcessor("processors/unpublish_content.processor.php",$manager_theme)); |
|
| 358 | + break; |
|
| 359 | + case 56: |
|
| 360 | + // get the sort menuindex action |
|
| 361 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 362 | + include_once(includeFileProcessor("actions/mutate_menuindex_sort.dynamic.php",$manager_theme)); |
|
| 363 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 364 | + break; |
|
| 365 | 365 | /********************************************************************/ |
| 366 | 366 | /* show the wait page - gives the tree time to refresh (hopefully) */ |
| 367 | 367 | /********************************************************************/ |
| 368 | - case 7: |
|
| 369 | - // get the wait page (so the tree can reload) |
|
| 370 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 371 | - include_once(includeFileProcessor("actions/wait.static.php",$manager_theme)); |
|
| 372 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 373 | - break; |
|
| 368 | + case 7: |
|
| 369 | + // get the wait page (so the tree can reload) |
|
| 370 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 371 | + include_once(includeFileProcessor("actions/wait.static.php",$manager_theme)); |
|
| 372 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 373 | + break; |
|
| 374 | 374 | /********************************************************************/ |
| 375 | 375 | /* let the user log out */ |
| 376 | 376 | /********************************************************************/ |
| 377 | - case 8: |
|
| 378 | - // get the logout processor |
|
| 379 | - include_once(includeFileProcessor("processors/logout.processor.php",$manager_theme)); |
|
| 380 | - break; |
|
| 377 | + case 8: |
|
| 378 | + // get the logout processor |
|
| 379 | + include_once(includeFileProcessor("processors/logout.processor.php",$manager_theme)); |
|
| 380 | + break; |
|
| 381 | 381 | /********************************************************************/ |
| 382 | 382 | /* user management */ |
| 383 | 383 | /********************************************************************/ |
| 384 | - case 87: |
|
| 385 | - // get the new web user page |
|
| 386 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 387 | - include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme)); |
|
| 388 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 389 | - break; |
|
| 390 | - case 88: |
|
| 391 | - // get the edit web user page |
|
| 392 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 393 | - include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme)); |
|
| 394 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 395 | - break; |
|
| 396 | - case 89: |
|
| 397 | - // get the save web user processor |
|
| 398 | - include_once(includeFileProcessor("processors/save_web_user.processor.php",$manager_theme)); |
|
| 399 | - break; |
|
| 400 | - case 90: |
|
| 401 | - // get the delete web user page |
|
| 402 | - include_once(includeFileProcessor("processors/delete_web_user.processor.php",$manager_theme)); |
|
| 403 | - break; |
|
| 404 | - case 11: |
|
| 405 | - // get the new user page |
|
| 406 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 407 | - include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme)); |
|
| 408 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 409 | - break; |
|
| 410 | - case 12: |
|
| 411 | - // get the edit user page |
|
| 412 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 413 | - include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme)); |
|
| 414 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 415 | - break; |
|
| 416 | - case 32: |
|
| 417 | - // get the save user processor |
|
| 418 | - include_once(includeFileProcessor("processors/save_user.processor.php",$manager_theme)); |
|
| 419 | - break; |
|
| 420 | - case 28: |
|
| 421 | - // get the change password page |
|
| 422 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 423 | - include_once(includeFileProcessor("actions/mutate_password.dynamic.php",$manager_theme)); |
|
| 424 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 425 | - break; |
|
| 426 | - case 34: |
|
| 427 | - // get the save new password page |
|
| 428 | - include_once(includeFileProcessor("processors/save_password.processor.php",$manager_theme)); |
|
| 429 | - break; |
|
| 430 | - case 33: |
|
| 431 | - // get the delete user page |
|
| 432 | - include_once(includeFileProcessor("processors/delete_user.processor.php",$manager_theme)); |
|
| 433 | - break; |
|
| 384 | + case 87: |
|
| 385 | + // get the new web user page |
|
| 386 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 387 | + include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme)); |
|
| 388 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 389 | + break; |
|
| 390 | + case 88: |
|
| 391 | + // get the edit web user page |
|
| 392 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 393 | + include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme)); |
|
| 394 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 395 | + break; |
|
| 396 | + case 89: |
|
| 397 | + // get the save web user processor |
|
| 398 | + include_once(includeFileProcessor("processors/save_web_user.processor.php",$manager_theme)); |
|
| 399 | + break; |
|
| 400 | + case 90: |
|
| 401 | + // get the delete web user page |
|
| 402 | + include_once(includeFileProcessor("processors/delete_web_user.processor.php",$manager_theme)); |
|
| 403 | + break; |
|
| 404 | + case 11: |
|
| 405 | + // get the new user page |
|
| 406 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 407 | + include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme)); |
|
| 408 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 409 | + break; |
|
| 410 | + case 12: |
|
| 411 | + // get the edit user page |
|
| 412 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 413 | + include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme)); |
|
| 414 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 415 | + break; |
|
| 416 | + case 32: |
|
| 417 | + // get the save user processor |
|
| 418 | + include_once(includeFileProcessor("processors/save_user.processor.php",$manager_theme)); |
|
| 419 | + break; |
|
| 420 | + case 28: |
|
| 421 | + // get the change password page |
|
| 422 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 423 | + include_once(includeFileProcessor("actions/mutate_password.dynamic.php",$manager_theme)); |
|
| 424 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 425 | + break; |
|
| 426 | + case 34: |
|
| 427 | + // get the save new password page |
|
| 428 | + include_once(includeFileProcessor("processors/save_password.processor.php",$manager_theme)); |
|
| 429 | + break; |
|
| 430 | + case 33: |
|
| 431 | + // get the delete user page |
|
| 432 | + include_once(includeFileProcessor("processors/delete_user.processor.php",$manager_theme)); |
|
| 433 | + break; |
|
| 434 | 434 | /********************************************************************/ |
| 435 | 435 | /* role management */ |
| 436 | 436 | /********************************************************************/ |
| 437 | - case 38: |
|
| 438 | - // get the new role page |
|
| 439 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 440 | - include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme)); |
|
| 441 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 442 | - break; |
|
| 443 | - case 35: |
|
| 444 | - // get the edit role page |
|
| 445 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 446 | - include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme)); |
|
| 447 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 448 | - break; |
|
| 449 | - case 36: |
|
| 450 | - // get the save role page |
|
| 451 | - include_once(includeFileProcessor("processors/save_role.processor.php",$manager_theme)); |
|
| 452 | - break; |
|
| 453 | - case 37: |
|
| 454 | - // get the delete role page |
|
| 455 | - include_once(includeFileProcessor("processors/delete_role.processor.php",$manager_theme)); |
|
| 456 | - break; |
|
| 437 | + case 38: |
|
| 438 | + // get the new role page |
|
| 439 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 440 | + include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme)); |
|
| 441 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 442 | + break; |
|
| 443 | + case 35: |
|
| 444 | + // get the edit role page |
|
| 445 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 446 | + include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme)); |
|
| 447 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 448 | + break; |
|
| 449 | + case 36: |
|
| 450 | + // get the save role page |
|
| 451 | + include_once(includeFileProcessor("processors/save_role.processor.php",$manager_theme)); |
|
| 452 | + break; |
|
| 453 | + case 37: |
|
| 454 | + // get the delete role page |
|
| 455 | + include_once(includeFileProcessor("processors/delete_role.processor.php",$manager_theme)); |
|
| 456 | + break; |
|
| 457 | 457 | /********************************************************************/ |
| 458 | 458 | /* category management */ |
| 459 | 459 | /********************************************************************/ |
| 460 | - case 120: |
|
| 461 | - // get the edit category page |
|
| 462 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 463 | - include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme)); |
|
| 464 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 465 | - break; |
|
| 466 | - case 121: |
|
| 467 | - // for ajax-requests |
|
| 468 | - include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme)); |
|
| 469 | - break; |
|
| 460 | + case 120: |
|
| 461 | + // get the edit category page |
|
| 462 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 463 | + include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme)); |
|
| 464 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 465 | + break; |
|
| 466 | + case 121: |
|
| 467 | + // for ajax-requests |
|
| 468 | + include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme)); |
|
| 469 | + break; |
|
| 470 | 470 | /********************************************************************/ |
| 471 | 471 | /* template management */ |
| 472 | 472 | /********************************************************************/ |
| 473 | - case 16: |
|
| 474 | - // get the edit template action |
|
| 475 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 476 | - include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme)); |
|
| 477 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 478 | - break; |
|
| 479 | - case 19: |
|
| 480 | - // get the new template action |
|
| 481 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 482 | - include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme)); |
|
| 483 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 484 | - break; |
|
| 485 | - case 20: |
|
| 486 | - // get the save processor |
|
| 487 | - include_once(includeFileProcessor("processors/save_template.processor.php",$manager_theme)); |
|
| 488 | - break; |
|
| 489 | - case 21: |
|
| 490 | - // get the delete processor |
|
| 491 | - include_once(includeFileProcessor("processors/delete_template.processor.php",$manager_theme)); |
|
| 492 | - break; |
|
| 493 | - case 96: |
|
| 494 | - // get the duplicate template processor |
|
| 495 | - include_once(includeFileProcessor("processors/duplicate_template.processor.php",$manager_theme)); |
|
| 496 | - break; |
|
| 497 | - case 117: |
|
| 498 | - // change the tv rank for selected template |
|
| 499 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 500 | - include_once(includeFileProcessor("actions/mutate_template_tv_rank.dynamic.php",$manager_theme)); |
|
| 501 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 502 | - break; |
|
| 473 | + case 16: |
|
| 474 | + // get the edit template action |
|
| 475 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 476 | + include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme)); |
|
| 477 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 478 | + break; |
|
| 479 | + case 19: |
|
| 480 | + // get the new template action |
|
| 481 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 482 | + include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme)); |
|
| 483 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 484 | + break; |
|
| 485 | + case 20: |
|
| 486 | + // get the save processor |
|
| 487 | + include_once(includeFileProcessor("processors/save_template.processor.php",$manager_theme)); |
|
| 488 | + break; |
|
| 489 | + case 21: |
|
| 490 | + // get the delete processor |
|
| 491 | + include_once(includeFileProcessor("processors/delete_template.processor.php",$manager_theme)); |
|
| 492 | + break; |
|
| 493 | + case 96: |
|
| 494 | + // get the duplicate template processor |
|
| 495 | + include_once(includeFileProcessor("processors/duplicate_template.processor.php",$manager_theme)); |
|
| 496 | + break; |
|
| 497 | + case 117: |
|
| 498 | + // change the tv rank for selected template |
|
| 499 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 500 | + include_once(includeFileProcessor("actions/mutate_template_tv_rank.dynamic.php",$manager_theme)); |
|
| 501 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 502 | + break; |
|
| 503 | 503 | /********************************************************************/ |
| 504 | 504 | /* snippet management */ |
| 505 | 505 | /********************************************************************/ |
| 506 | - case 22: |
|
| 507 | - // get the edit snippet action |
|
| 508 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 509 | - include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme)); |
|
| 510 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 511 | - break; |
|
| 512 | - case 23: |
|
| 513 | - // get the new snippet action |
|
| 514 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 515 | - include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme)); |
|
| 516 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 517 | - break; |
|
| 518 | - case 24: |
|
| 519 | - // get the save processor |
|
| 520 | - include_once(includeFileProcessor("processors/save_snippet.processor.php",$manager_theme)); |
|
| 521 | - break; |
|
| 522 | - case 25: |
|
| 523 | - // get the delete processor |
|
| 524 | - include_once(includeFileProcessor("processors/delete_snippet.processor.php",$manager_theme)); |
|
| 525 | - break; |
|
| 526 | - case 98: |
|
| 527 | - // get the duplicate processor |
|
| 528 | - include_once(includeFileProcessor("processors/duplicate_snippet.processor.php",$manager_theme)); |
|
| 529 | - break; |
|
| 506 | + case 22: |
|
| 507 | + // get the edit snippet action |
|
| 508 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 509 | + include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme)); |
|
| 510 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 511 | + break; |
|
| 512 | + case 23: |
|
| 513 | + // get the new snippet action |
|
| 514 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 515 | + include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme)); |
|
| 516 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 517 | + break; |
|
| 518 | + case 24: |
|
| 519 | + // get the save processor |
|
| 520 | + include_once(includeFileProcessor("processors/save_snippet.processor.php",$manager_theme)); |
|
| 521 | + break; |
|
| 522 | + case 25: |
|
| 523 | + // get the delete processor |
|
| 524 | + include_once(includeFileProcessor("processors/delete_snippet.processor.php",$manager_theme)); |
|
| 525 | + break; |
|
| 526 | + case 98: |
|
| 527 | + // get the duplicate processor |
|
| 528 | + include_once(includeFileProcessor("processors/duplicate_snippet.processor.php",$manager_theme)); |
|
| 529 | + break; |
|
| 530 | 530 | /********************************************************************/ |
| 531 | 531 | /* htmlsnippet management */ |
| 532 | 532 | /********************************************************************/ |
| 533 | - case 78: |
|
| 534 | - // get the edit snippet action |
|
| 535 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 536 | - include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme)); |
|
| 537 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 538 | - break; |
|
| 539 | - case 77: |
|
| 540 | - // get the new snippet action |
|
| 541 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 542 | - include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme)); |
|
| 543 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 544 | - break; |
|
| 545 | - case 79: |
|
| 546 | - // get the save processor |
|
| 547 | - include_once(includeFileProcessor("processors/save_htmlsnippet.processor.php",$manager_theme)); |
|
| 548 | - break; |
|
| 549 | - case 80: |
|
| 550 | - // get the delete processor |
|
| 551 | - include_once(includeFileProcessor("processors/delete_htmlsnippet.processor.php",$manager_theme)); |
|
| 552 | - break; |
|
| 553 | - case 97: |
|
| 554 | - // get the duplicate processor |
|
| 555 | - include_once(includeFileProcessor("processors/duplicate_htmlsnippet.processor.php",$manager_theme)); |
|
| 556 | - break; |
|
| 533 | + case 78: |
|
| 534 | + // get the edit snippet action |
|
| 535 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 536 | + include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme)); |
|
| 537 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 538 | + break; |
|
| 539 | + case 77: |
|
| 540 | + // get the new snippet action |
|
| 541 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 542 | + include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme)); |
|
| 543 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 544 | + break; |
|
| 545 | + case 79: |
|
| 546 | + // get the save processor |
|
| 547 | + include_once(includeFileProcessor("processors/save_htmlsnippet.processor.php",$manager_theme)); |
|
| 548 | + break; |
|
| 549 | + case 80: |
|
| 550 | + // get the delete processor |
|
| 551 | + include_once(includeFileProcessor("processors/delete_htmlsnippet.processor.php",$manager_theme)); |
|
| 552 | + break; |
|
| 553 | + case 97: |
|
| 554 | + // get the duplicate processor |
|
| 555 | + include_once(includeFileProcessor("processors/duplicate_htmlsnippet.processor.php",$manager_theme)); |
|
| 556 | + break; |
|
| 557 | 557 | /********************************************************************/ |
| 558 | 558 | /* show the credits page */ |
| 559 | 559 | /********************************************************************/ |
| 560 | - case 18: |
|
| 561 | - // get the credits page |
|
| 562 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 563 | - include_once(includeFileProcessor("actions/credits.static.php",$manager_theme)); |
|
| 564 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 565 | - break; |
|
| 560 | + case 18: |
|
| 561 | + // get the credits page |
|
| 562 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 563 | + include_once(includeFileProcessor("actions/credits.static.php",$manager_theme)); |
|
| 564 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 565 | + break; |
|
| 566 | 566 | /********************************************************************/ |
| 567 | 567 | /* empty cache & synchronisation */ |
| 568 | 568 | /********************************************************************/ |
| 569 | - case 26: |
|
| 570 | - // get the cache emptying processor |
|
| 571 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 572 | - include_once(includeFileProcessor("actions/refresh_site.dynamic.php",$manager_theme)); |
|
| 573 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 574 | - break; |
|
| 569 | + case 26: |
|
| 570 | + // get the cache emptying processor |
|
| 571 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 572 | + include_once(includeFileProcessor("actions/refresh_site.dynamic.php",$manager_theme)); |
|
| 573 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 574 | + break; |
|
| 575 | 575 | /********************************************************************/ |
| 576 | 576 | /* Module management */ |
| 577 | 577 | /********************************************************************/ |
| 578 | - case 106: |
|
| 579 | - // get module management |
|
| 580 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 581 | - include_once(includeFileProcessor("actions/modules.static.php",$manager_theme)); |
|
| 582 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 583 | - break; |
|
| 584 | - case 107: |
|
| 585 | - // get the new module action |
|
| 586 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 587 | - include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme)); |
|
| 588 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 589 | - break; |
|
| 590 | - case 108: |
|
| 591 | - // get the edit module action |
|
| 592 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 593 | - include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme)); |
|
| 594 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 595 | - break; |
|
| 596 | - case 109: |
|
| 597 | - // get the save processor |
|
| 598 | - include_once(includeFileProcessor("processors/save_module.processor.php",$manager_theme)); |
|
| 599 | - break; |
|
| 600 | - case 110: |
|
| 601 | - // get the delete processor |
|
| 602 | - include_once(includeFileProcessor("processors/delete_module.processor.php",$manager_theme)); |
|
| 603 | - break; |
|
| 604 | - case 111: |
|
| 605 | - // get the duplicate processor |
|
| 606 | - include_once(includeFileProcessor("processors/duplicate_module.processor.php",$manager_theme)); |
|
| 607 | - break; |
|
| 608 | - case 112: |
|
| 609 | - // execute/run the module |
|
| 610 | - //include_once "header.inc.php"; |
|
| 611 | - include_once(includeFileProcessor("processors/execute_module.processor.php",$manager_theme)); |
|
| 612 | - //include_once "footer.inc.php"; |
|
| 613 | - break; |
|
| 614 | - case 113: |
|
| 615 | - // get the module resources (dependencies) action |
|
| 616 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 617 | - include_once(includeFileProcessor("actions/mutate_module_resources.dynamic.php",$manager_theme)); |
|
| 618 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 619 | - break; |
|
| 578 | + case 106: |
|
| 579 | + // get module management |
|
| 580 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 581 | + include_once(includeFileProcessor("actions/modules.static.php",$manager_theme)); |
|
| 582 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 583 | + break; |
|
| 584 | + case 107: |
|
| 585 | + // get the new module action |
|
| 586 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 587 | + include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme)); |
|
| 588 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 589 | + break; |
|
| 590 | + case 108: |
|
| 591 | + // get the edit module action |
|
| 592 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 593 | + include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme)); |
|
| 594 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 595 | + break; |
|
| 596 | + case 109: |
|
| 597 | + // get the save processor |
|
| 598 | + include_once(includeFileProcessor("processors/save_module.processor.php",$manager_theme)); |
|
| 599 | + break; |
|
| 600 | + case 110: |
|
| 601 | + // get the delete processor |
|
| 602 | + include_once(includeFileProcessor("processors/delete_module.processor.php",$manager_theme)); |
|
| 603 | + break; |
|
| 604 | + case 111: |
|
| 605 | + // get the duplicate processor |
|
| 606 | + include_once(includeFileProcessor("processors/duplicate_module.processor.php",$manager_theme)); |
|
| 607 | + break; |
|
| 608 | + case 112: |
|
| 609 | + // execute/run the module |
|
| 610 | + //include_once "header.inc.php"; |
|
| 611 | + include_once(includeFileProcessor("processors/execute_module.processor.php",$manager_theme)); |
|
| 612 | + //include_once "footer.inc.php"; |
|
| 613 | + break; |
|
| 614 | + case 113: |
|
| 615 | + // get the module resources (dependencies) action |
|
| 616 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 617 | + include_once(includeFileProcessor("actions/mutate_module_resources.dynamic.php",$manager_theme)); |
|
| 618 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 619 | + break; |
|
| 620 | 620 | /********************************************************************/ |
| 621 | 621 | /* plugin management */ |
| 622 | 622 | /********************************************************************/ |
| 623 | - case 100: |
|
| 624 | - // change the plugin priority |
|
| 625 | - //include_once "header.inc.php"; - in action file |
|
| 626 | - include_once(includeFileProcessor("actions/mutate_plugin_priority.dynamic.php",$manager_theme)); |
|
| 627 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 628 | - break; |
|
| 629 | - case 101: |
|
| 630 | - // get the new plugin action |
|
| 631 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 632 | - include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme)); |
|
| 633 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 634 | - break; |
|
| 635 | - case 102: |
|
| 636 | - // get the edit plugin action |
|
| 637 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 638 | - include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme)); |
|
| 639 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 640 | - break; |
|
| 641 | - case 103: |
|
| 642 | - // get the save processor |
|
| 643 | - include_once(includeFileProcessor("processors/save_plugin.processor.php",$manager_theme)); |
|
| 644 | - break; |
|
| 645 | - case 104: |
|
| 646 | - // get the delete processor |
|
| 647 | - include_once(includeFileProcessor("processors/delete_plugin.processor.php",$manager_theme)); |
|
| 648 | - break; |
|
| 649 | - case 105: |
|
| 650 | - // get the duplicate processor |
|
| 651 | - include_once(includeFileProcessor("processors/duplicate_plugin.processor.php",$manager_theme)); |
|
| 652 | - break; |
|
| 653 | - case 119: |
|
| 654 | - // get the purge processor |
|
| 655 | - include_once(includeFileProcessor("processors/purge_plugin.processor.php",$manager_theme)); |
|
| 656 | - break; |
|
| 623 | + case 100: |
|
| 624 | + // change the plugin priority |
|
| 625 | + //include_once "header.inc.php"; - in action file |
|
| 626 | + include_once(includeFileProcessor("actions/mutate_plugin_priority.dynamic.php",$manager_theme)); |
|
| 627 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 628 | + break; |
|
| 629 | + case 101: |
|
| 630 | + // get the new plugin action |
|
| 631 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 632 | + include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme)); |
|
| 633 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 634 | + break; |
|
| 635 | + case 102: |
|
| 636 | + // get the edit plugin action |
|
| 637 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 638 | + include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme)); |
|
| 639 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 640 | + break; |
|
| 641 | + case 103: |
|
| 642 | + // get the save processor |
|
| 643 | + include_once(includeFileProcessor("processors/save_plugin.processor.php",$manager_theme)); |
|
| 644 | + break; |
|
| 645 | + case 104: |
|
| 646 | + // get the delete processor |
|
| 647 | + include_once(includeFileProcessor("processors/delete_plugin.processor.php",$manager_theme)); |
|
| 648 | + break; |
|
| 649 | + case 105: |
|
| 650 | + // get the duplicate processor |
|
| 651 | + include_once(includeFileProcessor("processors/duplicate_plugin.processor.php",$manager_theme)); |
|
| 652 | + break; |
|
| 653 | + case 119: |
|
| 654 | + // get the purge processor |
|
| 655 | + include_once(includeFileProcessor("processors/purge_plugin.processor.php",$manager_theme)); |
|
| 656 | + break; |
|
| 657 | 657 | /********************************************************************/ |
| 658 | 658 | /* view phpinfo */ |
| 659 | 659 | /********************************************************************/ |
| 660 | - case 200: |
|
| 661 | - // show phpInfo |
|
| 662 | - if($modx->hasPermission('logs')) { |
|
| 663 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 664 | - include_once(includeFileProcessor("actions/phpinfo.static.php",$manager_theme)); |
|
| 665 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 666 | - } |
|
| 667 | - break; |
|
| 660 | + case 200: |
|
| 661 | + // show phpInfo |
|
| 662 | + if($modx->hasPermission('logs')) { |
|
| 663 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 664 | + include_once(includeFileProcessor("actions/phpinfo.static.php",$manager_theme)); |
|
| 665 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 666 | + } |
|
| 667 | + break; |
|
| 668 | 668 | /********************************************************************/ |
| 669 | 669 | /* errorpage */ |
| 670 | 670 | /********************************************************************/ |
| 671 | - case 29: |
|
| 672 | - // get the error page |
|
| 673 | - include_once(includeFileProcessor("actions/error_dialog.static.php",$manager_theme)); |
|
| 674 | - break; |
|
| 671 | + case 29: |
|
| 672 | + // get the error page |
|
| 673 | + include_once(includeFileProcessor("actions/error_dialog.static.php",$manager_theme)); |
|
| 674 | + break; |
|
| 675 | 675 | /********************************************************************/ |
| 676 | 676 | /* file manager */ |
| 677 | 677 | /********************************************************************/ |
| 678 | - case 31: |
|
| 679 | - // get the page to manage files |
|
| 680 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 681 | - include_once(includeFileProcessor("actions/files.dynamic.php",$manager_theme)); |
|
| 682 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 683 | - break; |
|
| 678 | + case 31: |
|
| 679 | + // get the page to manage files |
|
| 680 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 681 | + include_once(includeFileProcessor("actions/files.dynamic.php",$manager_theme)); |
|
| 682 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 683 | + break; |
|
| 684 | 684 | /********************************************************************/ |
| 685 | 685 | /* access permissions */ |
| 686 | 686 | /********************************************************************/ |
| 687 | - case 40: |
|
| 688 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 689 | - include_once(includeFileProcessor("actions/access_permissions.dynamic.php",$manager_theme)); |
|
| 690 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 691 | - break; |
|
| 692 | - case 91: |
|
| 693 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 694 | - include_once(includeFileProcessor("actions/web_access_permissions.dynamic.php",$manager_theme)); |
|
| 695 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 696 | - break; |
|
| 687 | + case 40: |
|
| 688 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 689 | + include_once(includeFileProcessor("actions/access_permissions.dynamic.php",$manager_theme)); |
|
| 690 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 691 | + break; |
|
| 692 | + case 91: |
|
| 693 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 694 | + include_once(includeFileProcessor("actions/web_access_permissions.dynamic.php",$manager_theme)); |
|
| 695 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 696 | + break; |
|
| 697 | 697 | /********************************************************************/ |
| 698 | 698 | /* access groups processor */ |
| 699 | 699 | /********************************************************************/ |
| 700 | - case 41: |
|
| 701 | - include_once(includeFileProcessor("processors/access_groups.processor.php",$manager_theme)); |
|
| 702 | - break; |
|
| 703 | - case 92: |
|
| 704 | - include_once(includeFileProcessor("processors/web_access_groups.processor.php",$manager_theme)); |
|
| 705 | - break; |
|
| 700 | + case 41: |
|
| 701 | + include_once(includeFileProcessor("processors/access_groups.processor.php",$manager_theme)); |
|
| 702 | + break; |
|
| 703 | + case 92: |
|
| 704 | + include_once(includeFileProcessor("processors/web_access_groups.processor.php",$manager_theme)); |
|
| 705 | + break; |
|
| 706 | 706 | /********************************************************************/ |
| 707 | 707 | /* settings editor */ |
| 708 | 708 | /********************************************************************/ |
| 709 | - case 17: |
|
| 710 | - // get the settings editor |
|
| 711 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 712 | - include_once(includeFileProcessor("actions/mutate_settings.dynamic.php",$manager_theme)); |
|
| 713 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 714 | - break; |
|
| 715 | - case 118: |
|
| 716 | - // call settings ajax include |
|
| 717 | - ob_clean(); |
|
| 718 | - include_once(includeFileProcessor("includes/mutate_settings.ajax.php",$manager_theme)); |
|
| 719 | - break; |
|
| 709 | + case 17: |
|
| 710 | + // get the settings editor |
|
| 711 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 712 | + include_once(includeFileProcessor("actions/mutate_settings.dynamic.php",$manager_theme)); |
|
| 713 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 714 | + break; |
|
| 715 | + case 118: |
|
| 716 | + // call settings ajax include |
|
| 717 | + ob_clean(); |
|
| 718 | + include_once(includeFileProcessor("includes/mutate_settings.ajax.php",$manager_theme)); |
|
| 719 | + break; |
|
| 720 | 720 | /********************************************************************/ |
| 721 | 721 | /* save settings */ |
| 722 | 722 | /********************************************************************/ |
| 723 | - case 30: |
|
| 724 | - // get the save settings processor |
|
| 725 | - include_once(includeFileProcessor("processors/save_settings.processor.php",$manager_theme)); |
|
| 726 | - break; |
|
| 723 | + case 30: |
|
| 724 | + // get the save settings processor |
|
| 725 | + include_once(includeFileProcessor("processors/save_settings.processor.php",$manager_theme)); |
|
| 726 | + break; |
|
| 727 | 727 | /********************************************************************/ |
| 728 | 728 | /* system information */ |
| 729 | 729 | /********************************************************************/ |
| 730 | - case 53: |
|
| 731 | - // get the settings editor |
|
| 732 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 733 | - include_once(includeFileProcessor("actions/sysinfo.static.php",$manager_theme)); |
|
| 734 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 735 | - break; |
|
| 730 | + case 53: |
|
| 731 | + // get the settings editor |
|
| 732 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 733 | + include_once(includeFileProcessor("actions/sysinfo.static.php",$manager_theme)); |
|
| 734 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 735 | + break; |
|
| 736 | 736 | /********************************************************************/ |
| 737 | 737 | /* optimise table */ |
| 738 | 738 | /********************************************************************/ |
| 739 | - case 54: |
|
| 740 | - // get the table optimizer/truncate processor |
|
| 741 | - include_once(includeFileProcessor("processors/optimize_table.processor.php",$manager_theme)); |
|
| 742 | - break; |
|
| 739 | + case 54: |
|
| 740 | + // get the table optimizer/truncate processor |
|
| 741 | + include_once(includeFileProcessor("processors/optimize_table.processor.php",$manager_theme)); |
|
| 742 | + break; |
|
| 743 | 743 | /********************************************************************/ |
| 744 | 744 | /* view logging */ |
| 745 | 745 | /********************************************************************/ |
| 746 | - case 13: |
|
| 747 | - // view logging |
|
| 748 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 749 | - include_once(includeFileProcessor("actions/logging.static.php",$manager_theme)); |
|
| 750 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 751 | - break; |
|
| 746 | + case 13: |
|
| 747 | + // view logging |
|
| 748 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 749 | + include_once(includeFileProcessor("actions/logging.static.php",$manager_theme)); |
|
| 750 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 751 | + break; |
|
| 752 | 752 | /********************************************************************/ |
| 753 | 753 | /* empty logs */ |
| 754 | 754 | /********************************************************************/ |
| 755 | - case 55: |
|
| 756 | - // get the settings editor |
|
| 757 | - include_once(includeFileProcessor("processors/empty_table.processor.php",$manager_theme)); |
|
| 758 | - break; |
|
| 755 | + case 55: |
|
| 756 | + // get the settings editor |
|
| 757 | + include_once(includeFileProcessor("processors/empty_table.processor.php",$manager_theme)); |
|
| 758 | + break; |
|
| 759 | 759 | /********************************************************************/ |
| 760 | 760 | /* calls test page */ |
| 761 | 761 | /********************************************************************/ |
| 762 | - case 999: |
|
| 763 | - // get the test page |
|
| 764 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 765 | - include_once(includeFileProcessor("test_page.php",$manager_theme)); |
|
| 766 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 767 | - break; |
|
| 762 | + case 999: |
|
| 763 | + // get the test page |
|
| 764 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 765 | + include_once(includeFileProcessor("test_page.php",$manager_theme)); |
|
| 766 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 767 | + break; |
|
| 768 | 768 | /********************************************************************/ |
| 769 | 769 | /* Empty recycle bin */ |
| 770 | 770 | /********************************************************************/ |
| 771 | - case 64: |
|
| 772 | - // get the Recycle bin emptier |
|
| 773 | - include_once(includeFileProcessor("processors/remove_content.processor.php",$manager_theme)); |
|
| 774 | - break; |
|
| 771 | + case 64: |
|
| 772 | + // get the Recycle bin emptier |
|
| 773 | + include_once(includeFileProcessor("processors/remove_content.processor.php",$manager_theme)); |
|
| 774 | + break; |
|
| 775 | 775 | /********************************************************************/ |
| 776 | 776 | /* Messages */ |
| 777 | 777 | /********************************************************************/ |
| 778 | - case 10: |
|
| 779 | - // get the messages page |
|
| 780 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 781 | - include_once(includeFileProcessor("actions/messages.static.php",$manager_theme)); |
|
| 782 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 783 | - break; |
|
| 778 | + case 10: |
|
| 779 | + // get the messages page |
|
| 780 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 781 | + include_once(includeFileProcessor("actions/messages.static.php",$manager_theme)); |
|
| 782 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 783 | + break; |
|
| 784 | 784 | /********************************************************************/ |
| 785 | 785 | /* Delete a message */ |
| 786 | 786 | /********************************************************************/ |
| 787 | - case 65: |
|
| 788 | - // get the message deleter |
|
| 789 | - include_once(includeFileProcessor("processors/delete_message.processor.php",$manager_theme)); |
|
| 790 | - break; |
|
| 787 | + case 65: |
|
| 788 | + // get the message deleter |
|
| 789 | + include_once(includeFileProcessor("processors/delete_message.processor.php",$manager_theme)); |
|
| 790 | + break; |
|
| 791 | 791 | /********************************************************************/ |
| 792 | 792 | /* Send a message */ |
| 793 | 793 | /********************************************************************/ |
| 794 | - case 66: |
|
| 795 | - // get the message deleter |
|
| 796 | - include_once(includeFileProcessor("processors/send_message.processor.php",$manager_theme)); |
|
| 797 | - break; |
|
| 794 | + case 66: |
|
| 795 | + // get the message deleter |
|
| 796 | + include_once(includeFileProcessor("processors/send_message.processor.php",$manager_theme)); |
|
| 797 | + break; |
|
| 798 | 798 | /********************************************************************/ |
| 799 | 799 | /* Remove locks */ |
| 800 | 800 | /********************************************************************/ |
| 801 | - case 67: |
|
| 802 | - // get the lock remover |
|
| 803 | - include_once(includeFileProcessor("processors/remove_locks.processor.php",$manager_theme)); |
|
| 804 | - break; |
|
| 801 | + case 67: |
|
| 802 | + // get the lock remover |
|
| 803 | + include_once(includeFileProcessor("processors/remove_locks.processor.php",$manager_theme)); |
|
| 804 | + break; |
|
| 805 | 805 | /********************************************************************/ |
| 806 | 806 | /* Site schedule */ |
| 807 | 807 | /********************************************************************/ |
| 808 | - case 70: |
|
| 809 | - // get the schedule page |
|
| 810 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 811 | - include_once(includeFileProcessor("actions/site_schedule.static.php",$manager_theme)); |
|
| 812 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 813 | - break; |
|
| 808 | + case 70: |
|
| 809 | + // get the schedule page |
|
| 810 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 811 | + include_once(includeFileProcessor("actions/site_schedule.static.php",$manager_theme)); |
|
| 812 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 813 | + break; |
|
| 814 | 814 | /********************************************************************/ |
| 815 | 815 | /* Search */ |
| 816 | 816 | /********************************************************************/ |
| 817 | - case 71: |
|
| 818 | - // get the search page |
|
| 819 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 820 | - include_once(includeFileProcessor("actions/search.static.php",$manager_theme)); |
|
| 821 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 822 | - break; |
|
| 817 | + case 71: |
|
| 818 | + // get the search page |
|
| 819 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 820 | + include_once(includeFileProcessor("actions/search.static.php",$manager_theme)); |
|
| 821 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 822 | + break; |
|
| 823 | 823 | /********************************************************************/ |
| 824 | 824 | /* About */ |
| 825 | 825 | /********************************************************************/ |
| 826 | - case 59: |
|
| 827 | - // get the about page |
|
| 828 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 829 | - include_once(includeFileProcessor("actions/about.static.php",$manager_theme)); |
|
| 830 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 831 | - break; |
|
| 826 | + case 59: |
|
| 827 | + // get the about page |
|
| 828 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 829 | + include_once(includeFileProcessor("actions/about.static.php",$manager_theme)); |
|
| 830 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 831 | + break; |
|
| 832 | 832 | /********************************************************************/ |
| 833 | 833 | /* Add weblink */ |
| 834 | 834 | /********************************************************************/ |
| 835 | - case 72: |
|
| 836 | - // get the weblink page |
|
| 837 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 838 | - include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 839 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 840 | - break; |
|
| 835 | + case 72: |
|
| 836 | + // get the weblink page |
|
| 837 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 838 | + include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
| 839 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 840 | + break; |
|
| 841 | 841 | /********************************************************************/ |
| 842 | 842 | /* User management */ |
| 843 | 843 | /********************************************************************/ |
| 844 | - case 75: |
|
| 845 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 846 | - include_once(includeFileProcessor("actions/user_management.static.php",$manager_theme)); |
|
| 847 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 848 | - break; |
|
| 849 | - case 99: |
|
| 850 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 851 | - include_once(includeFileProcessor("actions/web_user_management.static.php",$manager_theme)); |
|
| 852 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 853 | - break; |
|
| 854 | - case 86: |
|
| 855 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 856 | - include_once(includeFileProcessor("actions/role_management.static.php",$manager_theme)); |
|
| 857 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 858 | - break; |
|
| 844 | + case 75: |
|
| 845 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 846 | + include_once(includeFileProcessor("actions/user_management.static.php",$manager_theme)); |
|
| 847 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 848 | + break; |
|
| 849 | + case 99: |
|
| 850 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 851 | + include_once(includeFileProcessor("actions/web_user_management.static.php",$manager_theme)); |
|
| 852 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 853 | + break; |
|
| 854 | + case 86: |
|
| 855 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 856 | + include_once(includeFileProcessor("actions/role_management.static.php",$manager_theme)); |
|
| 857 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 858 | + break; |
|
| 859 | 859 | /********************************************************************/ |
| 860 | 860 | /* template/ snippet management */ |
| 861 | 861 | /********************************************************************/ |
| 862 | - case 76: |
|
| 863 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 864 | - include_once(includeFileProcessor("actions/resources.static.php",$manager_theme)); |
|
| 865 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 866 | - break; |
|
| 862 | + case 76: |
|
| 863 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 864 | + include_once(includeFileProcessor("actions/resources.static.php",$manager_theme)); |
|
| 865 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 866 | + break; |
|
| 867 | 867 | /********************************************************************/ |
| 868 | 868 | /* Export to file */ |
| 869 | 869 | /********************************************************************/ |
| 870 | - case 83: |
|
| 871 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 872 | - include_once(includeFileProcessor("actions/export_site.static.php",$manager_theme)); |
|
| 873 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 874 | - break; |
|
| 870 | + case 83: |
|
| 871 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 872 | + include_once(includeFileProcessor("actions/export_site.static.php",$manager_theme)); |
|
| 873 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 874 | + break; |
|
| 875 | 875 | /********************************************************************/ |
| 876 | 876 | /* Resource Selector */ |
| 877 | 877 | /********************************************************************/ |
| 878 | - case 84: |
|
| 879 | - include_once(includeFileProcessor("actions/resource_selector.static.php",$manager_theme)); |
|
| 880 | - break; |
|
| 878 | + case 84: |
|
| 879 | + include_once(includeFileProcessor("actions/resource_selector.static.php",$manager_theme)); |
|
| 880 | + break; |
|
| 881 | 881 | /********************************************************************/ |
| 882 | 882 | /* Backup Manager */ |
| 883 | 883 | /********************************************************************/ |
| 884 | - case 93: |
|
| 885 | - # header and footer will be handled interally |
|
| 886 | - include_once(includeFileProcessor("actions/bkmanager.static.php",$manager_theme)); |
|
| 887 | - break; |
|
| 884 | + case 93: |
|
| 885 | + # header and footer will be handled interally |
|
| 886 | + include_once(includeFileProcessor("actions/bkmanager.static.php",$manager_theme)); |
|
| 887 | + break; |
|
| 888 | 888 | /********************************************************************/ |
| 889 | 889 | /* Duplicate Document */ |
| 890 | 890 | /********************************************************************/ |
| 891 | - case 94: |
|
| 892 | - // get the duplicate processor |
|
| 893 | - include_once(includeFileProcessor("processors/duplicate_content.processor.php",$manager_theme)); |
|
| 894 | - break; |
|
| 891 | + case 94: |
|
| 892 | + // get the duplicate processor |
|
| 893 | + include_once(includeFileProcessor("processors/duplicate_content.processor.php",$manager_theme)); |
|
| 894 | + break; |
|
| 895 | 895 | /********************************************************************/ |
| 896 | 896 | /* Import Document from file */ |
| 897 | 897 | /********************************************************************/ |
| 898 | - case 95: |
|
| 899 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 900 | - include_once(includeFileProcessor("actions/import_site.static.php",$manager_theme)); |
|
| 901 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 902 | - break; |
|
| 898 | + case 95: |
|
| 899 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 900 | + include_once(includeFileProcessor("actions/import_site.static.php",$manager_theme)); |
|
| 901 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 902 | + break; |
|
| 903 | 903 | /********************************************************************/ |
| 904 | 904 | /* Help */ |
| 905 | 905 | /********************************************************************/ |
| 906 | - case 9: |
|
| 907 | - // get the help page |
|
| 908 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 909 | - include_once(includeFileProcessor("actions/help.static.php",$manager_theme)); |
|
| 910 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 911 | - break; |
|
| 906 | + case 9: |
|
| 907 | + // get the help page |
|
| 908 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 909 | + include_once(includeFileProcessor("actions/help.static.php",$manager_theme)); |
|
| 910 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 911 | + break; |
|
| 912 | 912 | /********************************************************************/ |
| 913 | 913 | /* Template Variables - Based on Apodigm's Docvars */ |
| 914 | 914 | /********************************************************************/ |
| 915 | - case 300: |
|
| 916 | - // get the new document variable action |
|
| 917 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 918 | - include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme)); |
|
| 919 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 920 | - break; |
|
| 921 | - case 301: |
|
| 922 | - // get the edit document variable action |
|
| 923 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 924 | - include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme)); |
|
| 925 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 926 | - break; |
|
| 927 | - case 302: |
|
| 928 | - // get the save processor |
|
| 929 | - include_once(includeFileProcessor("processors/save_tmplvars.processor.php",$manager_theme)); |
|
| 930 | - break; |
|
| 931 | - case 303: |
|
| 932 | - // get the delete processor |
|
| 933 | - include_once(includeFileProcessor("processors/delete_tmplvars.processor.php",$manager_theme)); |
|
| 934 | - break; |
|
| 935 | - case 304: |
|
| 936 | - // get the duplicate processor |
|
| 937 | - include_once(includeFileProcessor("processors/duplicate_tmplvars.processor.php",$manager_theme)); |
|
| 938 | - break; |
|
| 939 | - case 305: |
|
| 940 | - // get the tv-rank action |
|
| 941 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 942 | - include_once(includeFileProcessor("actions/mutate_tv_rank.dynamic.php",$manager_theme)); |
|
| 943 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 944 | - break; |
|
| 915 | + case 300: |
|
| 916 | + // get the new document variable action |
|
| 917 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 918 | + include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme)); |
|
| 919 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 920 | + break; |
|
| 921 | + case 301: |
|
| 922 | + // get the edit document variable action |
|
| 923 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 924 | + include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme)); |
|
| 925 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 926 | + break; |
|
| 927 | + case 302: |
|
| 928 | + // get the save processor |
|
| 929 | + include_once(includeFileProcessor("processors/save_tmplvars.processor.php",$manager_theme)); |
|
| 930 | + break; |
|
| 931 | + case 303: |
|
| 932 | + // get the delete processor |
|
| 933 | + include_once(includeFileProcessor("processors/delete_tmplvars.processor.php",$manager_theme)); |
|
| 934 | + break; |
|
| 935 | + case 304: |
|
| 936 | + // get the duplicate processor |
|
| 937 | + include_once(includeFileProcessor("processors/duplicate_tmplvars.processor.php",$manager_theme)); |
|
| 938 | + break; |
|
| 939 | + case 305: |
|
| 940 | + // get the tv-rank action |
|
| 941 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 942 | + include_once(includeFileProcessor("actions/mutate_tv_rank.dynamic.php",$manager_theme)); |
|
| 943 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 944 | + break; |
|
| 945 | 945 | /********************************************************************/ |
| 946 | 946 | /* Event viewer: show event message log */ |
| 947 | 947 | /********************************************************************/ |
| 948 | - case 114: |
|
| 949 | - // get event logs |
|
| 950 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 951 | - include_once(includeFileProcessor("actions/eventlog.dynamic.php",$manager_theme)); |
|
| 952 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 953 | - break; |
|
| 954 | - case 115: |
|
| 955 | - // get event log details viewer |
|
| 956 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 957 | - include_once(includeFileProcessor("actions/eventlog_details.dynamic.php",$manager_theme)); |
|
| 958 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 959 | - break; |
|
| 960 | - case 116: |
|
| 961 | - // get the event log delete processor |
|
| 962 | - include_once(includeFileProcessor("processors/delete_eventlog.processor.php",$manager_theme)); |
|
| 963 | - break; |
|
| 964 | - |
|
| 965 | - case 501: |
|
| 966 | - //delete category |
|
| 967 | - include_once(includeFileProcessor("processors/delete_category.processor.php",$manager_theme)); |
|
| 968 | - break; |
|
| 948 | + case 114: |
|
| 949 | + // get event logs |
|
| 950 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 951 | + include_once(includeFileProcessor("actions/eventlog.dynamic.php",$manager_theme)); |
|
| 952 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 953 | + break; |
|
| 954 | + case 115: |
|
| 955 | + // get event log details viewer |
|
| 956 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 957 | + include_once(includeFileProcessor("actions/eventlog_details.dynamic.php",$manager_theme)); |
|
| 958 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 959 | + break; |
|
| 960 | + case 116: |
|
| 961 | + // get the event log delete processor |
|
| 962 | + include_once(includeFileProcessor("processors/delete_eventlog.processor.php",$manager_theme)); |
|
| 963 | + break; |
|
| 964 | + |
|
| 965 | + case 501: |
|
| 966 | + //delete category |
|
| 967 | + include_once(includeFileProcessor("processors/delete_category.processor.php",$manager_theme)); |
|
| 968 | + break; |
|
| 969 | 969 | /********************************************************************/ |
| 970 | 970 | /* default action: show not implemented message */ |
| 971 | 971 | /********************************************************************/ |
| 972 | - default : |
|
| 973 | - // say that what was requested doesn't do anything yet |
|
| 974 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 975 | - echo " |
|
| 972 | + default : |
|
| 973 | + // say that what was requested doesn't do anything yet |
|
| 974 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
| 975 | + echo " |
|
| 976 | 976 | <div class='sectionHeader'>".$_lang['functionnotimpl']."</div> |
| 977 | 977 | <div class='sectionBody'> |
| 978 | 978 | <p>".$_lang['functionnotimpl_message']."</p> |
| 979 | 979 | </div> |
| 980 | 980 | "; |
| 981 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 981 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
| 982 | 982 | } |
| 983 | 983 | |
| 984 | 984 | /********************************************************************/ |
| 985 | 985 | // log action, unless it's a frame request |
| 986 | 986 | if($action!=1 && $action!=7 && $action!=2) { |
| 987 | - include_once "log.class.inc.php"; |
|
| 988 | - $log = new logHandler; |
|
| 989 | - $log->initAndWriteLog(); |
|
| 987 | + include_once "log.class.inc.php"; |
|
| 988 | + $log = new logHandler; |
|
| 989 | + $log->initAndWriteLog(); |
|
| 990 | 990 | } |
| 991 | 991 | /********************************************************************/ |
| 992 | 992 | // show debug |
@@ -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)) { |