@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -$userid = (int)$value; |
|
2 | +$userid = (int) $value; |
|
3 | 3 | if (!isset($modx->getModifiers()->cache['ui'][$userid])) { |
4 | 4 | if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid)); |
5 | 5 | else $user = $modx->getUserInfo($userid); |
@@ -1,8 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | $userid = (int)$value; |
3 | 3 | if (!isset($modx->getModifiers()->cache['ui'][$userid])) { |
4 | - if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid)); |
|
5 | - else $user = $modx->getUserInfo($userid); |
|
4 | + if ($userid < 0) { |
|
5 | + $user = $modx->getWebUserInfo(abs($userid)); |
|
6 | + } else { |
|
7 | + $user = $modx->getUserInfo($userid); |
|
8 | + } |
|
6 | 9 | $modx->getModifiers()->cache['ui'][$userid] = $user; |
7 | 10 | } else { |
8 | 11 | $user = $modx->getModifiers()->cache['ui'][$userid]; |
@@ -1,43 +1,43 @@ |
||
1 | 1 | <?php |
2 | -if(strpos($opt,',')) list($limit,$delim) = explode(',', $opt); |
|
3 | -elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} |
|
4 | -else {$limit=124;$delim='';} |
|
2 | +if (strpos($opt, ',')) list($limit, $delim) = explode(',', $opt); |
|
3 | +elseif (preg_match('/^[1-9][0-9]*$/', $opt)) {$limit = $opt; $delim = ''; } |
|
4 | +else {$limit = 124; $delim = ''; } |
|
5 | 5 | |
6 | -if($delim==='') $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.'; |
|
7 | -$limit = (int)$limit; |
|
6 | +if ($delim === '') $delim = $modx->config['manager_language'] === 'japanese-utf8' ? '。' : '.'; |
|
7 | +$limit = (int) $limit; |
|
8 | 8 | |
9 | 9 | $content = $modx->getModifiers()->parseDocumentSource($value); |
10 | 10 | |
11 | 11 | $content = strip_tags($content); |
12 | 12 | |
13 | -$content = str_replace(array("\r\n","\r","\n","\t",' '),' ',$content); |
|
14 | -if(preg_match('/\s+/',$content)) |
|
15 | - $content = preg_replace('/\s+/',' ',$content); |
|
13 | +$content = str_replace(array("\r\n", "\r", "\n", "\t", ' '), ' ', $content); |
|
14 | +if (preg_match('/\s+/', $content)) |
|
15 | + $content = preg_replace('/\s+/', ' ', $content); |
|
16 | 16 | $content = trim($content); |
17 | 17 | |
18 | 18 | $pos = $modx->getModifiers()->strpos($content, $delim); |
19 | 19 | |
20 | -if($pos!==false && $pos<$limit) { |
|
20 | +if ($pos !== false && $pos < $limit) { |
|
21 | 21 | $_ = explode($delim, $content); |
22 | 22 | $text = ''; |
23 | - foreach($_ as $v) { |
|
24 | - if($limit <= $modx->getModifiers()->strlen($text.$v.$delim)) break; |
|
23 | + foreach ($_ as $v) { |
|
24 | + if ($limit <= $modx->getModifiers()->strlen($text.$v.$delim)) break; |
|
25 | 25 | $text .= $v.$delim; |
26 | 26 | } |
27 | - if($text) $content = $text; |
|
27 | + if ($text) $content = $text; |
|
28 | 28 | } |
29 | 29 | |
30 | -if($limit<$modx->getModifiers()->strlen($content) && strpos($content,' ')!==false) { |
|
30 | +if ($limit < $modx->getModifiers()->strlen($content) && strpos($content, ' ') !== false) { |
|
31 | 31 | $_ = explode(' ', $content); |
32 | 32 | $text = ''; |
33 | - foreach($_ as $v) { |
|
34 | - if($limit <= $modx->getModifiers()->strlen($text.$v.' ')) break; |
|
35 | - $text .= $v . ' '; |
|
33 | + foreach ($_ as $v) { |
|
34 | + if ($limit <= $modx->getModifiers()->strlen($text.$v.' ')) break; |
|
35 | + $text .= $v.' '; |
|
36 | 36 | } |
37 | - if($text!=='') $content = $text; |
|
37 | + if ($text !== '') $content = $text; |
|
38 | 38 | } |
39 | 39 | |
40 | -if($limit < $modx->getModifiers()->strlen($content)) $content = $modx->getModifiers()->substr($content, 0, $limit); |
|
41 | -if($modx->getModifiers()->substr($content,-1)==$delim) $content = rtrim($content,$delim) . $delim; |
|
40 | +if ($limit < $modx->getModifiers()->strlen($content)) $content = $modx->getModifiers()->substr($content, 0, $limit); |
|
41 | +if ($modx->getModifiers()->substr($content, -1) == $delim) $content = rtrim($content, $delim).$delim; |
|
42 | 42 | |
43 | 43 | return $content; |
@@ -1,9 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if(strpos($opt,',')) list($limit,$delim) = explode(',', $opt); |
|
3 | -elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} |
|
4 | -else {$limit=124;$delim='';} |
|
2 | +if(strpos($opt,',')) { |
|
3 | + list($limit,$delim) = explode(',', $opt); |
|
4 | +} elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} else {$limit=124;$delim='';} |
|
5 | 5 | |
6 | -if($delim==='') $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.'; |
|
6 | +if($delim==='') { |
|
7 | + $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.'; |
|
8 | +} |
|
7 | 9 | $limit = (int)$limit; |
8 | 10 | |
9 | 11 | $content = $modx->getModifiers()->parseDocumentSource($value); |
@@ -11,8 +13,9 @@ discard block |
||
11 | 13 | $content = strip_tags($content); |
12 | 14 | |
13 | 15 | $content = str_replace(array("\r\n","\r","\n","\t",' '),' ',$content); |
14 | -if(preg_match('/\s+/',$content)) |
|
16 | +if(preg_match('/\s+/',$content)) { |
|
15 | 17 | $content = preg_replace('/\s+/',' ',$content); |
18 | +} |
|
16 | 19 | $content = trim($content); |
17 | 20 | |
18 | 21 | $pos = $modx->getModifiers()->strpos($content, $delim); |
@@ -21,23 +24,35 @@ discard block |
||
21 | 24 | $_ = explode($delim, $content); |
22 | 25 | $text = ''; |
23 | 26 | foreach($_ as $v) { |
24 | - if($limit <= $modx->getModifiers()->strlen($text.$v.$delim)) break; |
|
27 | + if($limit <= $modx->getModifiers()->strlen($text.$v.$delim)) { |
|
28 | + break; |
|
29 | + } |
|
25 | 30 | $text .= $v.$delim; |
26 | 31 | } |
27 | - if($text) $content = $text; |
|
28 | -} |
|
32 | + if($text) { |
|
33 | + $content = $text; |
|
34 | + } |
|
35 | + } |
|
29 | 36 | |
30 | 37 | if($limit<$modx->getModifiers()->strlen($content) && strpos($content,' ')!==false) { |
31 | 38 | $_ = explode(' ', $content); |
32 | 39 | $text = ''; |
33 | 40 | foreach($_ as $v) { |
34 | - if($limit <= $modx->getModifiers()->strlen($text.$v.' ')) break; |
|
41 | + if($limit <= $modx->getModifiers()->strlen($text.$v.' ')) { |
|
42 | + break; |
|
43 | + } |
|
35 | 44 | $text .= $v . ' '; |
36 | 45 | } |
37 | - if($text!=='') $content = $text; |
|
38 | -} |
|
46 | + if($text!=='') { |
|
47 | + $content = $text; |
|
48 | + } |
|
49 | + } |
|
39 | 50 | |
40 | -if($limit < $modx->getModifiers()->strlen($content)) $content = $modx->getModifiers()->substr($content, 0, $limit); |
|
41 | -if($modx->getModifiers()->substr($content,-1)==$delim) $content = rtrim($content,$delim) . $delim; |
|
51 | +if($limit < $modx->getModifiers()->strlen($content)) { |
|
52 | + $content = $modx->getModifiers()->substr($content, 0, $limit); |
|
53 | +} |
|
54 | +if($modx->getModifiers()->substr($content,-1)==$delim) { |
|
55 | + $content = rtrim($content,$delim) . $delim; |
|
56 | +} |
|
42 | 57 | |
43 | 58 | return $content; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * @see https://github.com/theseer/Autoload |
4 | 4 | */ |
5 | 5 | spl_autoload_register( |
6 | - function($class) { |
|
6 | + function($class){ |
|
7 | 7 | static $classes = null; |
8 | 8 | if ($classes === null) { |
9 | 9 | $classes = array( |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | $cn = strtolower($class); |
68 | 68 | if (isset($classes[$cn])) { |
69 | - require __DIR__ . $classes[$cn]; |
|
69 | + require __DIR__.$classes[$cn]; |
|
70 | 70 | } |
71 | 71 | }, |
72 | 72 | true, |
@@ -3,7 +3,7 @@ |
||
3 | 3 | * @see https://github.com/theseer/Autoload |
4 | 4 | */ |
5 | 5 | spl_autoload_register( |
6 | - function($class) { |
|
6 | + function($class){ |
|
7 | 7 | static $classes = null; |
8 | 8 | if ($classes === null) { |
9 | 9 | $classes = array( |
@@ -376,10 +376,10 @@ |
||
376 | 376 | if ($properties = $modx->getDatabase()->getValue($res)) { |
377 | 377 | $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
378 | 378 | } else { |
379 | - $properties = NULL; |
|
379 | + $properties = null; |
|
380 | 380 | } |
381 | 381 | } else { |
382 | - $properties = NULL; |
|
382 | + $properties = null; |
|
383 | 383 | } |
384 | 384 | return $properties; |
385 | 385 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | /** |
314 | 314 | * @param $filename |
315 | - * @return mixed|string |
|
315 | + * @return string |
|
316 | 316 | */ |
317 | 317 | protected function normalizeFilename($filename) { |
318 | 318 | if ($this->getTransaliasSettings()) { |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
327 | - * @param $dirname |
|
327 | + * @param string $dirname |
|
328 | 328 | * @return string |
329 | 329 | */ |
330 | 330 | protected function normalizeDirname($dirname) { |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @param $dir |
409 | 409 | * @param bool $inclType |
410 | 410 | * @param bool $existing |
411 | - * @return bool|string |
|
411 | + * @return false|string |
|
412 | 412 | */ |
413 | 413 | protected function checkInputDir($dir, $inclType=true, $existing=true) { |
414 | 414 | $dir = path::normalize($dir); |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | /** |
440 | - * @param $ext |
|
440 | + * @param string $ext |
|
441 | 441 | * @param $type |
442 | 442 | * @return bool |
443 | 443 | */ |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | |
469 | 469 | /** |
470 | 470 | * @param $path |
471 | - * @return mixed |
|
471 | + * @return string |
|
472 | 472 | */ |
473 | 473 | protected function getTypeFromPath($path) { |
474 | 474 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | } |
477 | 477 | |
478 | 478 | /** |
479 | - * @param $path |
|
479 | + * @param string $path |
|
480 | 480 | * @return string |
481 | 481 | */ |
482 | 482 | protected function removeTypeFromPath($path) { |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | } |
695 | 695 | |
696 | 696 | /** |
697 | - * @param $url |
|
697 | + * @param string $url |
|
698 | 698 | * @param string $message |
699 | 699 | */ |
700 | 700 | protected function callBack($url, $message="") { |
@@ -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 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | ) |
137 | 137 | $this->cms = $this->get['cms']; |
138 | 138 | |
139 | - // LINKING UPLOADED FILE |
|
139 | + // LINKING UPLOADED FILE |
|
140 | 140 | if (count($_FILES)) |
141 | 141 | $this->file = &$_FILES[key($_FILES)]; |
142 | 142 | |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
218 | 218 | ? path::normalize($this->config['uploadDir']) |
219 | 219 | : path::url2fullPath("/$path"); |
220 | - $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
221 | - $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
220 | + $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
221 | + $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
222 | 222 | |
223 | 223 | // SITE ROOT |
224 | 224 | } elseif ($this->config['uploadURL'] == "/") { |
@@ -291,23 +291,23 @@ discard block |
||
291 | 291 | * @return array|bool|int|null|string|void |
292 | 292 | */ |
293 | 293 | protected function getTransaliasSettings() { |
294 | - $modx = evolutionCMS(); |
|
295 | - |
|
296 | - // Cleaning uploaded filename? |
|
297 | - $setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
298 | - if ($modx->getDatabase()->getValue($setting)>0) { |
|
299 | - // Transalias plugin active? |
|
300 | - $res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
301 | - if ($properties = $modx->getDatabase()->getValue($res)) { |
|
302 | - $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
303 | - } else { |
|
304 | - $properties = NULL; |
|
305 | - } |
|
306 | - } else { |
|
307 | - $properties = NULL; |
|
308 | - } |
|
309 | - return $properties; |
|
310 | - } |
|
294 | + $modx = evolutionCMS(); |
|
295 | + |
|
296 | + // Cleaning uploaded filename? |
|
297 | + $setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
298 | + if ($modx->getDatabase()->getValue($setting)>0) { |
|
299 | + // Transalias plugin active? |
|
300 | + $res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
301 | + if ($properties = $modx->getDatabase()->getValue($res)) { |
|
302 | + $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
303 | + } else { |
|
304 | + $properties = NULL; |
|
305 | + } |
|
306 | + } else { |
|
307 | + $properties = NULL; |
|
308 | + } |
|
309 | + return $properties; |
|
310 | + } |
|
311 | 311 | |
312 | 312 | |
313 | 313 | /** |
@@ -315,13 +315,13 @@ discard block |
||
315 | 315 | * @return mixed|string |
316 | 316 | */ |
317 | 317 | protected function normalizeFilename($filename) { |
318 | - if ($this->getTransaliasSettings()) { |
|
319 | - $format = strrchr($filename, "."); |
|
320 | - $filename = str_replace($format, "", $filename); |
|
321 | - $filename = $this->modx->stripAlias($filename).$format; |
|
322 | - } |
|
323 | - return $filename; |
|
324 | - } |
|
318 | + if ($this->getTransaliasSettings()) { |
|
319 | + $format = strrchr($filename, "."); |
|
320 | + $filename = str_replace($format, "", $filename); |
|
321 | + $filename = $this->modx->stripAlias($filename).$format; |
|
322 | + } |
|
323 | + return $filename; |
|
324 | + } |
|
325 | 325 | |
326 | 326 | /** |
327 | 327 | * @param $dirname |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | return $this->label("The image is too big and/or cannot be resized."); |
397 | 397 | |
398 | 398 | |
399 | - // CHECK FOR MODX MAX FILE SIZE |
|
400 | - $actualfilesize=filesize($file['tmp_name']); |
|
401 | - if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
402 | - return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
399 | + // CHECK FOR MODX MAX FILE SIZE |
|
400 | + $actualfilesize=filesize($file['tmp_name']); |
|
401 | + if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
402 | + return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
403 | 403 | |
404 | 404 | return true; |
405 | 405 | } |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $top = isset($this->config['watermark']['top']) |
576 | 576 | ? $this->config['watermark']['top'] : false; |
577 | 577 | $img->watermark($this->config['watermark']['file'], $left, $top); |
578 | - } |
|
578 | + } |
|
579 | 579 | |
580 | 580 | $options = array( 'file' => $file ); |
581 | 581 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class uploader { |
|
15 | +class uploader{ |
|
16 | 16 | |
17 | 17 | /** Release version */ |
18 | 18 | const VERSION = "2.54"; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | |
73 | 73 | /** Next three properties are got from the current language file |
74 | 74 | * @var string */ |
75 | - protected $dateTimeFull; // Currently not used |
|
76 | - protected $dateTimeMid; // Currently not used |
|
75 | + protected $dateTimeFull; // Currently not used |
|
76 | + protected $dateTimeMid; // Currently not used |
|
77 | 77 | protected $dateTimeSmall; |
78 | 78 | |
79 | 79 | /** Contain Specified language labels |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
105 | 105 | * @param string $property |
106 | 106 | * @return mixed */ |
107 | - public function __get($property) { |
|
107 | + public function __get($property){ |
|
108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
109 | 109 | } |
110 | 110 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * uploader constructor. |
113 | 113 | * @param DocumentParser $modx |
114 | 114 | */ |
115 | - public function __construct(DocumentParser $modx) { |
|
115 | + public function __construct(DocumentParser $modx){ |
|
116 | 116 | |
117 | 117 | //MODX |
118 | 118 | try { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | // COOKIES INIT |
197 | 197 | $ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'; |
198 | - $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/'; |
|
198 | + $ip = '/^'.implode('\.', array($ip, $ip, $ip, $ip)).'$/'; |
|
199 | 199 | if (preg_match($ip, $_SERVER['HTTP_HOST']) || |
200 | 200 | preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST']) |
201 | 201 | ) |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | ) { |
214 | 214 | list($unused, $protocol, $domain, $unused, $port, $path) = $patt; |
215 | 215 | $path = path::normalize($path); |
216 | - $this->config['uploadURL'] = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/$path"; |
|
216 | + $this->config['uploadURL'] = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/$path"; |
|
217 | 217 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
218 | 218 | ? path::normalize($this->config['uploadDir']) |
219 | 219 | : path::url2fullPath("/$path"); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | foreach ($this->langInputNames as $key) |
257 | 257 | if (isset($this->get[$key]) && |
258 | 258 | preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) && |
259 | - file_exists("lang/" . strtolower($this->get[$key]) . ".php") |
|
259 | + file_exists("lang/".strtolower($this->get[$key]).".php") |
|
260 | 260 | ) { |
261 | 261 | $this->lang = $this->get[$key]; |
262 | 262 | break; |
@@ -290,12 +290,12 @@ discard block |
||
290 | 290 | /** |
291 | 291 | * @return array|bool|int|null|string|void |
292 | 292 | */ |
293 | - protected function getTransaliasSettings() { |
|
293 | + protected function getTransaliasSettings(){ |
|
294 | 294 | $modx = evolutionCMS(); |
295 | 295 | |
296 | 296 | // Cleaning uploaded filename? |
297 | 297 | $setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
298 | - if ($modx->getDatabase()->getValue($setting)>0) { |
|
298 | + if ($modx->getDatabase()->getValue($setting) > 0) { |
|
299 | 299 | // Transalias plugin active? |
300 | 300 | $res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
301 | 301 | if ($properties = $modx->getDatabase()->getValue($res)) { |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @param $filename |
315 | 315 | * @return mixed|string |
316 | 316 | */ |
317 | - protected function normalizeFilename($filename) { |
|
317 | + protected function normalizeFilename($filename){ |
|
318 | 318 | if ($this->getTransaliasSettings()) { |
319 | 319 | $format = strrchr($filename, "."); |
320 | 320 | $filename = str_replace($format, "", $filename); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @param $dirname |
328 | 328 | * @return string |
329 | 329 | */ |
330 | - protected function normalizeDirname($dirname) { |
|
330 | + protected function normalizeDirname($dirname){ |
|
331 | 331 | return $this->modx->stripAlias($dirname); |
332 | 332 | } |
333 | 333 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * @param array|null $aFile |
336 | 336 | * @return bool|mixed |
337 | 337 | */ |
338 | - protected function checkUploadedFile(array $aFile=null) { |
|
338 | + protected function checkUploadedFile(array $aFile = null){ |
|
339 | 339 | $config = &$this->config; |
340 | 340 | $file = ($aFile === null) ? $this->file : $aFile; |
341 | 341 | |
@@ -361,8 +361,7 @@ discard block |
||
361 | 361 | ($file['error'] == UPLOAD_ERR_NO_TMP_DIR) ? |
362 | 362 | $this->label("Missing a temporary folder.") : ( |
363 | 363 | ($file['error'] == UPLOAD_ERR_CANT_WRITE) ? |
364 | - $this->label("Failed to write file.") : |
|
365 | - $this->label("Unknown error.") |
|
364 | + $this->label("Failed to write file.") : $this->label("Unknown error.") |
|
366 | 365 | ))))); |
367 | 366 | |
368 | 367 | // HIDDEN FILENAMES CHECK |
@@ -397,7 +396,7 @@ discard block |
||
397 | 396 | |
398 | 397 | |
399 | 398 | // CHECK FOR MODX MAX FILE SIZE |
400 | - $actualfilesize=filesize($file['tmp_name']); |
|
399 | + $actualfilesize = filesize($file['tmp_name']); |
|
401 | 400 | if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
402 | 401 | return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
403 | 402 | |
@@ -410,7 +409,7 @@ discard block |
||
410 | 409 | * @param bool $existing |
411 | 410 | * @return bool|string |
412 | 411 | */ |
413 | - protected function checkInputDir($dir, $inclType=true, $existing=true) { |
|
412 | + protected function checkInputDir($dir, $inclType = true, $existing = true){ |
|
414 | 413 | $dir = path::normalize($dir); |
415 | 414 | if (substr($dir, 0, 1) == "/") |
416 | 415 | $dir = substr($dir, 1); |
@@ -441,7 +440,7 @@ discard block |
||
441 | 440 | * @param $type |
442 | 441 | * @return bool |
443 | 442 | */ |
444 | - protected function validateExtension($ext, $type) { |
|
443 | + protected function validateExtension($ext, $type){ |
|
445 | 444 | $ext = trim(strtolower($ext)); |
446 | 445 | if (!isset($this->types[$type])) |
447 | 446 | return false; |
@@ -470,7 +469,7 @@ discard block |
||
470 | 469 | * @param $path |
471 | 470 | * @return mixed |
472 | 471 | */ |
473 | - protected function getTypeFromPath($path) { |
|
472 | + protected function getTypeFromPath($path){ |
|
474 | 473 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
475 | 474 | ? $patt[1] : $path; |
476 | 475 | } |
@@ -479,7 +478,7 @@ discard block |
||
479 | 478 | * @param $path |
480 | 479 | * @return string |
481 | 480 | */ |
482 | - protected function removeTypeFromPath($path) { |
|
481 | + protected function removeTypeFromPath($path){ |
|
483 | 482 | return preg_match('/^[^\/]*\/(.*)$/', $path, $patt) |
484 | 483 | ? $patt[1] : ""; |
485 | 484 | } |
@@ -489,7 +488,7 @@ discard block |
||
489 | 488 | * @param null $file |
490 | 489 | * @return bool |
491 | 490 | */ |
492 | - protected function imageResize($image, $file=null) { |
|
491 | + protected function imageResize($image, $file = null){ |
|
493 | 492 | |
494 | 493 | if (!($image instanceof image)) { |
495 | 494 | $img = image::factory($this->imageDriver, $image); |
@@ -577,19 +576,19 @@ discard block |
||
577 | 576 | $img->watermark($this->config['watermark']['file'], $left, $top); |
578 | 577 | } |
579 | 578 | |
580 | - $options = array( 'file' => $file ); |
|
579 | + $options = array('file' => $file); |
|
581 | 580 | |
582 | - $type = exif_imagetype( $file ); |
|
581 | + $type = exif_imagetype($file); |
|
583 | 582 | |
584 | - switch ( $type ) { |
|
583 | + switch ($type) { |
|
585 | 584 | case IMAGETYPE_GIF: |
586 | - return $img->output( 'gif', $options ); |
|
585 | + return $img->output('gif', $options); |
|
587 | 586 | |
588 | 587 | case IMAGETYPE_PNG: |
589 | - return $img->output( 'png', $options ); |
|
588 | + return $img->output('png', $options); |
|
590 | 589 | |
591 | 590 | default: |
592 | - return $img->output( 'jpeg', array_merge( $options, array( 'quality' => $this->config['jpegQuality'] ) ) ); |
|
591 | + return $img->output('jpeg', array_merge($options, array('quality' => $this->config['jpegQuality']))); |
|
593 | 592 | } |
594 | 593 | |
595 | 594 | } |
@@ -599,7 +598,7 @@ discard block |
||
599 | 598 | * @param bool $overwrite |
600 | 599 | * @return bool |
601 | 600 | */ |
602 | - protected function makeThumb($file, $overwrite=true) { |
|
601 | + protected function makeThumb($file, $overwrite = true){ |
|
603 | 602 | $img = image::factory($this->imageDriver, $file); |
604 | 603 | |
605 | 604 | // Drop files which are not images |
@@ -607,7 +606,7 @@ discard block |
||
607 | 606 | return true; |
608 | 607 | |
609 | 608 | $thumb = substr($file, strlen($this->config['uploadDir'])); |
610 | - $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb; |
|
609 | + $thumb = $this->config['uploadDir']."/".$this->config['thumbsDir']."/".$thumb; |
|
611 | 610 | $thumb = path::normalize($thumb); |
612 | 611 | $thumbDir = dirname($thumb); |
613 | 612 | if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) |
@@ -630,15 +629,15 @@ discard block |
||
630 | 629 | if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) |
631 | 630 | return false; |
632 | 631 | |
633 | - if ( $this->imageDriver == 'gd' ) { |
|
634 | - $width = imagesx( $img->image ); |
|
635 | - $height = imagesy( $img->image ); |
|
636 | - $back = image::factory( $this->imageDriver, array( $width, $height ) ); |
|
637 | - $tile = image::factory( $this->imageDriver, __DIR__ . '/../themes/' . $this->config['theme'] . '/img/bg_transparent.png' ); |
|
632 | + if ($this->imageDriver == 'gd') { |
|
633 | + $width = imagesx($img->image); |
|
634 | + $height = imagesy($img->image); |
|
635 | + $back = image::factory($this->imageDriver, array($width, $height)); |
|
636 | + $tile = image::factory($this->imageDriver, __DIR__.'/../themes/'.$this->config['theme'].'/img/bg_transparent.png'); |
|
638 | 637 | |
639 | - imagesettile( $back->image, $tile->image ); |
|
640 | - imagefilledrectangle( $back->image, 0, 0, $width, $height, IMG_COLOR_TILED ); |
|
641 | - imagecopy( $back->image, $img->image, 0, 0, 0, 0, $width, $height ); |
|
638 | + imagesettile($back->image, $tile->image); |
|
639 | + imagefilledrectangle($back->image, 0, 0, $width, $height, IMG_COLOR_TILED); |
|
640 | + imagecopy($back->image, $img->image, 0, 0, 0, 0, $width, $height); |
|
642 | 641 | |
643 | 642 | $img = $back; |
644 | 643 | } |
@@ -653,7 +652,7 @@ discard block |
||
653 | 652 | /** |
654 | 653 | * @param $langCode |
655 | 654 | */ |
656 | - protected function localize($langCode) { |
|
655 | + protected function localize($langCode){ |
|
657 | 656 | require "lang/{$langCode}.php"; |
658 | 657 | setlocale(LC_ALL, $lang['_locale']); |
659 | 658 | $this->charset = $lang['_charset']; |
@@ -673,7 +672,7 @@ discard block |
||
673 | 672 | * @param array|null $data |
674 | 673 | * @return mixed |
675 | 674 | */ |
676 | - protected function label($string, array $data=null) { |
|
675 | + protected function label($string, array $data = null){ |
|
677 | 676 | $return = isset($this->labels[$string]) ? $this->labels[$string] : $string; |
678 | 677 | if (is_array($data)) |
679 | 678 | foreach ($data as $key => $val) |
@@ -685,7 +684,7 @@ discard block |
||
685 | 684 | * @param $message |
686 | 685 | * @param array|null $data |
687 | 686 | */ |
688 | - protected function backMsg($message, array $data=null) { |
|
687 | + protected function backMsg($message, array $data = null){ |
|
689 | 688 | $message = $this->label($message, $data); |
690 | 689 | if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) |
691 | 690 | @unlink($this->file['tmp_name']); |
@@ -697,7 +696,7 @@ discard block |
||
697 | 696 | * @param $url |
698 | 697 | * @param string $message |
699 | 698 | */ |
700 | - protected function callBack($url, $message="") { |
|
699 | + protected function callBack($url, $message = ""){ |
|
701 | 700 | $message = text::jsValue($message); |
702 | 701 | $CKfuncNum = isset($this->opener['CKEditor']['funcNum']) |
703 | 702 | ? $this->opener['CKEditor']['funcNum'] : 0; |
@@ -741,7 +740,7 @@ discard block |
||
741 | 740 | /** |
742 | 741 | * @return string |
743 | 742 | */ |
744 | - protected function get_htaccess() { |
|
743 | + protected function get_htaccess(){ |
|
745 | 744 | return "<IfModule mod_php4.c> |
746 | 745 | php_value engine off |
747 | 746 | </IfModule> |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class uploader { |
|
15 | +class uploader |
|
16 | +{ |
|
16 | 17 | |
17 | 18 | /** Release version */ |
18 | 19 | const VERSION = "2.54"; |
@@ -104,7 +105,8 @@ 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 | |
@@ -112,13 +114,16 @@ discard block |
||
112 | 114 | * uploader constructor. |
113 | 115 | * @param DocumentParser $modx |
114 | 116 | */ |
115 | - public function __construct(DocumentParser $modx) { |
|
117 | + public function __construct(DocumentParser $modx) |
|
118 | + { |
|
116 | 119 | |
117 | 120 | //MODX |
118 | 121 | try { |
119 | 122 | if ($modx instanceof DocumentParser) { |
120 | 123 | $this->modx = $modx; |
121 | - } else throw new Exception('MODX should be instance of DocumentParser'); |
|
124 | + } else { |
|
125 | + throw new Exception('MODX should be instance of DocumentParser'); |
|
126 | + } |
|
122 | 127 | } catch (Exception $e) { |
123 | 128 | die($e->getMessage()); |
124 | 129 | } |
@@ -133,12 +138,14 @@ discard block |
||
133 | 138 | // SET CMS INTEGRATION ATTRIBUTE |
134 | 139 | if (isset($this->get['cms']) && |
135 | 140 | in_array($this->get['cms'], array("drupal")) |
136 | - ) |
|
137 | - $this->cms = $this->get['cms']; |
|
141 | + ) { |
|
142 | + $this->cms = $this->get['cms']; |
|
143 | + } |
|
138 | 144 | |
139 | 145 | // LINKING UPLOADED FILE |
140 | - if (count($_FILES)) |
|
141 | - $this->file = &$_FILES[key($_FILES)]; |
|
146 | + if (count($_FILES)) { |
|
147 | + $this->file = &$_FILES[key($_FILES)]; |
|
148 | + } |
|
142 | 149 | |
143 | 150 | // LOAD DEFAULT CONFIGURATION |
144 | 151 | require "config.php"; |
@@ -148,31 +155,37 @@ discard block |
||
148 | 155 | if (isset($_CONFIG['_sessionVar']) && |
149 | 156 | is_array($_CONFIG['_sessionVar']) |
150 | 157 | ) { |
151 | - foreach ($_CONFIG['_sessionVar'] as $key => $val) |
|
152 | - if ((substr($key, 0, 1) != "_") && isset($_CONFIG[$key])) |
|
158 | + foreach ($_CONFIG['_sessionVar'] as $key => $val) { |
|
159 | + if ((substr($key, 0, 1) != "_") && isset($_CONFIG[$key])) |
|
153 | 160 | $this->config[$key] = $val; |
154 | - if (!isset($this->config['_sessionVar']['self'])) |
|
155 | - $this->config['_sessionVar']['self'] = array(); |
|
161 | + } |
|
162 | + if (!isset($this->config['_sessionVar']['self'])) { |
|
163 | + $this->config['_sessionVar']['self'] = array(); |
|
164 | + } |
|
156 | 165 | $this->session = &$this->config['_sessionVar']['self']; |
157 | - } else |
|
158 | - $this->session = &$_SESSION; |
|
166 | + } else { |
|
167 | + $this->session = &$_SESSION; |
|
168 | + } |
|
159 | 169 | |
160 | 170 | // IMAGE DRIVER INIT |
161 | 171 | if (isset($this->config['imageDriversPriority'])) { |
162 | 172 | $this->config['imageDriversPriority'] = |
163 | 173 | text::clearWhitespaces($this->config['imageDriversPriority']); |
164 | 174 | $driver = image::getDriver(explode(' ', $this->config['imageDriversPriority'])); |
165 | - if ($driver !== false) |
|
166 | - $this->imageDriver = $driver; |
|
175 | + if ($driver !== false) { |
|
176 | + $this->imageDriver = $driver; |
|
177 | + } |
|
167 | 178 | } |
168 | 179 | if ((!isset($driver) || ($driver === false)) && |
169 | 180 | (image::getDriver(array($this->imageDriver)) === false) |
170 | - ) |
|
171 | - die("Cannot find any of the supported PHP image extensions!"); |
|
181 | + ) { |
|
182 | + die("Cannot find any of the supported PHP image extensions!"); |
|
183 | + } |
|
172 | 184 | |
173 | 185 | // WATERMARK INIT |
174 | - if (isset($this->config['watermark']) && is_string($this->config['watermark'])) |
|
175 | - $this->config['watermark'] = array('file' => $this->config['watermark']); |
|
186 | + if (isset($this->config['watermark']) && is_string($this->config['watermark'])) { |
|
187 | + $this->config['watermark'] = array('file' => $this->config['watermark']); |
|
188 | + } |
|
176 | 189 | |
177 | 190 | // GET TYPE DIRECTORY |
178 | 191 | $this->types = &$this->config['types']; |
@@ -186,9 +199,10 @@ discard block |
||
186 | 199 | |
187 | 200 | // LOAD TYPE DIRECTORY SPECIFIC CONFIGURATION IF EXISTS |
188 | 201 | if (is_array($this->types[$this->type])) { |
189 | - foreach ($this->types[$this->type] as $key => $val) |
|
190 | - if (in_array($key, $this->typeSettings)) |
|
202 | + foreach ($this->types[$this->type] as $key => $val) { |
|
203 | + if (in_array($key, $this->typeSettings)) |
|
191 | 204 | $this->config[$key] = $val; |
205 | + } |
|
192 | 206 | $this->types[$this->type] = isset($this->types[$this->type]['type']) |
193 | 207 | ? $this->types[$this->type]['type'] : ""; |
194 | 208 | } |
@@ -198,12 +212,14 @@ discard block |
||
198 | 212 | $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/'; |
199 | 213 | if (preg_match($ip, $_SERVER['HTTP_HOST']) || |
200 | 214 | preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST']) |
201 | - ) |
|
202 | - $this->config['cookieDomain'] = ""; |
|
203 | - elseif (!strlen($this->config['cookieDomain'])) |
|
204 | - $this->config['cookieDomain'] = $_SERVER['HTTP_HOST']; |
|
205 | - if (!strlen($this->config['cookiePath'])) |
|
206 | - $this->config['cookiePath'] = "/"; |
|
215 | + ) { |
|
216 | + $this->config['cookieDomain'] = ""; |
|
217 | + } elseif (!strlen($this->config['cookieDomain'])) { |
|
218 | + $this->config['cookieDomain'] = $_SERVER['HTTP_HOST']; |
|
219 | + } |
|
220 | + if (!strlen($this->config['cookiePath'])) { |
|
221 | + $this->config['cookiePath'] = "/"; |
|
222 | + } |
|
207 | 223 | |
208 | 224 | // UPLOAD FOLDER INIT |
209 | 225 | |
@@ -239,26 +255,30 @@ discard block |
||
239 | 255 | $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
240 | 256 | $this->typeURL = "{$this->config['uploadURL']}/{$this->type}"; |
241 | 257 | } |
242 | - if (!is_dir($this->config['uploadDir'])) |
|
243 | - @mkdir($this->config['uploadDir'], $this->config['dirPerms']); |
|
258 | + if (!is_dir($this->config['uploadDir'])) { |
|
259 | + @mkdir($this->config['uploadDir'], $this->config['dirPerms']); |
|
260 | + } |
|
244 | 261 | |
245 | 262 | // HOST APPLICATIONS INIT |
246 | - if (isset($this->get['CKEditorFuncNum'])) |
|
247 | - $this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum']; |
|
263 | + if (isset($this->get['CKEditorFuncNum'])) { |
|
264 | + $this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum']; |
|
265 | + } |
|
248 | 266 | if (isset($this->get['opener']) && |
249 | 267 | (strtolower($this->get['opener']) == "tinymce") && |
250 | 268 | isset($this->config['_tinyMCEPath']) && |
251 | 269 | strlen($this->config['_tinyMCEPath']) |
252 | - ) |
|
253 | - $this->opener['TinyMCE'] = true; |
|
270 | + ) { |
|
271 | + $this->opener['TinyMCE'] = true; |
|
272 | + } |
|
254 | 273 | |
255 | 274 | // LOCALIZATION |
256 | - foreach ($this->langInputNames as $key) |
|
257 | - if (isset($this->get[$key]) && |
|
275 | + foreach ($this->langInputNames as $key) { |
|
276 | + if (isset($this->get[$key]) && |
|
258 | 277 | preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) && |
259 | 278 | file_exists("lang/" . strtolower($this->get[$key]) . ".php") |
260 | 279 | ) { |
261 | 280 | $this->lang = $this->get[$key]; |
281 | + } |
|
262 | 282 | break; |
263 | 283 | } |
264 | 284 | $this->localize($this->lang); |
@@ -269,28 +289,34 @@ discard block |
||
269 | 289 | ) { |
270 | 290 | $htaccess = "{$this->config['uploadDir']}/.htaccess"; |
271 | 291 | if (!file_exists($htaccess)) { |
272 | - if (!@file_put_contents($htaccess, $this->get_htaccess())) |
|
273 | - $this->backMsg("Cannot write to upload folder. {$this->config['uploadDir']}"); |
|
292 | + if (!@file_put_contents($htaccess, $this->get_htaccess())) { |
|
293 | + $this->backMsg("Cannot write to upload folder. {$this->config['uploadDir']}"); |
|
294 | + } |
|
274 | 295 | } else { |
275 | - if (false === ($data = @file_get_contents($htaccess))) |
|
276 | - $this->backMsg("Cannot read .htaccess"); |
|
277 | - if (($data != $this->get_htaccess()) && !@file_put_contents($htaccess, $data)) |
|
278 | - $this->backMsg("Incorrect .htaccess file. Cannot rewrite it!"); |
|
296 | + if (false === ($data = @file_get_contents($htaccess))) { |
|
297 | + $this->backMsg("Cannot read .htaccess"); |
|
298 | + } |
|
299 | + if (($data != $this->get_htaccess()) && !@file_put_contents($htaccess, $data)) { |
|
300 | + $this->backMsg("Incorrect .htaccess file. Cannot rewrite it!"); |
|
301 | + } |
|
279 | 302 | } |
280 | 303 | } |
281 | 304 | |
282 | 305 | // CHECK & CREATE UPLOAD FOLDER |
283 | 306 | if (!is_dir($this->typeDir)) { |
284 | - if (!mkdir($this->typeDir, $this->config['dirPerms'])) |
|
285 | - $this->backMsg("Cannot create {dir} folder.", array('dir' => $this->type)); |
|
286 | - } elseif (!is_readable($this->typeDir)) |
|
287 | - $this->backMsg("Cannot read upload folder."); |
|
307 | + if (!mkdir($this->typeDir, $this->config['dirPerms'])) { |
|
308 | + $this->backMsg("Cannot create {dir} folder.", array('dir' => $this->type)); |
|
309 | + } |
|
310 | + } elseif (!is_readable($this->typeDir)) { |
|
311 | + $this->backMsg("Cannot read upload folder."); |
|
312 | + } |
|
288 | 313 | } |
289 | 314 | |
290 | 315 | /** |
291 | 316 | * @return array|bool|int|null|string|void |
292 | 317 | */ |
293 | - protected function getTransaliasSettings() { |
|
318 | + protected function getTransaliasSettings() |
|
319 | + { |
|
294 | 320 | $modx = evolutionCMS(); |
295 | 321 | |
296 | 322 | // Cleaning uploaded filename? |
@@ -314,7 +340,8 @@ discard block |
||
314 | 340 | * @param $filename |
315 | 341 | * @return mixed|string |
316 | 342 | */ |
317 | - protected function normalizeFilename($filename) { |
|
343 | + protected function normalizeFilename($filename) |
|
344 | + { |
|
318 | 345 | if ($this->getTransaliasSettings()) { |
319 | 346 | $format = strrchr($filename, "."); |
320 | 347 | $filename = str_replace($format, "", $filename); |
@@ -327,7 +354,8 @@ discard block |
||
327 | 354 | * @param $dirname |
328 | 355 | * @return string |
329 | 356 | */ |
330 | - protected function normalizeDirname($dirname) { |
|
357 | + protected function normalizeDirname($dirname) |
|
358 | + { |
|
331 | 359 | return $this->modx->stripAlias($dirname); |
332 | 360 | } |
333 | 361 | |
@@ -335,19 +363,21 @@ discard block |
||
335 | 363 | * @param array|null $aFile |
336 | 364 | * @return bool|mixed |
337 | 365 | */ |
338 | - protected function checkUploadedFile(array $aFile=null) { |
|
366 | + protected function checkUploadedFile(array $aFile=null) |
|
367 | + { |
|
339 | 368 | $config = &$this->config; |
340 | 369 | $file = ($aFile === null) ? $this->file : $aFile; |
341 | 370 | |
342 | - if (!is_array($file) || !isset($file['name'])) |
|
343 | - return $this->label("Unknown error."); |
|
371 | + if (!is_array($file) || !isset($file['name'])) { |
|
372 | + return $this->label("Unknown error."); |
|
373 | + } |
|
344 | 374 | |
345 | 375 | $extension = file::getExtension($file['name']); |
346 | 376 | $typePatt = strtolower(text::clearWhitespaces($this->types[$this->type])); |
347 | 377 | |
348 | 378 | // CHECK FOR UPLOAD ERRORS |
349 | - if ($file['error']) |
|
350 | - return |
|
379 | + if ($file['error']) { |
|
380 | + return |
|
351 | 381 | ($file['error'] == UPLOAD_ERR_INI_SIZE) ? |
352 | 382 | $this->label("The uploaded file exceeds {size} bytes.", |
353 | 383 | array('size' => ini_get('upload_max_filesize'))) : ( |
@@ -364,14 +394,17 @@ discard block |
||
364 | 394 | $this->label("Failed to write file.") : |
365 | 395 | $this->label("Unknown error.") |
366 | 396 | ))))); |
397 | + } |
|
367 | 398 | |
368 | 399 | // HIDDEN FILENAMES CHECK |
369 | - elseif (substr($file['name'], 0, 1) == ".") |
|
370 | - return $this->label("File name shouldn't begins with '.'"); |
|
400 | + elseif (substr($file['name'], 0, 1) == ".") { |
|
401 | + return $this->label("File name shouldn't begins with '.'"); |
|
402 | + } |
|
371 | 403 | |
372 | 404 | // EXTENSION CHECK |
373 | - elseif (!$this->validateExtension($extension, $this->type)) |
|
374 | - return $this->label("Denied file extension."); |
|
405 | + elseif (!$this->validateExtension($extension, $this->type)) { |
|
406 | + return $this->label("Denied file extension."); |
|
407 | + } |
|
375 | 408 | |
376 | 409 | // SPECIAL DIRECTORY TYPES CHECK (e.g. *img) |
377 | 410 | elseif (preg_match('/^\*([^ ]+)(.*)?$/s', $typePatt, $patt)) { |
@@ -381,25 +414,30 @@ discard block |
||
381 | 414 | $type = new $class(); |
382 | 415 | $cfg = $config; |
383 | 416 | $cfg['filename'] = $file['name']; |
384 | - if (strlen($params)) |
|
385 | - $cfg['params'] = trim($params); |
|
417 | + if (strlen($params)) { |
|
418 | + $cfg['params'] = trim($params); |
|
419 | + } |
|
386 | 420 | $response = $type->checkFile($file['tmp_name'], $cfg); |
387 | - if ($response !== true) |
|
388 | - return $this->label($response); |
|
389 | - } else |
|
390 | - return $this->label("Non-existing directory type."); |
|
421 | + if ($response !== true) { |
|
422 | + return $this->label($response); |
|
423 | + } |
|
424 | + } else { |
|
425 | + return $this->label("Non-existing directory type."); |
|
426 | + } |
|
391 | 427 | } |
392 | 428 | |
393 | 429 | // IMAGE RESIZE |
394 | 430 | $img = image::factory($this->imageDriver, $file['tmp_name']); |
395 | - if (!$img->initError && !$this->imageResize($img, $file['tmp_name'])) |
|
396 | - return $this->label("The image is too big and/or cannot be resized."); |
|
431 | + if (!$img->initError && !$this->imageResize($img, $file['tmp_name'])) { |
|
432 | + return $this->label("The image is too big and/or cannot be resized."); |
|
433 | + } |
|
397 | 434 | |
398 | 435 | |
399 | 436 | // CHECK FOR MODX MAX FILE SIZE |
400 | 437 | $actualfilesize=filesize($file['tmp_name']); |
401 | - if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
402 | - return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
438 | + if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) { |
|
439 | + return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
440 | + } |
|
403 | 441 | |
404 | 442 | return true; |
405 | 443 | } |
@@ -410,27 +448,32 @@ discard block |
||
410 | 448 | * @param bool $existing |
411 | 449 | * @return bool|string |
412 | 450 | */ |
413 | - protected function checkInputDir($dir, $inclType=true, $existing=true) { |
|
451 | + protected function checkInputDir($dir, $inclType=true, $existing=true) |
|
452 | + { |
|
414 | 453 | $dir = path::normalize($dir); |
415 | - if (substr($dir, 0, 1) == "/") |
|
416 | - $dir = substr($dir, 1); |
|
454 | + if (substr($dir, 0, 1) == "/") { |
|
455 | + $dir = substr($dir, 1); |
|
456 | + } |
|
417 | 457 | |
418 | - if ((substr($dir, 0, 1) == ".") || (substr(basename($dir), 0, 1) == ".")) |
|
419 | - return false; |
|
458 | + if ((substr($dir, 0, 1) == ".") || (substr(basename($dir), 0, 1) == ".")) { |
|
459 | + return false; |
|
460 | + } |
|
420 | 461 | |
421 | 462 | if ($inclType) { |
422 | 463 | $first = explode("/", $dir); |
423 | 464 | $first = $first[0]; |
424 | - if ($first != $this->type) |
|
425 | - return false; |
|
465 | + if ($first != $this->type) { |
|
466 | + return false; |
|
467 | + } |
|
426 | 468 | $return = $this->removeTypeFromPath($dir); |
427 | 469 | } else { |
428 | 470 | $return = $dir; |
429 | 471 | $dir = "{$this->type}/$dir"; |
430 | 472 | } |
431 | 473 | |
432 | - if (!$existing) |
|
433 | - return $return; |
|
474 | + if (!$existing) { |
|
475 | + return $return; |
|
476 | + } |
|
434 | 477 | |
435 | 478 | $path = "{$this->config['uploadDir']}/$dir"; |
436 | 479 | return (is_dir($path) && is_readable($path)) ? $return : false; |
@@ -441,21 +484,25 @@ discard block |
||
441 | 484 | * @param $type |
442 | 485 | * @return bool |
443 | 486 | */ |
444 | - protected function validateExtension($ext, $type) { |
|
487 | + protected function validateExtension($ext, $type) |
|
488 | + { |
|
445 | 489 | $ext = trim(strtolower($ext)); |
446 | - if (!isset($this->types[$type])) |
|
447 | - return false; |
|
490 | + if (!isset($this->types[$type])) { |
|
491 | + return false; |
|
492 | + } |
|
448 | 493 | |
449 | 494 | $exts = strtolower(text::clearWhitespaces($this->config['deniedExts'])); |
450 | 495 | if (strlen($exts)) { |
451 | 496 | $exts = explode(" ", $exts); |
452 | - if (in_array($ext, $exts)) |
|
453 | - return false; |
|
497 | + if (in_array($ext, $exts)) { |
|
498 | + return false; |
|
499 | + } |
|
454 | 500 | } |
455 | 501 | |
456 | 502 | $exts = trim($this->types[$type]); |
457 | - if (!strlen($exts) || substr($exts, 0, 1) == "*") |
|
458 | - return true; |
|
503 | + if (!strlen($exts) || substr($exts, 0, 1) == "*") { |
|
504 | + return true; |
|
505 | + } |
|
459 | 506 | |
460 | 507 | if (substr($exts, 0, 1) == "!") { |
461 | 508 | $exts = explode(" ", trim(strtolower(substr($exts, 1)))); |
@@ -470,7 +517,8 @@ discard block |
||
470 | 517 | * @param $path |
471 | 518 | * @return mixed |
472 | 519 | */ |
473 | - protected function getTypeFromPath($path) { |
|
520 | + protected function getTypeFromPath($path) |
|
521 | + { |
|
474 | 522 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
475 | 523 | ? $patt[1] : $path; |
476 | 524 | } |
@@ -479,7 +527,8 @@ discard block |
||
479 | 527 | * @param $path |
480 | 528 | * @return string |
481 | 529 | */ |
482 | - protected function removeTypeFromPath($path) { |
|
530 | + protected function removeTypeFromPath($path) |
|
531 | + { |
|
483 | 532 | return preg_match('/^[^\/]*\/(.*)$/', $path, $patt) |
484 | 533 | ? $patt[1] : ""; |
485 | 534 | } |
@@ -489,16 +538,20 @@ discard block |
||
489 | 538 | * @param null $file |
490 | 539 | * @return bool |
491 | 540 | */ |
492 | - protected function imageResize($image, $file=null) { |
|
541 | + protected function imageResize($image, $file=null) |
|
542 | + { |
|
493 | 543 | |
494 | 544 | if (!($image instanceof image)) { |
495 | 545 | $img = image::factory($this->imageDriver, $image); |
496 | - if ($img->initError) return false; |
|
546 | + if ($img->initError) { |
|
547 | + return false; |
|
548 | + } |
|
497 | 549 | $file = $image; |
498 | - } elseif ($file === null) |
|
499 | - return false; |
|
500 | - else |
|
501 | - $img = $image; |
|
550 | + } elseif ($file === null) { |
|
551 | + return false; |
|
552 | + } else { |
|
553 | + $img = $image; |
|
554 | + } |
|
502 | 555 | |
503 | 556 | $orientation = 1; |
504 | 557 | if (function_exists("exif_read_data")) { |
@@ -520,8 +573,9 @@ discard block |
||
520 | 573 | ) |
521 | 574 | ) && |
522 | 575 | ($orientation == 1) |
523 | - ) |
|
524 | - return true; |
|
576 | + ) { |
|
577 | + return true; |
|
578 | + } |
|
525 | 579 | |
526 | 580 | |
527 | 581 | // PROPORTIONAL RESIZE |
@@ -541,15 +595,17 @@ discard block |
||
541 | 595 | $width = $img->getPropWidth($height); |
542 | 596 | } |
543 | 597 | |
544 | - if (isset($width) && isset($height) && !$img->resize($width, $height)) |
|
545 | - return false; |
|
598 | + if (isset($width) && isset($height) && !$img->resize($width, $height)) { |
|
599 | + return false; |
|
600 | + } |
|
546 | 601 | |
547 | 602 | // RESIZE TO FIT |
548 | 603 | } elseif ( |
549 | 604 | $this->config['maxImageWidth'] && $this->config['maxImageHeight'] && |
550 | 605 | !$img->resizeFit($this->config['maxImageWidth'], $this->config['maxImageHeight']) |
551 | - ) |
|
552 | - return false; |
|
606 | + ) { |
|
607 | + return false; |
|
608 | + } |
|
553 | 609 | |
554 | 610 | // AUTO FLIP AND ROTATE FROM EXIF |
555 | 611 | if ((($orientation == 2) && !$img->flipHorizontal()) || |
@@ -559,11 +615,13 @@ discard block |
||
559 | 615 | (($orientation == 6) && !$img->rotate(90)) || |
560 | 616 | (($orientation == 7) && (!$img->flipHorizontal() || !$img->rotate(90))) || |
561 | 617 | (($orientation == 8) && !$img->rotate(270)) |
562 | - ) |
|
563 | - return false; |
|
564 | - if (($orientation >= 2) && ($orientation <= 8) && ($this->imageDriver == "imagick")) |
|
565 | - try { |
|
618 | + ) { |
|
619 | + return false; |
|
620 | + } |
|
621 | + if (($orientation >= 2) && ($orientation <= 8) && ($this->imageDriver == "imagick")) { |
|
622 | + try { |
|
566 | 623 | $img->image->setImageProperty('exif:Orientation', "1"); |
624 | + } |
|
567 | 625 | } catch (Exception $e) {} |
568 | 626 | |
569 | 627 | // WATERMARK |
@@ -599,22 +657,26 @@ discard block |
||
599 | 657 | * @param bool $overwrite |
600 | 658 | * @return bool |
601 | 659 | */ |
602 | - protected function makeThumb($file, $overwrite=true) { |
|
660 | + protected function makeThumb($file, $overwrite=true) |
|
661 | + { |
|
603 | 662 | $img = image::factory($this->imageDriver, $file); |
604 | 663 | |
605 | 664 | // Drop files which are not images |
606 | - if ($img->initError) |
|
607 | - return true; |
|
665 | + if ($img->initError) { |
|
666 | + return true; |
|
667 | + } |
|
608 | 668 | |
609 | 669 | $thumb = substr($file, strlen($this->config['uploadDir'])); |
610 | 670 | $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb; |
611 | 671 | $thumb = path::normalize($thumb); |
612 | 672 | $thumbDir = dirname($thumb); |
613 | - if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) |
|
614 | - return false; |
|
673 | + if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) { |
|
674 | + return false; |
|
675 | + } |
|
615 | 676 | |
616 | - if (!$overwrite && is_file($thumb)) |
|
617 | - return true; |
|
677 | + if (!$overwrite && is_file($thumb)) { |
|
678 | + return true; |
|
679 | + } |
|
618 | 680 | |
619 | 681 | // Images with smaller resolutions than thumbnails |
620 | 682 | /*if (($img->width <= $this->config['thumbWidth']) && |
@@ -627,8 +689,9 @@ discard block |
||
627 | 689 | |
628 | 690 | // Resize image |
629 | 691 | } else */ |
630 | - if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) |
|
631 | - return false; |
|
692 | + if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) { |
|
693 | + return false; |
|
694 | + } |
|
632 | 695 | |
633 | 696 | if ( $this->imageDriver == 'gd' ) { |
634 | 697 | $width = imagesx( $img->image ); |
@@ -653,7 +716,8 @@ discard block |
||
653 | 716 | /** |
654 | 717 | * @param $langCode |
655 | 718 | */ |
656 | - protected function localize($langCode) { |
|
719 | + protected function localize($langCode) |
|
720 | + { |
|
657 | 721 | require "lang/{$langCode}.php"; |
658 | 722 | setlocale(LC_ALL, $lang['_locale']); |
659 | 723 | $this->charset = $lang['_charset']; |
@@ -673,11 +737,13 @@ discard block |
||
673 | 737 | * @param array|null $data |
674 | 738 | * @return mixed |
675 | 739 | */ |
676 | - protected function label($string, array $data=null) { |
|
740 | + protected function label($string, array $data=null) |
|
741 | + { |
|
677 | 742 | $return = isset($this->labels[$string]) ? $this->labels[$string] : $string; |
678 | - if (is_array($data)) |
|
679 | - foreach ($data as $key => $val) |
|
743 | + if (is_array($data)) { |
|
744 | + foreach ($data as $key => $val) |
|
680 | 745 | $return = str_replace("{{$key}}", $val, $return); |
746 | + } |
|
681 | 747 | return $return; |
682 | 748 | } |
683 | 749 | |
@@ -685,10 +751,12 @@ discard block |
||
685 | 751 | * @param $message |
686 | 752 | * @param array|null $data |
687 | 753 | */ |
688 | - protected function backMsg($message, array $data=null) { |
|
754 | + protected function backMsg($message, array $data=null) |
|
755 | + { |
|
689 | 756 | $message = $this->label($message, $data); |
690 | - if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) |
|
691 | - @unlink($this->file['tmp_name']); |
|
757 | + if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) { |
|
758 | + @unlink($this->file['tmp_name']); |
|
759 | + } |
|
692 | 760 | $this->callBack("", $message); |
693 | 761 | die; |
694 | 762 | } |
@@ -697,11 +765,14 @@ discard block |
||
697 | 765 | * @param $url |
698 | 766 | * @param string $message |
699 | 767 | */ |
700 | - protected function callBack($url, $message="") { |
|
768 | + protected function callBack($url, $message="") |
|
769 | + { |
|
701 | 770 | $message = text::jsValue($message); |
702 | 771 | $CKfuncNum = isset($this->opener['CKEditor']['funcNum']) |
703 | 772 | ? $this->opener['CKEditor']['funcNum'] : 0; |
704 | - if (!$CKfuncNum) $CKfuncNum = 0; |
|
773 | + if (!$CKfuncNum) { |
|
774 | + $CKfuncNum = 0; |
|
775 | + } |
|
705 | 776 | header("Content-Type: text/html; charset={$this->charset}"); |
706 | 777 | |
707 | 778 | ?><html> |
@@ -741,7 +812,8 @@ discard block |
||
741 | 812 | /** |
742 | 813 | * @return string |
743 | 814 | */ |
744 | - protected function get_htaccess() { |
|
815 | + protected function get_htaccess() |
|
816 | + { |
|
745 | 817 | return "<IfModule mod_php4.c> |
746 | 818 | php_value engine off |
747 | 819 | </IfModule> |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | 6 | // invoke OnManagerTreeInit event |
7 | 7 | $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST); |
8 | -if(is_array($evtOut)) { |
|
8 | +if (is_array($evtOut)) { |
|
9 | 9 | echo implode("\n", $evtOut); |
10 | 10 | } |
11 | 11 | ?> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | <a class="treeButton" id="treeMenu_collapsetree" onclick="modx.tree.collapseTree();" title="<?php echo $_lang['collapse_tree']; ?>"><?php echo $_style['collapse_tree']; ?></a> |
19 | 19 | |
20 | - <?php if($modx->hasPermission('new_document')) { ?> |
|
20 | + <?php if ($modx->hasPermission('new_document')) { ?> |
|
21 | 21 | <a class="treeButton" id="treeMenu_addresource" onclick="modx.tabs({url:'<?= MODX_MANAGER_URL ?>?a=4', title: '<?php echo $_lang['add_resource']; ?>'});" title="<?php echo $_lang['add_resource']; ?>"><?php echo $_style['add_doc_tree']; ?></a> |
22 | 22 | <a class="treeButton" id="treeMenu_addweblink" onclick="modx.tabs({url:'<?= MODX_MANAGER_URL ?>?a=72', title: '<?php echo $_lang['add_weblink']; ?>'});" title="<?php echo $_lang['add_weblink']; ?>"><?php echo $_style['add_weblink_tree']; ?></a> |
23 | 23 | <?php } ?> |
@@ -26,23 +26,23 @@ discard block |
||
26 | 26 | |
27 | 27 | <a class="treeButton" id="treeMenu_sortingtree" onclick="modx.tree.showSorter(event);" title="<?php echo $_lang['sort_tree']; ?>"><?php echo $_style['sort_tree']; ?></a> |
28 | 28 | |
29 | - <?php if($modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { ?> |
|
29 | + <?php if ($modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { ?> |
|
30 | 30 | <a class="treeButton" id="treeMenu_sortingindex" onclick="modx.tabs({url: '<?= MODX_MANAGER_URL ?>?a=56&id=0', title: '<?php echo $_lang['sort_menuindex']; ?>'});" title="<?php echo $_lang['sort_menuindex']; ?>"><?php echo $_style['sort_menuindex']; ?></a> |
31 | 31 | <?php } ?> |
32 | 32 | |
33 | - <?php if($use_browser && $modx->hasPermission('assets_images')) { ?> |
|
34 | - <a class="treeButton" id="treeMenu_openimages" title="<?php echo $_lang["images_management"] . "\n" . $_lang['em_button_shift'] ?>"><?php echo $_style['images_management']; ?></a> |
|
33 | + <?php if ($use_browser && $modx->hasPermission('assets_images')) { ?> |
|
34 | + <a class="treeButton" id="treeMenu_openimages" title="<?php echo $_lang["images_management"]."\n".$_lang['em_button_shift'] ?>"><?php echo $_style['images_management']; ?></a> |
|
35 | 35 | <?php } ?> |
36 | 36 | |
37 | - <?php if($use_browser && $modx->hasPermission('assets_files')) { ?> |
|
38 | - <a class="treeButton" id="treeMenu_openfiles" title="<?php echo $_lang["files_management"] . "\n" . $_lang['em_button_shift'] ?>"><?php echo $_style['files_management']; ?></a> |
|
37 | + <?php if ($use_browser && $modx->hasPermission('assets_files')) { ?> |
|
38 | + <a class="treeButton" id="treeMenu_openfiles" title="<?php echo $_lang["files_management"]."\n".$_lang['em_button_shift'] ?>"><?php echo $_style['files_management']; ?></a> |
|
39 | 39 | <?php } ?> |
40 | 40 | |
41 | - <?php if($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?> |
|
42 | - <a class="treeButton" id="treeMenu_openelements" title="<?php echo $_lang["element_management"] . "\n" . $_lang['em_button_shift'] ?>"><?php echo $_style['element_management']; ?></a> |
|
41 | + <?php if ($modx->hasPermission('edit_template') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('edit_chunk') || $modx->hasPermission('edit_plugin')) { ?> |
|
42 | + <a class="treeButton" id="treeMenu_openelements" title="<?php echo $_lang["element_management"]."\n".$_lang['em_button_shift'] ?>"><?php echo $_style['element_management']; ?></a> |
|
43 | 43 | <?php } ?> |
44 | 44 | |
45 | - <?php if($modx->hasPermission('empty_trash')) { ?> |
|
45 | + <?php if ($modx->hasPermission('empty_trash')) { ?> |
|
46 | 46 | <a class="treeButton treeButtonDisabled" id="treeMenu_emptytrash" title="<?php echo $_lang['empty_recycle_bin_empty']; ?>"><?php echo $_style['empty_recycle_bin_empty']; ?></a> |
47 | 47 | <?php } ?> |
48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | <?php |
55 | 55 | // invoke OnManagerTreePrerender event |
56 | 56 | $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST)); |
57 | - if(is_array($evtOut)) { |
|
57 | + if (is_array($evtOut)) { |
|
58 | 58 | echo implode("\n", $evtOut); |
59 | 59 | } |
60 | 60 | ?> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | <?php |
67 | 67 | // invoke OnManagerTreeRender event |
68 | 68 | $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST)); |
69 | - if(is_array($evtOut)) { |
|
69 | + if (is_array($evtOut)) { |
|
70 | 70 | echo implode("\n", $evtOut); |
71 | 71 | } |
72 | 72 | ?> |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | 6 | // invoke OnManagerTreeInit event |
7 | 7 | $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST); |
8 | -if(is_array($evtOut)) { |
|
8 | +if(is_array($evtOut)) { |
|
9 | 9 | echo implode("\n", $evtOut); |
10 | 10 | } |
11 | 11 | ?> |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | <?php |
55 | 55 | // invoke OnManagerTreePrerender event |
56 | 56 | $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST)); |
57 | - if(is_array($evtOut)) { |
|
57 | + if(is_array($evtOut)) { |
|
58 | 58 | echo implode("\n", $evtOut); |
59 | 59 | } |
60 | 60 | ?> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | <?php |
67 | 67 | // invoke OnManagerTreeRender event |
68 | 68 | $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST)); |
69 | - if(is_array($evtOut)) { |
|
69 | + if(is_array($evtOut)) { |
|
70 | 70 | echo implode("\n", $evtOut); |
71 | 71 | } |
72 | 72 | ?> |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | // invoke OnManagerTreeInit event |
7 | 7 | $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST); |
8 | 8 | if(is_array($evtOut)) { |
9 | - echo implode("\n", $evtOut); |
|
9 | + echo implode("\n", $evtOut); |
|
10 | 10 | } |
11 | 11 | ?> |
12 | 12 | |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | |
53 | 53 | <div id="treeHolder"> |
54 | 54 | <?php |
55 | - // invoke OnManagerTreePrerender event |
|
56 | - $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST)); |
|
57 | - if(is_array($evtOut)) { |
|
58 | - echo implode("\n", $evtOut); |
|
59 | - } |
|
60 | - ?> |
|
55 | + // invoke OnManagerTreePrerender event |
|
56 | + $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST)); |
|
57 | + if(is_array($evtOut)) { |
|
58 | + echo implode("\n", $evtOut); |
|
59 | + } |
|
60 | + ?> |
|
61 | 61 | <div id="node0" class="rootNode"><a class="node" onclick="modx.tree.treeAction(event, 0)" data-id="0" data-title-esc="<?php $site_name = $modx->getPhpCompat()->entities($site_name); |
62 | - echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a> |
|
62 | + echo $site_name; ?>"><span class="icon"><?php echo $_style['tree_showtree']; ?></span><span class="title"><?php echo $site_name; ?></span></a> |
|
63 | 63 | <div id="treeloader"><i class="fa fa-cog fa-spin fa-3x fa-fw"></i></div> |
64 | 64 | </div> |
65 | 65 | <div id="treeRoot"></div> |
66 | 66 | <?php |
67 | - // invoke OnManagerTreeRender event |
|
68 | - $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST)); |
|
69 | - if(is_array($evtOut)) { |
|
70 | - echo implode("\n", $evtOut); |
|
71 | - } |
|
72 | - ?> |
|
67 | + // invoke OnManagerTreeRender event |
|
68 | + $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST)); |
|
69 | + if(is_array($evtOut)) { |
|
70 | + echo implode("\n", $evtOut); |
|
71 | + } |
|
72 | + ?> |
|
73 | 73 | </div> |
74 | 74 | </div> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('file_manager')) { |
@@ -9,15 +9,15 @@ discard block |
||
9 | 9 | $newToken = makeToken(); |
10 | 10 | |
11 | 11 | // settings |
12 | -$theme_image_path = $modx->config['site_manager_url'] . 'media/style/' . $modx->config['manager_theme'] . '/images/'; |
|
12 | +$theme_image_path = $modx->config['site_manager_url'].'media/style/'.$modx->config['manager_theme'].'/images/'; |
|
13 | 13 | $excludes = array( |
14 | 14 | '.', |
15 | 15 | '..', |
16 | 16 | '.svn' |
17 | 17 | ); |
18 | -$alias_suffix = (!empty($friendly_url_suffix)) ? ',' . ltrim($friendly_url_suffix, '.') : ''; |
|
19 | -$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix); |
|
20 | -$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix); |
|
18 | +$alias_suffix = (!empty($friendly_url_suffix)) ? ','.ltrim($friendly_url_suffix, '.') : ''; |
|
19 | +$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix); |
|
20 | +$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix); |
|
21 | 21 | $viewablefiles = explode(',', 'jpg,gif,png,ico'); |
22 | 22 | |
23 | 23 | $editablefiles = add_dot($editablefiles); |
@@ -30,31 +30,31 @@ discard block |
||
30 | 30 | { |
31 | 31 | */ |
32 | 32 | $protected_path[] = $modx->config['site_manager_path']; |
33 | -$protected_path[] = $modx->config['base_path'] . 'temp/backup'; |
|
34 | -$protected_path[] = $modx->config['base_path'] . 'assets/backup'; |
|
33 | +$protected_path[] = $modx->config['base_path'].'temp/backup'; |
|
34 | +$protected_path[] = $modx->config['base_path'].'assets/backup'; |
|
35 | 35 | |
36 | 36 | if (!$modx->hasPermission('save_plugin')) { |
37 | - $protected_path[] = $modx->config['base_path'] . 'assets/plugins'; |
|
37 | + $protected_path[] = $modx->config['base_path'].'assets/plugins'; |
|
38 | 38 | } |
39 | 39 | if (!$modx->hasPermission('save_snippet')) { |
40 | - $protected_path[] = $modx->config['base_path'] . 'assets/snippets'; |
|
40 | + $protected_path[] = $modx->config['base_path'].'assets/snippets'; |
|
41 | 41 | } |
42 | 42 | if (!$modx->hasPermission('save_template')) { |
43 | - $protected_path[] = $modx->config['base_path'] . 'assets/templates'; |
|
43 | + $protected_path[] = $modx->config['base_path'].'assets/templates'; |
|
44 | 44 | } |
45 | 45 | if (!$modx->hasPermission('save_module')) { |
46 | - $protected_path[] = $modx->config['base_path'] . 'assets/modules'; |
|
46 | + $protected_path[] = $modx->config['base_path'].'assets/modules'; |
|
47 | 47 | } |
48 | 48 | if (!$modx->hasPermission('empty_cache')) { |
49 | - $protected_path[] = $modx->config['base_path'] . 'assets/cache'; |
|
49 | + $protected_path[] = $modx->config['base_path'].'assets/cache'; |
|
50 | 50 | } |
51 | 51 | if (!$modx->hasPermission('import_static')) { |
52 | - $protected_path[] = $modx->config['base_path'] . 'temp/import'; |
|
53 | - $protected_path[] = $modx->config['base_path'] . 'assets/import'; |
|
52 | + $protected_path[] = $modx->config['base_path'].'temp/import'; |
|
53 | + $protected_path[] = $modx->config['base_path'].'assets/import'; |
|
54 | 54 | } |
55 | 55 | if (!$modx->hasPermission('export_static')) { |
56 | - $protected_path[] = $modx->config['base_path'] . 'temp/export'; |
|
57 | - $protected_path[] = $modx->config['base_path'] . 'assets/export'; |
|
56 | + $protected_path[] = $modx->config['base_path'].'temp/export'; |
|
57 | + $protected_path[] = $modx->config['base_path'].'assets/export'; |
|
58 | 58 | } |
59 | 59 | /* |
60 | 60 | } |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | $rw = realpath('../'); |
97 | 97 | $webstart_path = str_replace('\\', '/', str_replace($rw, '', $rf)); |
98 | 98 | if (substr($webstart_path, 0, 1) == '/') { |
99 | - $webstart_path = '..' . $webstart_path; |
|
99 | + $webstart_path = '..'.$webstart_path; |
|
100 | 100 | } else { |
101 | - $webstart_path = '../' . $webstart_path; |
|
101 | + $webstart_path = '../'.$webstart_path; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | ?> |
105 | 105 | <script type="text/javascript"> |
106 | 106 | |
107 | - var current_path = '<?= $startpath;?>'; |
|
107 | + var current_path = '<?= $startpath; ?>'; |
|
108 | 108 | |
109 | 109 | function viewfile (url) |
110 | 110 | { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | function unzipFile (file) |
141 | 141 | { |
142 | 142 | if (confirmUnzip()) { |
143 | - window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken;?>"; |
|
143 | + window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken; ?>"; |
|
144 | 144 | return false; |
145 | 145 | } |
146 | 146 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | function deleteFolder (folder, status) |
163 | 163 | { |
164 | 164 | if (confirmDeleteFolder(status)) { |
165 | - window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken;?>"; |
|
165 | + window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken; ?>"; |
|
166 | 166 | return false; |
167 | 167 | } |
168 | 168 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | function deleteFile (file) |
171 | 171 | { |
172 | 172 | if (confirmDelete()) { |
173 | - window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken;?>"; |
|
173 | + window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken; ?>"; |
|
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | { |
180 | 180 | var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
181 | 181 | if (newFilename !== null && newFilename !== file) { |
182 | - window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
182 | + window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | { |
188 | 188 | var newDirname = prompt("<?= $_lang["files_dynamic_new_folder_name"] ?>", dir); |
189 | 189 | if (newDirname !== null && newDirname !== dir) { |
190 | - window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken;?>"; |
|
190 | + window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken; ?>"; |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | { |
196 | 196 | var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file); |
197 | 197 | if (newFilename !== null && newFilename !== file) { |
198 | - window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>"; |
|
198 | + window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>"; |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | <?php endif ?> |
215 | 215 | <?php |
216 | 216 | if (isset($_GET['mode']) && $_GET['mode'] !== 'drill') { |
217 | - $href = 'a=31&path=' . urlencode($_REQUEST['path']); |
|
217 | + $href = 'a=31&path='.urlencode($_REQUEST['path']); |
|
218 | 218 | } else { |
219 | 219 | $href = 'a=2'; |
220 | 220 | } |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFolderName(this);"><i class="[+image+]"></i><span>[+subject+]</span></a>'; |
225 | 225 | $ph['image'] = $_style['files_folder-open']; |
226 | 226 | $ph['subject'] = $_lang['add_folder']; |
227 | - $ph['href'] = 'index.php?a=31&mode=newfolder&path=' . urlencode($startpath) . '&name='; |
|
227 | + $ph['href'] = 'index.php?a=31&mode=newfolder&path='.urlencode($startpath).'&name='; |
|
228 | 228 | $_ = parsePlaceholder($tpl, $ph); |
229 | 229 | |
230 | - $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>' . $_lang['files.dynamic.php1'] . '</span></a>'; |
|
230 | + $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>'.$_lang['files.dynamic.php1'].'</span></a>'; |
|
231 | 231 | $ph['image'] = $_style['files_page_html']; |
232 | - $ph['href'] = 'index.php?a=31&mode=newfile&path=' . urlencode($startpath) . '&name='; |
|
232 | + $ph['href'] = 'index.php?a=31&mode=newfile&path='.urlencode($startpath).'&name='; |
|
233 | 233 | $_ .= parsePlaceholder($tpl, $ph); |
234 | 234 | echo $_; |
235 | 235 | } |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | $ph = array(); |
260 | 260 | $ph['style_path'] = $theme_image_path; |
261 | 261 | // To Top Level with folder icon to the left |
262 | - if ($startpath == $filemanager_path || $startpath . '/' == $filemanager_path) { |
|
263 | - $ph['image'] = '' . $_style['files_top'] . ''; |
|
262 | + if ($startpath == $filemanager_path || $startpath.'/' == $filemanager_path) { |
|
263 | + $ph['image'] = ''.$_style['files_top'].''; |
|
264 | 264 | $ph['subject'] = '<span>Top</span>'; |
265 | 265 | } else { |
266 | - $ph['image'] = '' . $_style['files_top'] . ''; |
|
267 | - $ph['subject'] = '<a href="index.php?a=31&mode=drill&path=' . $filemanager_path . '">Top</a>/'; |
|
266 | + $ph['image'] = ''.$_style['files_top'].''; |
|
267 | + $ph['subject'] = '<a href="index.php?a=31&mode=drill&path='.$filemanager_path.'">Top</a>/'; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | echo parsePlaceholder($tpl, $ph); |
@@ -281,12 +281,12 @@ discard block |
||
281 | 281 | if (empty($v)) { |
282 | 282 | continue; |
283 | 283 | } |
284 | - $path .= rtrim($v, '/') . '/'; |
|
284 | + $path .= rtrim($v, '/').'/'; |
|
285 | 285 | if (1 < $count) { |
286 | - $href = 'index.php?a=31&mode=drill&path=' . urlencode($filemanager_path . $path); |
|
287 | - $pieces[$i] = '<a href="' . $href . '">' . trim($v, '/') . '</a>'; |
|
286 | + $href = 'index.php?a=31&mode=drill&path='.urlencode($filemanager_path.$path); |
|
287 | + $pieces[$i] = '<a href="'.$href.'">'.trim($v, '/').'</a>'; |
|
288 | 288 | } else { |
289 | - $pieces[$i] = '<span>' . trim($v, '/') . '</span>'; |
|
289 | + $pieces[$i] = '<span>'.trim($v, '/').'</span>'; |
|
290 | 290 | } |
291 | 291 | $count--; |
292 | 292 | } |
@@ -299,16 +299,16 @@ discard block |
||
299 | 299 | </div> |
300 | 300 | <?php |
301 | 301 | // check to see user isn't trying to move below the document_root |
302 | - if (substr(strtolower(str_replace('//', '/', $startpath . "/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path . '/'))) { |
|
302 | + if (substr(strtolower(str_replace('//', '/', $startpath."/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path.'/'))) { |
|
303 | 303 | $modx->webAlertAndQuit($_lang["files_access_denied"]); |
304 | 304 | } |
305 | 305 | |
306 | 306 | // Unzip .zip files - by Raymond |
307 | 307 | if ($enablefileunzip && $_REQUEST['mode'] == 'unzip' && is_writable($startpath)) { |
308 | - if (!$err = unzip(realpath("{$startpath}/" . $_REQUEST['file']), realpath($startpath))) { |
|
309 | - echo '<span class="warning"><b>' . $_lang['file_unzip_fail'] . ($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '') . '</b></span><br /><br />'; |
|
308 | + if (!$err = unzip(realpath("{$startpath}/".$_REQUEST['file']), realpath($startpath))) { |
|
309 | + echo '<span class="warning"><b>'.$_lang['file_unzip_fail'].($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '').'</b></span><br /><br />'; |
|
310 | 310 | } else { |
311 | - echo '<span class="success"><b>' . $_lang['file_unzip'] . '</b></span><br /><br />'; |
|
311 | + echo '<span class="success"><b>'.$_lang['file_unzip'].'</b></span><br /><br />'; |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | // End Unzip - Raymond |
@@ -320,9 +320,9 @@ discard block |
||
320 | 320 | if ($_REQUEST['mode'] == 'deletefolder') { |
321 | 321 | $folder = $_REQUEST['folderpath']; |
322 | 322 | if (!$token_check || !@rrmdir($folder)) { |
323 | - echo '<span class="warning"><b>' . $_lang['file_folder_not_deleted'] . '</b></span><br /><br />'; |
|
323 | + echo '<span class="warning"><b>'.$_lang['file_folder_not_deleted'].'</b></span><br /><br />'; |
|
324 | 324 | } else { |
325 | - echo '<span class="success"><b>' . $_lang['file_folder_deleted'] . '</b></span><br /><br />'; |
|
325 | + echo '<span class="success"><b>'.$_lang['file_folder_deleted'].'</b></span><br /><br />'; |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
@@ -333,10 +333,10 @@ discard block |
||
333 | 333 | if (!mkdirs("{$startpath}/{$foldername}", 0777)) { |
334 | 334 | echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
335 | 335 | } else { |
336 | - if (!@chmod($startpath . '/' . $foldername, $newfolderaccessmode)) { |
|
337 | - echo '<span class="warning"><b>' . $_lang['file_folder_chmod_error'] . '</b></span><br /><br />'; |
|
336 | + if (!@chmod($startpath.'/'.$foldername, $newfolderaccessmode)) { |
|
337 | + echo '<span class="warning"><b>'.$_lang['file_folder_chmod_error'].'</b></span><br /><br />'; |
|
338 | 338 | } else { |
339 | - echo '<span class="success"><b>' . $_lang['file_folder_created'] . '</b></span><br /><br />'; |
|
339 | + echo '<span class="success"><b>'.$_lang['file_folder_created'].'</b></span><br /><br />'; |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | umask($old_umask); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | $filename = $modx->getDatabase()->escape($filename); |
349 | 349 | |
350 | 350 | if (!checkExtension($filename)) { |
351 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
351 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
352 | 352 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $filename) !== 0) { |
353 | 353 | echo $_lang['files.dynamic.php3']; |
354 | 354 | } else { |
@@ -370,11 +370,11 @@ discard block |
||
370 | 370 | $newFilename = $modx->getDatabase()->escape($newFilename); |
371 | 371 | |
372 | 372 | if (!checkExtension($newFilename)) { |
373 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
373 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
374 | 374 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
375 | 375 | echo $_lang['files.dynamic.php3']; |
376 | 376 | } else { |
377 | - if (!copy($filename, MODX_BASE_PATH . $newFilename)) { |
|
377 | + if (!copy($filename, MODX_BASE_PATH.$newFilename)) { |
|
378 | 378 | echo $_lang['files.dynamic.php5']; |
379 | 379 | } |
380 | 380 | umask($old_umask); |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | // Rename folder here |
384 | 384 | if ($_REQUEST['mode'] == 'renameFolder') { |
385 | 385 | $old_umask = umask(0); |
386 | - $dirname = $_REQUEST['path'] . '/' . $_REQUEST['dirname']; |
|
386 | + $dirname = $_REQUEST['path'].'/'.$_REQUEST['dirname']; |
|
387 | 387 | $dirname = $modx->getDatabase()->escape($dirname); |
388 | 388 | $newDirname = str_replace(array( |
389 | 389 | '..\\', |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | |
396 | 396 | if (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newDirname) !== 0) { |
397 | 397 | echo $_lang['files.dynamic.php3']; |
398 | - } else if (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) { |
|
398 | + } else if (!rename($dirname, $_REQUEST['path'].'/'.$newDirname)) { |
|
399 | 399 | echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />'; |
400 | 400 | } |
401 | 401 | umask($old_umask); |
@@ -415,11 +415,11 @@ discard block |
||
415 | 415 | $newFilename = $modx->getDatabase()->escape($newFilename); |
416 | 416 | |
417 | 417 | if (!checkExtension($newFilename)) { |
418 | - echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />'; |
|
418 | + echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />'; |
|
419 | 419 | } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) { |
420 | 420 | echo $_lang['files.dynamic.php3']; |
421 | 421 | } else { |
422 | - if (!rename($filename, $path . '/' . $newFilename)) { |
|
422 | + if (!rename($filename, $path.'/'.$newFilename)) { |
|
423 | 423 | echo $_lang['files.dynamic.php5']; |
424 | 424 | } |
425 | 425 | umask($old_umask); |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | ls($startpath); |
453 | 453 | echo "\n\n\n"; |
454 | 454 | if ($folders == 0 && $files == 0) { |
455 | - echo '<tr><td colspan="4"><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> ' . $_lang['files_directory_is_empty'] . ' </span></td></tr>'; |
|
455 | + echo '<tr><td colspan="4"><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> '.$_lang['files_directory_is_empty'].' </span></td></tr>'; |
|
456 | 456 | } |
457 | 457 | ?> |
458 | 458 | </table> |
@@ -461,10 +461,10 @@ discard block |
||
461 | 461 | <div class="container"> |
462 | 462 | <p> |
463 | 463 | <?php |
464 | - echo $_lang['files_directories'] . ': <b>' . $folders . '</b> '; |
|
465 | - echo $_lang['files_files'] . ': <b>' . $files . '</b> '; |
|
466 | - echo $_lang['files_data'] . ': <b><span dir="ltr">' . $modx->nicesize($filesizes) . '</span></b> '; |
|
467 | - echo $_lang['files_dirwritable'] . ' <b>' . (is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no']) . '.</b>' |
|
464 | + echo $_lang['files_directories'].': <b>'.$folders.'</b> '; |
|
465 | + echo $_lang['files_files'].': <b>'.$files.'</b> '; |
|
466 | + echo $_lang['files_data'].': <b><span dir="ltr">'.$modx->nicesize($filesizes).'</span></b> '; |
|
467 | + echo $_lang['files_dirwritable'].' <b>'.(is_writable($startpath) == 1 ? $_lang['yes'].'.' : $_lang['no']).'.</b>' |
|
468 | 468 | ?> |
469 | 469 | </p> |
470 | 470 | |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | </form> |
490 | 490 | <?php |
491 | 491 | } else { |
492 | - echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>"; |
|
492 | + echo "<p>".$_lang['files_upload_inhibited_msg']."</p>"; |
|
493 | 493 | } |
494 | 494 | ?> |
495 | 495 | <div id="imageviewer"></div> |
@@ -476,7 +476,8 @@ discard block |
||
476 | 476 | return s; |
477 | 477 | } |
478 | 478 | |
479 | - <?php if ($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { // Web Link specific ?> |
|
479 | + <?php if ($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { |
|
480 | +// Web Link specific ?> |
|
480 | 481 | var lastImageCtrl; |
481 | 482 | var lastFileCtrl; |
482 | 483 | |
@@ -692,7 +693,8 @@ discard block |
||
692 | 693 | </td> |
693 | 694 | </tr> |
694 | 695 | |
695 | - <?php if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { // Web Link specific ?> |
|
696 | + <?php if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { |
|
697 | +// Web Link specific ?> |
|
696 | 698 | |
697 | 699 | <tr> |
698 | 700 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -1370,7 +1372,9 @@ discard block |
||
1370 | 1372 | if($documentId > 0) { |
1371 | 1373 | // Load up, the permissions from the parent (if new document) or existing document |
1372 | 1374 | $rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1373 | - while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1375 | + while($currentgroup = $modx->getDatabase()->getRow($rs)) { |
|
1376 | + $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1377 | + } |
|
1374 | 1378 | |
1375 | 1379 | // Load up the current permissions and names |
1376 | 1380 | $vs = array( |
@@ -1432,7 +1436,9 @@ discard block |
||
1432 | 1436 | |
1433 | 1437 | // Create attribute string list |
1434 | 1438 | $inputString = array(); |
1435 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1439 | + foreach($inputAttributes as $k => $v) { |
|
1440 | + $inputString[] = $k . '="' . $v . '"'; |
|
1441 | + } |
|
1436 | 1442 | |
1437 | 1443 | // Make the <input> HTML |
1438 | 1444 | $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /********************/ |
@@ -12,29 +12,29 @@ discard block |
||
12 | 12 | |
13 | 13 | // check permissions |
14 | 14 | switch($modx->getManagerApi()->action) { |
15 | - case 27: |
|
16 | - if(!$modx->hasPermission('edit_document')) { |
|
17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | - } |
|
19 | - break; |
|
20 | - case 85: |
|
21 | - case 72: |
|
22 | - case 4: |
|
23 | - if(!$modx->hasPermission('new_document')) { |
|
24 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | - // check user has permissions for parent |
|
27 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
28 | - $udperms->user = $modx->getLoginUserID(); |
|
29 | - $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
30 | - $udperms->role = $_SESSION['mgrRole']; |
|
31 | - if(!$udperms->checkPermissions()) { |
|
32 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
33 | - } |
|
34 | - } |
|
35 | - break; |
|
36 | - default: |
|
37 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + case 27: |
|
16 | + if(!$modx->hasPermission('edit_document')) { |
|
17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | + } |
|
19 | + break; |
|
20 | + case 85: |
|
21 | + case 72: |
|
22 | + case 4: |
|
23 | + if(!$modx->hasPermission('new_document')) { |
|
24 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
25 | + } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | + // check user has permissions for parent |
|
27 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
28 | + $udperms->user = $modx->getLoginUserID(); |
|
29 | + $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
|
30 | + $udperms->role = $_SESSION['mgrRole']; |
|
31 | + if(!$udperms->checkPermissions()) { |
|
32 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
33 | + } |
|
34 | + } |
|
35 | + break; |
|
36 | + default: |
|
37 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -53,21 +53,21 @@ discard block |
||
53 | 53 | $tbl_site_tmplvars = $modx->getDatabase()->getFullTableName('site_tmplvars'); |
54 | 54 | |
55 | 55 | if($modx->getManagerApi()->action == 27) { |
56 | - //editing an existing document |
|
57 | - // check permissions on the document |
|
58 | - $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
59 | - $udperms->user = $modx->getLoginUserID(); |
|
60 | - $udperms->document = $id; |
|
61 | - $udperms->role = $_SESSION['mgrRole']; |
|
62 | - |
|
63 | - if(!$udperms->checkPermissions()) { |
|
64 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
65 | - } |
|
56 | + //editing an existing document |
|
57 | + // check permissions on the document |
|
58 | + $udperms = new EvolutionCMS\Legacy\Permissions(); |
|
59 | + $udperms->user = $modx->getLoginUserID(); |
|
60 | + $udperms->document = $id; |
|
61 | + $udperms->role = $_SESSION['mgrRole']; |
|
62 | + |
|
63 | + if(!$udperms->checkPermissions()) { |
|
64 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // check to see if resource isn't locked |
69 | 69 | if($lockedEl = $modx->elementIsLocked(7, $id)) { |
70 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
70 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
|
71 | 71 | } |
72 | 72 | // end check for lock |
73 | 73 | |
@@ -76,74 +76,74 @@ discard block |
||
76 | 76 | |
77 | 77 | // get document groups for current user |
78 | 78 | if($_SESSION['mgrDocgroups']) { |
79 | - $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
79 | + $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | if(!empty ($id)) { |
83 | - $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
84 | - if($docgrp) { |
|
85 | - $access .= " OR dg.document_group IN ({$docgrp})"; |
|
86 | - } |
|
87 | - $rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
88 | - $content = array(); |
|
89 | - $content = $modx->getDatabase()->getRow($rs); |
|
90 | - $modx->documentObject = &$content; |
|
91 | - if(!$content) { |
|
92 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
93 | - } |
|
94 | - $_SESSION['itemname'] = $content['pagetitle']; |
|
83 | + $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
|
84 | + if($docgrp) { |
|
85 | + $access .= " OR dg.document_group IN ({$docgrp})"; |
|
86 | + } |
|
87 | + $rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
|
88 | + $content = array(); |
|
89 | + $content = $modx->getDatabase()->getRow($rs); |
|
90 | + $modx->documentObject = &$content; |
|
91 | + if(!$content) { |
|
92 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
93 | + } |
|
94 | + $_SESSION['itemname'] = $content['pagetitle']; |
|
95 | 95 | } else { |
96 | - $content = array(); |
|
96 | + $content = array(); |
|
97 | 97 | |
98 | - if(isset($_REQUEST['newtemplate'])) { |
|
99 | - $content['template'] = $_REQUEST['newtemplate']; |
|
100 | - } else { |
|
101 | - $content['template'] = getDefaultTemplate(); |
|
102 | - } |
|
98 | + if(isset($_REQUEST['newtemplate'])) { |
|
99 | + $content['template'] = $_REQUEST['newtemplate']; |
|
100 | + } else { |
|
101 | + $content['template'] = getDefaultTemplate(); |
|
102 | + } |
|
103 | 103 | |
104 | - $_SESSION['itemname'] = $_lang["new_resource"]; |
|
104 | + $_SESSION['itemname'] = $_lang["new_resource"]; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // restore saved form |
108 | 108 | $formRestored = $modx->getManagerApi()->loadFormValues(); |
109 | 109 | if(isset($_REQUEST['newtemplate'])) { |
110 | - $formRestored = true; |
|
110 | + $formRestored = true; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | // retain form values if template was changed |
114 | 114 | // edited to convert pub_date and unpub_date |
115 | 115 | // sottwell 02-09-2006 |
116 | 116 | if($formRestored == true) { |
117 | - $content = array_merge($content, $_POST); |
|
118 | - $content['content'] = $_POST['ta']; |
|
119 | - if(empty ($content['pub_date'])) { |
|
120 | - unset ($content['pub_date']); |
|
121 | - } else { |
|
122 | - $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
123 | - } |
|
124 | - if(empty ($content['unpub_date'])) { |
|
125 | - unset ($content['unpub_date']); |
|
126 | - } else { |
|
127 | - $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
128 | - } |
|
117 | + $content = array_merge($content, $_POST); |
|
118 | + $content['content'] = $_POST['ta']; |
|
119 | + if(empty ($content['pub_date'])) { |
|
120 | + unset ($content['pub_date']); |
|
121 | + } else { |
|
122 | + $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
|
123 | + } |
|
124 | + if(empty ($content['unpub_date'])) { |
|
125 | + unset ($content['unpub_date']); |
|
126 | + } else { |
|
127 | + $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
|
128 | + } |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // increase menu index if this is a new document |
132 | 132 | if(!isset ($_REQUEST['id'])) { |
133 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
134 | - $modx->config['auto_menuindex'] = 1; |
|
135 | - } |
|
136 | - if($modx->config['auto_menuindex']) { |
|
137 | - $pid = (int)$_REQUEST['pid']; |
|
138 | - $rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
139 | - $content['menuindex'] = $modx->getDatabase()->getValue($rs); |
|
140 | - } else { |
|
141 | - $content['menuindex'] = 0; |
|
142 | - } |
|
133 | + if(!isset ($modx->config['auto_menuindex'])) { |
|
134 | + $modx->config['auto_menuindex'] = 1; |
|
135 | + } |
|
136 | + if($modx->config['auto_menuindex']) { |
|
137 | + $pid = (int)$_REQUEST['pid']; |
|
138 | + $rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
|
139 | + $content['menuindex'] = $modx->getDatabase()->getValue($rs); |
|
140 | + } else { |
|
141 | + $content['menuindex'] = 0; |
|
142 | + } |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | if(isset ($_POST['which_editor'])) { |
146 | - $modx->config['which_editor'] = $_POST['which_editor']; |
|
146 | + $modx->config['which_editor'] = $_POST['which_editor']; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | // Add lock-element JS-Script |
@@ -543,23 +543,23 @@ discard block |
||
543 | 543 | |
544 | 544 | <form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;"> |
545 | 545 | <?php |
546 | - // invoke OnDocFormPrerender event |
|
547 | - $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
548 | - 'id' => $id, |
|
549 | - 'template' => $content['template'] |
|
550 | - )); |
|
551 | - |
|
552 | - if(is_array($evtOut)) { |
|
553 | - echo implode('', $evtOut); |
|
554 | - } |
|
555 | - |
|
556 | - /*************************/ |
|
557 | - $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
558 | - $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
559 | - $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
560 | - /*************************/ |
|
561 | - |
|
562 | - ?> |
|
546 | + // invoke OnDocFormPrerender event |
|
547 | + $evtOut = $modx->invokeEvent('OnDocFormPrerender', array( |
|
548 | + 'id' => $id, |
|
549 | + 'template' => $content['template'] |
|
550 | + )); |
|
551 | + |
|
552 | + if(is_array($evtOut)) { |
|
553 | + echo implode('', $evtOut); |
|
554 | + } |
|
555 | + |
|
556 | + /*************************/ |
|
557 | + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : ''; |
|
558 | + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon'; |
|
559 | + $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : ''; |
|
560 | + /*************************/ |
|
561 | + |
|
562 | + ?> |
|
563 | 563 | <input type="hidden" name="a" value="5" /> |
564 | 564 | <input type="hidden" name="id" value="<?= $content['id'] ?>" /> |
565 | 565 | <input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>" /> |
@@ -574,54 +574,54 @@ discard block |
||
574 | 574 | |
575 | 575 | <h1> |
576 | 576 | <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
577 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
578 | - } else { |
|
579 | - if ($modx->getManagerApi()->action == '4') { |
|
577 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
578 | + } else { |
|
579 | + if ($modx->getManagerApi()->action == '4') { |
|
580 | 580 | echo $_lang['add_resource']; |
581 | 581 | } else if ($modx->getManagerApi()->action == '72') { |
582 | 582 | echo $_lang['add_weblink']; |
583 | 583 | } else { |
584 | 584 | echo $_lang['create_resource_title']; |
585 | 585 | } |
586 | - } ?> |
|
586 | + } ?> |
|
587 | 587 | </h1> |
588 | 588 | |
589 | 589 | <?= $_style['actionbuttons']['dynamic']['document'] ?> |
590 | 590 | |
591 | 591 | <?php |
592 | - // breadcrumbs |
|
593 | - if($modx->config['use_breadcrumbs']) { |
|
594 | - $temp = array(); |
|
595 | - $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
596 | - |
|
597 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
598 | - $bID = (int) $_REQUEST['id']; |
|
599 | - $temp = $modx->getParentIds($bID); |
|
600 | - } else if(isset($_REQUEST['pid'])) { |
|
601 | - $bID = (int) $_REQUEST['pid']; |
|
602 | - $temp = $modx->getParentIds($bID); |
|
603 | - array_unshift($temp, $bID); |
|
604 | - } |
|
605 | - |
|
606 | - if($temp) { |
|
607 | - $parents = implode(',', $temp); |
|
608 | - |
|
609 | - if(!empty($parents)) { |
|
610 | - $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
611 | - $rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
612 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
613 | - $out .= '<li class="breadcrumbs__li"> |
|
592 | + // breadcrumbs |
|
593 | + if($modx->config['use_breadcrumbs']) { |
|
594 | + $temp = array(); |
|
595 | + $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
|
596 | + |
|
597 | + if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
598 | + $bID = (int) $_REQUEST['id']; |
|
599 | + $temp = $modx->getParentIds($bID); |
|
600 | + } else if(isset($_REQUEST['pid'])) { |
|
601 | + $bID = (int) $_REQUEST['pid']; |
|
602 | + $temp = $modx->getParentIds($bID); |
|
603 | + array_unshift($temp, $bID); |
|
604 | + } |
|
605 | + |
|
606 | + if($temp) { |
|
607 | + $parents = implode(',', $temp); |
|
608 | + |
|
609 | + if(!empty($parents)) { |
|
610 | + $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
|
611 | + $rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
|
612 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
613 | + $out .= '<li class="breadcrumbs__li"> |
|
614 | 614 | <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
615 | 615 | <span class="breadcrumbs__sep">></span> |
616 | 616 | </li>'; |
617 | - } |
|
618 | - } |
|
619 | - } |
|
617 | + } |
|
618 | + } |
|
619 | + } |
|
620 | 620 | |
621 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
622 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
623 | - } |
|
624 | - ?> |
|
621 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
622 | + echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
623 | + } |
|
624 | + ?> |
|
625 | 625 | |
626 | 626 | <!-- start main wrapper --> |
627 | 627 | <div class="sectionBody"> |
@@ -633,13 +633,13 @@ discard block |
||
633 | 633 | |
634 | 634 | <!-- General --> |
635 | 635 | <?php |
636 | - $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
637 | - 'id' => $id |
|
638 | - )); |
|
639 | - if(is_array($evtOut)) { |
|
640 | - echo implode('', $evtOut); |
|
641 | - } else { |
|
642 | - ?> |
|
636 | + $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
|
637 | + 'id' => $id |
|
638 | + )); |
|
639 | + if(is_array($evtOut)) { |
|
640 | + echo implode('', $evtOut); |
|
641 | + } else { |
|
642 | + ?> |
|
643 | 643 | <div class="tab-page" id="tabGeneral"> |
644 | 644 | <h2 class="tab"><?= $_lang['settings_general'] ?></h2> |
645 | 645 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script> |
@@ -724,36 +724,36 @@ discard block |
||
724 | 724 | <select id="template" name="template" class="inputBox" onchange="templateWarning();"> |
725 | 725 | <option value="0">(blank)</option> |
726 | 726 | <?php |
727 | - $field = "t.templatename, t.selectable, t.id, c.category"; |
|
728 | - $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
729 | - $rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
730 | - $currentCategory = ''; |
|
731 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
732 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
733 | - continue; |
|
734 | - }; |
|
735 | - // Skip if not selectable but show if selected! |
|
736 | - $thisCategory = $row['category']; |
|
737 | - if($thisCategory == null) { |
|
738 | - $thisCategory = $_lang["no_category"]; |
|
739 | - } |
|
740 | - if($thisCategory != $currentCategory) { |
|
741 | - if($closeOptGroup) { |
|
742 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
743 | - } |
|
744 | - echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
745 | - $closeOptGroup = true; |
|
746 | - } |
|
727 | + $field = "t.templatename, t.selectable, t.id, c.category"; |
|
728 | + $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
|
729 | + $rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC'); |
|
730 | + $currentCategory = ''; |
|
731 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
732 | + if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
733 | + continue; |
|
734 | + }; |
|
735 | + // Skip if not selectable but show if selected! |
|
736 | + $thisCategory = $row['category']; |
|
737 | + if($thisCategory == null) { |
|
738 | + $thisCategory = $_lang["no_category"]; |
|
739 | + } |
|
740 | + if($thisCategory != $currentCategory) { |
|
741 | + if($closeOptGroup) { |
|
742 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
743 | + } |
|
744 | + echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
|
745 | + $closeOptGroup = true; |
|
746 | + } |
|
747 | 747 | |
748 | - $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
748 | + $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
|
749 | 749 | |
750 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
751 | - $currentCategory = $thisCategory; |
|
752 | - } |
|
753 | - if($thisCategory != '') { |
|
754 | - echo "\t\t\t\t\t</optgroup>\n"; |
|
755 | - } |
|
756 | - ?> |
|
750 | + echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
751 | + $currentCategory = $thisCategory; |
|
752 | + } |
|
753 | + if($thisCategory != '') { |
|
754 | + echo "\t\t\t\t\t</optgroup>\n"; |
|
755 | + } |
|
756 | + ?> |
|
757 | 757 | </select> |
758 | 758 | </td> |
759 | 759 | </tr> |
@@ -793,37 +793,37 @@ discard block |
||
793 | 793 | </td> |
794 | 794 | <td valign="top"> |
795 | 795 | <?php |
796 | - $parentlookup = false; |
|
797 | - if(isset ($_REQUEST['id'])) { |
|
798 | - if($content['parent'] == 0) { |
|
799 | - $parentname = $site_name; |
|
800 | - } else { |
|
801 | - $parentlookup = $content['parent']; |
|
802 | - } |
|
803 | - } elseif(isset ($_REQUEST['pid'])) { |
|
804 | - if($_REQUEST['pid'] == 0) { |
|
805 | - $parentname = $site_name; |
|
806 | - } else { |
|
807 | - $parentlookup = $_REQUEST['pid']; |
|
808 | - } |
|
809 | - } elseif(isset($_POST['parent'])) { |
|
810 | - if($_POST['parent'] == 0) { |
|
811 | - $parentname = $site_name; |
|
812 | - } else { |
|
813 | - $parentlookup = $_POST['parent']; |
|
814 | - } |
|
815 | - } else { |
|
816 | - $parentname = $site_name; |
|
817 | - $content['parent'] = 0; |
|
818 | - } |
|
819 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
820 | - $rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
821 | - $parentname = $modx->getDatabase()->getValue($rs); |
|
822 | - if(!$parentname) { |
|
823 | - $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
824 | - } |
|
825 | - } |
|
826 | - ?> |
|
796 | + $parentlookup = false; |
|
797 | + if(isset ($_REQUEST['id'])) { |
|
798 | + if($content['parent'] == 0) { |
|
799 | + $parentname = $site_name; |
|
800 | + } else { |
|
801 | + $parentlookup = $content['parent']; |
|
802 | + } |
|
803 | + } elseif(isset ($_REQUEST['pid'])) { |
|
804 | + if($_REQUEST['pid'] == 0) { |
|
805 | + $parentname = $site_name; |
|
806 | + } else { |
|
807 | + $parentlookup = $_REQUEST['pid']; |
|
808 | + } |
|
809 | + } elseif(isset($_POST['parent'])) { |
|
810 | + if($_POST['parent'] == 0) { |
|
811 | + $parentname = $site_name; |
|
812 | + } else { |
|
813 | + $parentlookup = $_POST['parent']; |
|
814 | + } |
|
815 | + } else { |
|
816 | + $parentname = $site_name; |
|
817 | + $content['parent'] = 0; |
|
818 | + } |
|
819 | + if($parentlookup !== false && is_numeric($parentlookup)) { |
|
820 | + $rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
|
821 | + $parentname = $modx->getDatabase()->getValue($rs); |
|
822 | + if(!$parentname) { |
|
823 | + $modx->webAlertAndQuit($_lang["error_no_parent"]); |
|
824 | + } |
|
825 | + } |
|
826 | + ?> |
|
827 | 827 | <i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i> |
828 | 828 | <b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $modx->getPhpCompat()->entities($parentname) ?>)</span></b> |
829 | 829 | <input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" /> |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | </tr> |
832 | 832 | <tr></tr> |
833 | 833 | <?php |
834 | - /* |
|
834 | + /* |
|
835 | 835 | if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { |
836 | 836 | ?> |
837 | 837 | <tr> |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | </tr> |
860 | 860 | <?php |
861 | 861 | }*/ |
862 | - ?> |
|
862 | + ?> |
|
863 | 863 | |
864 | 864 | <?php if($content['type'] == 'document' || $modx->getManagerApi()->action == '4') { ?> |
865 | 865 | <tr> |
@@ -872,36 +872,36 @@ discard block |
||
872 | 872 | <select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();"> |
873 | 873 | <option value="none"><?= $_lang['none'] ?></option> |
874 | 874 | <?php |
875 | - // invoke OnRichTextEditorRegister event |
|
876 | - $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
877 | - if(is_array($evtOut)) { |
|
878 | - for($i = 0; $i < count($evtOut); $i++) { |
|
879 | - $editor = $evtOut[$i]; |
|
880 | - echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
881 | - } |
|
882 | - } |
|
883 | - ?> |
|
875 | + // invoke OnRichTextEditorRegister event |
|
876 | + $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
|
877 | + if(is_array($evtOut)) { |
|
878 | + for($i = 0; $i < count($evtOut); $i++) { |
|
879 | + $editor = $evtOut[$i]; |
|
880 | + echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
|
881 | + } |
|
882 | + } |
|
883 | + ?> |
|
884 | 884 | </select> |
885 | 885 | </label> |
886 | 886 | </div> |
887 | 887 | <div id="content_body"> |
888 | 888 | <?php |
889 | - if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) { |
|
890 | - $htmlContent = $content['content']; |
|
891 | - ?> |
|
889 | + if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) { |
|
890 | + $htmlContent = $content['content']; |
|
891 | + ?> |
|
892 | 892 | <div class="section-editor clearfix"> |
893 | 893 | <textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->getPhpCompat()->htmlspecialchars($htmlContent) ?></textarea> |
894 | 894 | </div> |
895 | 895 | <?php |
896 | - // Richtext-[*content*] |
|
897 | - $richtexteditorIds = array(); |
|
898 | - $richtexteditorOptions = array(); |
|
899 | - $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
900 | - $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
901 | - } else { |
|
902 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
903 | - } |
|
904 | - ?> |
|
896 | + // Richtext-[*content*] |
|
897 | + $richtexteditorIds = array(); |
|
898 | + $richtexteditorOptions = array(); |
|
899 | + $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
|
900 | + $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
|
901 | + } else { |
|
902 | + echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
903 | + } |
|
904 | + ?> |
|
905 | 905 | </div> |
906 | 906 | </td> |
907 | 907 | </tr> |
@@ -1208,8 +1208,8 @@ discard block |
||
1208 | 1208 | |
1209 | 1209 | <?php |
1210 | 1210 | |
1211 | - if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1212 | - ?> |
|
1211 | + if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1212 | + ?> |
|
1213 | 1213 | <tr> |
1214 | 1214 | <td> |
1215 | 1215 | <span class="warning"><?= $_lang['resource_type'] ?></span> |
@@ -1231,15 +1231,15 @@ discard block |
||
1231 | 1231 | <td> |
1232 | 1232 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1233 | 1233 | <?php |
1234 | - if(!$content['contentType']) { |
|
1235 | - $content['contentType'] = 'text/html'; |
|
1236 | - } |
|
1237 | - $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1238 | - $ct = explode(",", $custom_contenttype); |
|
1239 | - for($i = 0; $i < count($ct); $i++) { |
|
1240 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1241 | - } |
|
1242 | - ?> |
|
1234 | + if(!$content['contentType']) { |
|
1235 | + $content['contentType'] = 'text/html'; |
|
1236 | + } |
|
1237 | + $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
|
1238 | + $ct = explode(",", $custom_contenttype); |
|
1239 | + for($i = 0; $i < count($ct); $i++) { |
|
1240 | + echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1241 | + } |
|
1242 | + ?> |
|
1243 | 1243 | </select> |
1244 | 1244 | </td> |
1245 | 1245 | </tr> |
@@ -1262,23 +1262,23 @@ discard block |
||
1262 | 1262 | </td> |
1263 | 1263 | </tr> |
1264 | 1264 | <?php |
1265 | - } else { |
|
1266 | - if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') { |
|
1267 | - // non-admin managers creating or editing a document resource |
|
1268 | - ?> |
|
1265 | + } else { |
|
1266 | + if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') { |
|
1267 | + // non-admin managers creating or editing a document resource |
|
1268 | + ?> |
|
1269 | 1269 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
1270 | 1270 | <input type="hidden" name="type" value="document" /> |
1271 | 1271 | <input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" /> |
1272 | 1272 | <?php |
1273 | - } else { |
|
1274 | - // non-admin managers creating or editing a reference (weblink) resource |
|
1275 | - ?> |
|
1273 | + } else { |
|
1274 | + // non-admin managers creating or editing a reference (weblink) resource |
|
1275 | + ?> |
|
1276 | 1276 | <input type="hidden" name="type" value="reference" /> |
1277 | 1277 | <input type="hidden" name="contentType" value="text/html" /> |
1278 | 1278 | <?php |
1279 | - } |
|
1280 | - }//if mgrRole |
|
1281 | - ?> |
|
1279 | + } |
|
1280 | + }//if mgrRole |
|
1281 | + ?> |
|
1282 | 1282 | |
1283 | 1283 | <tr> |
1284 | 1284 | <td> |
@@ -1361,112 +1361,112 @@ discard block |
||
1361 | 1361 | ?> |
1362 | 1362 | |
1363 | 1363 | <?php |
1364 | - /******************************* |
|
1364 | + /******************************* |
|
1365 | 1365 | * Document Access Permissions */ |
1366 | - if($use_udperms == 1) { |
|
1367 | - $groupsarray = array(); |
|
1368 | - $sql = ''; |
|
1369 | - |
|
1370 | - $documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1371 | - if($documentId > 0) { |
|
1372 | - // Load up, the permissions from the parent (if new document) or existing document |
|
1373 | - $rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1374 | - while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1375 | - |
|
1376 | - // Load up the current permissions and names |
|
1377 | - $vs = array( |
|
1378 | - $tbl_document_group_names, |
|
1379 | - $tbl_document_groups, |
|
1380 | - $documentId |
|
1381 | - ); |
|
1382 | - $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1383 | - $rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1384 | - } else { |
|
1385 | - // Just load up the names, we're starting clean |
|
1386 | - $rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1387 | - } |
|
1388 | - |
|
1389 | - // retain selected doc groups between post |
|
1390 | - if(isset($_POST['docgroups'])) { |
|
1391 | - $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1392 | - } |
|
1366 | + if($use_udperms == 1) { |
|
1367 | + $groupsarray = array(); |
|
1368 | + $sql = ''; |
|
1369 | + |
|
1370 | + $documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
|
1371 | + if($documentId > 0) { |
|
1372 | + // Load up, the permissions from the parent (if new document) or existing document |
|
1373 | + $rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
|
1374 | + while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1375 | + |
|
1376 | + // Load up the current permissions and names |
|
1377 | + $vs = array( |
|
1378 | + $tbl_document_group_names, |
|
1379 | + $tbl_document_groups, |
|
1380 | + $documentId |
|
1381 | + ); |
|
1382 | + $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs); |
|
1383 | + $rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name'); |
|
1384 | + } else { |
|
1385 | + // Just load up the names, we're starting clean |
|
1386 | + $rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name'); |
|
1387 | + } |
|
1388 | + |
|
1389 | + // retain selected doc groups between post |
|
1390 | + if(isset($_POST['docgroups'])) { |
|
1391 | + $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
|
1392 | + } |
|
1393 | + |
|
1394 | + $isManager = $modx->hasPermission('access_permissions'); |
|
1395 | + $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1396 | + |
|
1397 | + // Setup Basic attributes for each Input box |
|
1398 | + $inputAttributes = array( |
|
1399 | + 'type' => 'checkbox', |
|
1400 | + 'class' => 'checkbox', |
|
1401 | + 'name' => 'docgroups[]', |
|
1402 | + 'onclick' => 'makePublic(false);', |
|
1403 | + ); |
|
1404 | + $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1405 | + $permissions_yes = 0; // count permissions the current mgr user has |
|
1406 | + $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1407 | + |
|
1408 | + // Loop through the permissions list |
|
1409 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
1410 | + |
|
1411 | + // Create an inputValue pair (group ID and group link (if it exists)) |
|
1412 | + $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1413 | + $inputId = 'group-' . $row['id']; |
|
1414 | + |
|
1415 | + $checked = in_array($inputValue, $groupsarray); |
|
1416 | + if($checked) { |
|
1417 | + $notPublic = true; |
|
1418 | + } // Mark as private access (either web or manager) |
|
1419 | + |
|
1420 | + // Skip the access permission if the user doesn't have access... |
|
1421 | + if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1422 | + continue; |
|
1423 | + } |
|
1393 | 1424 | |
1394 | - $isManager = $modx->hasPermission('access_permissions'); |
|
1395 | - $isWeb = $modx->hasPermission('web_access_permissions'); |
|
1396 | - |
|
1397 | - // Setup Basic attributes for each Input box |
|
1398 | - $inputAttributes = array( |
|
1399 | - 'type' => 'checkbox', |
|
1400 | - 'class' => 'checkbox', |
|
1401 | - 'name' => 'docgroups[]', |
|
1402 | - 'onclick' => 'makePublic(false);', |
|
1403 | - ); |
|
1404 | - $permissions = array(); // New Permissions array list (this contains the HTML) |
|
1405 | - $permissions_yes = 0; // count permissions the current mgr user has |
|
1406 | - $permissions_no = 0; // count permissions the current mgr user doesn't have |
|
1407 | - |
|
1408 | - // Loop through the permissions list |
|
1409 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
1410 | - |
|
1411 | - // Create an inputValue pair (group ID and group link (if it exists)) |
|
1412 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1413 | - $inputId = 'group-' . $row['id']; |
|
1414 | - |
|
1415 | - $checked = in_array($inputValue, $groupsarray); |
|
1416 | - if($checked) { |
|
1417 | - $notPublic = true; |
|
1418 | - } // Mark as private access (either web or manager) |
|
1419 | - |
|
1420 | - // Skip the access permission if the user doesn't have access... |
|
1421 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1422 | - continue; |
|
1423 | - } |
|
1424 | - |
|
1425 | - // Setup attributes for this Input box |
|
1426 | - $inputAttributes['id'] = $inputId; |
|
1427 | - $inputAttributes['value'] = $inputValue; |
|
1428 | - if($checked) { |
|
1429 | - $inputAttributes['checked'] = 'checked'; |
|
1430 | - } else { |
|
1431 | - unset($inputAttributes['checked']); |
|
1432 | - } |
|
1433 | - |
|
1434 | - // Create attribute string list |
|
1435 | - $inputString = array(); |
|
1436 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1437 | - |
|
1438 | - // Make the <input> HTML |
|
1439 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1440 | - |
|
1441 | - // does user have this permission? |
|
1442 | - $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1443 | - $vs = array( |
|
1444 | - $row['id'], |
|
1445 | - $_SESSION['mgrInternalKey'] |
|
1446 | - ); |
|
1447 | - $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1448 | - $rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where); |
|
1449 | - $count = $modx->getDatabase()->getValue($rsp); |
|
1450 | - if($count > 0) { |
|
1451 | - ++$permissions_yes; |
|
1452 | - } else { |
|
1453 | - ++$permissions_no; |
|
1454 | - } |
|
1455 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1456 | - } |
|
1457 | - // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1458 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1459 | - $permissions = array(); |
|
1460 | - } |
|
1425 | + // Setup attributes for this Input box |
|
1426 | + $inputAttributes['id'] = $inputId; |
|
1427 | + $inputAttributes['value'] = $inputValue; |
|
1428 | + if($checked) { |
|
1429 | + $inputAttributes['checked'] = 'checked'; |
|
1430 | + } else { |
|
1431 | + unset($inputAttributes['checked']); |
|
1432 | + } |
|
1461 | 1433 | |
1462 | - // See if the Access Permissions section is worth displaying... |
|
1463 | - if(!empty($permissions)) { |
|
1464 | - // Add the "All Document Groups" item if we have rights in both contexts |
|
1465 | - if($isManager && $isWeb) { |
|
1466 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1467 | - } |
|
1468 | - // Output the permissions list... |
|
1469 | - ?> |
|
1434 | + // Create attribute string list |
|
1435 | + $inputString = array(); |
|
1436 | + foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1437 | + |
|
1438 | + // Make the <input> HTML |
|
1439 | + $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1440 | + |
|
1441 | + // does user have this permission? |
|
1442 | + $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
|
1443 | + $vs = array( |
|
1444 | + $row['id'], |
|
1445 | + $_SESSION['mgrInternalKey'] |
|
1446 | + ); |
|
1447 | + $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
|
1448 | + $rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where); |
|
1449 | + $count = $modx->getDatabase()->getValue($rsp); |
|
1450 | + if($count > 0) { |
|
1451 | + ++$permissions_yes; |
|
1452 | + } else { |
|
1453 | + ++$permissions_no; |
|
1454 | + } |
|
1455 | + $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1456 | + } |
|
1457 | + // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
|
1458 | + if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1459 | + $permissions = array(); |
|
1460 | + } |
|
1461 | + |
|
1462 | + // See if the Access Permissions section is worth displaying... |
|
1463 | + if(!empty($permissions)) { |
|
1464 | + // Add the "All Document Groups" item if we have rights in both contexts |
|
1465 | + if($isManager && $isWeb) { |
|
1466 | + array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1467 | + } |
|
1468 | + // Output the permissions list... |
|
1469 | + ?> |
|
1470 | 1470 | <!-- Access Permissions --> |
1471 | 1471 | <div class="tab-page" id="tabAccess"> |
1472 | 1472 | <h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2> |
@@ -1500,31 +1500,31 @@ discard block |
||
1500 | 1500 | </ul> |
1501 | 1501 | </div><!--div class="tab-page" id="tabAccess"--> |
1502 | 1502 | <?php |
1503 | - } // !empty($permissions) |
|
1504 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1505 | - ?> |
|
1503 | + } // !empty($permissions) |
|
1504 | + elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1505 | + ?> |
|
1506 | 1506 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1507 | 1507 | <?php |
1508 | 1508 | |
1509 | - } |
|
1510 | - } |
|
1511 | - /* End Document Access Permissions * |
|
1509 | + } |
|
1510 | + } |
|
1511 | + /* End Document Access Permissions * |
|
1512 | 1512 | ***********************************/ |
1513 | - ?> |
|
1513 | + ?> |
|
1514 | 1514 | |
1515 | 1515 | <input type="submit" name="save" style="display:none" /> |
1516 | 1516 | <?php |
1517 | 1517 | |
1518 | - // invoke OnDocFormRender event |
|
1519 | - $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1520 | - 'id' => $id, |
|
1521 | - 'template' => $content['template'] |
|
1522 | - )); |
|
1518 | + // invoke OnDocFormRender event |
|
1519 | + $evtOut = $modx->invokeEvent('OnDocFormRender', array( |
|
1520 | + 'id' => $id, |
|
1521 | + 'template' => $content['template'] |
|
1522 | + )); |
|
1523 | 1523 | |
1524 | - if(is_array($evtOut)) { |
|
1525 | - echo implode('', $evtOut); |
|
1526 | - } |
|
1527 | - ?> |
|
1524 | + if(is_array($evtOut)) { |
|
1525 | + echo implode('', $evtOut); |
|
1526 | + } |
|
1527 | + ?> |
|
1528 | 1528 | </div><!--div class="tab-pane" id="documentPane"--> |
1529 | 1529 | </div><!--div class="sectionBody"--> |
1530 | 1530 | </fieldset> |
@@ -1535,17 +1535,17 @@ discard block |
||
1535 | 1535 | </script> |
1536 | 1536 | <?php |
1537 | 1537 | if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4' || $modx->getManagerApi()->action == '72') && $use_editor == 1) { |
1538 | - if(is_array($richtexteditorIds)) { |
|
1539 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1540 | - // invoke OnRichTextEditorInit event |
|
1541 | - $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1542 | - 'editor' => $editor, |
|
1543 | - 'elements' => $elements, |
|
1544 | - 'options' => $richtexteditorOptions[$editor] |
|
1545 | - )); |
|
1546 | - if(is_array($evtOut)) { |
|
1547 | - echo implode('', $evtOut); |
|
1548 | - } |
|
1549 | - } |
|
1550 | - } |
|
1538 | + if(is_array($richtexteditorIds)) { |
|
1539 | + foreach($richtexteditorIds as $editor => $elements) { |
|
1540 | + // invoke OnRichTextEditorInit event |
|
1541 | + $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
|
1542 | + 'editor' => $editor, |
|
1543 | + 'elements' => $elements, |
|
1544 | + 'options' => $richtexteditorOptions[$editor] |
|
1545 | + )); |
|
1546 | + if(is_array($evtOut)) { |
|
1547 | + echo implode('', $evtOut); |
|
1548 | + } |
|
1549 | + } |
|
1550 | + } |
|
1551 | 1551 | } |
@@ -1,34 +1,34 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | 6 | /********************/ |
7 | -$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC'; |
|
8 | -$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon'; |
|
9 | -$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : ''; |
|
10 | -$add_path = $sd . $sb . $pg; |
|
7 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
8 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
9 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
10 | +$add_path = $sd.$sb.$pg; |
|
11 | 11 | /*******************/ |
12 | 12 | |
13 | 13 | // check permissions |
14 | -switch($modx->getManagerApi()->action) { |
|
14 | +switch ($modx->getManagerApi()->action) { |
|
15 | 15 | case 27: |
16 | - if(!$modx->hasPermission('edit_document')) { |
|
16 | + if (!$modx->hasPermission('edit_document')) { |
|
17 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
18 | 18 | } |
19 | 19 | break; |
20 | 20 | case 85: |
21 | 21 | case 72: |
22 | 22 | case 4: |
23 | - if(!$modx->hasPermission('new_document')) { |
|
23 | + if (!$modx->hasPermission('new_document')) { |
|
24 | 24 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
25 | - } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
25 | + } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') { |
|
26 | 26 | // check user has permissions for parent |
27 | 27 | $udperms = new EvolutionCMS\Legacy\Permissions(); |
28 | 28 | $udperms->user = $modx->getLoginUserID(); |
29 | 29 | $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid']; |
30 | 30 | $udperms->role = $_SESSION['mgrRole']; |
31 | - if(!$udperms->checkPermissions()) { |
|
31 | + if (!$udperms->checkPermissions()) { |
|
32 | 32 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
33 | 33 | } |
34 | 34 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
38 | 38 | } |
39 | 39 | |
40 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
40 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
41 | 41 | |
42 | 42 | // Get table names (alphabetical) |
43 | 43 | $tbl_categories = $modx->getDatabase()->getFullTableName('categories'); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $tbl_site_tmplvar_templates = $modx->getDatabase()->getFullTableName('site_tmplvar_templates'); |
53 | 53 | $tbl_site_tmplvars = $modx->getDatabase()->getFullTableName('site_tmplvars'); |
54 | 54 | |
55 | -if($modx->getManagerApi()->action == 27) { |
|
55 | +if ($modx->getManagerApi()->action == 27) { |
|
56 | 56 | //editing an existing document |
57 | 57 | // check permissions on the document |
58 | 58 | $udperms = new EvolutionCMS\Legacy\Permissions(); |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | $udperms->document = $id; |
61 | 61 | $udperms->role = $_SESSION['mgrRole']; |
62 | 62 | |
63 | - if(!$udperms->checkPermissions()) { |
|
63 | + if (!$udperms->checkPermissions()) { |
|
64 | 64 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | 68 | // check to see if resource isn't locked |
69 | -if($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
69 | +if ($lockedEl = $modx->elementIsLocked(7, $id)) { |
|
70 | 70 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource'])); |
71 | 71 | } |
72 | 72 | // end check for lock |
@@ -75,27 +75,27 @@ discard block |
||
75 | 75 | $modx->lockElement(7, $id); |
76 | 76 | |
77 | 77 | // get document groups for current user |
78 | -if($_SESSION['mgrDocgroups']) { |
|
78 | +if ($_SESSION['mgrDocgroups']) { |
|
79 | 79 | $docgrp = implode(',', $_SESSION['mgrDocgroups']); |
80 | 80 | } |
81 | 81 | |
82 | -if(!empty ($id)) { |
|
82 | +if (!empty ($id)) { |
|
83 | 83 | $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']); |
84 | - if($docgrp) { |
|
84 | + if ($docgrp) { |
|
85 | 85 | $access .= " OR dg.document_group IN ({$docgrp})"; |
86 | 86 | } |
87 | 87 | $rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})"); |
88 | 88 | $content = array(); |
89 | 89 | $content = $modx->getDatabase()->getRow($rs); |
90 | 90 | $modx->documentObject = &$content; |
91 | - if(!$content) { |
|
91 | + if (!$content) { |
|
92 | 92 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
93 | 93 | } |
94 | 94 | $_SESSION['itemname'] = $content['pagetitle']; |
95 | 95 | } else { |
96 | 96 | $content = array(); |
97 | 97 | |
98 | - if(isset($_REQUEST['newtemplate'])) { |
|
98 | + if (isset($_REQUEST['newtemplate'])) { |
|
99 | 99 | $content['template'] = $_REQUEST['newtemplate']; |
100 | 100 | } else { |
101 | 101 | $content['template'] = getDefaultTemplate(); |
@@ -106,22 +106,22 @@ discard block |
||
106 | 106 | |
107 | 107 | // restore saved form |
108 | 108 | $formRestored = $modx->getManagerApi()->loadFormValues(); |
109 | -if(isset($_REQUEST['newtemplate'])) { |
|
109 | +if (isset($_REQUEST['newtemplate'])) { |
|
110 | 110 | $formRestored = true; |
111 | 111 | } |
112 | 112 | |
113 | 113 | // retain form values if template was changed |
114 | 114 | // edited to convert pub_date and unpub_date |
115 | 115 | // sottwell 02-09-2006 |
116 | -if($formRestored == true) { |
|
116 | +if ($formRestored == true) { |
|
117 | 117 | $content = array_merge($content, $_POST); |
118 | 118 | $content['content'] = $_POST['ta']; |
119 | - if(empty ($content['pub_date'])) { |
|
119 | + if (empty ($content['pub_date'])) { |
|
120 | 120 | unset ($content['pub_date']); |
121 | 121 | } else { |
122 | 122 | $content['pub_date'] = $modx->toTimeStamp($content['pub_date']); |
123 | 123 | } |
124 | - if(empty ($content['unpub_date'])) { |
|
124 | + if (empty ($content['unpub_date'])) { |
|
125 | 125 | unset ($content['unpub_date']); |
126 | 126 | } else { |
127 | 127 | $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']); |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | // increase menu index if this is a new document |
132 | -if(!isset ($_REQUEST['id'])) { |
|
133 | - if(!isset ($modx->config['auto_menuindex'])) { |
|
132 | +if (!isset ($_REQUEST['id'])) { |
|
133 | + if (!isset ($modx->config['auto_menuindex'])) { |
|
134 | 134 | $modx->config['auto_menuindex'] = 1; |
135 | 135 | } |
136 | - if($modx->config['auto_menuindex']) { |
|
137 | - $pid = (int)$_REQUEST['pid']; |
|
136 | + if ($modx->config['auto_menuindex']) { |
|
137 | + $pid = (int) $_REQUEST['pid']; |
|
138 | 138 | $rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'"); |
139 | 139 | $content['menuindex'] = $modx->getDatabase()->getValue($rs); |
140 | 140 | } else { |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
145 | -if(isset ($_POST['which_editor'])) { |
|
145 | +if (isset ($_POST['which_editor'])) { |
|
146 | 146 | $modx->config['which_editor'] = $_POST['which_editor']; |
147 | 147 | } |
148 | 148 | |
149 | 149 | // Add lock-element JS-Script |
150 | 150 | $lockElementId = $id; |
151 | 151 | $lockElementType = 7; |
152 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
152 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
153 | 153 | ?> |
154 | 154 | <script type="text/javascript"> |
155 | 155 | /* <![CDATA[ */ |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | }, |
180 | 180 | cancel: function() { |
181 | 181 | documentDirty = false; |
182 | - document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>'; |
|
182 | + document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>'; |
|
183 | 183 | }, |
184 | 184 | duplicate: function() { |
185 | 185 | if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) { |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | }, |
189 | 189 | view: function() { |
190 | - window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin'); |
|
190 | + window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin'); |
|
191 | 191 | } |
192 | 192 | }; |
193 | 193 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | 'template' => $content['template'] |
550 | 550 | )); |
551 | 551 | |
552 | - if(is_array($evtOut)) { |
|
552 | + if (is_array($evtOut)) { |
|
553 | 553 | echo implode('', $evtOut); |
554 | 554 | } |
555 | 555 | |
@@ -573,8 +573,8 @@ discard block |
||
573 | 573 | <fieldset id="create_edit"> |
574 | 574 | |
575 | 575 | <h1> |
576 | - <i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) { |
|
577 | - echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>'; |
|
576 | + <i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) { |
|
577 | + echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>'; |
|
578 | 578 | } else { |
579 | 579 | if ($modx->getManagerApi()->action == '4') { |
580 | 580 | echo $_lang['add_resource']; |
@@ -590,36 +590,36 @@ discard block |
||
590 | 590 | |
591 | 591 | <?php |
592 | 592 | // breadcrumbs |
593 | - if($modx->config['use_breadcrumbs']) { |
|
593 | + if ($modx->config['use_breadcrumbs']) { |
|
594 | 594 | $temp = array(); |
595 | 595 | $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title']; |
596 | 596 | |
597 | - if(isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
597 | + if (isset($_REQUEST['id']) && $content['parent'] != 0) { |
|
598 | 598 | $bID = (int) $_REQUEST['id']; |
599 | 599 | $temp = $modx->getParentIds($bID); |
600 | - } else if(isset($_REQUEST['pid'])) { |
|
600 | + } else if (isset($_REQUEST['pid'])) { |
|
601 | 601 | $bID = (int) $_REQUEST['pid']; |
602 | 602 | $temp = $modx->getParentIds($bID); |
603 | 603 | array_unshift($temp, $bID); |
604 | 604 | } |
605 | 605 | |
606 | - if($temp) { |
|
606 | + if ($temp) { |
|
607 | 607 | $parents = implode(',', $temp); |
608 | 608 | |
609 | - if(!empty($parents)) { |
|
609 | + if (!empty($parents)) { |
|
610 | 610 | $where = "FIND_IN_SET(id,'{$parents}') DESC"; |
611 | 611 | $rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where); |
612 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
612 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
613 | 613 | $out .= '<li class="breadcrumbs__li"> |
614 | - <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a> |
|
614 | + <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a> |
|
615 | 615 | <span class="breadcrumbs__sep">></span> |
616 | 616 | </li>'; |
617 | 617 | } |
618 | 618 | } |
619 | 619 | } |
620 | 620 | |
621 | - $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>'; |
|
622 | - echo '<ul class="breadcrumbs">' . $out . '</ul>'; |
|
621 | + $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>'; |
|
622 | + echo '<ul class="breadcrumbs">'.$out.'</ul>'; |
|
623 | 623 | } |
624 | 624 | ?> |
625 | 625 | |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array( |
637 | 637 | 'id' => $id |
638 | 638 | )); |
639 | - if(is_array($evtOut)) { |
|
639 | + if (is_array($evtOut)) { |
|
640 | 640 | echo implode('', $evtOut); |
641 | 641 | } else { |
642 | 642 | ?> |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | </td> |
693 | 693 | </tr> |
694 | 694 | |
695 | - <?php if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { // Web Link specific ?> |
|
695 | + <?php if ($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { // Web Link specific ?> |
|
696 | 696 | |
697 | 697 | <tr> |
698 | 698 | <td><span class="warning"><?= $_lang['weblink'] ?></span> |
@@ -728,17 +728,17 @@ discard block |
||
728 | 728 | $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id"; |
729 | 729 | $rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC'); |
730 | 730 | $currentCategory = ''; |
731 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
732 | - if($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
731 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
732 | + if ($row['selectable'] != 1 && $row['id'] != $content['template']) { |
|
733 | 733 | continue; |
734 | 734 | }; |
735 | 735 | // Skip if not selectable but show if selected! |
736 | 736 | $thisCategory = $row['category']; |
737 | - if($thisCategory == null) { |
|
737 | + if ($thisCategory == null) { |
|
738 | 738 | $thisCategory = $_lang["no_category"]; |
739 | 739 | } |
740 | - if($thisCategory != $currentCategory) { |
|
741 | - if($closeOptGroup) { |
|
740 | + if ($thisCategory != $currentCategory) { |
|
741 | + if ($closeOptGroup) { |
|
742 | 742 | echo "\t\t\t\t\t</optgroup>\n"; |
743 | 743 | } |
744 | 744 | echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n"; |
@@ -747,10 +747,10 @@ discard block |
||
747 | 747 | |
748 | 748 | $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : ''; |
749 | 749 | |
750 | - echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n"; |
|
750 | + echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n"; |
|
751 | 751 | $currentCategory = $thisCategory; |
752 | 752 | } |
753 | - if($thisCategory != '') { |
|
753 | + if ($thisCategory != '') { |
|
754 | 754 | echo "\t\t\t\t\t</optgroup>\n"; |
755 | 755 | } |
756 | 756 | ?> |
@@ -794,20 +794,20 @@ discard block |
||
794 | 794 | <td valign="top"> |
795 | 795 | <?php |
796 | 796 | $parentlookup = false; |
797 | - if(isset ($_REQUEST['id'])) { |
|
798 | - if($content['parent'] == 0) { |
|
797 | + if (isset ($_REQUEST['id'])) { |
|
798 | + if ($content['parent'] == 0) { |
|
799 | 799 | $parentname = $site_name; |
800 | 800 | } else { |
801 | 801 | $parentlookup = $content['parent']; |
802 | 802 | } |
803 | - } elseif(isset ($_REQUEST['pid'])) { |
|
804 | - if($_REQUEST['pid'] == 0) { |
|
803 | + } elseif (isset ($_REQUEST['pid'])) { |
|
804 | + if ($_REQUEST['pid'] == 0) { |
|
805 | 805 | $parentname = $site_name; |
806 | 806 | } else { |
807 | 807 | $parentlookup = $_REQUEST['pid']; |
808 | 808 | } |
809 | - } elseif(isset($_POST['parent'])) { |
|
810 | - if($_POST['parent'] == 0) { |
|
809 | + } elseif (isset($_POST['parent'])) { |
|
810 | + if ($_POST['parent'] == 0) { |
|
811 | 811 | $parentname = $site_name; |
812 | 812 | } else { |
813 | 813 | $parentlookup = $_POST['parent']; |
@@ -816,10 +816,10 @@ discard block |
||
816 | 816 | $parentname = $site_name; |
817 | 817 | $content['parent'] = 0; |
818 | 818 | } |
819 | - if($parentlookup !== false && is_numeric($parentlookup)) { |
|
819 | + if ($parentlookup !== false && is_numeric($parentlookup)) { |
|
820 | 820 | $rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'"); |
821 | 821 | $parentname = $modx->getDatabase()->getValue($rs); |
822 | - if(!$parentname) { |
|
822 | + if (!$parentname) { |
|
823 | 823 | $modx->webAlertAndQuit($_lang["error_no_parent"]); |
824 | 824 | } |
825 | 825 | } |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | }*/ |
862 | 862 | ?> |
863 | 863 | |
864 | - <?php if($content['type'] == 'document' || $modx->getManagerApi()->action == '4') { ?> |
|
864 | + <?php if ($content['type'] == 'document' || $modx->getManagerApi()->action == '4') { ?> |
|
865 | 865 | <tr> |
866 | 866 | <td colspan="2"> |
867 | 867 | <hr> |
@@ -874,8 +874,8 @@ discard block |
||
874 | 874 | <?php |
875 | 875 | // invoke OnRichTextEditorRegister event |
876 | 876 | $evtOut = $modx->invokeEvent("OnRichTextEditorRegister"); |
877 | - if(is_array($evtOut)) { |
|
878 | - for($i = 0; $i < count($evtOut); $i++) { |
|
877 | + if (is_array($evtOut)) { |
|
878 | + for ($i = 0; $i < count($evtOut); $i++) { |
|
879 | 879 | $editor = $evtOut[$i]; |
880 | 880 | echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n"; |
881 | 881 | } |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | </div> |
887 | 887 | <div id="content_body"> |
888 | 888 | <?php |
889 | - if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) { |
|
889 | + if (($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) { |
|
890 | 890 | $htmlContent = $content['content']; |
891 | 891 | ?> |
892 | 892 | <div class="section-editor clearfix"> |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | $richtexteditorIds[$modx->config['which_editor']][] = 'ta'; |
900 | 900 | $richtexteditorOptions[$modx->config['which_editor']]['ta'] = ''; |
901 | 901 | } else { |
902 | - echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n"; |
|
902 | + echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>'."\n"; |
|
903 | 903 | } |
904 | 904 | ?> |
905 | 905 | </div> |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | |
916 | 916 | if (($content['type'] == 'document' || $modx->getManagerApi()->action == '4') || ($content['type'] == 'reference' || $modx->getManagerApi()->action == 72)) { |
917 | 917 | $template = $default_template; |
918 | - $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs']; |
|
918 | + $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs']; |
|
919 | 919 | if (isset ($_REQUEST['newtemplate'])) { |
920 | 920 | $template = $_REQUEST['newtemplate']; |
921 | 921 | } else { |
@@ -943,10 +943,10 @@ discard block |
||
943 | 943 | ); |
944 | 944 | $sort = 'tvtpl.rank,tv.rank, tv.id'; |
945 | 945 | if ($group_tvs) { |
946 | - $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
946 | + $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank'; |
|
947 | 947 | $from .= ' |
948 | - LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category'; |
|
949 | - $sort = 'cat.rank,cat.id,' . $sort; |
|
948 | + LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category'; |
|
949 | + $sort = 'cat.rank,cat.id,'.$sort; |
|
950 | 950 | } |
951 | 951 | $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs); |
952 | 952 | $rs = $modx->getDatabase()->select($field, $from, $where, $sort); |
@@ -964,8 +964,8 @@ discard block |
||
964 | 964 | if ($group_tvs == 1 || $group_tvs == 3) { |
965 | 965 | if ($i === 0) { |
966 | 966 | $templateVariablesOutput .= ' |
967 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
968 | - <div class="tab-header">' . $row['category'] . '</div> |
|
967 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
968 | + <div class="tab-header">' . $row['category'].'</div> |
|
969 | 969 | <div class="tab-body tmplvars"> |
970 | 970 | <table>' . "\n"; |
971 | 971 | } else { |
@@ -974,17 +974,17 @@ discard block |
||
974 | 974 | </div> |
975 | 975 | </div> |
976 | 976 | |
977 | - <div class="tab-section" id="tabTV_' . $row['category_id'] . '"> |
|
978 | - <div class="tab-header">' . $row['category'] . '</div> |
|
977 | + <div class="tab-section" id="tabTV_' . $row['category_id'].'"> |
|
978 | + <div class="tab-header">' . $row['category'].'</div> |
|
979 | 979 | <div class="tab-body tmplvars"> |
980 | 980 | <table>'; |
981 | 981 | } |
982 | 982 | } else if ($group_tvs == 2 || $group_tvs == 4) { |
983 | 983 | if ($i === 0) { |
984 | 984 | $templateVariablesOutput .= ' |
985 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
986 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
987 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
985 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
986 | + <h2 class="tab">' . $row['category'].'</h2> |
|
987 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
988 | 988 | |
989 | 989 | <div class="tab-body tmplvars"> |
990 | 990 | <table>'; |
@@ -994,9 +994,9 @@ discard block |
||
994 | 994 | </div> |
995 | 995 | </div> |
996 | 996 | |
997 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
998 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
999 | - <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
997 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
998 | + <h2 class="tab">' . $row['category'].'</h2> |
|
999 | + <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1000 | 1000 | |
1001 | 1001 | <div class="tab-body tmplvars"> |
1002 | 1002 | <table>'; |
@@ -1004,18 +1004,18 @@ discard block |
||
1004 | 1004 | } else if ($group_tvs == 5) { |
1005 | 1005 | if ($i === 0) { |
1006 | 1006 | $templateVariablesOutput .= ' |
1007 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1008 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1009 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1007 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1008 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1009 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1010 | 1010 | <table>'; |
1011 | 1011 | } else { |
1012 | 1012 | $templateVariablesOutput .= ' |
1013 | 1013 | </table> |
1014 | 1014 | </div> |
1015 | 1015 | |
1016 | - <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars"> |
|
1017 | - <h2 class="tab">' . $row['category'] . '</h2> |
|
1018 | - <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script> |
|
1016 | + <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars"> |
|
1017 | + <h2 class="tab">' . $row['category'].'</h2> |
|
1018 | + <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script> |
|
1019 | 1019 | |
1020 | 1020 | <table>'; |
1021 | 1021 | } |
@@ -1035,8 +1035,8 @@ discard block |
||
1035 | 1035 | $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor']; |
1036 | 1036 | }; |
1037 | 1037 | // Add richtext editor to the list |
1038 | - $richtexteditorIds[$editor][] = "tv" . $row['id']; |
|
1039 | - $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions; |
|
1038 | + $richtexteditorIds[$editor][] = "tv".$row['id']; |
|
1039 | + $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions; |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | $templateVariablesTmp = ''; |
@@ -1053,24 +1053,24 @@ discard block |
||
1053 | 1053 | } |
1054 | 1054 | |
1055 | 1055 | // post back value |
1056 | - if (array_key_exists('tv' . $row['id'], $_POST)) { |
|
1057 | - if (is_array($_POST['tv' . $row['id']])) { |
|
1058 | - $tvPBV = implode('||', $_POST['tv' . $row['id']]); |
|
1056 | + if (array_key_exists('tv'.$row['id'], $_POST)) { |
|
1057 | + if (is_array($_POST['tv'.$row['id']])) { |
|
1058 | + $tvPBV = implode('||', $_POST['tv'.$row['id']]); |
|
1059 | 1059 | } else { |
1060 | - $tvPBV = $_POST['tv' . $row['id']]; |
|
1060 | + $tvPBV = $_POST['tv'.$row['id']]; |
|
1061 | 1061 | } |
1062 | 1062 | } else { |
1063 | 1063 | $tvPBV = $row['value']; |
1064 | 1064 | } |
1065 | 1065 | |
1066 | - $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : ''; |
|
1067 | - $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : ''; |
|
1068 | - $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : ''; |
|
1066 | + $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : ''; |
|
1067 | + $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : ''; |
|
1068 | + $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : ''; |
|
1069 | 1069 | |
1070 | 1070 | $templateVariablesTmp .= ' |
1071 | 1071 | <tr> |
1072 | - <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td> |
|
1073 | - <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td> |
|
1072 | + <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td> |
|
1073 | + <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td> |
|
1074 | 1074 | </tr>'; |
1075 | 1075 | |
1076 | 1076 | if ($group_tvs && $row['category_id'] == 0) { |
@@ -1084,37 +1084,37 @@ discard block |
||
1084 | 1084 | } |
1085 | 1085 | |
1086 | 1086 | if ($templateVariablesGeneral) { |
1087 | - echo '<table id="tabTV_0" class="tmplvars"><tbody>' . $templateVariablesGeneral . '</tbody></table>'; |
|
1087 | + echo '<table id="tabTV_0" class="tmplvars"><tbody>'.$templateVariablesGeneral.'</tbody></table>'; |
|
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | $templateVariables .= ' |
1091 | 1091 | <!-- Template Variables -->' . "\n"; |
1092 | 1092 | if (!$group_tvs) { |
1093 | 1093 | $templateVariables .= ' |
1094 | - <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
1094 | + <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
1095 | 1095 | <div class="sectionBody tmplvars"> |
1096 | 1096 | <table>'; |
1097 | 1097 | } else if ($group_tvs == 2) { |
1098 | 1098 | $templateVariables .= ' |
1099 | 1099 | <div class="tab-section"> |
1100 | - <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div> |
|
1100 | + <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div> |
|
1101 | 1101 | <div class="tab-pane" id="paneTemplateVariables"> |
1102 | 1102 | <script type="text/javascript"> |
1103 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
1103 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
1104 | 1104 | </script>'; |
1105 | 1105 | } else if ($group_tvs == 3) { |
1106 | 1106 | $templateVariables .= ' |
1107 | 1107 | <div id="templateVariables" class="tab-page tmplvars"> |
1108 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
1108 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
1109 | 1109 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>'; |
1110 | 1110 | } else if ($group_tvs == 4) { |
1111 | 1111 | $templateVariables .= ' |
1112 | 1112 | <div id="templateVariables" class="tab-page tmplvars"> |
1113 | - <h2 class="tab">' . $_lang['settings_templvars'] . '</h2> |
|
1113 | + <h2 class="tab">' . $_lang['settings_templvars'].'</h2> |
|
1114 | 1114 | <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script> |
1115 | 1115 | <div class="tab-pane" id="paneTemplateVariables"> |
1116 | 1116 | <script type="text/javascript"> |
1117 | - tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . '); |
|
1117 | + tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').'); |
|
1118 | 1118 | </script>'; |
1119 | 1119 | } |
1120 | 1120 | if ($templateVariablesOutput) { |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | |
1209 | 1209 | <?php |
1210 | 1210 | |
1211 | - if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1211 | + if ($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) { |
|
1212 | 1212 | ?> |
1213 | 1213 | <tr> |
1214 | 1214 | <td> |
@@ -1231,13 +1231,13 @@ discard block |
||
1231 | 1231 | <td> |
1232 | 1232 | <select name="contentType" class="inputBox" onchange="documentDirty=true;"> |
1233 | 1233 | <?php |
1234 | - if(!$content['contentType']) { |
|
1234 | + if (!$content['contentType']) { |
|
1235 | 1235 | $content['contentType'] = 'text/html'; |
1236 | 1236 | } |
1237 | 1237 | $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml"); |
1238 | 1238 | $ct = explode(",", $custom_contenttype); |
1239 | - for($i = 0; $i < count($ct); $i++) { |
|
1240 | - echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n"; |
|
1239 | + for ($i = 0; $i < count($ct); $i++) { |
|
1240 | + echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n"; |
|
1241 | 1241 | } |
1242 | 1242 | ?> |
1243 | 1243 | </select> |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | </tr> |
1264 | 1264 | <?php |
1265 | 1265 | } else { |
1266 | - if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') { |
|
1266 | + if ($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') { |
|
1267 | 1267 | // non-admin managers creating or editing a document resource |
1268 | 1268 | ?> |
1269 | 1269 | <input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" /> |
@@ -1363,15 +1363,15 @@ discard block |
||
1363 | 1363 | <?php |
1364 | 1364 | /******************************* |
1365 | 1365 | * Document Access Permissions */ |
1366 | - if($use_udperms == 1) { |
|
1366 | + if ($use_udperms == 1) { |
|
1367 | 1367 | $groupsarray = array(); |
1368 | 1368 | $sql = ''; |
1369 | 1369 | |
1370 | 1370 | $documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent'])); |
1371 | - if($documentId > 0) { |
|
1371 | + if ($documentId > 0) { |
|
1372 | 1372 | // Load up, the permissions from the parent (if new document) or existing document |
1373 | 1373 | $rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'"); |
1374 | - while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id']; |
|
1374 | + while ($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id']; |
|
1375 | 1375 | |
1376 | 1376 | // Load up the current permissions and names |
1377 | 1377 | $vs = array( |
@@ -1387,7 +1387,7 @@ discard block |
||
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | // retain selected doc groups between post |
1390 | - if(isset($_POST['docgroups'])) { |
|
1390 | + if (isset($_POST['docgroups'])) { |
|
1391 | 1391 | $groupsarray = array_merge($groupsarray, $_POST['docgroups']); |
1392 | 1392 | } |
1393 | 1393 | |
@@ -1406,26 +1406,26 @@ discard block |
||
1406 | 1406 | $permissions_no = 0; // count permissions the current mgr user doesn't have |
1407 | 1407 | |
1408 | 1408 | // Loop through the permissions list |
1409 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
1409 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
1410 | 1410 | |
1411 | 1411 | // Create an inputValue pair (group ID and group link (if it exists)) |
1412 | - $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new'); |
|
1413 | - $inputId = 'group-' . $row['id']; |
|
1412 | + $inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new'); |
|
1413 | + $inputId = 'group-'.$row['id']; |
|
1414 | 1414 | |
1415 | 1415 | $checked = in_array($inputValue, $groupsarray); |
1416 | - if($checked) { |
|
1416 | + if ($checked) { |
|
1417 | 1417 | $notPublic = true; |
1418 | 1418 | } // Mark as private access (either web or manager) |
1419 | 1419 | |
1420 | 1420 | // Skip the access permission if the user doesn't have access... |
1421 | - if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1421 | + if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) { |
|
1422 | 1422 | continue; |
1423 | 1423 | } |
1424 | 1424 | |
1425 | 1425 | // Setup attributes for this Input box |
1426 | 1426 | $inputAttributes['id'] = $inputId; |
1427 | 1427 | $inputAttributes['value'] = $inputValue; |
1428 | - if($checked) { |
|
1428 | + if ($checked) { |
|
1429 | 1429 | $inputAttributes['checked'] = 'checked'; |
1430 | 1430 | } else { |
1431 | 1431 | unset($inputAttributes['checked']); |
@@ -1433,10 +1433,10 @@ discard block |
||
1433 | 1433 | |
1434 | 1434 | // Create attribute string list |
1435 | 1435 | $inputString = array(); |
1436 | - foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"'; |
|
1436 | + foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"'; |
|
1437 | 1437 | |
1438 | 1438 | // Make the <input> HTML |
1439 | - $inputHTML = '<input ' . implode(' ', $inputString) . ' />'; |
|
1439 | + $inputHTML = '<input '.implode(' ', $inputString).' />'; |
|
1440 | 1440 | |
1441 | 1441 | // does user have this permission? |
1442 | 1442 | $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg"; |
@@ -1447,23 +1447,23 @@ discard block |
||
1447 | 1447 | $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs); |
1448 | 1448 | $rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where); |
1449 | 1449 | $count = $modx->getDatabase()->getValue($rsp); |
1450 | - if($count > 0) { |
|
1450 | + if ($count > 0) { |
|
1451 | 1451 | ++$permissions_yes; |
1452 | 1452 | } else { |
1453 | 1453 | ++$permissions_no; |
1454 | 1454 | } |
1455 | - $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>'; |
|
1455 | + $permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>'; |
|
1456 | 1456 | } |
1457 | 1457 | // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public |
1458 | - if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1458 | + if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) { |
|
1459 | 1459 | $permissions = array(); |
1460 | 1460 | } |
1461 | 1461 | |
1462 | 1462 | // See if the Access Permissions section is worth displaying... |
1463 | - if(!empty($permissions)) { |
|
1463 | + if (!empty($permissions)) { |
|
1464 | 1464 | // Add the "All Document Groups" item if we have rights in both contexts |
1465 | - if($isManager && $isWeb) { |
|
1466 | - array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>'); |
|
1465 | + if ($isManager && $isWeb) { |
|
1466 | + array_unshift($permissions, "\t\t".'<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true);" /><label for="groupall" class="warning">'.$_lang['all_doc_groups'].'</label></li>'); |
|
1467 | 1467 | } |
1468 | 1468 | // Output the permissions list... |
1469 | 1469 | ?> |
@@ -1496,12 +1496,12 @@ discard block |
||
1496 | 1496 | </script> |
1497 | 1497 | <p><?= $_lang['access_permissions_docs_message'] ?></p> |
1498 | 1498 | <ul> |
1499 | - <?= implode("\n", $permissions) . "\n" ?> |
|
1499 | + <?= implode("\n", $permissions)."\n" ?> |
|
1500 | 1500 | </ul> |
1501 | 1501 | </div><!--div class="tab-page" id="tabAccess"--> |
1502 | 1502 | <?php |
1503 | 1503 | } // !empty($permissions) |
1504 | - elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1504 | + elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) { |
|
1505 | 1505 | ?> |
1506 | 1506 | <p><?= $_lang["access_permissions_docs_collision"] ?></p> |
1507 | 1507 | <?php |
@@ -1521,7 +1521,7 @@ discard block |
||
1521 | 1521 | 'template' => $content['template'] |
1522 | 1522 | )); |
1523 | 1523 | |
1524 | - if(is_array($evtOut)) { |
|
1524 | + if (is_array($evtOut)) { |
|
1525 | 1525 | echo implode('', $evtOut); |
1526 | 1526 | } |
1527 | 1527 | ?> |
@@ -1534,16 +1534,16 @@ discard block |
||
1534 | 1534 | storeCurTemplate(); |
1535 | 1535 | </script> |
1536 | 1536 | <?php |
1537 | -if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4' || $modx->getManagerApi()->action == '72') && $use_editor == 1) { |
|
1538 | - if(is_array($richtexteditorIds)) { |
|
1539 | - foreach($richtexteditorIds as $editor => $elements) { |
|
1537 | +if (($content['richtext'] == 1 || $modx->getManagerApi()->action == '4' || $modx->getManagerApi()->action == '72') && $use_editor == 1) { |
|
1538 | + if (is_array($richtexteditorIds)) { |
|
1539 | + foreach ($richtexteditorIds as $editor => $elements) { |
|
1540 | 1540 | // invoke OnRichTextEditorInit event |
1541 | 1541 | $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array( |
1542 | 1542 | 'editor' => $editor, |
1543 | 1543 | 'elements' => $elements, |
1544 | 1544 | 'options' => $richtexteditorOptions[$editor] |
1545 | 1545 | )); |
1546 | - if(is_array($evtOut)) { |
|
1546 | + if (is_array($evtOut)) { |
|
1547 | 1547 | echo implode('', $evtOut); |
1548 | 1548 | } |
1549 | 1549 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('logs')) { |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | $collation = $modx->getDatabase()->getRow($res, 'num'); |
13 | 13 | |
14 | 14 | $serverArr = array( |
15 | - $_lang['modx_version'] => $modx->getVersionData('version') . ' ' . $newversiontext, |
|
15 | + $_lang['modx_version'] => $modx->getVersionData('version').' '.$newversiontext, |
|
16 | 16 | $_lang['release_date'] => $modx->getVersionData('release_date'), |
17 | 17 | 'PHP Version' => phpversion(), |
18 | - 'phpInfo()' => '<a class="text-underline" href="javascript:;" onclick="viewPHPInfo();return false;">' . $_lang['view'] . '</a>', |
|
18 | + 'phpInfo()' => '<a class="text-underline" href="javascript:;" onclick="viewPHPInfo();return false;">'.$_lang['view'].'</a>', |
|
19 | 19 | $_lang['access_permissions'] => ($use_udperms == 1 ? $_lang['enabled'] : $_lang['disabled']), |
20 | 20 | $_lang['servertime'] => strftime('%H:%M:%S', time()), |
21 | 21 | $_lang['localtime'] => strftime('%H:%M:%S', time() + $server_offset_time), |
22 | - $_lang['serveroffset'] => $server_offset_time / (60 * 60) . ' h', |
|
22 | + $_lang['serveroffset'] => $server_offset_time / (60 * 60).' h', |
|
23 | 23 | $_lang['database_name'] => trim($dbase, '`'), |
24 | 24 | $_lang['database_server'] => $database_server, |
25 | 25 | $_lang['database_version'] => $modx->getDatabase()->getVersion(), |
@@ -95,33 +95,33 @@ discard block |
||
95 | 95 | </thead> |
96 | 96 | <tbody> |
97 | 97 | <?php |
98 | - $sql = "SHOW TABLE STATUS FROM $dbase LIKE '" . $modx->getDatabase()->escape($modx->getDatabase()->config['table_prefix']) . "%';"; |
|
98 | + $sql = "SHOW TABLE STATUS FROM $dbase LIKE '".$modx->getDatabase()->escape($modx->getDatabase()->config['table_prefix'])."%';"; |
|
99 | 99 | $rs = $modx->getDatabase()->query($sql); |
100 | 100 | $i = 0; |
101 | 101 | while ($log_status = $modx->getDatabase()->getRow($rs)) { |
102 | 102 | ?> |
103 | 103 | <tr> |
104 | 104 | <td class="text-primary"><b><?= $log_status['Name'] ?></b></td> |
105 | - <td class="text-xs-center"><?= (!empty($log_status['Comment']) ? '<i class="' . $_style['actions_help'] . '" data-tooltip="' . $log_status['Comment'] . '"></i>' : '') ?></td> |
|
105 | + <td class="text-xs-center"><?= (!empty($log_status['Comment']) ? '<i class="'.$_style['actions_help'].'" data-tooltip="'.$log_status['Comment'].'"></i>' : '') ?></td> |
|
106 | 106 | <td class="text-xs-right"><?= $log_status['Rows'] ?></td> |
107 | 107 | |
108 | 108 | <?php |
109 | 109 | $truncateable = array( |
110 | - $modx->getDatabase()->config['table_prefix'] . 'event_log', |
|
111 | - $modx->getDatabase()->config['table_prefix'] . 'manager_log', |
|
110 | + $modx->getDatabase()->config['table_prefix'].'event_log', |
|
111 | + $modx->getDatabase()->config['table_prefix'].'manager_log', |
|
112 | 112 | ); |
113 | 113 | if ($modx->hasPermission('settings') && in_array($log_status['Name'], $truncateable)) { |
114 | 114 | echo "<td class=\"text-xs-right\">"; |
115 | - echo "<a class=\"text-danger\" href='index.php?a=54&mode=$action&u=" . $log_status['Name'] . "' title='" . $_lang['truncate_table'] . "'>" . $modx->nicesize($log_status['Data_length'] + $log_status['Data_free']) . "</a>"; |
|
115 | + echo "<a class=\"text-danger\" href='index.php?a=54&mode=$action&u=".$log_status['Name']."' title='".$_lang['truncate_table']."'>".$modx->nicesize($log_status['Data_length'] + $log_status['Data_free'])."</a>"; |
|
116 | 116 | echo "</td>"; |
117 | 117 | } else { |
118 | - echo "<td class=\"text-xs-right\">" . $modx->nicesize($log_status['Data_length'] + $log_status['Data_free']) . "</td>"; |
|
118 | + echo "<td class=\"text-xs-right\">".$modx->nicesize($log_status['Data_length'] + $log_status['Data_free'])."</td>"; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | if ($modx->hasPermission('settings')) { |
122 | - echo "<td class=\"text-xs-right\">" . ($log_status['Data_free'] > 0 ? "<a class=\"text-danger\" href='index.php?a=54&mode=$action&t=" . $log_status['Name'] . "' title='" . $_lang['optimize_table'] . "' ><span>" . $modx->nicesize($log_status['Data_free']) . "</span></a>" : "-") . "</td>"; |
|
122 | + echo "<td class=\"text-xs-right\">".($log_status['Data_free'] > 0 ? "<a class=\"text-danger\" href='index.php?a=54&mode=$action&t=".$log_status['Name']."' title='".$_lang['optimize_table']."' ><span>".$modx->nicesize($log_status['Data_free'])."</span></a>" : "-")."</td>"; |
|
123 | 123 | } else { |
124 | - echo "<td class=\"text-xs-right\">" . ($log_status['Data_free'] > 0 ? $modx->nicesize($log_status['Data_free']) : "-") . "</td>"; |
|
124 | + echo "<td class=\"text-xs-right\">".($log_status['Data_free'] > 0 ? $modx->nicesize($log_status['Data_free']) : "-")."</td>"; |
|
125 | 125 | } |
126 | 126 | ?> |
127 | 127 | <td class="text-xs-right"><?= $modx->nicesize($log_status['Data_length'] - $log_status['Data_free']) ?></td> |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | <tr class="unstyled"> |
137 | 137 | <td class="text-xs-right"><?= $_lang['database_table_totals'] ?></td> |
138 | 138 | <td colspan="3"> </td> |
139 | - <td class="text-xs-right"><?= $totaloverhead > 0 ? "<b class=\"text-danger\">" . $modx->nicesize($totaloverhead) . "</b><br />(" . number_format($totaloverhead) . " B)" : "-" ?></td> |
|
139 | + <td class="text-xs-right"><?= $totaloverhead > 0 ? "<b class=\"text-danger\">".$modx->nicesize($totaloverhead)."</b><br />(".number_format($totaloverhead)." B)" : "-" ?></td> |
|
140 | 140 | <td colspan="2"> </td> |
141 | - <td class="text-xs-right"><?= "<b>" . $modx->nicesize($total) . "</b><br />(" . number_format($total) . " B)" ?></td> |
|
141 | + <td class="text-xs-right"><?= "<b>".$modx->nicesize($total)."</b><br />(".number_format($total)." B)" ?></td> |
|
142 | 142 | </tr> |
143 | 143 | </tbody> |
144 | 144 | </table> |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -if (!$modx->hasPermission('logs')) { |
|
5 | +if (!$modx->hasPermission('logs')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | <table class="table data table-sm nowrap"> |
56 | 56 | <tbody> |
57 | 57 | <?php |
58 | - foreach ($serverArr as $key => $value) { |
|
58 | + foreach ($serverArr as $key => $value) { |
|
59 | 59 | ?> |
60 | 60 | <tr> |
61 | 61 | <td width="1%"><?= $key ?></td> |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $sql = "SHOW TABLE STATUS FROM $dbase LIKE '" . $modx->getDatabase()->escape($modx->getDatabase()->config['table_prefix']) . "%';"; |
99 | 99 | $rs = $modx->getDatabase()->query($sql); |
100 | 100 | $i = 0; |
101 | - while ($log_status = $modx->getDatabase()->getRow($rs)) { |
|
101 | + while ($log_status = $modx->getDatabase()->getRow($rs)) { |
|
102 | 102 | ?> |
103 | 103 | <tr> |
104 | 104 | <td class="text-primary"><b><?= $log_status['Name'] ?></b></td> |
@@ -110,17 +110,17 @@ discard block |
||
110 | 110 | $modx->getDatabase()->config['table_prefix'] . 'event_log', |
111 | 111 | $modx->getDatabase()->config['table_prefix'] . 'manager_log', |
112 | 112 | ); |
113 | - if ($modx->hasPermission('settings') && in_array($log_status['Name'], $truncateable)) { |
|
113 | + if ($modx->hasPermission('settings') && in_array($log_status['Name'], $truncateable)) { |
|
114 | 114 | echo "<td class=\"text-xs-right\">"; |
115 | 115 | echo "<a class=\"text-danger\" href='index.php?a=54&mode=$action&u=" . $log_status['Name'] . "' title='" . $_lang['truncate_table'] . "'>" . $modx->nicesize($log_status['Data_length'] + $log_status['Data_free']) . "</a>"; |
116 | 116 | echo "</td>"; |
117 | - } else { |
|
117 | + } else { |
|
118 | 118 | echo "<td class=\"text-xs-right\">" . $modx->nicesize($log_status['Data_length'] + $log_status['Data_free']) . "</td>"; |
119 | 119 | } |
120 | 120 | |
121 | - if ($modx->hasPermission('settings')) { |
|
121 | + if ($modx->hasPermission('settings')) { |
|
122 | 122 | echo "<td class=\"text-xs-right\">" . ($log_status['Data_free'] > 0 ? "<a class=\"text-danger\" href='index.php?a=54&mode=$action&t=" . $log_status['Name'] . "' title='" . $_lang['optimize_table'] . "' ><span>" . $modx->nicesize($log_status['Data_free']) . "</span></a>" : "-") . "</td>"; |
123 | - } else { |
|
123 | + } else { |
|
124 | 124 | echo "<td class=\"text-xs-right\">" . ($log_status['Data_free'] > 0 ? $modx->nicesize($log_status['Data_free']) : "-") . "</td>"; |
125 | 125 | } |
126 | 126 | ?> |
@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch ($modx->getManagerApi()->action) { |
7 | - case 102: |
|
8 | - if (!$modx->hasPermission('edit_plugin')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 101: |
|
13 | - if (!$modx->hasPermission('new_plugin')) { |
|
7 | + case 102: |
|
8 | + if (!$modx->hasPermission('edit_plugin')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 101: |
|
13 | + if (!$modx->hasPermission('new_plugin')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
14 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | $tbl_site_plugins = $modx->getDatabase()->getFullTableName('site_plugins'); |
24 | 24 | $tbl_site_plugin_events = $modx->getDatabase()->getFullTableName('site_plugin_events'); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $content['properties'] = str_replace("&", "&", $content['properties']); |
47 | 47 | } else { |
48 | 48 | $_SESSION['itemname'] = $_lang["new_plugin"]; |
49 | - $content['category'] = (int)$_REQUEST['catid']; |
|
49 | + $content['category'] = (int) $_REQUEST['catid']; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | if ($modx->getManagerApi()->hasFormValues()) { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | // Add lock-element JS-Script |
57 | 57 | $lockElementId = $id; |
58 | 58 | $lockElementType = 5; |
59 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
59 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
60 | 60 | |
61 | 61 | |
62 | 62 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | <input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>"> |
474 | 474 | |
475 | 475 | <h1> |
476 | - <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i> |
|
476 | + <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i> |
|
477 | 477 | </h1> |
478 | 478 | |
479 | 479 | <?= $_style['actionbuttons']['dynamic']['element'] ?> |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | <div class="form-control-name clearfix"> |
500 | 500 | <input name="name" type="text" maxlength="100" value="<?= $modx->getPhpCompat()->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
501 | 501 | <?php if ($modx->hasPermission('save_role')): ?> |
502 | - <label class="custom-control" title="<?= $_lang['lock_plugin'] . "\n" . $_lang['lock_plugin_msg'] ?>" tooltip> |
|
502 | + <label class="custom-control" title="<?= $_lang['lock_plugin']."\n".$_lang['lock_plugin_msg'] ?>" tooltip> |
|
503 | 503 | <input name="locked" type="checkbox" value="on"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
504 | 504 | <i class="fa fa-lock"></i> |
505 | 505 | </label> |
@@ -523,9 +523,9 @@ discard block |
||
523 | 523 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
524 | 524 | <option> </option> |
525 | 525 | <?php |
526 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
526 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
527 | 527 | foreach (getCategories() as $n => $v) { |
528 | - echo '<option value="' . $v['id'] . '"' . ($content["category"] == $v["id"] ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>"; |
|
528 | + echo '<option value="'.$v['id'].'"'.($content["category"] == $v["id"] ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($v["category"])."</option>"; |
|
529 | 529 | } |
530 | 530 | ?> |
531 | 531 | </select> |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | <?php if ($modx->hasPermission('save_role')): ?> |
542 | 542 | <div class="form-group"> |
543 | 543 | <div class="form-row"> |
544 | - <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['plugin_disabled'] . "</span>" : $_lang['plugin_disabled']) ?></label> |
|
544 | + <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['plugin_disabled']."</span>" : $_lang['plugin_disabled']) ?></label> |
|
545 | 545 | </div> |
546 | 546 | <div class="form-row"> |
547 | 547 | <label> |
@@ -588,11 +588,11 @@ discard block |
||
588 | 588 | <select name="moduleguid" class="form-control" onchange="documentDirty=true;"> |
589 | 589 | <option> </option> |
590 | 590 | <?php |
591 | - $ds = $modx->getDatabase()->select('sm.id,sm.name,sm.guid', $modx->getDatabase()->getFullTableName("site_modules") . " sm |
|
592 | - INNER JOIN " . $modx->getDatabase()->getFullTableName("site_module_depobj") . " smd ON smd.module=sm.id AND smd.type=30 |
|
593 | - INNER JOIN " . $modx->getDatabase()->getFullTableName("site_plugins") . " sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name'); |
|
591 | + $ds = $modx->getDatabase()->select('sm.id,sm.name,sm.guid', $modx->getDatabase()->getFullTableName("site_modules")." sm |
|
592 | + INNER JOIN " . $modx->getDatabase()->getFullTableName("site_module_depobj")." smd ON smd.module=sm.id AND smd.type=30 |
|
593 | + INNER JOIN " . $modx->getDatabase()->getFullTableName("site_plugins")." sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name'); |
|
594 | 594 | while ($row = $modx->getDatabase()->getRow($ds)) { |
595 | - echo "<option value='" . $row['guid'] . "'" . ($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($row["name"]) . "</option>"; |
|
595 | + echo "<option value='".$row['guid']."'".($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "").">".$modx->getPhpCompat()->htmlspecialchars($row["name"])."</option>"; |
|
596 | 596 | } |
597 | 597 | ?> |
598 | 598 | </select> |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | echoEventRows($evtnames); |
655 | 655 | } |
656 | 656 | echo '<hr class="clear">'; |
657 | - echo '<div class="form-group"><b>' . $services[$srv - 1] . '</b></div>'; |
|
657 | + echo '<div class="form-group"><b>'.$services[$srv - 1].'</b></div>'; |
|
658 | 658 | } |
659 | 659 | // display group name |
660 | 660 | if ($grp != $row['groupname']) { |
@@ -663,9 +663,9 @@ discard block |
||
663 | 663 | echoEventRows($evtnames); |
664 | 664 | } |
665 | 665 | echo '<hr class="clear">'; |
666 | - echo '<div class="form-group"><b>' . $row['groupname'] . '</b></div>'; |
|
666 | + echo '<div class="form-group"><b>'.$row['groupname'].'</b></div>'; |
|
667 | 667 | } |
668 | - $evtnames[] = '<input name="sysevents[]" id="' . $row['name'] . '" type="checkbox" ' . (in_array($row['id'], $evts) ? ' checked="checked" ' : '') . 'class="inputBox" value="' . $row['id'] . '" /> <label for="' . $row['name'] . '" ' . bold(in_array($row['id'], $evts)) . '> ' . $row['name'] . '</label>' . "\n"; |
|
668 | + $evtnames[] = '<input name="sysevents[]" id="'.$row['name'].'" type="checkbox" '.(in_array($row['id'], $evts) ? ' checked="checked" ' : '').'class="inputBox" value="'.$row['id'].'" /> <label for="'.$row['name'].'" '.bold(in_array($row['id'], $evts)).'> '.$row['name'].'</label>'."\n"; |
|
669 | 669 | if (count($evtnames) == 2) { |
670 | 670 | echoEventRows($evtnames); |
671 | 671 | } |