@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | $state = 'skipframe'; |
| 152 | 152 | } |
| 153 | - elseif (in_array($b, array_merge(range(0xC0,0xC3), range(0xC5,0xC7), range(0xC9,0xCB), range(0xCD,0xCF)))) |
|
| 153 | + elseif (in_array($b, array_merge(range(0xC0, 0xC3), range(0xC5, 0xC7), range(0xC9, 0xCB), range(0xCD, 0xCF)))) |
|
| 154 | 154 | { |
| 155 | 155 | $state = 'readsize'; |
| 156 | 156 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $response = null; |
| 189 | 189 | |
| 190 | 190 | // do we need more data? |
| 191 | - if ($this->strpos + $n -1 >= strlen($this->str)) |
|
| 191 | + if ($this->strpos + $n - 1 >= strlen($this->str)) |
|
| 192 | 192 | { |
| 193 | 193 | $end = ($this->strpos + $n); |
| 194 | 194 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class httpCache { |
|
| 15 | +class httpCache{ |
|
| 16 | 16 | const DEFAULT_TYPE = "text/html"; |
| 17 | 17 | const DEFAULT_EXPIRE = 604800; // in seconds |
| 18 | 18 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @param integer $expire |
| 26 | 26 | * @param array $headers */ |
| 27 | 27 | |
| 28 | - static function file($file, $type=null, $expire=null, array $headers=null) { |
|
| 28 | + static function file($file, $type = null, $expire = null, array $headers = null){ |
|
| 29 | 29 | $mtime = @filemtime($file); |
| 30 | 30 | if ($mtime !== false) self::checkMTime($mtime); |
| 31 | 31 | |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | * @param array $headers |
| 48 | 48 | * @param bool $checkMTime */ |
| 49 | 49 | |
| 50 | - static function content($content, $mtime, $type=null, $expire=null, array $headers=null, $checkMTime=true) { |
|
| 50 | + static function content($content, $mtime, $type = null, $expire = null, array $headers = null, $checkMTime = true){ |
|
| 51 | 51 | if ($checkMTime) self::checkMTime($mtime); |
| 52 | 52 | if ($type === null) $type = self::DEFAULT_TYPE; |
| 53 | 53 | if ($expire === null) $expire = self::DEFAULT_EXPIRE; |
| 54 | 54 | $size = strlen($content); |
| 55 | - $expires = gmdate("D, d M Y H:i:s", time() + $expire) . " GMT"; |
|
| 55 | + $expires = gmdate("D, d M Y H:i:s", time() + $expire)." GMT"; |
|
| 56 | 56 | header("Content-Type: $type"); |
| 57 | 57 | header("Expires: $expires"); |
| 58 | 58 | header("Cache-Control: max-age=$expire"); |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * the PHP to be configured as Apache module. |
| 69 | 69 | * @param integer $mtime */ |
| 70 | 70 | |
| 71 | - static function checkMTime($mtime, $sendHeaders=null) { |
|
| 72 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s", $mtime) . " GMT"); |
|
| 71 | + static function checkMTime($mtime, $sendHeaders = null){ |
|
| 72 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s", $mtime)." GMT"); |
|
| 73 | 73 | |
| 74 | 74 | $headers = function_exists("getallheaders") |
| 75 | 75 | ? getallheaders() |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class image_gd extends image { |
|
| 15 | +class image_gd extends image{ |
|
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | // ABSTRACT PUBLIC METHODS |
| 19 | 19 | |
| 20 | - public function resize($width, $height) { |
|
| 20 | + public function resize($width, $height){ |
|
| 21 | 21 | if (!$width) $width = 1; |
| 22 | 22 | if (!$height) $height = 1; |
| 23 | 23 | return ( |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | ); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function resizeFit($width, $height, $background=false) { |
|
| 32 | + public function resizeFit($width, $height, $background = false){ |
|
| 33 | 33 | if ((!$width && !$height) || (($width == $this->width) && ($height == $this->height))) |
| 34 | 34 | return true; |
| 35 | 35 | if (!$width || (($height / $width) < ($this->height / $this->width))) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public function resizeCrop($width, $height, $offset=false) { |
|
| 70 | + public function resizeCrop($width, $height, $offset = false){ |
|
| 71 | 71 | |
| 72 | 72 | if (($this->width / $this->height) > ($width / $height)) { |
| 73 | 73 | $h = $height; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | return $return; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - public function rotate($angle, $background="#000000") { |
|
| 120 | + public function rotate($angle, $background = "#000000"){ |
|
| 121 | 121 | $angle = -$angle; |
| 122 | 122 | $img = @imagerotate($this->image, $angle, $this->gdColor($background)); |
| 123 | 123 | if ($img === false) |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | return true; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - public function flipHorizontal() { |
|
| 131 | + public function flipHorizontal(){ |
|
| 132 | 132 | $img = imagecreatetruecolor($this->width, $this->height); |
| 133 | 133 | imagealphablending($img, false); |
| 134 | 134 | imagesavealpha($img, true); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | return true; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - public function flipVertical() { |
|
| 142 | + public function flipVertical(){ |
|
| 143 | 143 | $img = imagecreatetruecolor($this->width, $this->height); |
| 144 | 144 | imagealphablending($img, false); |
| 145 | 145 | imagesavealpha($img, true); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | return true; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - public function watermark($file, $left=false, $top=false) { |
|
| 153 | + public function watermark($file, $left = false, $top = false){ |
|
| 154 | 154 | $info = getimagesize($file); |
| 155 | 155 | list($w, $h, $t) = $info; |
| 156 | 156 | if (!in_array($t, array(IMAGETYPE_PNG, IMAGETYPE_GIF))) |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | return true; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - public function output($type='jpeg', array $options=array()) { |
|
| 190 | + public function output($type = 'jpeg', array $options = array()){ |
|
| 191 | 191 | $method = "output_$type"; |
| 192 | 192 | if (!method_exists($this, $method)) |
| 193 | 193 | return false; |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | // ABSTRACT PROTECTED METHODS |
| 199 | 199 | |
| 200 | - protected function getBlankImage($width, $height) { |
|
| 200 | + protected function getBlankImage($width, $height){ |
|
| 201 | 201 | $img = @imagecreatetruecolor($width, $height); |
| 202 | 202 | // imagealphablending($img, false); |
| 203 | 203 | // imagesavealpha($img, true); |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | return $img; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - protected function getImage($image, &$width, &$height) { |
|
| 210 | + protected function getImage($image, &$width, &$height){ |
|
| 211 | 211 | |
| 212 | 212 | if (is_resource($image) && (get_resource_type($image) == "gd")) { |
| 213 | 213 | $width = @imagesx($image); |
@@ -218,11 +218,11 @@ discard block |
||
| 218 | 218 | (false !== (list($width, $height, $t) = @getimagesize($image))) |
| 219 | 219 | ) { |
| 220 | 220 | $image = |
| 221 | - ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
| 221 | + ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($image) : ( |
|
| 222 | 222 | ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($image) : ( |
| 223 | 223 | ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($image) : ( |
| 224 | - ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
| 225 | - ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
| 224 | + ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($image) : ( |
|
| 225 | + ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($image) : false |
|
| 226 | 226 | )))); |
| 227 | 227 | |
| 228 | 228 | return $image; |
@@ -234,22 +234,22 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | // PSEUDO-ABSTRACT STATIC METHODS |
| 236 | 236 | |
| 237 | - static function available() { |
|
| 237 | + static function available(){ |
|
| 238 | 238 | return function_exists("imagecreatefromjpeg"); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - static function checkImage($file) { |
|
| 241 | + static function checkImage($file){ |
|
| 242 | 242 | if (!is_string($file) || |
| 243 | 243 | ((false === (list($width, $height, $t) = @getimagesize($file)))) |
| 244 | 244 | ) |
| 245 | 245 | return false; |
| 246 | 246 | |
| 247 | 247 | $img = |
| 248 | - ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($file) : ( |
|
| 248 | + ($t == IMAGETYPE_GIF) ? @imagecreatefromgif($file) : ( |
|
| 249 | 249 | ($t == IMAGETYPE_WBMP) ? @imagecreatefromwbmp($file) : ( |
| 250 | 250 | ($t == IMAGETYPE_JPEG) ? @imagecreatefromjpeg($file) : ( |
| 251 | - ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($file) : ( |
|
| 252 | - ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($file) : false |
|
| 251 | + ($t == IMAGETYPE_PNG) ? @imagecreatefrompng($file) : ( |
|
| 252 | + ($t == IMAGETYPE_XBM) ? @imagecreatefromxbm($file) : false |
|
| 253 | 253 | )))); |
| 254 | 254 | |
| 255 | 255 | return ($img !== false); |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | // OWN METHODS |
| 260 | 260 | |
| 261 | - protected function output_png(array $options=array()) { |
|
| 261 | + protected function output_png(array $options = array()){ |
|
| 262 | 262 | $file = isset($options['file']) ? $options['file'] : null; |
| 263 | 263 | $quality = isset($options['quality']) ? $options['quality'] : null; |
| 264 | 264 | $filters = isset($options['filters']) ? $options['filters'] : null; |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | return imagepng($this->image, $file, $quality, $filters); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - protected function output_jpeg(array $options=array()) { |
|
| 271 | + protected function output_jpeg(array $options = array()){ |
|
| 272 | 272 | $file = isset($options['file']) ? $options['file'] : null; |
| 273 | 273 | $quality = isset($options['quality']) |
| 274 | 274 | ? $options['quality'] |
@@ -278,14 +278,14 @@ discard block |
||
| 278 | 278 | return imagejpeg($this->image, $file, $quality); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - protected function output_gif(array $options=array()) { |
|
| 281 | + protected function output_gif(array $options = array()){ |
|
| 282 | 282 | $file = isset($options['file']) ? $options['file'] : null; |
| 283 | 283 | if (isset($options['file']) && !headers_sent()) |
| 284 | 284 | header("Content-Type: image/gif"); |
| 285 | 285 | return imagegif($this->image, $file); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - protected function gdColor() { |
|
| 288 | + protected function gdColor(){ |
|
| 289 | 289 | $args = func_get_args(); |
| 290 | 290 | |
| 291 | 291 | $exprRGB = '/^rgb\(\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\,\s*(\d{1,3})\s*\)$/i'; |
@@ -327,15 +327,15 @@ discard block |
||
| 327 | 327 | return imagecolorallocate($this->image, $r, $g, $b); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color) { |
|
| 330 | + protected function imageFilledRectangle($x1, $y1, $x2, $y2, $color){ |
|
| 331 | 331 | $color = $this->gdColor($color); |
| 332 | 332 | if ($color === false) return false; |
| 333 | 333 | return imageFilledRectangle($this->image, $x1, $y1, $x2, $y2, $color); |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | protected function imageCopyResampled( |
| 337 | - $src, $dstX=0, $dstY=0, $srcX=0, $srcY=0, $dstW=null, $dstH=null, $srcW=null, $srcH=null |
|
| 338 | - ) { |
|
| 337 | + $src, $dstX = 0, $dstY = 0, $srcX = 0, $srcY = 0, $dstW = null, $dstH = null, $srcW = null, $srcH = null |
|
| 338 | + ){ |
|
| 339 | 339 | $imageDetails = $this->buildImage($src); |
| 340 | 340 | |
| 341 | 341 | if ($imageDetails === false) |
@@ -12,13 +12,13 @@ discard block |
||
| 12 | 12 | * @link http://kcfinder.sunhater.com |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -class text { |
|
| 15 | +class text{ |
|
| 16 | 16 | |
| 17 | 17 | /** Replace repeated white spaces to single space |
| 18 | 18 | * @param string $string |
| 19 | 19 | * @return string */ |
| 20 | 20 | |
| 21 | - static function clearWhitespaces($string) { |
|
| 21 | + static function clearWhitespaces($string){ |
|
| 22 | 22 | return trim(preg_replace('/\s+/s', " ", $string)); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @param string $string |
| 27 | 27 | * @return string */ |
| 28 | 28 | |
| 29 | - static function htmlValue($string) { |
|
| 29 | + static function htmlValue($string){ |
|
| 30 | 30 | return |
| 31 | 31 | str_replace('"', """, |
| 32 | 32 | str_replace("'", ''', |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @param string $string |
| 40 | 40 | * @return string */ |
| 41 | 41 | |
| 42 | - static function jsValue($string) { |
|
| 42 | + static function jsValue($string){ |
|
| 43 | 43 | return |
| 44 | 44 | preg_replace('/\r?\n/', "\\n", |
| 45 | 45 | str_replace('"', "\\\"", |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param string $string |
| 53 | 53 | * @param bool $cdata */ |
| 54 | 54 | |
| 55 | - static function xmlData($string, $cdata=false) { |
|
| 55 | + static function xmlData($string, $cdata = false){ |
|
| 56 | 56 | $string = str_replace("]]>", "]]]]><![CDATA[>", $string); |
| 57 | 57 | if (!$cdata) |
| 58 | 58 | $string = "<![CDATA[$string]]>"; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param string $code |
| 64 | 64 | * @return string */ |
| 65 | 65 | |
| 66 | - static function compressCSS($code) { |
|
| 66 | + static function compressCSS($code){ |
|
| 67 | 67 | $code = self::clearWhitespaces($code); |
| 68 | 68 | $code = preg_replace('/ ?\{ ?/', "{", $code); |
| 69 | 69 | $code = preg_replace('/ ?\} ?/', "}", $code); |
@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | * @link http://kcfinder.sunhater.com |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -class zipFolder { |
|
| 16 | +class zipFolder{ |
|
| 17 | 17 | protected $zip; |
| 18 | 18 | protected $root; |
| 19 | 19 | protected $ignored; |
| 20 | 20 | |
| 21 | - function __construct($file, $folder, $ignored=null) { |
|
| 21 | + function __construct($file, $folder, $ignored = null){ |
|
| 22 | 22 | $this->zip = new ZipArchive(); |
| 23 | 23 | |
| 24 | 24 | $this->ignored = is_array($ignored) |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $this->zip->close(); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - function zip($folder, $parent=null) { |
|
| 42 | + function zip($folder, $parent = null){ |
|
| 43 | 43 | $full_path = "{$this->root}$parent$folder"; |
| 44 | 44 | $zip_path = "$parent$folder"; |
| 45 | 45 | $this->zip->addEmptyDir($zip_path); |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | 'theme' => "evo", |
| 28 | 28 | |
| 29 | - 'uploadURL' => rtrim($modx->config['rb_base_url'],'/'), |
|
| 30 | - 'uploadDir' => rtrim($modx->config['rb_base_dir'],'/'), |
|
| 29 | + 'uploadURL' => rtrim($modx->config['rb_base_url'], '/'), |
|
| 30 | + 'uploadDir' => rtrim($modx->config['rb_base_dir'], '/'), |
|
| 31 | 31 | 'siteURL' => $modx->config['site_url'], |
| 32 | - 'assetsURL' => rtrim($modx->config['rb_base_url'],'/'), |
|
| 33 | - 'dirPerms' => intval($modx->config['new_folder_permissions'],8), |
|
| 34 | - 'filePerms' => intval($modx->config['new_file_permissions'],8), |
|
| 32 | + 'assetsURL' => rtrim($modx->config['rb_base_url'], '/'), |
|
| 33 | + 'dirPerms' => intval($modx->config['new_folder_permissions'], 8), |
|
| 34 | + 'filePerms' => intval($modx->config['new_file_permissions'], 8), |
|
| 35 | 35 | 'maxfilesize' => $settings['upload_maxsize'], |
| 36 | 36 | 'denyUpdateCheck' => true, |
| 37 | 37 | |
@@ -58,14 +58,14 @@ discard block |
||
| 58 | 58 | 'types' => array( |
| 59 | 59 | |
| 60 | 60 | // CKEditor & FCKEditor types |
| 61 | - 'files' => str_replace(',',' ',$modx->config['upload_files']), |
|
| 62 | - 'flash' => str_replace(',',' ',$modx->config['upload_flash']), |
|
| 63 | - 'images' => str_replace(',',' ',$modx->config['upload_images']), |
|
| 61 | + 'files' => str_replace(',', ' ', $modx->config['upload_files']), |
|
| 62 | + 'flash' => str_replace(',', ' ', $modx->config['upload_flash']), |
|
| 63 | + 'images' => str_replace(',', ' ', $modx->config['upload_images']), |
|
| 64 | 64 | |
| 65 | 65 | // TinyMCE types |
| 66 | - 'file' => str_replace(',',' ',$modx->config['upload_files']), |
|
| 67 | - 'media' => str_replace(',',' ',$modx->config['upload_media']), |
|
| 68 | - 'image' => str_replace(',',' ',$modx->config['upload_images']), |
|
| 66 | + 'file' => str_replace(',', ' ', $modx->config['upload_files']), |
|
| 67 | + 'media' => str_replace(',', ' ', $modx->config['upload_media']), |
|
| 68 | + 'image' => str_replace(',', ' ', $modx->config['upload_images']), |
|
| 69 | 69 | ), |
| 70 | 70 | 'dirnameChangeChars' => array( |
| 71 | 71 | ' ' => "_", |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // THE FOLLOWING SETTINGS CANNOT BE OVERRIDED WITH SESSION CONFIGURATION |
| 91 | 91 | '_check4htaccess' => false, |
| 92 | - '_tinyMCEPath' => MODX_BASE_URL . "assets/plugins/tinymce/tiny_mce", |
|
| 92 | + '_tinyMCEPath' => MODX_BASE_URL."assets/plugins/tinymce/tiny_mce", |
|
| 93 | 93 | |
| 94 | 94 | '_sessionVar' => &$_SESSION['KCFINDER'], |
| 95 | 95 | //'_sessionLifetime' => 30, |
@@ -14,14 +14,14 @@ |
||
| 14 | 14 | |
| 15 | 15 | require "core/autoload.php"; // Init MODX |
| 16 | 16 | |
| 17 | -function returnNoPermissionsMessage($role) { |
|
| 17 | +function returnNoPermissionsMessage($role){ |
|
| 18 | 18 | global $_lang; |
| 19 | 19 | echo sprintf($_lang['files_management_no_permission'], $role); |
| 20 | 20 | exit; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -if( $_GET['type'] == 'images' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_images')) returnNoPermissionsMessage('assets_images'); |
|
| 24 | -if( $_GET['type'] == 'files' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_files')) returnNoPermissionsMessage('assets_files'); |
|
| 23 | +if ($_GET['type'] == 'images' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_images')) returnNoPermissionsMessage('assets_images'); |
|
| 24 | +if ($_GET['type'] == 'files' && !$modx->hasPermission('file_manager') && !$modx->hasPermission('assets_files')) returnNoPermissionsMessage('assets_files'); |
|
| 25 | 25 | |
| 26 | 26 | $browser = new browser($modx); |
| 27 | 27 | $browser->action(); |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | $modx->config['enable_filter'] = 1; |
| 3 | 3 | |
| 4 | -$modx->addSnippet('hasPermission','return $modx->hasPermission($key);');
|
|
| 4 | +$modx->addSnippet('hasPermission', 'return $modx->hasPermission($key);');
|
|
| 5 | 5 | |
| 6 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags'))
|
|
| 6 | +if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags'))
|
|
| 7 | 7 | $hasAnyPermission = 1; |
| 8 | 8 | else $hasAnyPermission = 0; |
| 9 | -$modx->addSnippet('hasAnyPermission','global $hasAnyPermission; return $hasAnyPermission;');
|
|
| 10 | -$modx->addSnippet('getLoginUserName','return $modx->getLoginUserName();');
|
|
| 9 | +$modx->addSnippet('hasAnyPermission', 'global $hasAnyPermission; return $hasAnyPermission;');
|
|
| 10 | +$modx->addSnippet('getLoginUserName', 'return $modx->getLoginUserName();');
|
|
| 11 | 11 | $code = 'global $_lang;return $_SESSION["nrtotalmessages"] ? sprintf($_lang["welcome_messages"], $_SESSION["nrtotalmessages"], \'<span style="color:red;">\' . $_SESSION["nrnewmessages"] . "</span>") : $_lang["messages_no_messages"];'; |
| 12 | -$modx->addSnippet('getMessageCount',$code);
|
|
| 12 | +$modx->addSnippet('getMessageCount', $code);
|
|
| 13 | 13 | |
| 14 | 14 | // Large Icons |
| 15 | 15 | $_style['icons_backup_large'] = 'fa fa-database fa-fw fa-2x'; |
@@ -19,11 +19,11 @@ discard block |
||
| 19 | 19 | $modx->loadExtension("ManagerAPI");
|
| 20 | 20 | |
| 21 | 21 | $_lang = array(); |
| 22 | -include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php'; |
|
| 22 | +include_once MODX_MANAGER_PATH.'/includes/lang/english.inc.php'; |
|
| 23 | 23 | if ($modx->config['manager_language'] != 'english') {
|
| 24 | - include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php'; |
|
| 24 | + include_once MODX_MANAGER_PATH.'/includes/lang/'.$modx->config['manager_language'].'.inc.php'; |
|
| 25 | 25 | } |
| 26 | -include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php'; |
|
| 26 | +include_once MODX_MANAGER_PATH.'/media/style/'.$modx->config['manager_theme'].'/style.php'; |
|
| 27 | 27 | |
| 28 | 28 | $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : ''; |
| 29 | 29 | $frame = isset($_REQUEST['f']) ? $_REQUEST['f'] : ''; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | switch ($frame) {
|
| 42 | 42 | case 'nodes': |
| 43 | - include_once MODX_MANAGER_PATH . '/frames/nodes.php'; |
|
| 43 | + include_once MODX_MANAGER_PATH.'/frames/nodes.php'; |
|
| 44 | 44 | |
| 45 | 45 | break; |
| 46 | 46 | } |
@@ -58,21 +58,21 @@ discard block |
||
| 58 | 58 | $sql = ''; |
| 59 | 59 | $a = ''; |
| 60 | 60 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '%*_') : ''; |
| 61 | - $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
| 62 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
| 61 | + $sqlLike = $filter ? 'WHERE t1.name LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
| 62 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
| 63 | 63 | |
| 64 | 64 | switch ($elements) {
|
| 65 | 65 | case 'element_templates': |
| 66 | 66 | $a = 16; |
| 67 | - $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
| 67 | + $sqlLike = $filter ? 'WHERE t1.templatename LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
| 68 | 68 | $sql = $modx->db->query('SELECT t1.*, t1.templatename AS name
|
| 69 | - FROM ' . $modx->getFullTableName('site_templates') . ' AS t1
|
|
| 70 | - ' . $sqlLike . ' |
|
| 69 | + FROM ' . $modx->getFullTableName('site_templates').' AS t1
|
|
| 70 | + ' . $sqlLike.' |
|
| 71 | 71 | ORDER BY t1.templatename ASC |
| 72 | 72 | ' . $sqlLimit); |
| 73 | 73 | |
| 74 | 74 | if ($modx->hasPermission('new_template')) {
|
| 75 | - $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>'; |
|
| 75 | + $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>'.$_lang['new_template'].'</a></li>'; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | break; |
@@ -80,15 +80,15 @@ discard block |
||
| 80 | 80 | case 'element_tplvars': |
| 81 | 81 | $a = 301; |
| 82 | 82 | $sql = $modx->db->query('SELECT t1.*, IF(t2.templateid,0,1) AS disabled
|
| 83 | - FROM ' . $modx->getFullTableName('site_tmplvars') . ' AS t1
|
|
| 84 | - LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates') . ' AS t2 ON t1.id=t2.tmplvarid
|
|
| 85 | - ' . $sqlLike . ' |
|
| 83 | + FROM ' . $modx->getFullTableName('site_tmplvars').' AS t1
|
|
| 84 | + LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates').' AS t2 ON t1.id=t2.tmplvarid
|
|
| 85 | + ' . $sqlLike.' |
|
| 86 | 86 | GROUP BY t1.id |
| 87 | 87 | ORDER BY t1.name ASC |
| 88 | 88 | ' . $sqlLimit); |
| 89 | 89 | |
| 90 | 90 | if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
|
| 91 | - $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>'; |
|
| 91 | + $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>'.$_lang['new_tmplvars'].'</a></li>'; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | break; |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | case 'element_htmlsnippets': |
| 97 | 97 | $a = 78; |
| 98 | 98 | $sql = $modx->db->query('SELECT t1.*
|
| 99 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . ' AS t1
|
|
| 100 | - ' . $sqlLike . ' |
|
| 99 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').' AS t1
|
|
| 100 | + ' . $sqlLike.' |
|
| 101 | 101 | ORDER BY t1.name ASC |
| 102 | 102 | ' . $sqlLimit); |
| 103 | 103 | |
| 104 | 104 | if ($modx->hasPermission('new_chunk')) {
|
| 105 | - $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>'; |
|
| 105 | + $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>'.$_lang['new_htmlsnippet'].'</a></li>'; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | break; |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | case 'element_snippets': |
| 111 | 111 | $a = 22; |
| 112 | 112 | $sql = $modx->db->query('SELECT t1.*
|
| 113 | - FROM ' . $modx->getFullTableName('site_snippets') . ' AS t1
|
|
| 114 | - ' . $sqlLike . ' |
|
| 113 | + FROM ' . $modx->getFullTableName('site_snippets').' AS t1
|
|
| 114 | + ' . $sqlLike.' |
|
| 115 | 115 | ORDER BY t1.name ASC |
| 116 | 116 | ' . $sqlLimit); |
| 117 | 117 | |
| 118 | 118 | if ($modx->hasPermission('new_snippet')) {
|
| 119 | - $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>'; |
|
| 119 | + $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>'.$_lang['new_snippet'].'</a></li>'; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | break; |
@@ -124,13 +124,13 @@ discard block |
||
| 124 | 124 | case 'element_plugins': |
| 125 | 125 | $a = 102; |
| 126 | 126 | $sql = $modx->db->query('SELECT t1.*
|
| 127 | - FROM ' . $modx->getFullTableName('site_plugins') . ' AS t1
|
|
| 128 | - ' . $sqlLike . ' |
|
| 127 | + FROM ' . $modx->getFullTableName('site_plugins').' AS t1
|
|
| 128 | + ' . $sqlLike.' |
|
| 129 | 129 | ORDER BY t1.name ASC |
| 130 | 130 | ' . $sqlLimit); |
| 131 | 131 | |
| 132 | 132 | if ($modx->hasPermission('new_plugin')) {
|
| 133 | - $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>'; |
|
| 133 | + $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>'.$_lang['new_plugin'].'</a></li>'; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | break; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | continue; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $items .= '<li class="item ' . ($row['disabled'] ? 'disabled' : '') . ($row['locked'] ? ' locked' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main" data-parent-id="a_76__elements_' . $elements . '">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>' . "\n";
|
|
| 148 | + $items .= '<li class="item '.($row['disabled'] ? 'disabled' : '').($row['locked'] ? ' locked' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main" data-parent-id="a_76__elements_'.$elements.'">'.$row['name'].' <small>('.$row['id'].')</small></a></li>'."\n";
|
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
@@ -166,18 +166,18 @@ discard block |
||
| 166 | 166 | $output = ''; |
| 167 | 167 | $items = ''; |
| 168 | 168 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : ''; |
| 169 | - $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
| 170 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
| 169 | + $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
| 170 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
| 171 | 171 | |
| 172 | 172 | $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked
|
| 173 | - FROM ' . $modx->getFullTableName('manager_users') . ' AS t1
|
|
| 174 | - LEFT JOIN ' . $modx->getFullTableName('user_attributes') . ' AS t2 ON t1.id=t2.internalKey
|
|
| 175 | - ' . $sqlLike . ' |
|
| 173 | + FROM ' . $modx->getFullTableName('manager_users').' AS t1
|
|
| 174 | + LEFT JOIN ' . $modx->getFullTableName('user_attributes').' AS t2 ON t1.id=t2.internalKey
|
|
| 175 | + ' . $sqlLike.' |
|
| 176 | 176 | ORDER BY t1.username ASC |
| 177 | 177 | ' . $sqlLimit); |
| 178 | 178 | |
| 179 | 179 | if ($modx->hasPermission('new_user')) {
|
| 180 | - $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>'; |
|
| 180 | + $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>'.$_lang['new_user'].'</a></li>'; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | if ($count = $modx->db->getRecordCount($sql)) {
|
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 186 | 186 | } |
| 187 | 187 | while ($row = $modx->db->getRow($sql)) {
|
| 188 | - $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
|
|
| 188 | + $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
|
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | |
@@ -205,18 +205,18 @@ discard block |
||
| 205 | 205 | $output = ''; |
| 206 | 206 | $items = ''; |
| 207 | 207 | $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : ''; |
| 208 | - $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : ''; |
|
| 209 | - $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit; |
|
| 208 | + $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : ''; |
|
| 209 | + $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit; |
|
| 210 | 210 | |
| 211 | 211 | $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked
|
| 212 | - FROM ' . $modx->getFullTableName('web_users') . ' AS t1
|
|
| 213 | - LEFT JOIN ' . $modx->getFullTableName('web_user_attributes') . ' AS t2 ON t1.id=t2.internalKey
|
|
| 214 | - ' . $sqlLike . ' |
|
| 212 | + FROM ' . $modx->getFullTableName('web_users').' AS t1
|
|
| 213 | + LEFT JOIN ' . $modx->getFullTableName('web_user_attributes').' AS t2 ON t1.id=t2.internalKey
|
|
| 214 | + ' . $sqlLike.' |
|
| 215 | 215 | ORDER BY t1.username ASC |
| 216 | 216 | ' . $sqlLimit); |
| 217 | 217 | |
| 218 | 218 | if ($modx->hasPermission('new_web_user')) {
|
| 219 | - $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>'; |
|
| 219 | + $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>'.$_lang['new_web_user'].'</a></li>'; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | if ($count = $modx->db->getRecordCount($sql)) {
|
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>'; |
| 225 | 225 | } |
| 226 | 226 | while ($row = $modx->db->getRow($sql)) {
|
| 227 | - $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
|
|
| 227 | + $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
|
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
@@ -250,35 +250,35 @@ discard block |
||
| 250 | 250 | case 'SnippetNoCache': {
|
| 251 | 251 | |
| 252 | 252 | $sql = $modx->db->query('SELECT *
|
| 253 | - FROM ' . $modx->getFullTableName('site_snippets') . '
|
|
| 254 | - WHERE name="' . $name . '" |
|
| 253 | + FROM ' . $modx->getFullTableName('site_snippets').'
|
|
| 254 | + WHERE name="' . $name.'" |
|
| 255 | 255 | LIMIT 1'); |
| 256 | 256 | |
| 257 | 257 | if ($modx->db->getRecordCount($sql)) {
|
| 258 | 258 | $row = $modx->db->getRow($sql); |
| 259 | 259 | $contextmenu = array( |
| 260 | 260 | 'header' => array( |
| 261 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name'] |
|
| 261 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$row['name'] |
|
| 262 | 262 | ), |
| 263 | 263 | 'item' => array( |
| 264 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 265 | - 'url' => "index.php?a=22&id=" . $row['id'] |
|
| 264 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 265 | + 'url' => "index.php?a=22&id=".$row['id'] |
|
| 266 | 266 | ) |
| 267 | 267 | ); |
| 268 | 268 | if (!empty($row['description'])) {
|
| 269 | 269 | $contextmenu['seperator'] = ''; |
| 270 | 270 | $contextmenu['description'] = array( |
| 271 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 271 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 272 | 272 | ); |
| 273 | 273 | } |
| 274 | 274 | } else {
|
| 275 | 275 | $contextmenu = array( |
| 276 | 276 | 'header' => array( |
| 277 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
|
| 277 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$name |
|
| 278 | 278 | ), |
| 279 | 279 | 'item' => array( |
| 280 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'], |
|
| 281 | - 'url' => "index.php?a=23&itemname=" . $name |
|
| 280 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'], |
|
| 281 | + 'url' => "index.php?a=23&itemname=".$name |
|
| 282 | 282 | ) |
| 283 | 283 | ); |
| 284 | 284 | } |
@@ -288,35 +288,35 @@ discard block |
||
| 288 | 288 | case 'Chunk' : {
|
| 289 | 289 | |
| 290 | 290 | $sql = $modx->db->query('SELECT *
|
| 291 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
|
|
| 292 | - WHERE name="' . $name . '" |
|
| 291 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').'
|
|
| 292 | + WHERE name="' . $name.'" |
|
| 293 | 293 | LIMIT 1'); |
| 294 | 294 | |
| 295 | 295 | if ($modx->db->getRecordCount($sql)) {
|
| 296 | 296 | $row = $modx->db->getRow($sql); |
| 297 | 297 | $contextmenu = array( |
| 298 | 298 | 'header' => array( |
| 299 | - 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $row['name'] |
|
| 299 | + 'innerHTML' => '<i class="fa fa-th-large"></i> '.$row['name'] |
|
| 300 | 300 | ), |
| 301 | 301 | 'item' => array( |
| 302 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 303 | - 'url' => "index.php?a=78&id=" . $row['id'] |
|
| 302 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 303 | + 'url' => "index.php?a=78&id=".$row['id'] |
|
| 304 | 304 | ) |
| 305 | 305 | ); |
| 306 | 306 | if (!empty($row['description'])) {
|
| 307 | 307 | $contextmenu['seperator'] = ''; |
| 308 | 308 | $contextmenu['description'] = array( |
| 309 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 309 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 310 | 310 | ); |
| 311 | 311 | } |
| 312 | 312 | } else {
|
| 313 | 313 | $contextmenu = array( |
| 314 | 314 | 'header' => array( |
| 315 | - 'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name |
|
| 315 | + 'innerHTML' => '<i class="fa fa-th-large"></i> '.$name |
|
| 316 | 316 | ), |
| 317 | 317 | 'item' => array( |
| 318 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'], |
|
| 319 | - 'url' => "index.php?a=77&itemname=" . $name |
|
| 318 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'], |
|
| 319 | + 'url' => "index.php?a=77&itemname=".$name |
|
| 320 | 320 | ) |
| 321 | 321 | ); |
| 322 | 322 | } |
@@ -325,8 +325,8 @@ discard block |
||
| 325 | 325 | } |
| 326 | 326 | case 'AttributeValue': {
|
| 327 | 327 | $sql = $modx->db->query('SELECT *
|
| 328 | - FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
|
|
| 329 | - WHERE name="' . $name . '" |
|
| 328 | + FROM ' . $modx->getFullTableName('site_htmlsnippets').'
|
|
| 329 | + WHERE name="' . $name.'" |
|
| 330 | 330 | LIMIT 1'); |
| 331 | 331 | |
| 332 | 332 | if ($modx->db->getRecordCount($sql)) {
|
@@ -336,52 +336,52 @@ discard block |
||
| 336 | 336 | 'innerText' => $row['name'] |
| 337 | 337 | ), |
| 338 | 338 | 'item' => array( |
| 339 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 340 | - 'url' => "index.php?a=78&id=" . $row['id'] |
|
| 339 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 340 | + 'url' => "index.php?a=78&id=".$row['id'] |
|
| 341 | 341 | ) |
| 342 | 342 | ); |
| 343 | 343 | if (!empty($row['description'])) {
|
| 344 | 344 | $contextmenu['seperator'] = ''; |
| 345 | 345 | $contextmenu['description'] = array( |
| 346 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 346 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 347 | 347 | ); |
| 348 | 348 | } |
| 349 | 349 | } else {
|
| 350 | 350 | |
| 351 | 351 | $sql = $modx->db->query('SELECT *
|
| 352 | - FROM ' . $modx->getFullTableName('site_snippets') . '
|
|
| 353 | - WHERE name="' . $name . '" |
|
| 352 | + FROM ' . $modx->getFullTableName('site_snippets').'
|
|
| 353 | + WHERE name="' . $name.'" |
|
| 354 | 354 | LIMIT 1'); |
| 355 | 355 | |
| 356 | 356 | if ($modx->db->getRecordCount($sql)) {
|
| 357 | 357 | $row = $modx->db->getRow($sql); |
| 358 | 358 | $contextmenu = array( |
| 359 | 359 | 'header' => array( |
| 360 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name'] |
|
| 360 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$row['name'] |
|
| 361 | 361 | ), |
| 362 | 362 | 'item' => array( |
| 363 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 364 | - 'url' => "index.php?a=22&id=" . $row['id'] |
|
| 363 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 364 | + 'url' => "index.php?a=22&id=".$row['id'] |
|
| 365 | 365 | ) |
| 366 | 366 | ); |
| 367 | 367 | if (!empty($row['description'])) {
|
| 368 | 368 | $contextmenu['seperator'] = ''; |
| 369 | 369 | $contextmenu['description'] = array( |
| 370 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 370 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 371 | 371 | ); |
| 372 | 372 | } |
| 373 | 373 | } else {
|
| 374 | 374 | $contextmenu = array( |
| 375 | 375 | 'header' => array( |
| 376 | - 'innerHTML' => '<i class="fa fa-code"></i> ' . $name |
|
| 376 | + 'innerHTML' => '<i class="fa fa-code"></i> '.$name |
|
| 377 | 377 | ), |
| 378 | 378 | 'item' => array( |
| 379 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'], |
|
| 380 | - 'url' => "index.php?a=77&itemname=" . $name |
|
| 379 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'], |
|
| 380 | + 'url' => "index.php?a=77&itemname=".$name |
|
| 381 | 381 | ), |
| 382 | 382 | 'item2' => array( |
| 383 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'], |
|
| 384 | - 'url' => "index.php?a=23&itemname=" . $name |
|
| 383 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'], |
|
| 384 | + 'url' => "index.php?a=23&itemname=".$name |
|
| 385 | 385 | ) |
| 386 | 386 | ); |
| 387 | 387 | } |
@@ -437,35 +437,35 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | $sql = $modx->db->query('SELECT *
|
| 440 | - FROM ' . $modx->getFullTableName('site_tmplvars') . '
|
|
| 441 | - WHERE name="' . $name . '" |
|
| 440 | + FROM ' . $modx->getFullTableName('site_tmplvars').'
|
|
| 441 | + WHERE name="' . $name.'" |
|
| 442 | 442 | LIMIT 1'); |
| 443 | 443 | |
| 444 | 444 | if ($modx->db->getRecordCount($sql)) {
|
| 445 | 445 | $row = $modx->db->getRow($sql); |
| 446 | 446 | $contextmenu = array( |
| 447 | 447 | 'header' => array( |
| 448 | - 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $row['name'] |
|
| 448 | + 'innerHTML' => '<i class="fa fa-list-alt"></i> '.$row['name'] |
|
| 449 | 449 | ), |
| 450 | 450 | 'item' => array( |
| 451 | - 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'], |
|
| 452 | - 'url' => "index.php?a=301&id=" . $row['id'] |
|
| 451 | + 'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'], |
|
| 452 | + 'url' => "index.php?a=301&id=".$row['id'] |
|
| 453 | 453 | ) |
| 454 | 454 | ); |
| 455 | 455 | if (!empty($row['description'])) {
|
| 456 | 456 | $contextmenu['seperator'] = ''; |
| 457 | 457 | $contextmenu['description'] = array( |
| 458 | - 'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description'] |
|
| 458 | + 'innerHTML' => '<i class="fa fa-info"></i> '.$row['description'] |
|
| 459 | 459 | ); |
| 460 | 460 | } |
| 461 | 461 | } else {
|
| 462 | 462 | $contextmenu = array( |
| 463 | 463 | 'header' => array( |
| 464 | - 'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name |
|
| 464 | + 'innerHTML' => '<i class="fa fa-list-alt"></i> '.$name |
|
| 465 | 465 | ), |
| 466 | 466 | 'item' => array( |
| 467 | - 'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_tmplvars'], |
|
| 468 | - 'url' => "index.php?a=300&itemname=" . $name |
|
| 467 | + 'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_tmplvars'], |
|
| 468 | + 'url' => "index.php?a=300&itemname=".$name |
|
| 469 | 469 | ) |
| 470 | 470 | ); |
| 471 | 471 | } |
@@ -484,15 +484,15 @@ discard block |
||
| 484 | 484 | $json = array(); |
| 485 | 485 | |
| 486 | 486 | if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
|
| 487 | - $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : ''; |
|
| 488 | - $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0; |
|
| 487 | + $id = !empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : ''; |
|
| 488 | + $parent = isset($_REQUEST['parent']) ? (int) $_REQUEST['parent'] : 0; |
|
| 489 | 489 | $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0; |
| 490 | 490 | |
| 491 | 491 | // set parent |
| 492 | 492 | if ($id && $parent >= 0) {
|
| 493 | 493 | |
| 494 | 494 | // find older parent |
| 495 | - $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id));
|
|
| 495 | + $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id='.$id));
|
|
| 496 | 496 | |
| 497 | 497 | $eventOut = $modx->invokeEvent('onBeforeMoveDocument', [
|
| 498 | 498 | 'id_document' => $id, |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | if (empty($json['errors'])) {
|
| 514 | 514 | // check privileges user for move docs |
| 515 | 515 | if (!empty($modx->config['tree_show_protected']) && $role != 1) {
|
| 516 | - $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
|
|
| 516 | + $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN('.$id.','.$parent.','.$parentOld.')');
|
|
| 517 | 517 | if ($modx->db->getRecordCount($sql)) {
|
| 518 | 518 | $document_groups = array(); |
| 519 | 519 | while ($row = $modx->db->getRow($sql)) {
|
@@ -538,22 +538,22 @@ discard block |
||
| 538 | 538 | // set new parent |
| 539 | 539 | $modx->db->update(array( |
| 540 | 540 | 'parent' => $parent |
| 541 | - ), $modx->getFullTableName('site_content'), 'id=' . $id);
|
|
| 541 | + ), $modx->getFullTableName('site_content'), 'id='.$id);
|
|
| 542 | 542 | // set parent isfolder = 1 |
| 543 | 543 | $modx->db->update(array( |
| 544 | 544 | 'isfolder' => 1 |
| 545 | - ), $modx->getFullTableName('site_content'), 'id=' . $parent);
|
|
| 545 | + ), $modx->getFullTableName('site_content'), 'id='.$parent);
|
|
| 546 | 546 | |
| 547 | 547 | if ($parent != $parentOld) {
|
| 548 | 548 | // check children docs and set parent isfolder |
| 549 | - if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
|
|
| 549 | + if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent='.$parentOld))) {
|
|
| 550 | 550 | $modx->db->update(array( |
| 551 | 551 | 'isfolder' => 1 |
| 552 | - ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
|
|
| 552 | + ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
|
|
| 553 | 553 | } else {
|
| 554 | 554 | $modx->db->update(array( |
| 555 | 555 | 'isfolder' => 0 |
| 556 | - ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
|
|
| 556 | + ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
|
|
| 557 | 557 | } |
| 558 | 558 | } |
| 559 | 559 | |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | if (!empty($menuindex)) {
|
| 562 | 562 | $menuindex = explode(',', $menuindex);
|
| 563 | 563 | foreach ($menuindex as $key => $value) {
|
| 564 | - $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
|
|
| 564 | + $modx->db->query('UPDATE '.$modx->getFullTableName('site_content').' SET menuindex='.$key.' WHERE id='.$value);
|
|
| 565 | 565 | } |
| 566 | 566 | } else {
|
| 567 | 567 | // TODO: max(*) menuindex |
@@ -590,19 +590,19 @@ discard block |
||
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | case 'getLockedElements': {
|
| 593 | - $type = isset($_REQUEST['type']) ? (int)$_REQUEST['type'] : 0; |
|
| 594 | - $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
| 593 | + $type = isset($_REQUEST['type']) ? (int) $_REQUEST['type'] : 0; |
|
| 594 | + $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
| 595 | 595 | |
| 596 | 596 | $output = !!$modx->elementIsLocked($type, $id, true); |
| 597 | 597 | |
| 598 | 598 | if (!$output) {
|
| 599 | 599 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
|
| 600 | - $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
|
|
| 600 | + $docgrp_cond = $docgrp ? ' OR dg.document_group IN ('.$docgrp.')' : '';
|
|
| 601 | 601 | $sql = ' |
| 602 | - SELECT MAX(IF(1=' . $role . ' OR sc.privatemgr=0' . $docgrp_cond . ', 0, 1)) AS locked |
|
| 603 | - FROM ' . $modx->getFullTableName('site_content') . ' AS sc
|
|
| 604 | - LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
|
|
| 605 | - WHERE sc.id=' . $id . ' GROUP BY sc.id'; |
|
| 602 | + SELECT MAX(IF(1=' . $role.' OR sc.privatemgr=0'.$docgrp_cond.', 0, 1)) AS locked |
|
| 603 | + FROM ' . $modx->getFullTableName('site_content').' AS sc
|
|
| 604 | + LEFT JOIN ' . $modx->getFullTableName('document_groups').' dg ON dg.document=sc.id
|
|
| 605 | + WHERE sc.id=' . $id.' GROUP BY sc.id'; |
|
| 606 | 606 | $sql = $modx->db->query($sql); |
| 607 | 607 | if ($modx->db->getRecordCount($sql)) {
|
| 608 | 608 | $row = $modx->db->getRow($sql); |