@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc Uploader class |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.54 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010-2014 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - */ |
|
4 | + * |
|
5 | + * @desc Uploader class |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.54 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010-2014 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class uploader { |
16 | 16 | |
@@ -18,92 +18,92 @@ discard block |
||
18 | 18 | const VERSION = "2.54"; |
19 | 19 | |
20 | 20 | /** Config session-overrided settings |
21 | - * @var array */ |
|
21 | + * @var array */ |
|
22 | 22 | protected $config = array(); |
23 | 23 | |
24 | 24 | /** Default image driver |
25 | - * @var string */ |
|
25 | + * @var string */ |
|
26 | 26 | protected $imageDriver = "gd"; |
27 | 27 | |
28 | 28 | /** Opener applocation properties |
29 | - * $opener['name'] Got from $_GET['opener']; |
|
30 | - * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
31 | - * $opener['TinyMCE'] Boolean |
|
32 | - * @var array */ |
|
29 | + * $opener['name'] Got from $_GET['opener']; |
|
30 | + * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
31 | + * $opener['TinyMCE'] Boolean |
|
32 | + * @var array */ |
|
33 | 33 | protected $opener = array(); |
34 | 34 | |
35 | 35 | /** Got from $_GET['type'] or first one $config['types'] array key, if inexistant |
36 | - * @var string */ |
|
36 | + * @var string */ |
|
37 | 37 | protected $type; |
38 | 38 | |
39 | 39 | /** Helper property. Local filesystem path to the Type Directory |
40 | - * Equivalent: $config['uploadDir'] . "/" . $type |
|
41 | - * @var string */ |
|
40 | + * Equivalent: $config['uploadDir'] . "/" . $type |
|
41 | + * @var string */ |
|
42 | 42 | protected $typeDir; |
43 | 43 | |
44 | 44 | /** Helper property. Web URL to the Type Directory |
45 | - * Equivalent: $config['uploadURL'] . "/" . $type |
|
46 | - * @var string */ |
|
45 | + * Equivalent: $config['uploadURL'] . "/" . $type |
|
46 | + * @var string */ |
|
47 | 47 | protected $typeURL; |
48 | 48 | |
49 | 49 | /** Linked to $config['types'] |
50 | - * @var array */ |
|
50 | + * @var array */ |
|
51 | 51 | protected $types = array(); |
52 | 52 | |
53 | 53 | /** Settings which can override default settings if exists as keys in $config['types'][$type] array |
54 | - * @var array */ |
|
54 | + * @var array */ |
|
55 | 55 | protected $typeSettings = array('disabled', 'theme', 'dirPerms', 'filePerms', 'denyZipDownload', 'maxImageWidth', 'maxImageHeight', 'thumbWidth', 'thumbHeight', 'jpegQuality', 'access', 'filenameChangeChars', 'dirnameChangeChars', 'denyExtensionRename', 'deniedExts', 'watermark'); |
56 | 56 | |
57 | 57 | /** Got from language file |
58 | - * @var string */ |
|
58 | + * @var string */ |
|
59 | 59 | protected $charset; |
60 | 60 | |
61 | 61 | /** The language got from $_GET['lng'] or $_GET['lang'] or... Please see next property |
62 | - * @var string */ |
|
62 | + * @var string */ |
|
63 | 63 | protected $lang = 'en'; |
64 | 64 | |
65 | 65 | /** Possible language $_GET keys |
66 | - * @var array */ |
|
66 | + * @var array */ |
|
67 | 67 | protected $langInputNames = array('lang', 'langCode', 'lng', 'language', 'lang_code'); |
68 | 68 | |
69 | 69 | /** Uploaded file(s) info. Linked to first $_FILES element |
70 | - * @var array */ |
|
70 | + * @var array */ |
|
71 | 71 | protected $file; |
72 | 72 | |
73 | 73 | /** Next three properties are got from the current language file |
74 | - * @var string */ |
|
74 | + * @var string */ |
|
75 | 75 | protected $dateTimeFull; // Currently not used |
76 | 76 | protected $dateTimeMid; // Currently not used |
77 | 77 | protected $dateTimeSmall; |
78 | 78 | |
79 | 79 | /** Contain Specified language labels |
80 | - * @var array */ |
|
80 | + * @var array */ |
|
81 | 81 | protected $labels = array(); |
82 | 82 | |
83 | 83 | /** Contain unprocessed $_GET array. Please use this instead of $_GET |
84 | - * @var array */ |
|
84 | + * @var array */ |
|
85 | 85 | protected $get; |
86 | 86 | |
87 | 87 | /** Contain unprocessed $_POST array. Please use this instead of $_POST |
88 | - * @var array */ |
|
88 | + * @var array */ |
|
89 | 89 | protected $post; |
90 | 90 | |
91 | 91 | /** Contain unprocessed $_COOKIE array. Please use this instead of $_COOKIE |
92 | - * @var array */ |
|
92 | + * @var array */ |
|
93 | 93 | protected $cookie; |
94 | 94 | |
95 | 95 | /** Session array. Please use this property instead of $_SESSION |
96 | - * @var array */ |
|
96 | + * @var array */ |
|
97 | 97 | protected $session; |
98 | 98 | |
99 | 99 | /** CMS integration attribute (got from $_GET['cms']) |
100 | - * @var string */ |
|
100 | + * @var string */ |
|
101 | 101 | protected $cms = ""; |
102 | 102 | |
103 | 103 | protected $modx = null; |
104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
105 | - * @param string $property |
|
106 | - * @return mixed */ |
|
105 | + * @param string $property |
|
106 | + * @return mixed */ |
|
107 | 107 | public function __get($property) { |
108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
109 | 109 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | ) |
133 | 133 | $this->cms = $this->get['cms']; |
134 | 134 | |
135 | - // LINKING UPLOADED FILE |
|
135 | + // LINKING UPLOADED FILE |
|
136 | 136 | if (count($_FILES)) |
137 | 137 | $this->file = &$_FILES[key($_FILES)]; |
138 | 138 | |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
229 | 229 | ? path::normalize($this->config['uploadDir']) |
230 | 230 | : path::url2fullPath("/$path"); |
231 | - $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
232 | - $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
231 | + $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
232 | + $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
233 | 233 | |
234 | 234 | // SITE ROOT |
235 | 235 | } elseif ($this->config['uploadURL'] == "/") { |
@@ -365,36 +365,36 @@ discard block |
||
365 | 365 | } |
366 | 366 | |
367 | 367 | |
368 | - protected function getTransaliasSettings() { |
|
369 | - $modx = evolutionCMS(); |
|
370 | - |
|
371 | - // Cleaning uploaded filename? |
|
372 | - $setting = $modx->db->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
373 | - if ($modx->db->getValue($setting)>0) { |
|
374 | - // Transalias plugin active? |
|
375 | - $res = $modx->db->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
376 | - if ($properties = $modx->db->getValue($res)) { |
|
377 | - $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
378 | - } else { |
|
379 | - $properties = NULL; |
|
380 | - } |
|
381 | - } else { |
|
382 | - $properties = NULL; |
|
383 | - } |
|
384 | - return $properties; |
|
385 | - } |
|
386 | - |
|
387 | - |
|
388 | - protected function normalizeFilename($filename) { |
|
389 | - if ($this->getTransaliasSettings()) { |
|
390 | - $format = strrchr($filename, "."); |
|
391 | - $filename = str_replace($format, "", $filename); |
|
392 | - $filename = $this->modx->stripAlias($filename).$format; |
|
393 | - } |
|
394 | - return $filename; |
|
395 | - } |
|
396 | - |
|
397 | - protected function normalizeDirname($dirname) { |
|
368 | + protected function getTransaliasSettings() { |
|
369 | + $modx = evolutionCMS(); |
|
370 | + |
|
371 | + // Cleaning uploaded filename? |
|
372 | + $setting = $modx->db->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
373 | + if ($modx->db->getValue($setting)>0) { |
|
374 | + // Transalias plugin active? |
|
375 | + $res = $modx->db->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
376 | + if ($properties = $modx->db->getValue($res)) { |
|
377 | + $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
378 | + } else { |
|
379 | + $properties = NULL; |
|
380 | + } |
|
381 | + } else { |
|
382 | + $properties = NULL; |
|
383 | + } |
|
384 | + return $properties; |
|
385 | + } |
|
386 | + |
|
387 | + |
|
388 | + protected function normalizeFilename($filename) { |
|
389 | + if ($this->getTransaliasSettings()) { |
|
390 | + $format = strrchr($filename, "."); |
|
391 | + $filename = str_replace($format, "", $filename); |
|
392 | + $filename = $this->modx->stripAlias($filename).$format; |
|
393 | + } |
|
394 | + return $filename; |
|
395 | + } |
|
396 | + |
|
397 | + protected function normalizeDirname($dirname) { |
|
398 | 398 | return $this->modx->stripAlias($dirname); |
399 | 399 | } |
400 | 400 | |
@@ -472,10 +472,10 @@ discard block |
||
472 | 472 | return $this->label("The image is too big and/or cannot be resized."); |
473 | 473 | |
474 | 474 | |
475 | - // CHECK FOR MODX MAX FILE SIZE |
|
476 | - $actualfilesize=filesize($file['tmp_name']); |
|
477 | - if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
478 | - return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
475 | + // CHECK FOR MODX MAX FILE SIZE |
|
476 | + $actualfilesize=filesize($file['tmp_name']); |
|
477 | + if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
478 | + return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
479 | 479 | |
480 | 480 | return true; |
481 | 481 | } |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | $top = isset($this->config['watermark']['top']) |
628 | 628 | ? $this->config['watermark']['top'] : false; |
629 | 629 | $img->watermark($this->config['watermark']['file'], $left, $top); |
630 | - } |
|
630 | + } |
|
631 | 631 | |
632 | 632 | $options = array( 'file' => $file ); |
633 | 633 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class uploader { |
|
15 | +class uploader{ |
|
16 | 16 | |
17 | 17 | /** Release version */ |
18 | 18 | const VERSION = "2.54"; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | |
73 | 73 | /** Next three properties are got from the current language file |
74 | 74 | * @var string */ |
75 | - protected $dateTimeFull; // Currently not used |
|
76 | - protected $dateTimeMid; // Currently not used |
|
75 | + protected $dateTimeFull; // Currently not used |
|
76 | + protected $dateTimeMid; // Currently not used |
|
77 | 77 | protected $dateTimeSmall; |
78 | 78 | |
79 | 79 | /** Contain Specified language labels |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
105 | 105 | * @param string $property |
106 | 106 | * @return mixed */ |
107 | - public function __get($property) { |
|
107 | + public function __get($property){ |
|
108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
109 | 109 | } |
110 | 110 | |
111 | - public function __construct($modx) { |
|
111 | + public function __construct($modx){ |
|
112 | 112 | |
113 | 113 | //MODX |
114 | 114 | try { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | // COOKIES INIT |
208 | 208 | $ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'; |
209 | - $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/'; |
|
209 | + $ip = '/^'.implode('\.', array($ip, $ip, $ip, $ip)).'$/'; |
|
210 | 210 | if (preg_match($ip, $_SERVER['HTTP_HOST']) || |
211 | 211 | preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST']) |
212 | 212 | ) |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | ) { |
225 | 225 | list($unused, $protocol, $domain, $unused, $port, $path) = $patt; |
226 | 226 | $path = path::normalize($path); |
227 | - $this->config['uploadURL'] = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/$path"; |
|
227 | + $this->config['uploadURL'] = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/$path"; |
|
228 | 228 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
229 | 229 | ? path::normalize($this->config['uploadDir']) |
230 | 230 | : path::url2fullPath("/$path"); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | foreach ($this->langInputNames as $key) |
268 | 268 | if (isset($this->get[$key]) && |
269 | 269 | preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) && |
270 | - file_exists("lang/" . strtolower($this->get[$key]) . ".php") |
|
270 | + file_exists("lang/".strtolower($this->get[$key]).".php") |
|
271 | 271 | ) { |
272 | 272 | $this->lang = $this->get[$key]; |
273 | 273 | break; |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $this->backMsg("Cannot read upload folder."); |
299 | 299 | } |
300 | 300 | |
301 | - public function upload() { |
|
301 | + public function upload(){ |
|
302 | 302 | $config = &$this->config; |
303 | 303 | $file = &$this->file; |
304 | 304 | $url = $message = ""; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | @mkdir(path::normalize($dir), $this->config['dirPerms'], true); |
330 | 330 | |
331 | 331 | $filename = $this->normalizeFilename($file['name']); |
332 | - $target = file::getInexistantFilename($dir . $filename); |
|
332 | + $target = file::getInexistantFilename($dir.$filename); |
|
333 | 333 | |
334 | 334 | if (!@move_uploaded_file($file['tmp_name'], $target) && |
335 | 335 | !@rename($file['tmp_name'], $target) && |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | $this->makeThumb($target); |
343 | 343 | $url = $this->typeURL; |
344 | 344 | if (isset($udir)) $url .= "/$udir"; |
345 | - $url .= "/" . basename($target); |
|
345 | + $url .= "/".basename($target); |
|
346 | 346 | if (preg_match('/^([a-z]+)\:\/\/([^\/^\:]+)(\:(\d+))?\/(.+)$/', $url, $patt)) { |
347 | 347 | list($unused, $protocol, $domain, $unused, $port, $path) = $patt; |
348 | - $base = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/"; |
|
349 | - $url = $base . path::urlPathEncode($path); |
|
348 | + $base = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/"; |
|
349 | + $url = $base.path::urlPathEncode($path); |
|
350 | 350 | } else |
351 | 351 | $url = path::urlPathEncode($url); |
352 | 352 | } |
@@ -365,12 +365,12 @@ discard block |
||
365 | 365 | } |
366 | 366 | |
367 | 367 | |
368 | - protected function getTransaliasSettings() { |
|
368 | + protected function getTransaliasSettings(){ |
|
369 | 369 | $modx = evolutionCMS(); |
370 | 370 | |
371 | 371 | // Cleaning uploaded filename? |
372 | 372 | $setting = $modx->db->select('count(*)', $modx->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
373 | - if ($modx->db->getValue($setting)>0) { |
|
373 | + if ($modx->db->getValue($setting) > 0) { |
|
374 | 374 | // Transalias plugin active? |
375 | 375 | $res = $modx->db->select('properties', $modx->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
376 | 376 | if ($properties = $modx->db->getValue($res)) { |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | |
388 | - protected function normalizeFilename($filename) { |
|
388 | + protected function normalizeFilename($filename){ |
|
389 | 389 | if ($this->getTransaliasSettings()) { |
390 | 390 | $format = strrchr($filename, "."); |
391 | 391 | $filename = str_replace($format, "", $filename); |
@@ -394,11 +394,11 @@ discard block |
||
394 | 394 | return $filename; |
395 | 395 | } |
396 | 396 | |
397 | - protected function normalizeDirname($dirname) { |
|
397 | + protected function normalizeDirname($dirname){ |
|
398 | 398 | return $this->modx->stripAlias($dirname); |
399 | 399 | } |
400 | 400 | |
401 | - protected function checkUploadedFile(array $aFile=null) { |
|
401 | + protected function checkUploadedFile(array $aFile = null){ |
|
402 | 402 | $config = &$this->config; |
403 | 403 | $file = ($aFile === null) ? $this->file : $aFile; |
404 | 404 | |
@@ -437,8 +437,7 @@ discard block |
||
437 | 437 | ($file['error'] == UPLOAD_ERR_NO_TMP_DIR) ? |
438 | 438 | $this->label("Missing a temporary folder.") : ( |
439 | 439 | ($file['error'] == UPLOAD_ERR_CANT_WRITE) ? |
440 | - $this->label("Failed to write file.") : |
|
441 | - $this->label("Unknown error.") |
|
440 | + $this->label("Failed to write file.") : $this->label("Unknown error.") |
|
442 | 441 | ))))); |
443 | 442 | |
444 | 443 | // HIDDEN FILENAMES CHECK |
@@ -473,14 +472,14 @@ discard block |
||
473 | 472 | |
474 | 473 | |
475 | 474 | // CHECK FOR MODX MAX FILE SIZE |
476 | - $actualfilesize=filesize($file['tmp_name']); |
|
475 | + $actualfilesize = filesize($file['tmp_name']); |
|
477 | 476 | if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
478 | 477 | return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
479 | 478 | |
480 | 479 | return true; |
481 | 480 | } |
482 | 481 | |
483 | - protected function checkInputDir($dir, $inclType=true, $existing=true) { |
|
482 | + protected function checkInputDir($dir, $inclType = true, $existing = true){ |
|
484 | 483 | $dir = path::normalize($dir); |
485 | 484 | if (substr($dir, 0, 1) == "/") |
486 | 485 | $dir = substr($dir, 1); |
@@ -506,7 +505,7 @@ discard block |
||
506 | 505 | return (is_dir($path) && is_readable($path)) ? $return : false; |
507 | 506 | } |
508 | 507 | |
509 | - protected function validateExtension($ext, $type) { |
|
508 | + protected function validateExtension($ext, $type){ |
|
510 | 509 | $ext = trim(strtolower($ext)); |
511 | 510 | if (!isset($this->types[$type])) |
512 | 511 | return false; |
@@ -531,17 +530,17 @@ discard block |
||
531 | 530 | return in_array($ext, $exts); |
532 | 531 | } |
533 | 532 | |
534 | - protected function getTypeFromPath($path) { |
|
533 | + protected function getTypeFromPath($path){ |
|
535 | 534 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
536 | 535 | ? $patt[1] : $path; |
537 | 536 | } |
538 | 537 | |
539 | - protected function removeTypeFromPath($path) { |
|
538 | + protected function removeTypeFromPath($path){ |
|
540 | 539 | return preg_match('/^[^\/]*\/(.*)$/', $path, $patt) |
541 | 540 | ? $patt[1] : ""; |
542 | 541 | } |
543 | 542 | |
544 | - protected function imageResize($image, $file=null) { |
|
543 | + protected function imageResize($image, $file = null){ |
|
545 | 544 | |
546 | 545 | if (!($image instanceof image)) { |
547 | 546 | $img = image::factory($this->imageDriver, $image); |
@@ -629,24 +628,24 @@ discard block |
||
629 | 628 | $img->watermark($this->config['watermark']['file'], $left, $top); |
630 | 629 | } |
631 | 630 | |
632 | - $options = array( 'file' => $file ); |
|
631 | + $options = array('file' => $file); |
|
633 | 632 | |
634 | - $type = exif_imagetype( $file ); |
|
633 | + $type = exif_imagetype($file); |
|
635 | 634 | |
636 | - switch ( $type ) { |
|
635 | + switch ($type) { |
|
637 | 636 | case IMAGETYPE_GIF: |
638 | - return $img->output( 'gif', $options ); |
|
637 | + return $img->output('gif', $options); |
|
639 | 638 | |
640 | 639 | case IMAGETYPE_PNG: |
641 | - return $img->output( 'png', $options ); |
|
640 | + return $img->output('png', $options); |
|
642 | 641 | |
643 | 642 | default: |
644 | - return $img->output( 'jpeg', array_merge( $options, array( 'quality' => $this->config['jpegQuality'] ) ) ); |
|
643 | + return $img->output('jpeg', array_merge($options, array('quality' => $this->config['jpegQuality']))); |
|
645 | 644 | } |
646 | 645 | |
647 | 646 | } |
648 | 647 | |
649 | - protected function makeThumb($file, $overwrite=true) { |
|
648 | + protected function makeThumb($file, $overwrite = true){ |
|
650 | 649 | $img = image::factory($this->imageDriver, $file); |
651 | 650 | |
652 | 651 | // Drop files which are not images |
@@ -654,7 +653,7 @@ discard block |
||
654 | 653 | return true; |
655 | 654 | |
656 | 655 | $thumb = substr($file, strlen($this->config['uploadDir'])); |
657 | - $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb; |
|
656 | + $thumb = $this->config['uploadDir']."/".$this->config['thumbsDir']."/".$thumb; |
|
658 | 657 | $thumb = path::normalize($thumb); |
659 | 658 | $thumbDir = dirname($thumb); |
660 | 659 | if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) |
@@ -677,15 +676,15 @@ discard block |
||
677 | 676 | if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) |
678 | 677 | return false; |
679 | 678 | |
680 | - if ( $this->imageDriver == 'gd' ) { |
|
681 | - $width = imagesx( $img->image ); |
|
682 | - $height = imagesy( $img->image ); |
|
683 | - $back = image::factory( $this->imageDriver, array( $width, $height ) ); |
|
684 | - $tile = image::factory( $this->imageDriver, __DIR__ . '/../themes/' . $this->config['theme'] . '/img/bg_transparent.png' ); |
|
679 | + if ($this->imageDriver == 'gd') { |
|
680 | + $width = imagesx($img->image); |
|
681 | + $height = imagesy($img->image); |
|
682 | + $back = image::factory($this->imageDriver, array($width, $height)); |
|
683 | + $tile = image::factory($this->imageDriver, __DIR__.'/../themes/'.$this->config['theme'].'/img/bg_transparent.png'); |
|
685 | 684 | |
686 | - imagesettile( $back->image, $tile->image ); |
|
687 | - imagefilledrectangle( $back->image, 0, 0, $width, $height, IMG_COLOR_TILED ); |
|
688 | - imagecopy( $back->image, $img->image, 0, 0, 0, 0, $width, $height ); |
|
685 | + imagesettile($back->image, $tile->image); |
|
686 | + imagefilledrectangle($back->image, 0, 0, $width, $height, IMG_COLOR_TILED); |
|
687 | + imagecopy($back->image, $img->image, 0, 0, 0, 0, $width, $height); |
|
689 | 688 | |
690 | 689 | $img = $back; |
691 | 690 | } |
@@ -697,7 +696,7 @@ discard block |
||
697 | 696 | )); |
698 | 697 | } |
699 | 698 | |
700 | - protected function localize($langCode) { |
|
699 | + protected function localize($langCode){ |
|
701 | 700 | require "lang/{$langCode}.php"; |
702 | 701 | setlocale(LC_ALL, $lang['_locale']); |
703 | 702 | $this->charset = $lang['_charset']; |
@@ -712,7 +711,7 @@ discard block |
||
712 | 711 | $this->labels = $lang; |
713 | 712 | } |
714 | 713 | |
715 | - protected function label($string, array $data=null) { |
|
714 | + protected function label($string, array $data = null){ |
|
716 | 715 | $return = isset($this->labels[$string]) ? $this->labels[$string] : $string; |
717 | 716 | if (is_array($data)) |
718 | 717 | foreach ($data as $key => $val) |
@@ -720,7 +719,7 @@ discard block |
||
720 | 719 | return $return; |
721 | 720 | } |
722 | 721 | |
723 | - protected function backMsg($message, array $data=null) { |
|
722 | + protected function backMsg($message, array $data = null){ |
|
724 | 723 | $message = $this->label($message, $data); |
725 | 724 | if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) |
726 | 725 | @unlink($this->file['tmp_name']); |
@@ -728,7 +727,7 @@ discard block |
||
728 | 727 | die; |
729 | 728 | } |
730 | 729 | |
731 | - protected function callBack($url, $message="") { |
|
730 | + protected function callBack($url, $message = ""){ |
|
732 | 731 | $message = text::jsValue($message); |
733 | 732 | $CKfuncNum = isset($this->opener['CKEditor']['funcNum']) |
734 | 733 | ? $this->opener['CKEditor']['funcNum'] : 0; |
@@ -769,7 +768,7 @@ discard block |
||
769 | 768 | |
770 | 769 | } |
771 | 770 | |
772 | - protected function get_htaccess() { |
|
771 | + protected function get_htaccess(){ |
|
773 | 772 | return "<IfModule mod_php4.c> |
774 | 773 | php_value engine off |
775 | 774 | </IfModule> |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class uploader { |
|
15 | +class uploader |
|
16 | +{ |
|
16 | 17 | |
17 | 18 | /** Release version */ |
18 | 19 | const VERSION = "2.54"; |
@@ -104,17 +105,21 @@ discard block |
||
104 | 105 | /** Magic method which allows read-only access to protected or private class properties |
105 | 106 | * @param string $property |
106 | 107 | * @return mixed */ |
107 | - public function __get($property) { |
|
108 | + public function __get($property) |
|
109 | + { |
|
108 | 110 | return property_exists($this, $property) ? $this->$property : null; |
109 | 111 | } |
110 | 112 | |
111 | - public function __construct($modx) { |
|
113 | + public function __construct($modx) |
|
114 | + { |
|
112 | 115 | |
113 | 116 | //MODX |
114 | 117 | try { |
115 | 118 | if ($modx instanceof DocumentParser) { |
116 | 119 | $this->modx = $modx; |
117 | - } else throw new Exception('MODX should be instance of DocumentParser'); |
|
120 | + } else { |
|
121 | + throw new Exception('MODX should be instance of DocumentParser'); |
|
122 | + } |
|
118 | 123 | } catch (Exception $e) { |
119 | 124 | die($e->getMessage()); |
120 | 125 | } |
@@ -129,26 +134,34 @@ discard block |
||
129 | 134 | // SET CMS INTEGRATION ATTRIBUTE |
130 | 135 | if (isset($this->get['cms']) && |
131 | 136 | in_array($this->get['cms'], array("drupal")) |
132 | - ) |
|
133 | - $this->cms = $this->get['cms']; |
|
137 | + ) { |
|
138 | + $this->cms = $this->get['cms']; |
|
139 | + } |
|
134 | 140 | |
135 | 141 | // LINKING UPLOADED FILE |
136 | - if (count($_FILES)) |
|
137 | - $this->file = &$_FILES[key($_FILES)]; |
|
142 | + if (count($_FILES)) { |
|
143 | + $this->file = &$_FILES[key($_FILES)]; |
|
144 | + } |
|
138 | 145 | |
139 | 146 | // LOAD DEFAULT CONFIGURATION |
140 | 147 | require "config.php"; |
141 | 148 | |
142 | 149 | // SETTING UP SESSION |
143 | - if (isset($_CONFIG['_sessionLifetime'])) |
|
144 | - ini_set('session.gc_maxlifetime', $_CONFIG['_sessionLifetime'] * 60); |
|
145 | - if (isset($_CONFIG['_sessionDir'])) |
|
146 | - ini_set('session.save_path', $_CONFIG['_sessionDir']); |
|
147 | - if (isset($_CONFIG['_sessionDomain'])) |
|
148 | - ini_set('session.cookie_domain', $_CONFIG['_sessionDomain']); |
|
150 | + if (isset($_CONFIG['_sessionLifetime'])) { |
|
151 | + ini_set('session.gc_maxlifetime', $_CONFIG['_sessionLifetime'] * 60); |
|
152 | + } |
|
153 | + if (isset($_CONFIG['_sessionDir'])) { |
|
154 | + ini_set('session.save_path', $_CONFIG['_sessionDir']); |
|
155 | + } |
|
156 | + if (isset($_CONFIG['_sessionDomain'])) { |
|
157 | + ini_set('session.cookie_domain', $_CONFIG['_sessionDomain']); |
|
158 | + } |
|
149 | 159 | switch ($this->cms) { |
150 | 160 | case "drupal": break; |
151 | - default: if (!session_id()) session_start(); break; |
|
161 | + default: if (!session_id()) { |
|
162 | + session_start(); |
|
163 | + } |
|
164 | + break; |
|
152 | 165 | } |
153 | 166 | |
154 | 167 | // RELOAD DEFAULT CONFIGURATION |
@@ -159,31 +172,37 @@ discard block |
||
159 | 172 | if (isset($_CONFIG['_sessionVar']) && |
160 | 173 | is_array($_CONFIG['_sessionVar']) |
161 | 174 | ) { |
162 | - foreach ($_CONFIG['_sessionVar'] as $key => $val) |
|
163 | - if ((substr($key, 0, 1) != "_") && isset($_CONFIG[$key])) |
|
175 | + foreach ($_CONFIG['_sessionVar'] as $key => $val) { |
|
176 | + if ((substr($key, 0, 1) != "_") && isset($_CONFIG[$key])) |
|
164 | 177 | $this->config[$key] = $val; |
165 | - if (!isset($this->config['_sessionVar']['self'])) |
|
166 | - $this->config['_sessionVar']['self'] = array(); |
|
178 | + } |
|
179 | + if (!isset($this->config['_sessionVar']['self'])) { |
|
180 | + $this->config['_sessionVar']['self'] = array(); |
|
181 | + } |
|
167 | 182 | $this->session = &$this->config['_sessionVar']['self']; |
168 | - } else |
|
169 | - $this->session = &$_SESSION; |
|
183 | + } else { |
|
184 | + $this->session = &$_SESSION; |
|
185 | + } |
|
170 | 186 | |
171 | 187 | // IMAGE DRIVER INIT |
172 | 188 | if (isset($this->config['imageDriversPriority'])) { |
173 | 189 | $this->config['imageDriversPriority'] = |
174 | 190 | text::clearWhitespaces($this->config['imageDriversPriority']); |
175 | 191 | $driver = image::getDriver(explode(' ', $this->config['imageDriversPriority'])); |
176 | - if ($driver !== false) |
|
177 | - $this->imageDriver = $driver; |
|
192 | + if ($driver !== false) { |
|
193 | + $this->imageDriver = $driver; |
|
194 | + } |
|
178 | 195 | } |
179 | 196 | if ((!isset($driver) || ($driver === false)) && |
180 | 197 | (image::getDriver(array($this->imageDriver)) === false) |
181 | - ) |
|
182 | - die("Cannot find any of the supported PHP image extensions!"); |
|
198 | + ) { |
|
199 | + die("Cannot find any of the supported PHP image extensions!"); |
|
200 | + } |
|
183 | 201 | |
184 | 202 | // WATERMARK INIT |
185 | - if (isset($this->config['watermark']) && is_string($this->config['watermark'])) |
|
186 | - $this->config['watermark'] = array('file' => $this->config['watermark']); |
|
203 | + if (isset($this->config['watermark']) && is_string($this->config['watermark'])) { |
|
204 | + $this->config['watermark'] = array('file' => $this->config['watermark']); |
|
205 | + } |
|
187 | 206 | |
188 | 207 | // GET TYPE DIRECTORY |
189 | 208 | $this->types = &$this->config['types']; |
@@ -197,9 +216,10 @@ discard block |
||
197 | 216 | |
198 | 217 | // LOAD TYPE DIRECTORY SPECIFIC CONFIGURATION IF EXISTS |
199 | 218 | if (is_array($this->types[$this->type])) { |
200 | - foreach ($this->types[$this->type] as $key => $val) |
|
201 | - if (in_array($key, $this->typeSettings)) |
|
219 | + foreach ($this->types[$this->type] as $key => $val) { |
|
220 | + if (in_array($key, $this->typeSettings)) |
|
202 | 221 | $this->config[$key] = $val; |
222 | + } |
|
203 | 223 | $this->types[$this->type] = isset($this->types[$this->type]['type']) |
204 | 224 | ? $this->types[$this->type]['type'] : ""; |
205 | 225 | } |
@@ -209,12 +229,14 @@ discard block |
||
209 | 229 | $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/'; |
210 | 230 | if (preg_match($ip, $_SERVER['HTTP_HOST']) || |
211 | 231 | preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST']) |
212 | - ) |
|
213 | - $this->config['cookieDomain'] = ""; |
|
214 | - elseif (!strlen($this->config['cookieDomain'])) |
|
215 | - $this->config['cookieDomain'] = $_SERVER['HTTP_HOST']; |
|
216 | - if (!strlen($this->config['cookiePath'])) |
|
217 | - $this->config['cookiePath'] = "/"; |
|
232 | + ) { |
|
233 | + $this->config['cookieDomain'] = ""; |
|
234 | + } elseif (!strlen($this->config['cookieDomain'])) { |
|
235 | + $this->config['cookieDomain'] = $_SERVER['HTTP_HOST']; |
|
236 | + } |
|
237 | + if (!strlen($this->config['cookiePath'])) { |
|
238 | + $this->config['cookiePath'] = "/"; |
|
239 | + } |
|
218 | 240 | |
219 | 241 | // UPLOAD FOLDER INIT |
220 | 242 | |
@@ -250,26 +272,30 @@ discard block |
||
250 | 272 | $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
251 | 273 | $this->typeURL = "{$this->config['uploadURL']}/{$this->type}"; |
252 | 274 | } |
253 | - if (!is_dir($this->config['uploadDir'])) |
|
254 | - @mkdir($this->config['uploadDir'], $this->config['dirPerms']); |
|
275 | + if (!is_dir($this->config['uploadDir'])) { |
|
276 | + @mkdir($this->config['uploadDir'], $this->config['dirPerms']); |
|
277 | + } |
|
255 | 278 | |
256 | 279 | // HOST APPLICATIONS INIT |
257 | - if (isset($this->get['CKEditorFuncNum'])) |
|
258 | - $this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum']; |
|
280 | + if (isset($this->get['CKEditorFuncNum'])) { |
|
281 | + $this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum']; |
|
282 | + } |
|
259 | 283 | if (isset($this->get['opener']) && |
260 | 284 | (strtolower($this->get['opener']) == "tinymce") && |
261 | 285 | isset($this->config['_tinyMCEPath']) && |
262 | 286 | strlen($this->config['_tinyMCEPath']) |
263 | - ) |
|
264 | - $this->opener['TinyMCE'] = true; |
|
287 | + ) { |
|
288 | + $this->opener['TinyMCE'] = true; |
|
289 | + } |
|
265 | 290 | |
266 | 291 | // LOCALIZATION |
267 | - foreach ($this->langInputNames as $key) |
|
268 | - if (isset($this->get[$key]) && |
|
292 | + foreach ($this->langInputNames as $key) { |
|
293 | + if (isset($this->get[$key]) && |
|
269 | 294 | preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) && |
270 | 295 | file_exists("lang/" . strtolower($this->get[$key]) . ".php") |
271 | 296 | ) { |
272 | 297 | $this->lang = $this->get[$key]; |
298 | + } |
|
273 | 299 | break; |
274 | 300 | } |
275 | 301 | $this->localize($this->lang); |
@@ -280,31 +306,39 @@ discard block |
||
280 | 306 | ) { |
281 | 307 | $htaccess = "{$this->config['uploadDir']}/.htaccess"; |
282 | 308 | if (!file_exists($htaccess)) { |
283 | - if (!@file_put_contents($htaccess, $this->get_htaccess())) |
|
284 | - $this->backMsg("Cannot write to upload folder. {$this->config['uploadDir']}"); |
|
309 | + if (!@file_put_contents($htaccess, $this->get_htaccess())) { |
|
310 | + $this->backMsg("Cannot write to upload folder. {$this->config['uploadDir']}"); |
|
311 | + } |
|
285 | 312 | } else { |
286 | - if (false === ($data = @file_get_contents($htaccess))) |
|
287 | - $this->backMsg("Cannot read .htaccess"); |
|
288 | - if (($data != $this->get_htaccess()) && !@file_put_contents($htaccess, $data)) |
|
289 | - $this->backMsg("Incorrect .htaccess file. Cannot rewrite it!"); |
|
313 | + if (false === ($data = @file_get_contents($htaccess))) { |
|
314 | + $this->backMsg("Cannot read .htaccess"); |
|
315 | + } |
|
316 | + if (($data != $this->get_htaccess()) && !@file_put_contents($htaccess, $data)) { |
|
317 | + $this->backMsg("Incorrect .htaccess file. Cannot rewrite it!"); |
|
318 | + } |
|
290 | 319 | } |
291 | 320 | } |
292 | 321 | |
293 | 322 | // CHECK & CREATE UPLOAD FOLDER |
294 | 323 | if (!is_dir($this->typeDir)) { |
295 | - if (!mkdir($this->typeDir, $this->config['dirPerms'])) |
|
296 | - $this->backMsg("Cannot create {dir} folder.", array('dir' => $this->type)); |
|
297 | - } elseif (!is_readable($this->typeDir)) |
|
298 | - $this->backMsg("Cannot read upload folder."); |
|
324 | + if (!mkdir($this->typeDir, $this->config['dirPerms'])) { |
|
325 | + $this->backMsg("Cannot create {dir} folder.", array('dir' => $this->type)); |
|
326 | + } |
|
327 | + } elseif (!is_readable($this->typeDir)) { |
|
328 | + $this->backMsg("Cannot read upload folder."); |
|
329 | + } |
|
299 | 330 | } |
300 | 331 | |
301 | - public function upload() { |
|
332 | + public function upload() |
|
333 | + { |
|
302 | 334 | $config = &$this->config; |
303 | 335 | $file = &$this->file; |
304 | 336 | $url = $message = ""; |
305 | 337 | |
306 | 338 | if ($config['disabled'] || !$config['access']['files']['upload']) { |
307 | - if (isset($file['tmp_name'])) @unlink($file['tmp_name']); |
|
339 | + if (isset($file['tmp_name'])) { |
|
340 | + @unlink($file['tmp_name']); |
|
341 | + } |
|
308 | 342 | $message = $this->label("You don't have permissions to upload files."); |
309 | 343 | |
310 | 344 | } elseif (true === ($message = $this->checkUploadedFile())) { |
@@ -315,9 +349,9 @@ discard block |
||
315 | 349 | (false !== ($gdir = $this->checkInputDir($this->get['dir']))) |
316 | 350 | ) { |
317 | 351 | $udir = path::normalize("$dir$gdir"); |
318 | - if (substr($udir, 0, strlen($dir)) !== $dir) |
|
319 | - $message = $this->label("Unknown error."); |
|
320 | - else { |
|
352 | + if (substr($udir, 0, strlen($dir)) !== $dir) { |
|
353 | + $message = $this->label("Unknown error."); |
|
354 | + } else { |
|
321 | 355 | $l = strlen($dir); |
322 | 356 | $dir = "$udir/"; |
323 | 357 | $udir = substr($udir, $l); |
@@ -325,8 +359,9 @@ discard block |
||
325 | 359 | } |
326 | 360 | |
327 | 361 | if (!strlen($message)) { |
328 | - if (!is_dir(path::normalize($dir))) |
|
329 | - @mkdir(path::normalize($dir), $this->config['dirPerms'], true); |
|
362 | + if (!is_dir(path::normalize($dir))) { |
|
363 | + @mkdir(path::normalize($dir), $this->config['dirPerms'], true); |
|
364 | + } |
|
330 | 365 | |
331 | 366 | $filename = $this->normalizeFilename($file['name']); |
332 | 367 | $target = file::getInexistantFilename($dir . $filename); |
@@ -334,21 +369,25 @@ discard block |
||
334 | 369 | if (!@move_uploaded_file($file['tmp_name'], $target) && |
335 | 370 | !@rename($file['tmp_name'], $target) && |
336 | 371 | !@copy($file['tmp_name'], $target) |
337 | - ) |
|
338 | - $message = $this->label("Cannot move uploaded file to target folder."); |
|
339 | - else { |
|
340 | - if (function_exists('chmod')) |
|
341 | - @chmod($target, $this->config['filePerms']); |
|
372 | + ) { |
|
373 | + $message = $this->label("Cannot move uploaded file to target folder."); |
|
374 | + } else { |
|
375 | + if (function_exists('chmod')) { |
|
376 | + @chmod($target, $this->config['filePerms']); |
|
377 | + } |
|
342 | 378 | $this->makeThumb($target); |
343 | 379 | $url = $this->typeURL; |
344 | - if (isset($udir)) $url .= "/$udir"; |
|
380 | + if (isset($udir)) { |
|
381 | + $url .= "/$udir"; |
|
382 | + } |
|
345 | 383 | $url .= "/" . basename($target); |
346 | 384 | if (preg_match('/^([a-z]+)\:\/\/([^\/^\:]+)(\:(\d+))?\/(.+)$/', $url, $patt)) { |
347 | 385 | list($unused, $protocol, $domain, $unused, $port, $path) = $patt; |
348 | 386 | $base = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/"; |
349 | 387 | $url = $base . path::urlPathEncode($path); |
350 | - } else |
|
351 | - $url = path::urlPathEncode($url); |
|
388 | + } else { |
|
389 | + $url = path::urlPathEncode($url); |
|
390 | + } |
|
352 | 391 | } |
353 | 392 | } |
354 | 393 | } |
@@ -356,16 +395,19 @@ discard block |
||
356 | 395 | if (strlen($message) && |
357 | 396 | isset($this->file['tmp_name']) && |
358 | 397 | file_exists($this->file['tmp_name']) |
359 | - ) |
|
360 | - @unlink($this->file['tmp_name']); |
|
398 | + ) { |
|
399 | + @unlink($this->file['tmp_name']); |
|
400 | + } |
|
361 | 401 | |
362 | - if (strlen($message) && method_exists($this, 'errorMsg')) |
|
363 | - $this->errorMsg($message); |
|
402 | + if (strlen($message) && method_exists($this, 'errorMsg')) { |
|
403 | + $this->errorMsg($message); |
|
404 | + } |
|
364 | 405 | $this->callBack($url, $message); |
365 | 406 | } |
366 | 407 | |
367 | 408 | |
368 | - protected function getTransaliasSettings() { |
|
409 | + protected function getTransaliasSettings() |
|
410 | + { |
|
369 | 411 | $modx = evolutionCMS(); |
370 | 412 | |
371 | 413 | // Cleaning uploaded filename? |
@@ -385,7 +427,8 @@ discard block |
||
385 | 427 | } |
386 | 428 | |
387 | 429 | |
388 | - protected function normalizeFilename($filename) { |
|
430 | + protected function normalizeFilename($filename) |
|
431 | + { |
|
389 | 432 | if ($this->getTransaliasSettings()) { |
390 | 433 | $format = strrchr($filename, "."); |
391 | 434 | $filename = str_replace($format, "", $filename); |
@@ -394,16 +437,19 @@ discard block |
||
394 | 437 | return $filename; |
395 | 438 | } |
396 | 439 | |
397 | - protected function normalizeDirname($dirname) { |
|
440 | + protected function normalizeDirname($dirname) |
|
441 | + { |
|
398 | 442 | return $this->modx->stripAlias($dirname); |
399 | 443 | } |
400 | 444 | |
401 | - protected function checkUploadedFile(array $aFile=null) { |
|
445 | + protected function checkUploadedFile(array $aFile=null) |
|
446 | + { |
|
402 | 447 | $config = &$this->config; |
403 | 448 | $file = ($aFile === null) ? $this->file : $aFile; |
404 | 449 | |
405 | - if (!is_array($file) || !isset($file['name'])) |
|
406 | - return $this->label("Unknown error"); |
|
450 | + if (!is_array($file) || !isset($file['name'])) { |
|
451 | + return $this->label("Unknown error"); |
|
452 | + } |
|
407 | 453 | |
408 | 454 | if (is_array($file['name'])) { |
409 | 455 | foreach ($file['name'] as $i => $name) { |
@@ -412,8 +458,9 @@ discard block |
||
412 | 458 | 'tmp_name' => $file['tmp_name'][$i], |
413 | 459 | 'error' => $file['error'][$i] |
414 | 460 | )); |
415 | - if ($return !== true) |
|
416 | - return "$name: $return"; |
|
461 | + if ($return !== true) { |
|
462 | + return "$name: $return"; |
|
463 | + } |
|
417 | 464 | } |
418 | 465 | return true; |
419 | 466 | } |
@@ -422,8 +469,8 @@ discard block |
||
422 | 469 | $typePatt = strtolower(text::clearWhitespaces($this->types[$this->type])); |
423 | 470 | |
424 | 471 | // CHECK FOR UPLOAD ERRORS |
425 | - if ($file['error']) |
|
426 | - return |
|
472 | + if ($file['error']) { |
|
473 | + return |
|
427 | 474 | ($file['error'] == UPLOAD_ERR_INI_SIZE) ? |
428 | 475 | $this->label("The uploaded file exceeds {size} bytes.", |
429 | 476 | array('size' => ini_get('upload_max_filesize'))) : ( |
@@ -440,14 +487,17 @@ discard block |
||
440 | 487 | $this->label("Failed to write file.") : |
441 | 488 | $this->label("Unknown error.") |
442 | 489 | ))))); |
490 | + } |
|
443 | 491 | |
444 | 492 | // HIDDEN FILENAMES CHECK |
445 | - elseif (substr($file['name'], 0, 1) == ".") |
|
446 | - return $this->label("File name shouldn't begins with '.'"); |
|
493 | + elseif (substr($file['name'], 0, 1) == ".") { |
|
494 | + return $this->label("File name shouldn't begins with '.'"); |
|
495 | + } |
|
447 | 496 | |
448 | 497 | // EXTENSION CHECK |
449 | - elseif (!$this->validateExtension($extension, $this->type)) |
|
450 | - return $this->label("Denied file extension."); |
|
498 | + elseif (!$this->validateExtension($extension, $this->type)) { |
|
499 | + return $this->label("Denied file extension."); |
|
500 | + } |
|
451 | 501 | |
452 | 502 | // SPECIAL DIRECTORY TYPES CHECK (e.g. *img) |
453 | 503 | elseif (preg_match('/^\*([^ ]+)(.*)?$/s', $typePatt, $patt)) { |
@@ -457,70 +507,84 @@ discard block |
||
457 | 507 | $type = new $class(); |
458 | 508 | $cfg = $config; |
459 | 509 | $cfg['filename'] = $file['name']; |
460 | - if (strlen($params)) |
|
461 | - $cfg['params'] = trim($params); |
|
510 | + if (strlen($params)) { |
|
511 | + $cfg['params'] = trim($params); |
|
512 | + } |
|
462 | 513 | $response = $type->checkFile($file['tmp_name'], $cfg); |
463 | - if ($response !== true) |
|
464 | - return $this->label($response); |
|
465 | - } else |
|
466 | - return $this->label("Non-existing directory type."); |
|
514 | + if ($response !== true) { |
|
515 | + return $this->label($response); |
|
516 | + } |
|
517 | + } else { |
|
518 | + return $this->label("Non-existing directory type."); |
|
519 | + } |
|
467 | 520 | } |
468 | 521 | |
469 | 522 | // IMAGE RESIZE |
470 | 523 | $img = image::factory($this->imageDriver, $file['tmp_name']); |
471 | - if (!$img->initError && !$this->imageResize($img, $file['tmp_name'])) |
|
472 | - return $this->label("The image is too big and/or cannot be resized."); |
|
524 | + if (!$img->initError && !$this->imageResize($img, $file['tmp_name'])) { |
|
525 | + return $this->label("The image is too big and/or cannot be resized."); |
|
526 | + } |
|
473 | 527 | |
474 | 528 | |
475 | 529 | // CHECK FOR MODX MAX FILE SIZE |
476 | 530 | $actualfilesize=filesize($file['tmp_name']); |
477 | - if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
478 | - return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
531 | + if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) { |
|
532 | + return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
533 | + } |
|
479 | 534 | |
480 | 535 | return true; |
481 | 536 | } |
482 | 537 | |
483 | - protected function checkInputDir($dir, $inclType=true, $existing=true) { |
|
538 | + protected function checkInputDir($dir, $inclType=true, $existing=true) |
|
539 | + { |
|
484 | 540 | $dir = path::normalize($dir); |
485 | - if (substr($dir, 0, 1) == "/") |
|
486 | - $dir = substr($dir, 1); |
|
541 | + if (substr($dir, 0, 1) == "/") { |
|
542 | + $dir = substr($dir, 1); |
|
543 | + } |
|
487 | 544 | |
488 | - if ((substr($dir, 0, 1) == ".") || (substr(basename($dir), 0, 1) == ".")) |
|
489 | - return false; |
|
545 | + if ((substr($dir, 0, 1) == ".") || (substr(basename($dir), 0, 1) == ".")) { |
|
546 | + return false; |
|
547 | + } |
|
490 | 548 | |
491 | 549 | if ($inclType) { |
492 | 550 | $first = explode("/", $dir); |
493 | 551 | $first = $first[0]; |
494 | - if ($first != $this->type) |
|
495 | - return false; |
|
552 | + if ($first != $this->type) { |
|
553 | + return false; |
|
554 | + } |
|
496 | 555 | $return = $this->removeTypeFromPath($dir); |
497 | 556 | } else { |
498 | 557 | $return = $dir; |
499 | 558 | $dir = "{$this->type}/$dir"; |
500 | 559 | } |
501 | 560 | |
502 | - if (!$existing) |
|
503 | - return $return; |
|
561 | + if (!$existing) { |
|
562 | + return $return; |
|
563 | + } |
|
504 | 564 | |
505 | 565 | $path = "{$this->config['uploadDir']}/$dir"; |
506 | 566 | return (is_dir($path) && is_readable($path)) ? $return : false; |
507 | 567 | } |
508 | 568 | |
509 | - protected function validateExtension($ext, $type) { |
|
569 | + protected function validateExtension($ext, $type) |
|
570 | + { |
|
510 | 571 | $ext = trim(strtolower($ext)); |
511 | - if (!isset($this->types[$type])) |
|
512 | - return false; |
|
572 | + if (!isset($this->types[$type])) { |
|
573 | + return false; |
|
574 | + } |
|
513 | 575 | |
514 | 576 | $exts = strtolower(text::clearWhitespaces($this->config['deniedExts'])); |
515 | 577 | if (strlen($exts)) { |
516 | 578 | $exts = explode(" ", $exts); |
517 | - if (in_array($ext, $exts)) |
|
518 | - return false; |
|
579 | + if (in_array($ext, $exts)) { |
|
580 | + return false; |
|
581 | + } |
|
519 | 582 | } |
520 | 583 | |
521 | 584 | $exts = trim($this->types[$type]); |
522 | - if (!strlen($exts) || substr($exts, 0, 1) == "*") |
|
523 | - return true; |
|
585 | + if (!strlen($exts) || substr($exts, 0, 1) == "*") { |
|
586 | + return true; |
|
587 | + } |
|
524 | 588 | |
525 | 589 | if (substr($exts, 0, 1) == "!") { |
526 | 590 | $exts = explode(" ", trim(strtolower(substr($exts, 1)))); |
@@ -531,26 +595,32 @@ discard block |
||
531 | 595 | return in_array($ext, $exts); |
532 | 596 | } |
533 | 597 | |
534 | - protected function getTypeFromPath($path) { |
|
598 | + protected function getTypeFromPath($path) |
|
599 | + { |
|
535 | 600 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
536 | 601 | ? $patt[1] : $path; |
537 | 602 | } |
538 | 603 | |
539 | - protected function removeTypeFromPath($path) { |
|
604 | + protected function removeTypeFromPath($path) |
|
605 | + { |
|
540 | 606 | return preg_match('/^[^\/]*\/(.*)$/', $path, $patt) |
541 | 607 | ? $patt[1] : ""; |
542 | 608 | } |
543 | 609 | |
544 | - protected function imageResize($image, $file=null) { |
|
610 | + protected function imageResize($image, $file=null) |
|
611 | + { |
|
545 | 612 | |
546 | 613 | if (!($image instanceof image)) { |
547 | 614 | $img = image::factory($this->imageDriver, $image); |
548 | - if ($img->initError) return false; |
|
615 | + if ($img->initError) { |
|
616 | + return false; |
|
617 | + } |
|
549 | 618 | $file = $image; |
550 | - } elseif ($file === null) |
|
551 | - return false; |
|
552 | - else |
|
553 | - $img = $image; |
|
619 | + } elseif ($file === null) { |
|
620 | + return false; |
|
621 | + } else { |
|
622 | + $img = $image; |
|
623 | + } |
|
554 | 624 | |
555 | 625 | $orientation = 1; |
556 | 626 | if (function_exists("exif_read_data")) { |
@@ -572,8 +642,9 @@ discard block |
||
572 | 642 | ) |
573 | 643 | ) && |
574 | 644 | ($orientation == 1) |
575 | - ) |
|
576 | - return true; |
|
645 | + ) { |
|
646 | + return true; |
|
647 | + } |
|
577 | 648 | |
578 | 649 | |
579 | 650 | // PROPORTIONAL RESIZE |
@@ -593,15 +664,17 @@ discard block |
||
593 | 664 | $width = $img->getPropWidth($height); |
594 | 665 | } |
595 | 666 | |
596 | - if (isset($width) && isset($height) && !$img->resize($width, $height)) |
|
597 | - return false; |
|
667 | + if (isset($width) && isset($height) && !$img->resize($width, $height)) { |
|
668 | + return false; |
|
669 | + } |
|
598 | 670 | |
599 | 671 | // RESIZE TO FIT |
600 | 672 | } elseif ( |
601 | 673 | $this->config['maxImageWidth'] && $this->config['maxImageHeight'] && |
602 | 674 | !$img->resizeFit($this->config['maxImageWidth'], $this->config['maxImageHeight']) |
603 | - ) |
|
604 | - return false; |
|
675 | + ) { |
|
676 | + return false; |
|
677 | + } |
|
605 | 678 | |
606 | 679 | // AUTO FLIP AND ROTATE FROM EXIF |
607 | 680 | if ((($orientation == 2) && !$img->flipHorizontal()) || |
@@ -611,11 +684,13 @@ discard block |
||
611 | 684 | (($orientation == 6) && !$img->rotate(90)) || |
612 | 685 | (($orientation == 7) && (!$img->flipHorizontal() || !$img->rotate(90))) || |
613 | 686 | (($orientation == 8) && !$img->rotate(270)) |
614 | - ) |
|
615 | - return false; |
|
616 | - if (($orientation >= 2) && ($orientation <= 8) && ($this->imageDriver == "imagick")) |
|
617 | - try { |
|
687 | + ) { |
|
688 | + return false; |
|
689 | + } |
|
690 | + if (($orientation >= 2) && ($orientation <= 8) && ($this->imageDriver == "imagick")) { |
|
691 | + try { |
|
618 | 692 | $img->image->setImageProperty('exif:Orientation', "1"); |
693 | + } |
|
619 | 694 | } catch (Exception $e) {} |
620 | 695 | |
621 | 696 | // WATERMARK |
@@ -646,22 +721,26 @@ discard block |
||
646 | 721 | |
647 | 722 | } |
648 | 723 | |
649 | - protected function makeThumb($file, $overwrite=true) { |
|
724 | + protected function makeThumb($file, $overwrite=true) |
|
725 | + { |
|
650 | 726 | $img = image::factory($this->imageDriver, $file); |
651 | 727 | |
652 | 728 | // Drop files which are not images |
653 | - if ($img->initError) |
|
654 | - return true; |
|
729 | + if ($img->initError) { |
|
730 | + return true; |
|
731 | + } |
|
655 | 732 | |
656 | 733 | $thumb = substr($file, strlen($this->config['uploadDir'])); |
657 | 734 | $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb; |
658 | 735 | $thumb = path::normalize($thumb); |
659 | 736 | $thumbDir = dirname($thumb); |
660 | - if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) |
|
661 | - return false; |
|
737 | + if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) { |
|
738 | + return false; |
|
739 | + } |
|
662 | 740 | |
663 | - if (!$overwrite && is_file($thumb)) |
|
664 | - return true; |
|
741 | + if (!$overwrite && is_file($thumb)) { |
|
742 | + return true; |
|
743 | + } |
|
665 | 744 | |
666 | 745 | // Images with smaller resolutions than thumbnails |
667 | 746 | /*if (($img->width <= $this->config['thumbWidth']) && |
@@ -674,8 +753,9 @@ discard block |
||
674 | 753 | |
675 | 754 | // Resize image |
676 | 755 | } else */ |
677 | - if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) |
|
678 | - return false; |
|
756 | + if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) { |
|
757 | + return false; |
|
758 | + } |
|
679 | 759 | |
680 | 760 | if ( $this->imageDriver == 'gd' ) { |
681 | 761 | $width = imagesx( $img->image ); |
@@ -697,7 +777,8 @@ discard block |
||
697 | 777 | )); |
698 | 778 | } |
699 | 779 | |
700 | - protected function localize($langCode) { |
|
780 | + protected function localize($langCode) |
|
781 | + { |
|
701 | 782 | require "lang/{$langCode}.php"; |
702 | 783 | setlocale(LC_ALL, $lang['_locale']); |
703 | 784 | $this->charset = $lang['_charset']; |
@@ -712,27 +793,34 @@ discard block |
||
712 | 793 | $this->labels = $lang; |
713 | 794 | } |
714 | 795 | |
715 | - protected function label($string, array $data=null) { |
|
796 | + protected function label($string, array $data=null) |
|
797 | + { |
|
716 | 798 | $return = isset($this->labels[$string]) ? $this->labels[$string] : $string; |
717 | - if (is_array($data)) |
|
718 | - foreach ($data as $key => $val) |
|
799 | + if (is_array($data)) { |
|
800 | + foreach ($data as $key => $val) |
|
719 | 801 | $return = str_replace("{{$key}}", $val, $return); |
802 | + } |
|
720 | 803 | return $return; |
721 | 804 | } |
722 | 805 | |
723 | - protected function backMsg($message, array $data=null) { |
|
806 | + protected function backMsg($message, array $data=null) |
|
807 | + { |
|
724 | 808 | $message = $this->label($message, $data); |
725 | - if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) |
|
726 | - @unlink($this->file['tmp_name']); |
|
809 | + if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) { |
|
810 | + @unlink($this->file['tmp_name']); |
|
811 | + } |
|
727 | 812 | $this->callBack("", $message); |
728 | 813 | die; |
729 | 814 | } |
730 | 815 | |
731 | - protected function callBack($url, $message="") { |
|
816 | + protected function callBack($url, $message="") |
|
817 | + { |
|
732 | 818 | $message = text::jsValue($message); |
733 | 819 | $CKfuncNum = isset($this->opener['CKEditor']['funcNum']) |
734 | 820 | ? $this->opener['CKEditor']['funcNum'] : 0; |
735 | - if (!$CKfuncNum) $CKfuncNum = 0; |
|
821 | + if (!$CKfuncNum) { |
|
822 | + $CKfuncNum = 0; |
|
823 | + } |
|
736 | 824 | header("Content-Type: text/html; charset={$this->charset}"); |
737 | 825 | |
738 | 826 | ?><html> |
@@ -769,7 +857,8 @@ discard block |
||
769 | 857 | |
770 | 858 | } |
771 | 859 | |
772 | - protected function get_htaccess() { |
|
860 | + protected function get_htaccess() |
|
861 | + { |
|
773 | 862 | return "<IfModule mod_php4.c> |
774 | 863 | php_value engine off |
775 | 864 | </IfModule> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $modx = evolutionCMS(); |
27 | 27 | $modx->db->connect(); |
28 | 28 | startCMSSession(); |
29 | -if(!isset($_SESSION['mgrValidated'])) { |
|
29 | +if (!isset($_SESSION['mgrValidated'])) { |
|
30 | 30 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
31 | 31 | } |
32 | 32 | define('IN_MANAGER_MODE', true); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $manager_language = $modx->config['manager_language']; |
36 | 36 | // Pass language code from MODX to KCFinder |
37 | -if(!file_exists("../../../includes/lang/".$manager_language.".inc.php")) { |
|
37 | +if (!file_exists("../../../includes/lang/".$manager_language.".inc.php")) { |
|
38 | 38 | $manager_language = "english"; // if not set, get the english language file. |
39 | 39 | } |
40 | 40 | include_once "../../../includes/lang/".$manager_language.".inc.php"; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | // PHP VERSION CHECK |
44 | 44 | if (substr(PHP_VERSION, 0, strpos(PHP_VERSION, '.')) < 5) |
45 | - die("You are using PHP " . PHP_VERSION . " when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution."); |
|
45 | + die("You are using PHP ".PHP_VERSION." when KCFinder require at least version 5! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution."); |
|
46 | 46 | |
47 | 47 | |
48 | 48 | // SAFE MODE CHECK |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | |
53 | 53 | // MAGIC AUTOLOAD CLASSES FUNCTION |
54 | -function autoloadda9d06472ccb71b84928677ce2a6ca89($class) { |
|
54 | +function autoloadda9d06472ccb71b84928677ce2a6ca89($class){ |
|
55 | 55 | static $classes = null; |
56 | 56 | if ($classes === null) { |
57 | 57 | $classes = array( |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ); |
76 | 76 | } |
77 | 77 | if (isset($classes[$class])) { |
78 | - require dirname(__FILE__) . $classes[$class]; |
|
78 | + require dirname(__FILE__).$classes[$class]; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | spl_autoload_register('autoloadda9d06472ccb71b84928677ce2a6ca89', true); |
@@ -84,18 +84,18 @@ discard block |
||
84 | 84 | // json_encode() IMPLEMENTATION IF JSON EXTENSION IS MISSING |
85 | 85 | if (!function_exists("json_encode")) { |
86 | 86 | |
87 | - function kcfinder_json_string_encode($string) { |
|
88 | - return '"' . |
|
87 | + function kcfinder_json_string_encode($string){ |
|
88 | + return '"'. |
|
89 | 89 | str_replace('/', "\\/", |
90 | 90 | str_replace("\t", "\\t", |
91 | 91 | str_replace("\r", "\\r", |
92 | 92 | str_replace("\n", "\\n", |
93 | 93 | str_replace('"', "\\\"", |
94 | 94 | str_replace("\\", "\\\\", |
95 | - $string)))))) . '"'; |
|
95 | + $string)))))).'"'; |
|
96 | 96 | } |
97 | 97 | |
98 | - function json_encode($data) { |
|
98 | + function json_encode($data){ |
|
99 | 99 | |
100 | 100 | if (is_array($data)) { |
101 | 101 | $ret = array(); |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | // OBJECT |
104 | 104 | if (array_keys($data) !== range(0, count($data) - 1)) { |
105 | 105 | foreach ($data as $key => $val) |
106 | - $ret[] = kcfinder_json_string_encode($key) . ':' . json_encode($val); |
|
107 | - return "{" . implode(",", $ret) . "}"; |
|
106 | + $ret[] = kcfinder_json_string_encode($key).':'.json_encode($val); |
|
107 | + return "{".implode(",", $ret)."}"; |
|
108 | 108 | |
109 | 109 | // ARRAY |
110 | 110 | } else { |
111 | 111 | foreach ($data as $val) |
112 | 112 | $ret[] = json_encode($val); |
113 | - return "[" . implode(",", $ret) . "]"; |
|
113 | + return "[".implode(",", $ret)."]"; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | // BOOLEAN OR NULL |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $autoloader = realpath(__DIR__.'/../vendor/autoload.php'); |
52 | 52 | if (file_exists($autoloader) && is_readable($autoloader)) { |
53 | - include_once($autoloader); |
|
53 | + include_once($autoloader); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // get start time |
@@ -65,22 +65,22 @@ discard block |
||
65 | 65 | $site_hostnames_path = $base_path . 'assets/cache/siteHostnames.php'; |
66 | 66 | if(is_file($site_hostnames_path)) include_once($site_hostnames_path); |
67 | 67 | if(!defined('MGR_DIR') || MGR_DIR!==$mgr_dir) { |
68 | - $src = "<?php\n"; |
|
69 | - $src .= "define('MGR_DIR', '{$mgr_dir}');\n"; |
|
70 | - $rs = file_put_contents($site_mgr_path,$src); |
|
71 | - if(!$rs) { |
|
72 | - echo 'siteManager.php write error'; |
|
73 | - exit; |
|
74 | - } |
|
75 | - sleep(1); |
|
76 | - header('Location:' . $_SERVER['REQUEST_URI']); |
|
77 | - exit; |
|
68 | + $src = "<?php\n"; |
|
69 | + $src .= "define('MGR_DIR', '{$mgr_dir}');\n"; |
|
70 | + $rs = file_put_contents($site_mgr_path,$src); |
|
71 | + if(!$rs) { |
|
72 | + echo 'siteManager.php write error'; |
|
73 | + exit; |
|
74 | + } |
|
75 | + sleep(1); |
|
76 | + header('Location:' . $_SERVER['REQUEST_URI']); |
|
77 | + exit; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // we use this to make sure files are accessed through |
81 | 81 | // the manager instead of seperately. |
82 | 82 | if ( ! defined('IN_MANAGER_MODE')) { |
83 | - define('IN_MANAGER_MODE', true); |
|
83 | + define('IN_MANAGER_MODE', true); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // harden it |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | |
102 | 102 | // check PHP version. EVO is compatible with php 5 (5.0.0+) |
103 | 103 | $php_ver_comp = version_compare(phpversion(), "5.0.0"); |
104 | - // -1 if left is less, 0 if equal, +1 if left is higher |
|
104 | + // -1 if left is less, 0 if equal, +1 if left is higher |
|
105 | 105 | if($php_ver_comp < 0) { |
106 | - echo sprintf($_lang['php_version_check'], phpversion()); |
|
107 | - exit; |
|
106 | + echo sprintf($_lang['php_version_check'], phpversion()); |
|
107 | + exit; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | // check if iconv is installed |
111 | 111 | if(!function_exists('iconv')) { |
112 | - echo $_lang['iconv_not_available']; |
|
113 | - exit; |
|
112 | + echo $_lang['iconv_not_available']; |
|
113 | + exit; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | // set some runtime options |
@@ -123,15 +123,15 @@ discard block |
||
123 | 123 | |
124 | 124 | // set the document_root :| |
125 | 125 | if(!isset($_SERVER['DOCUMENT_ROOT']) || empty($_SERVER['DOCUMENT_ROOT'])) { |
126 | - $_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['PATH_INFO'], "", preg_replace("/\\\\/", "/", $_SERVER['PATH_TRANSLATED']))."/"; |
|
126 | + $_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['PATH_INFO'], "", preg_replace("/\\\\/", "/", $_SERVER['PATH_TRANSLATED']))."/"; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | // include_once config file |
130 | 130 | $config_filename = "./includes/config.inc.php"; |
131 | 131 | if (!file_exists($config_filename)) { |
132 | - echo "<h3>Unable to load configuration settings</h3>"; |
|
133 | - echo "Please run the EVO <a href='../install'>install utility</a>"; |
|
134 | - exit; |
|
132 | + echo "<h3>Unable to load configuration settings</h3>"; |
|
133 | + echo "Please run the EVO <a href='../install'>install utility</a>"; |
|
134 | + exit; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | // include the database configuration file |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | |
140 | 140 | // initiate the content manager class |
141 | 141 | if (isset($coreClass) && class_exists($coreClass)) { |
142 | - $modx = new $coreClass; |
|
142 | + $modx = new $coreClass; |
|
143 | 143 | } |
144 | 144 | if (!isset($modx) || !($modx instanceof DocumentParser)) { |
145 | - include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
146 | - $modx = evolutionCMS(); |
|
145 | + include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
146 | + $modx = evolutionCMS(); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | $modx->loadExtension("ManagerAPI"); |
@@ -166,25 +166,25 @@ discard block |
||
166 | 166 | |
167 | 167 | // now include_once different language file as english |
168 | 168 | if(!isset($manager_language) || !file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) { |
169 | - $manager_language = "english"; // if not set, get the english language file. |
|
169 | + $manager_language = "english"; // if not set, get the english language file. |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | // $length_eng_lang = count($_lang); // Not used for now, required for difference-check with other languages than english (i.e. inside installer) |
173 | 173 | |
174 | 174 | if($manager_language!="english" && file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) { |
175 | - include_once "lang/".$manager_language.".inc.php"; |
|
175 | + include_once "lang/".$manager_language.".inc.php"; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | // allow custom language overrides not altered by future EVO-updates |
179 | 179 | if(file_exists(MODX_MANAGER_PATH."includes/lang/override/".$manager_language.".inc.php")) { |
180 | - include_once "lang/override/".$manager_language.".inc.php"; |
|
180 | + include_once "lang/override/".$manager_language.".inc.php"; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | $s = array('[+MGR_DIR+]'); |
184 | 184 | $r = array(MGR_DIR); |
185 | 185 | foreach($_lang as $k=>$v) |
186 | 186 | { |
187 | - if(strpos($v,'[+')!==false) $_lang[$k] = str_replace($s, $r, $v); |
|
187 | + if(strpos($v,'[+')!==false) $_lang[$k] = str_replace($s, $r, $v); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | // send the charset header |
@@ -199,19 +199,19 @@ discard block |
||
199 | 199 | |
200 | 200 | // double check the session |
201 | 201 | if(!isset($_SESSION['mgrValidated'])){ |
202 | - echo "Not Logged In!"; |
|
203 | - exit; |
|
202 | + echo "Not Logged In!"; |
|
203 | + exit; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | // include_once the style variables file |
207 | 207 | if(isset($manager_theme) && !isset($_style)) { |
208 | - $_style = array(); |
|
209 | - include_once "media/style/".$manager_theme."/style.php"; |
|
208 | + $_style = array(); |
|
209 | + include_once "media/style/".$manager_theme."/style.php"; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | // check if user is allowed to access manager interface |
213 | 213 | if(isset($allow_manager_access) && $allow_manager_access==0) { |
214 | - include_once "manager.lockout.inc.php"; |
|
214 | + include_once "manager.lockout.inc.php"; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | // Initialize System Alert Message Queque |
@@ -220,13 +220,13 @@ discard block |
||
220 | 220 | |
221 | 221 | // first we check to see if this is a frameset request |
222 | 222 | if(!isset($_POST['a']) && !isset($_GET['a']) && !isset($_POST['updateMsgCount'])) { |
223 | - // this looks to be a top-level frameset request, so let's serve up a frameset |
|
224 | - if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/frames/1.php")) { |
|
225 | - include_once "media/style/".$manager_theme."/frames/1.php"; |
|
226 | - }else{ |
|
227 | - include_once "frames/1.php"; |
|
228 | - } |
|
229 | - exit; |
|
223 | + // this looks to be a top-level frameset request, so let's serve up a frameset |
|
224 | + if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/frames/1.php")) { |
|
225 | + include_once "media/style/".$manager_theme."/frames/1.php"; |
|
226 | + }else{ |
|
227 | + include_once "frames/1.php"; |
|
228 | + } |
|
229 | + exit; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | // OK, let's retrieve the action directive from the request |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | else $action = null; |
238 | 238 | |
239 | 239 | if (isset($_POST['updateMsgCount']) && $modx->hasPermission('messages')) { |
240 | - include_once 'messageCount.inc.php'; |
|
240 | + include_once 'messageCount.inc.php'; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | // save page to manager object |
@@ -245,19 +245,19 @@ discard block |
||
245 | 245 | |
246 | 246 | // attempt to foil some simple types of CSRF attacks |
247 | 247 | if (isset($modx->config['validate_referer']) && (int)$modx->config['validate_referer']) { |
248 | - if (isset($_SERVER['HTTP_REFERER'])) { |
|
249 | - $referer = $_SERVER['HTTP_REFERER']; |
|
250 | - |
|
251 | - if (!empty($referer)) { |
|
252 | - if (!preg_match('/^'.preg_quote(MODX_SITE_URL, '/').'/i', $referer)) { |
|
253 | - $modx->webAlertAndQuit("A possible CSRF attempt was detected from referer: {$referer}.", "index.php"); |
|
254 | - } |
|
255 | - } else { |
|
256 | - $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the client.", "index.php"); |
|
257 | - } |
|
258 | - } else { |
|
259 | - $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the server.", "index.php"); |
|
260 | - } |
|
248 | + if (isset($_SERVER['HTTP_REFERER'])) { |
|
249 | + $referer = $_SERVER['HTTP_REFERER']; |
|
250 | + |
|
251 | + if (!empty($referer)) { |
|
252 | + if (!preg_match('/^'.preg_quote(MODX_SITE_URL, '/').'/i', $referer)) { |
|
253 | + $modx->webAlertAndQuit("A possible CSRF attempt was detected from referer: {$referer}.", "index.php"); |
|
254 | + } |
|
255 | + } else { |
|
256 | + $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the client.", "index.php"); |
|
257 | + } |
|
258 | + } else { |
|
259 | + $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the server.", "index.php"); |
|
260 | + } |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | // invoke OnManagerPageInit event |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | |
266 | 266 | // return element filepath |
267 | 267 | function includeFileProcessor ($filepath,$manager_theme) { |
268 | - $element = ""; |
|
269 | - if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath)) { |
|
270 | - $element = MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath; |
|
271 | - }else{ |
|
272 | - $element = $filepath; |
|
273 | - } |
|
274 | - return $element; |
|
268 | + $element = ""; |
|
269 | + if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath)) { |
|
270 | + $element = MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath; |
|
271 | + }else{ |
|
272 | + $element = $filepath; |
|
273 | + } |
|
274 | + return $element; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | // Now we decide what to do according to the action request. This is a BIG list :) |
@@ -279,714 +279,714 @@ discard block |
||
279 | 279 | /********************************************************************/ |
280 | 280 | /* frame management - show the requested frame */ |
281 | 281 | /********************************************************************/ |
282 | - case 1 : |
|
283 | - // get the requested frame |
|
284 | - $frame = preg_replace('/[^a-z0-9]/i','',$_REQUEST['f']); |
|
285 | - if($frame>9) { |
|
286 | - $enable_debug=false; // this is to stop the debug thingy being attached to the framesets |
|
287 | - } |
|
288 | - include_once(includeFileProcessor("frames/".$frame.".php",$manager_theme)); |
|
289 | - break; |
|
282 | + case 1 : |
|
283 | + // get the requested frame |
|
284 | + $frame = preg_replace('/[^a-z0-9]/i','',$_REQUEST['f']); |
|
285 | + if($frame>9) { |
|
286 | + $enable_debug=false; // this is to stop the debug thingy being attached to the framesets |
|
287 | + } |
|
288 | + include_once(includeFileProcessor("frames/".$frame.".php",$manager_theme)); |
|
289 | + break; |
|
290 | 290 | /********************************************************************/ |
291 | 291 | /* show the homepage */ |
292 | 292 | /********************************************************************/ |
293 | - case 2: |
|
294 | - // get the home page |
|
295 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
296 | - include_once(includeFileProcessor("actions/welcome.static.php",$manager_theme)); |
|
297 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
298 | - break; |
|
293 | + case 2: |
|
294 | + // get the home page |
|
295 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
296 | + include_once(includeFileProcessor("actions/welcome.static.php",$manager_theme)); |
|
297 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
298 | + break; |
|
299 | 299 | /********************************************************************/ |
300 | 300 | /* document data */ |
301 | 301 | /********************************************************************/ |
302 | - case 3: |
|
303 | - // get the page to show document's data |
|
304 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
305 | - include_once(includeFileProcessor("actions/document_data.static.php",$manager_theme)); |
|
306 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
307 | - break; |
|
302 | + case 3: |
|
303 | + // get the page to show document's data |
|
304 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
305 | + include_once(includeFileProcessor("actions/document_data.static.php",$manager_theme)); |
|
306 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
307 | + break; |
|
308 | 308 | /********************************************************************/ |
309 | 309 | /* content management */ |
310 | 310 | /********************************************************************/ |
311 | - case 85: |
|
312 | - // get the mutate page for adding a folder |
|
313 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
314 | - include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
315 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
316 | - break; |
|
317 | - case 27: |
|
318 | - // get the mutate page for changing content |
|
319 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
320 | - include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
321 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
322 | - break; |
|
323 | - case 4: |
|
324 | - // get the mutate page for adding content |
|
325 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
326 | - include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
327 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
328 | - break; |
|
329 | - case 5: |
|
330 | - // get the save processor |
|
331 | - include_once(includeFileProcessor("processors/save_content.processor.php",$manager_theme)); |
|
332 | - break; |
|
333 | - case 6: |
|
334 | - // get the delete processor |
|
335 | - include_once(includeFileProcessor("processors/delete_content.processor.php",$manager_theme)); |
|
336 | - break; |
|
337 | - case 63: |
|
338 | - // get the undelete processor |
|
339 | - include_once(includeFileProcessor("processors/undelete_content.processor.php",$manager_theme)); |
|
340 | - break; |
|
341 | - case 51: |
|
342 | - // get the move action |
|
343 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
344 | - include_once(includeFileProcessor("actions/move_document.dynamic.php",$manager_theme)); |
|
345 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
346 | - break; |
|
347 | - case 52: |
|
348 | - // get the move document processor |
|
349 | - include_once(includeFileProcessor("processors/move_document.processor.php",$manager_theme)); |
|
350 | - break; |
|
351 | - case 61: |
|
352 | - // get the processor for publishing content |
|
353 | - include_once(includeFileProcessor("processors/publish_content.processor.php",$manager_theme)); |
|
354 | - break; |
|
355 | - case 62: |
|
356 | - // get the processor for publishing content |
|
357 | - include_once(includeFileProcessor("processors/unpublish_content.processor.php",$manager_theme)); |
|
358 | - break; |
|
359 | - case 56: |
|
360 | - // get the sort menuindex action |
|
361 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
362 | - include_once(includeFileProcessor("actions/mutate_menuindex_sort.dynamic.php",$manager_theme)); |
|
363 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
364 | - break; |
|
311 | + case 85: |
|
312 | + // get the mutate page for adding a folder |
|
313 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
314 | + include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
315 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
316 | + break; |
|
317 | + case 27: |
|
318 | + // get the mutate page for changing content |
|
319 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
320 | + include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
321 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
322 | + break; |
|
323 | + case 4: |
|
324 | + // get the mutate page for adding content |
|
325 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
326 | + include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
327 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
328 | + break; |
|
329 | + case 5: |
|
330 | + // get the save processor |
|
331 | + include_once(includeFileProcessor("processors/save_content.processor.php",$manager_theme)); |
|
332 | + break; |
|
333 | + case 6: |
|
334 | + // get the delete processor |
|
335 | + include_once(includeFileProcessor("processors/delete_content.processor.php",$manager_theme)); |
|
336 | + break; |
|
337 | + case 63: |
|
338 | + // get the undelete processor |
|
339 | + include_once(includeFileProcessor("processors/undelete_content.processor.php",$manager_theme)); |
|
340 | + break; |
|
341 | + case 51: |
|
342 | + // get the move action |
|
343 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
344 | + include_once(includeFileProcessor("actions/move_document.dynamic.php",$manager_theme)); |
|
345 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
346 | + break; |
|
347 | + case 52: |
|
348 | + // get the move document processor |
|
349 | + include_once(includeFileProcessor("processors/move_document.processor.php",$manager_theme)); |
|
350 | + break; |
|
351 | + case 61: |
|
352 | + // get the processor for publishing content |
|
353 | + include_once(includeFileProcessor("processors/publish_content.processor.php",$manager_theme)); |
|
354 | + break; |
|
355 | + case 62: |
|
356 | + // get the processor for publishing content |
|
357 | + include_once(includeFileProcessor("processors/unpublish_content.processor.php",$manager_theme)); |
|
358 | + break; |
|
359 | + case 56: |
|
360 | + // get the sort menuindex action |
|
361 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
362 | + include_once(includeFileProcessor("actions/mutate_menuindex_sort.dynamic.php",$manager_theme)); |
|
363 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
364 | + break; |
|
365 | 365 | /********************************************************************/ |
366 | 366 | /* show the wait page - gives the tree time to refresh (hopefully) */ |
367 | 367 | /********************************************************************/ |
368 | - case 7: |
|
369 | - // get the wait page (so the tree can reload) |
|
370 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
371 | - include_once(includeFileProcessor("actions/wait.static.php",$manager_theme)); |
|
372 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
373 | - break; |
|
368 | + case 7: |
|
369 | + // get the wait page (so the tree can reload) |
|
370 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
371 | + include_once(includeFileProcessor("actions/wait.static.php",$manager_theme)); |
|
372 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
373 | + break; |
|
374 | 374 | /********************************************************************/ |
375 | 375 | /* let the user log out */ |
376 | 376 | /********************************************************************/ |
377 | - case 8: |
|
378 | - // get the logout processor |
|
379 | - include_once(includeFileProcessor("processors/logout.processor.php",$manager_theme)); |
|
380 | - break; |
|
377 | + case 8: |
|
378 | + // get the logout processor |
|
379 | + include_once(includeFileProcessor("processors/logout.processor.php",$manager_theme)); |
|
380 | + break; |
|
381 | 381 | /********************************************************************/ |
382 | 382 | /* user management */ |
383 | 383 | /********************************************************************/ |
384 | - case 87: |
|
385 | - // get the new web user page |
|
386 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
387 | - include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme)); |
|
388 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
389 | - break; |
|
390 | - case 88: |
|
391 | - // get the edit web user page |
|
392 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
393 | - include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme)); |
|
394 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
395 | - break; |
|
396 | - case 89: |
|
397 | - // get the save web user processor |
|
398 | - include_once(includeFileProcessor("processors/save_web_user.processor.php",$manager_theme)); |
|
399 | - break; |
|
400 | - case 90: |
|
401 | - // get the delete web user page |
|
402 | - include_once(includeFileProcessor("processors/delete_web_user.processor.php",$manager_theme)); |
|
403 | - break; |
|
404 | - case 11: |
|
405 | - // get the new user page |
|
406 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
407 | - include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme)); |
|
408 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
409 | - break; |
|
410 | - case 12: |
|
411 | - // get the edit user page |
|
412 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
413 | - include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme)); |
|
414 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
415 | - break; |
|
416 | - case 32: |
|
417 | - // get the save user processor |
|
418 | - include_once(includeFileProcessor("processors/save_user.processor.php",$manager_theme)); |
|
419 | - break; |
|
420 | - case 28: |
|
421 | - // get the change password page |
|
422 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
423 | - include_once(includeFileProcessor("actions/mutate_password.dynamic.php",$manager_theme)); |
|
424 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
425 | - break; |
|
426 | - case 34: |
|
427 | - // get the save new password page |
|
428 | - include_once(includeFileProcessor("processors/save_password.processor.php",$manager_theme)); |
|
429 | - break; |
|
430 | - case 33: |
|
431 | - // get the delete user page |
|
432 | - include_once(includeFileProcessor("processors/delete_user.processor.php",$manager_theme)); |
|
433 | - break; |
|
384 | + case 87: |
|
385 | + // get the new web user page |
|
386 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
387 | + include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme)); |
|
388 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
389 | + break; |
|
390 | + case 88: |
|
391 | + // get the edit web user page |
|
392 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
393 | + include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme)); |
|
394 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
395 | + break; |
|
396 | + case 89: |
|
397 | + // get the save web user processor |
|
398 | + include_once(includeFileProcessor("processors/save_web_user.processor.php",$manager_theme)); |
|
399 | + break; |
|
400 | + case 90: |
|
401 | + // get the delete web user page |
|
402 | + include_once(includeFileProcessor("processors/delete_web_user.processor.php",$manager_theme)); |
|
403 | + break; |
|
404 | + case 11: |
|
405 | + // get the new user page |
|
406 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
407 | + include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme)); |
|
408 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
409 | + break; |
|
410 | + case 12: |
|
411 | + // get the edit user page |
|
412 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
413 | + include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme)); |
|
414 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
415 | + break; |
|
416 | + case 32: |
|
417 | + // get the save user processor |
|
418 | + include_once(includeFileProcessor("processors/save_user.processor.php",$manager_theme)); |
|
419 | + break; |
|
420 | + case 28: |
|
421 | + // get the change password page |
|
422 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
423 | + include_once(includeFileProcessor("actions/mutate_password.dynamic.php",$manager_theme)); |
|
424 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
425 | + break; |
|
426 | + case 34: |
|
427 | + // get the save new password page |
|
428 | + include_once(includeFileProcessor("processors/save_password.processor.php",$manager_theme)); |
|
429 | + break; |
|
430 | + case 33: |
|
431 | + // get the delete user page |
|
432 | + include_once(includeFileProcessor("processors/delete_user.processor.php",$manager_theme)); |
|
433 | + break; |
|
434 | 434 | /********************************************************************/ |
435 | 435 | /* role management */ |
436 | 436 | /********************************************************************/ |
437 | - case 38: |
|
438 | - // get the new role page |
|
439 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
440 | - include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme)); |
|
441 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
442 | - break; |
|
443 | - case 35: |
|
444 | - // get the edit role page |
|
445 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
446 | - include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme)); |
|
447 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
448 | - break; |
|
449 | - case 36: |
|
450 | - // get the save role page |
|
451 | - include_once(includeFileProcessor("processors/save_role.processor.php",$manager_theme)); |
|
452 | - break; |
|
453 | - case 37: |
|
454 | - // get the delete role page |
|
455 | - include_once(includeFileProcessor("processors/delete_role.processor.php",$manager_theme)); |
|
456 | - break; |
|
437 | + case 38: |
|
438 | + // get the new role page |
|
439 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
440 | + include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme)); |
|
441 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
442 | + break; |
|
443 | + case 35: |
|
444 | + // get the edit role page |
|
445 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
446 | + include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme)); |
|
447 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
448 | + break; |
|
449 | + case 36: |
|
450 | + // get the save role page |
|
451 | + include_once(includeFileProcessor("processors/save_role.processor.php",$manager_theme)); |
|
452 | + break; |
|
453 | + case 37: |
|
454 | + // get the delete role page |
|
455 | + include_once(includeFileProcessor("processors/delete_role.processor.php",$manager_theme)); |
|
456 | + break; |
|
457 | 457 | /********************************************************************/ |
458 | 458 | /* category management */ |
459 | 459 | /********************************************************************/ |
460 | - case 120: |
|
461 | - // get the edit category page |
|
462 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
463 | - include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme)); |
|
464 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
465 | - break; |
|
466 | - case 121: |
|
467 | - // for ajax-requests |
|
468 | - include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme)); |
|
469 | - break; |
|
460 | + case 120: |
|
461 | + // get the edit category page |
|
462 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
463 | + include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme)); |
|
464 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
465 | + break; |
|
466 | + case 121: |
|
467 | + // for ajax-requests |
|
468 | + include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme)); |
|
469 | + break; |
|
470 | 470 | /********************************************************************/ |
471 | 471 | /* template management */ |
472 | 472 | /********************************************************************/ |
473 | - case 16: |
|
474 | - // get the edit template action |
|
475 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
476 | - include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme)); |
|
477 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
478 | - break; |
|
479 | - case 19: |
|
480 | - // get the new template action |
|
481 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
482 | - include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme)); |
|
483 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
484 | - break; |
|
485 | - case 20: |
|
486 | - // get the save processor |
|
487 | - include_once(includeFileProcessor("processors/save_template.processor.php",$manager_theme)); |
|
488 | - break; |
|
489 | - case 21: |
|
490 | - // get the delete processor |
|
491 | - include_once(includeFileProcessor("processors/delete_template.processor.php",$manager_theme)); |
|
492 | - break; |
|
493 | - case 96: |
|
494 | - // get the duplicate template processor |
|
495 | - include_once(includeFileProcessor("processors/duplicate_template.processor.php",$manager_theme)); |
|
496 | - break; |
|
497 | - case 117: |
|
498 | - // change the tv rank for selected template |
|
499 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
500 | - include_once(includeFileProcessor("actions/mutate_template_tv_rank.dynamic.php",$manager_theme)); |
|
501 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
502 | - break; |
|
473 | + case 16: |
|
474 | + // get the edit template action |
|
475 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
476 | + include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme)); |
|
477 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
478 | + break; |
|
479 | + case 19: |
|
480 | + // get the new template action |
|
481 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
482 | + include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme)); |
|
483 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
484 | + break; |
|
485 | + case 20: |
|
486 | + // get the save processor |
|
487 | + include_once(includeFileProcessor("processors/save_template.processor.php",$manager_theme)); |
|
488 | + break; |
|
489 | + case 21: |
|
490 | + // get the delete processor |
|
491 | + include_once(includeFileProcessor("processors/delete_template.processor.php",$manager_theme)); |
|
492 | + break; |
|
493 | + case 96: |
|
494 | + // get the duplicate template processor |
|
495 | + include_once(includeFileProcessor("processors/duplicate_template.processor.php",$manager_theme)); |
|
496 | + break; |
|
497 | + case 117: |
|
498 | + // change the tv rank for selected template |
|
499 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
500 | + include_once(includeFileProcessor("actions/mutate_template_tv_rank.dynamic.php",$manager_theme)); |
|
501 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
502 | + break; |
|
503 | 503 | /********************************************************************/ |
504 | 504 | /* snippet management */ |
505 | 505 | /********************************************************************/ |
506 | - case 22: |
|
507 | - // get the edit snippet action |
|
508 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
509 | - include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme)); |
|
510 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
511 | - break; |
|
512 | - case 23: |
|
513 | - // get the new snippet action |
|
514 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
515 | - include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme)); |
|
516 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
517 | - break; |
|
518 | - case 24: |
|
519 | - // get the save processor |
|
520 | - include_once(includeFileProcessor("processors/save_snippet.processor.php",$manager_theme)); |
|
521 | - break; |
|
522 | - case 25: |
|
523 | - // get the delete processor |
|
524 | - include_once(includeFileProcessor("processors/delete_snippet.processor.php",$manager_theme)); |
|
525 | - break; |
|
526 | - case 98: |
|
527 | - // get the duplicate processor |
|
528 | - include_once(includeFileProcessor("processors/duplicate_snippet.processor.php",$manager_theme)); |
|
529 | - break; |
|
506 | + case 22: |
|
507 | + // get the edit snippet action |
|
508 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
509 | + include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme)); |
|
510 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
511 | + break; |
|
512 | + case 23: |
|
513 | + // get the new snippet action |
|
514 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
515 | + include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme)); |
|
516 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
517 | + break; |
|
518 | + case 24: |
|
519 | + // get the save processor |
|
520 | + include_once(includeFileProcessor("processors/save_snippet.processor.php",$manager_theme)); |
|
521 | + break; |
|
522 | + case 25: |
|
523 | + // get the delete processor |
|
524 | + include_once(includeFileProcessor("processors/delete_snippet.processor.php",$manager_theme)); |
|
525 | + break; |
|
526 | + case 98: |
|
527 | + // get the duplicate processor |
|
528 | + include_once(includeFileProcessor("processors/duplicate_snippet.processor.php",$manager_theme)); |
|
529 | + break; |
|
530 | 530 | /********************************************************************/ |
531 | 531 | /* htmlsnippet management */ |
532 | 532 | /********************************************************************/ |
533 | - case 78: |
|
534 | - // get the edit snippet action |
|
535 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
536 | - include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme)); |
|
537 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
538 | - break; |
|
539 | - case 77: |
|
540 | - // get the new snippet action |
|
541 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
542 | - include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme)); |
|
543 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
544 | - break; |
|
545 | - case 79: |
|
546 | - // get the save processor |
|
547 | - include_once(includeFileProcessor("processors/save_htmlsnippet.processor.php",$manager_theme)); |
|
548 | - break; |
|
549 | - case 80: |
|
550 | - // get the delete processor |
|
551 | - include_once(includeFileProcessor("processors/delete_htmlsnippet.processor.php",$manager_theme)); |
|
552 | - break; |
|
553 | - case 97: |
|
554 | - // get the duplicate processor |
|
555 | - include_once(includeFileProcessor("processors/duplicate_htmlsnippet.processor.php",$manager_theme)); |
|
556 | - break; |
|
533 | + case 78: |
|
534 | + // get the edit snippet action |
|
535 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
536 | + include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme)); |
|
537 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
538 | + break; |
|
539 | + case 77: |
|
540 | + // get the new snippet action |
|
541 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
542 | + include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme)); |
|
543 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
544 | + break; |
|
545 | + case 79: |
|
546 | + // get the save processor |
|
547 | + include_once(includeFileProcessor("processors/save_htmlsnippet.processor.php",$manager_theme)); |
|
548 | + break; |
|
549 | + case 80: |
|
550 | + // get the delete processor |
|
551 | + include_once(includeFileProcessor("processors/delete_htmlsnippet.processor.php",$manager_theme)); |
|
552 | + break; |
|
553 | + case 97: |
|
554 | + // get the duplicate processor |
|
555 | + include_once(includeFileProcessor("processors/duplicate_htmlsnippet.processor.php",$manager_theme)); |
|
556 | + break; |
|
557 | 557 | /********************************************************************/ |
558 | 558 | /* show the credits page */ |
559 | 559 | /********************************************************************/ |
560 | - case 18: |
|
561 | - // get the credits page |
|
562 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
563 | - include_once(includeFileProcessor("actions/credits.static.php",$manager_theme)); |
|
564 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
565 | - break; |
|
560 | + case 18: |
|
561 | + // get the credits page |
|
562 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
563 | + include_once(includeFileProcessor("actions/credits.static.php",$manager_theme)); |
|
564 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
565 | + break; |
|
566 | 566 | /********************************************************************/ |
567 | 567 | /* empty cache & synchronisation */ |
568 | 568 | /********************************************************************/ |
569 | - case 26: |
|
570 | - // get the cache emptying processor |
|
571 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
572 | - include_once(includeFileProcessor("actions/refresh_site.dynamic.php",$manager_theme)); |
|
573 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
574 | - break; |
|
569 | + case 26: |
|
570 | + // get the cache emptying processor |
|
571 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
572 | + include_once(includeFileProcessor("actions/refresh_site.dynamic.php",$manager_theme)); |
|
573 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
574 | + break; |
|
575 | 575 | /********************************************************************/ |
576 | 576 | /* Module management */ |
577 | 577 | /********************************************************************/ |
578 | - case 106: |
|
579 | - // get module management |
|
580 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
581 | - include_once(includeFileProcessor("actions/modules.static.php",$manager_theme)); |
|
582 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
583 | - break; |
|
584 | - case 107: |
|
585 | - // get the new module action |
|
586 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
587 | - include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme)); |
|
588 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
589 | - break; |
|
590 | - case 108: |
|
591 | - // get the edit module action |
|
592 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
593 | - include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme)); |
|
594 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
595 | - break; |
|
596 | - case 109: |
|
597 | - // get the save processor |
|
598 | - include_once(includeFileProcessor("processors/save_module.processor.php",$manager_theme)); |
|
599 | - break; |
|
600 | - case 110: |
|
601 | - // get the delete processor |
|
602 | - include_once(includeFileProcessor("processors/delete_module.processor.php",$manager_theme)); |
|
603 | - break; |
|
604 | - case 111: |
|
605 | - // get the duplicate processor |
|
606 | - include_once(includeFileProcessor("processors/duplicate_module.processor.php",$manager_theme)); |
|
607 | - break; |
|
608 | - case 112: |
|
609 | - // execute/run the module |
|
610 | - //include_once "header.inc.php"; |
|
611 | - include_once(includeFileProcessor("processors/execute_module.processor.php",$manager_theme)); |
|
612 | - //include_once "footer.inc.php"; |
|
613 | - break; |
|
614 | - case 113: |
|
615 | - // get the module resources (dependencies) action |
|
616 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
617 | - include_once(includeFileProcessor("actions/mutate_module_resources.dynamic.php",$manager_theme)); |
|
618 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
619 | - break; |
|
578 | + case 106: |
|
579 | + // get module management |
|
580 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
581 | + include_once(includeFileProcessor("actions/modules.static.php",$manager_theme)); |
|
582 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
583 | + break; |
|
584 | + case 107: |
|
585 | + // get the new module action |
|
586 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
587 | + include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme)); |
|
588 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
589 | + break; |
|
590 | + case 108: |
|
591 | + // get the edit module action |
|
592 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
593 | + include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme)); |
|
594 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
595 | + break; |
|
596 | + case 109: |
|
597 | + // get the save processor |
|
598 | + include_once(includeFileProcessor("processors/save_module.processor.php",$manager_theme)); |
|
599 | + break; |
|
600 | + case 110: |
|
601 | + // get the delete processor |
|
602 | + include_once(includeFileProcessor("processors/delete_module.processor.php",$manager_theme)); |
|
603 | + break; |
|
604 | + case 111: |
|
605 | + // get the duplicate processor |
|
606 | + include_once(includeFileProcessor("processors/duplicate_module.processor.php",$manager_theme)); |
|
607 | + break; |
|
608 | + case 112: |
|
609 | + // execute/run the module |
|
610 | + //include_once "header.inc.php"; |
|
611 | + include_once(includeFileProcessor("processors/execute_module.processor.php",$manager_theme)); |
|
612 | + //include_once "footer.inc.php"; |
|
613 | + break; |
|
614 | + case 113: |
|
615 | + // get the module resources (dependencies) action |
|
616 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
617 | + include_once(includeFileProcessor("actions/mutate_module_resources.dynamic.php",$manager_theme)); |
|
618 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
619 | + break; |
|
620 | 620 | /********************************************************************/ |
621 | 621 | /* plugin management */ |
622 | 622 | /********************************************************************/ |
623 | - case 100: |
|
624 | - // change the plugin priority |
|
625 | - //include_once "header.inc.php"; - in action file |
|
626 | - include_once(includeFileProcessor("actions/mutate_plugin_priority.dynamic.php",$manager_theme)); |
|
627 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
628 | - break; |
|
629 | - case 101: |
|
630 | - // get the new plugin action |
|
631 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
632 | - include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme)); |
|
633 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
634 | - break; |
|
635 | - case 102: |
|
636 | - // get the edit plugin action |
|
637 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
638 | - include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme)); |
|
639 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
640 | - break; |
|
641 | - case 103: |
|
642 | - // get the save processor |
|
643 | - include_once(includeFileProcessor("processors/save_plugin.processor.php",$manager_theme)); |
|
644 | - break; |
|
645 | - case 104: |
|
646 | - // get the delete processor |
|
647 | - include_once(includeFileProcessor("processors/delete_plugin.processor.php",$manager_theme)); |
|
648 | - break; |
|
649 | - case 105: |
|
650 | - // get the duplicate processor |
|
651 | - include_once(includeFileProcessor("processors/duplicate_plugin.processor.php",$manager_theme)); |
|
652 | - break; |
|
653 | - case 119: |
|
654 | - // get the purge processor |
|
655 | - include_once(includeFileProcessor("processors/purge_plugin.processor.php",$manager_theme)); |
|
656 | - break; |
|
623 | + case 100: |
|
624 | + // change the plugin priority |
|
625 | + //include_once "header.inc.php"; - in action file |
|
626 | + include_once(includeFileProcessor("actions/mutate_plugin_priority.dynamic.php",$manager_theme)); |
|
627 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
628 | + break; |
|
629 | + case 101: |
|
630 | + // get the new plugin action |
|
631 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
632 | + include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme)); |
|
633 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
634 | + break; |
|
635 | + case 102: |
|
636 | + // get the edit plugin action |
|
637 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
638 | + include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme)); |
|
639 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
640 | + break; |
|
641 | + case 103: |
|
642 | + // get the save processor |
|
643 | + include_once(includeFileProcessor("processors/save_plugin.processor.php",$manager_theme)); |
|
644 | + break; |
|
645 | + case 104: |
|
646 | + // get the delete processor |
|
647 | + include_once(includeFileProcessor("processors/delete_plugin.processor.php",$manager_theme)); |
|
648 | + break; |
|
649 | + case 105: |
|
650 | + // get the duplicate processor |
|
651 | + include_once(includeFileProcessor("processors/duplicate_plugin.processor.php",$manager_theme)); |
|
652 | + break; |
|
653 | + case 119: |
|
654 | + // get the purge processor |
|
655 | + include_once(includeFileProcessor("processors/purge_plugin.processor.php",$manager_theme)); |
|
656 | + break; |
|
657 | 657 | /********************************************************************/ |
658 | 658 | /* view phpinfo */ |
659 | 659 | /********************************************************************/ |
660 | - case 200: |
|
661 | - // show phpInfo |
|
662 | - if($modx->hasPermission('logs')) { |
|
663 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
664 | - include_once(includeFileProcessor("actions/phpinfo.static.php",$manager_theme)); |
|
665 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
666 | - } |
|
667 | - break; |
|
660 | + case 200: |
|
661 | + // show phpInfo |
|
662 | + if($modx->hasPermission('logs')) { |
|
663 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
664 | + include_once(includeFileProcessor("actions/phpinfo.static.php",$manager_theme)); |
|
665 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
666 | + } |
|
667 | + break; |
|
668 | 668 | /********************************************************************/ |
669 | 669 | /* errorpage */ |
670 | 670 | /********************************************************************/ |
671 | - case 29: |
|
672 | - // get the error page |
|
673 | - include_once(includeFileProcessor("actions/error_dialog.static.php",$manager_theme)); |
|
674 | - break; |
|
671 | + case 29: |
|
672 | + // get the error page |
|
673 | + include_once(includeFileProcessor("actions/error_dialog.static.php",$manager_theme)); |
|
674 | + break; |
|
675 | 675 | /********************************************************************/ |
676 | 676 | /* file manager */ |
677 | 677 | /********************************************************************/ |
678 | - case 31: |
|
679 | - // get the page to manage files |
|
680 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
681 | - include_once(includeFileProcessor("actions/files.dynamic.php",$manager_theme)); |
|
682 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
683 | - break; |
|
678 | + case 31: |
|
679 | + // get the page to manage files |
|
680 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
681 | + include_once(includeFileProcessor("actions/files.dynamic.php",$manager_theme)); |
|
682 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
683 | + break; |
|
684 | 684 | /********************************************************************/ |
685 | 685 | /* access permissions */ |
686 | 686 | /********************************************************************/ |
687 | - case 40: |
|
688 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
689 | - include_once(includeFileProcessor("actions/access_permissions.dynamic.php",$manager_theme)); |
|
690 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
691 | - break; |
|
692 | - case 91: |
|
693 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
694 | - include_once(includeFileProcessor("actions/web_access_permissions.dynamic.php",$manager_theme)); |
|
695 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
696 | - break; |
|
687 | + case 40: |
|
688 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
689 | + include_once(includeFileProcessor("actions/access_permissions.dynamic.php",$manager_theme)); |
|
690 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
691 | + break; |
|
692 | + case 91: |
|
693 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
694 | + include_once(includeFileProcessor("actions/web_access_permissions.dynamic.php",$manager_theme)); |
|
695 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
696 | + break; |
|
697 | 697 | /********************************************************************/ |
698 | 698 | /* access groups processor */ |
699 | 699 | /********************************************************************/ |
700 | - case 41: |
|
701 | - include_once(includeFileProcessor("processors/access_groups.processor.php",$manager_theme)); |
|
702 | - break; |
|
703 | - case 92: |
|
704 | - include_once(includeFileProcessor("processors/web_access_groups.processor.php",$manager_theme)); |
|
705 | - break; |
|
700 | + case 41: |
|
701 | + include_once(includeFileProcessor("processors/access_groups.processor.php",$manager_theme)); |
|
702 | + break; |
|
703 | + case 92: |
|
704 | + include_once(includeFileProcessor("processors/web_access_groups.processor.php",$manager_theme)); |
|
705 | + break; |
|
706 | 706 | /********************************************************************/ |
707 | 707 | /* settings editor */ |
708 | 708 | /********************************************************************/ |
709 | - case 17: |
|
710 | - // get the settings editor |
|
711 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
712 | - include_once(includeFileProcessor("actions/mutate_settings.dynamic.php",$manager_theme)); |
|
713 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
714 | - break; |
|
715 | - case 118: |
|
716 | - // call settings ajax include |
|
717 | - ob_clean(); |
|
718 | - include_once(includeFileProcessor("includes/mutate_settings.ajax.php",$manager_theme)); |
|
719 | - break; |
|
709 | + case 17: |
|
710 | + // get the settings editor |
|
711 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
712 | + include_once(includeFileProcessor("actions/mutate_settings.dynamic.php",$manager_theme)); |
|
713 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
714 | + break; |
|
715 | + case 118: |
|
716 | + // call settings ajax include |
|
717 | + ob_clean(); |
|
718 | + include_once(includeFileProcessor("includes/mutate_settings.ajax.php",$manager_theme)); |
|
719 | + break; |
|
720 | 720 | /********************************************************************/ |
721 | 721 | /* save settings */ |
722 | 722 | /********************************************************************/ |
723 | - case 30: |
|
724 | - // get the save settings processor |
|
725 | - include_once(includeFileProcessor("processors/save_settings.processor.php",$manager_theme)); |
|
726 | - break; |
|
723 | + case 30: |
|
724 | + // get the save settings processor |
|
725 | + include_once(includeFileProcessor("processors/save_settings.processor.php",$manager_theme)); |
|
726 | + break; |
|
727 | 727 | /********************************************************************/ |
728 | 728 | /* system information */ |
729 | 729 | /********************************************************************/ |
730 | - case 53: |
|
731 | - // get the settings editor |
|
732 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
733 | - include_once(includeFileProcessor("actions/sysinfo.static.php",$manager_theme)); |
|
734 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
735 | - break; |
|
730 | + case 53: |
|
731 | + // get the settings editor |
|
732 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
733 | + include_once(includeFileProcessor("actions/sysinfo.static.php",$manager_theme)); |
|
734 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
735 | + break; |
|
736 | 736 | /********************************************************************/ |
737 | 737 | /* optimise table */ |
738 | 738 | /********************************************************************/ |
739 | - case 54: |
|
740 | - // get the table optimizer/truncate processor |
|
741 | - include_once(includeFileProcessor("processors/optimize_table.processor.php",$manager_theme)); |
|
742 | - break; |
|
739 | + case 54: |
|
740 | + // get the table optimizer/truncate processor |
|
741 | + include_once(includeFileProcessor("processors/optimize_table.processor.php",$manager_theme)); |
|
742 | + break; |
|
743 | 743 | /********************************************************************/ |
744 | 744 | /* view logging */ |
745 | 745 | /********************************************************************/ |
746 | - case 13: |
|
747 | - // view logging |
|
748 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
749 | - include_once(includeFileProcessor("actions/logging.static.php",$manager_theme)); |
|
750 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
751 | - break; |
|
746 | + case 13: |
|
747 | + // view logging |
|
748 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
749 | + include_once(includeFileProcessor("actions/logging.static.php",$manager_theme)); |
|
750 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
751 | + break; |
|
752 | 752 | /********************************************************************/ |
753 | 753 | /* empty logs */ |
754 | 754 | /********************************************************************/ |
755 | - case 55: |
|
756 | - // get the settings editor |
|
757 | - include_once(includeFileProcessor("processors/empty_table.processor.php",$manager_theme)); |
|
758 | - break; |
|
755 | + case 55: |
|
756 | + // get the settings editor |
|
757 | + include_once(includeFileProcessor("processors/empty_table.processor.php",$manager_theme)); |
|
758 | + break; |
|
759 | 759 | /********************************************************************/ |
760 | 760 | /* calls test page */ |
761 | 761 | /********************************************************************/ |
762 | - case 999: |
|
763 | - // get the test page |
|
764 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
765 | - include_once(includeFileProcessor("test_page.php",$manager_theme)); |
|
766 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
767 | - break; |
|
762 | + case 999: |
|
763 | + // get the test page |
|
764 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
765 | + include_once(includeFileProcessor("test_page.php",$manager_theme)); |
|
766 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
767 | + break; |
|
768 | 768 | /********************************************************************/ |
769 | 769 | /* Empty recycle bin */ |
770 | 770 | /********************************************************************/ |
771 | - case 64: |
|
772 | - // get the Recycle bin emptier |
|
773 | - include_once(includeFileProcessor("processors/remove_content.processor.php",$manager_theme)); |
|
774 | - break; |
|
771 | + case 64: |
|
772 | + // get the Recycle bin emptier |
|
773 | + include_once(includeFileProcessor("processors/remove_content.processor.php",$manager_theme)); |
|
774 | + break; |
|
775 | 775 | /********************************************************************/ |
776 | 776 | /* Messages */ |
777 | 777 | /********************************************************************/ |
778 | - case 10: |
|
779 | - // get the messages page |
|
780 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
781 | - include_once(includeFileProcessor("actions/messages.static.php",$manager_theme)); |
|
782 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
783 | - break; |
|
778 | + case 10: |
|
779 | + // get the messages page |
|
780 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
781 | + include_once(includeFileProcessor("actions/messages.static.php",$manager_theme)); |
|
782 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
783 | + break; |
|
784 | 784 | /********************************************************************/ |
785 | 785 | /* Delete a message */ |
786 | 786 | /********************************************************************/ |
787 | - case 65: |
|
788 | - // get the message deleter |
|
789 | - include_once(includeFileProcessor("processors/delete_message.processor.php",$manager_theme)); |
|
790 | - break; |
|
787 | + case 65: |
|
788 | + // get the message deleter |
|
789 | + include_once(includeFileProcessor("processors/delete_message.processor.php",$manager_theme)); |
|
790 | + break; |
|
791 | 791 | /********************************************************************/ |
792 | 792 | /* Send a message */ |
793 | 793 | /********************************************************************/ |
794 | - case 66: |
|
795 | - // get the message deleter |
|
796 | - include_once(includeFileProcessor("processors/send_message.processor.php",$manager_theme)); |
|
797 | - break; |
|
794 | + case 66: |
|
795 | + // get the message deleter |
|
796 | + include_once(includeFileProcessor("processors/send_message.processor.php",$manager_theme)); |
|
797 | + break; |
|
798 | 798 | /********************************************************************/ |
799 | 799 | /* Remove locks */ |
800 | 800 | /********************************************************************/ |
801 | - case 67: |
|
802 | - // get the lock remover |
|
803 | - include_once(includeFileProcessor("processors/remove_locks.processor.php",$manager_theme)); |
|
804 | - break; |
|
801 | + case 67: |
|
802 | + // get the lock remover |
|
803 | + include_once(includeFileProcessor("processors/remove_locks.processor.php",$manager_theme)); |
|
804 | + break; |
|
805 | 805 | /********************************************************************/ |
806 | 806 | /* Site schedule */ |
807 | 807 | /********************************************************************/ |
808 | - case 70: |
|
809 | - // get the schedule page |
|
810 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
811 | - include_once(includeFileProcessor("actions/site_schedule.static.php",$manager_theme)); |
|
812 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
813 | - break; |
|
808 | + case 70: |
|
809 | + // get the schedule page |
|
810 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
811 | + include_once(includeFileProcessor("actions/site_schedule.static.php",$manager_theme)); |
|
812 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
813 | + break; |
|
814 | 814 | /********************************************************************/ |
815 | 815 | /* Search */ |
816 | 816 | /********************************************************************/ |
817 | - case 71: |
|
818 | - // get the search page |
|
819 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
820 | - include_once(includeFileProcessor("actions/search.static.php",$manager_theme)); |
|
821 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
822 | - break; |
|
817 | + case 71: |
|
818 | + // get the search page |
|
819 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
820 | + include_once(includeFileProcessor("actions/search.static.php",$manager_theme)); |
|
821 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
822 | + break; |
|
823 | 823 | /********************************************************************/ |
824 | 824 | /* About */ |
825 | 825 | /********************************************************************/ |
826 | - case 59: |
|
827 | - // get the about page |
|
828 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
829 | - include_once(includeFileProcessor("actions/about.static.php",$manager_theme)); |
|
830 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
831 | - break; |
|
826 | + case 59: |
|
827 | + // get the about page |
|
828 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
829 | + include_once(includeFileProcessor("actions/about.static.php",$manager_theme)); |
|
830 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
831 | + break; |
|
832 | 832 | /********************************************************************/ |
833 | 833 | /* Add weblink */ |
834 | 834 | /********************************************************************/ |
835 | - case 72: |
|
836 | - // get the weblink page |
|
837 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
838 | - include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
839 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
840 | - break; |
|
835 | + case 72: |
|
836 | + // get the weblink page |
|
837 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
838 | + include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme)); |
|
839 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
840 | + break; |
|
841 | 841 | /********************************************************************/ |
842 | 842 | /* User management */ |
843 | 843 | /********************************************************************/ |
844 | - case 75: |
|
845 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
846 | - include_once(includeFileProcessor("actions/user_management.static.php",$manager_theme)); |
|
847 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
848 | - break; |
|
849 | - case 99: |
|
850 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
851 | - include_once(includeFileProcessor("actions/web_user_management.static.php",$manager_theme)); |
|
852 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
853 | - break; |
|
854 | - case 86: |
|
855 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
856 | - include_once(includeFileProcessor("actions/role_management.static.php",$manager_theme)); |
|
857 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
858 | - break; |
|
844 | + case 75: |
|
845 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
846 | + include_once(includeFileProcessor("actions/user_management.static.php",$manager_theme)); |
|
847 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
848 | + break; |
|
849 | + case 99: |
|
850 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
851 | + include_once(includeFileProcessor("actions/web_user_management.static.php",$manager_theme)); |
|
852 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
853 | + break; |
|
854 | + case 86: |
|
855 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
856 | + include_once(includeFileProcessor("actions/role_management.static.php",$manager_theme)); |
|
857 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
858 | + break; |
|
859 | 859 | /********************************************************************/ |
860 | 860 | /* template/ snippet management */ |
861 | 861 | /********************************************************************/ |
862 | - case 76: |
|
863 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
864 | - include_once(includeFileProcessor("actions/resources.static.php",$manager_theme)); |
|
865 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
866 | - break; |
|
862 | + case 76: |
|
863 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
864 | + include_once(includeFileProcessor("actions/resources.static.php",$manager_theme)); |
|
865 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
866 | + break; |
|
867 | 867 | /********************************************************************/ |
868 | 868 | /* Export to file */ |
869 | 869 | /********************************************************************/ |
870 | - case 83: |
|
871 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
872 | - include_once(includeFileProcessor("actions/export_site.static.php",$manager_theme)); |
|
873 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
874 | - break; |
|
870 | + case 83: |
|
871 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
872 | + include_once(includeFileProcessor("actions/export_site.static.php",$manager_theme)); |
|
873 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
874 | + break; |
|
875 | 875 | /********************************************************************/ |
876 | 876 | /* Resource Selector */ |
877 | 877 | /********************************************************************/ |
878 | - case 84: |
|
879 | - include_once(includeFileProcessor("actions/resource_selector.static.php",$manager_theme)); |
|
880 | - break; |
|
878 | + case 84: |
|
879 | + include_once(includeFileProcessor("actions/resource_selector.static.php",$manager_theme)); |
|
880 | + break; |
|
881 | 881 | /********************************************************************/ |
882 | 882 | /* Backup Manager */ |
883 | 883 | /********************************************************************/ |
884 | - case 93: |
|
885 | - # header and footer will be handled interally |
|
886 | - include_once(includeFileProcessor("actions/bkmanager.static.php",$manager_theme)); |
|
887 | - break; |
|
884 | + case 93: |
|
885 | + # header and footer will be handled interally |
|
886 | + include_once(includeFileProcessor("actions/bkmanager.static.php",$manager_theme)); |
|
887 | + break; |
|
888 | 888 | /********************************************************************/ |
889 | 889 | /* Duplicate Document */ |
890 | 890 | /********************************************************************/ |
891 | - case 94: |
|
892 | - // get the duplicate processor |
|
893 | - include_once(includeFileProcessor("processors/duplicate_content.processor.php",$manager_theme)); |
|
894 | - break; |
|
891 | + case 94: |
|
892 | + // get the duplicate processor |
|
893 | + include_once(includeFileProcessor("processors/duplicate_content.processor.php",$manager_theme)); |
|
894 | + break; |
|
895 | 895 | /********************************************************************/ |
896 | 896 | /* Import Document from file */ |
897 | 897 | /********************************************************************/ |
898 | - case 95: |
|
899 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
900 | - include_once(includeFileProcessor("actions/import_site.static.php",$manager_theme)); |
|
901 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
902 | - break; |
|
898 | + case 95: |
|
899 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
900 | + include_once(includeFileProcessor("actions/import_site.static.php",$manager_theme)); |
|
901 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
902 | + break; |
|
903 | 903 | /********************************************************************/ |
904 | 904 | /* Help */ |
905 | 905 | /********************************************************************/ |
906 | - case 9: |
|
907 | - // get the help page |
|
908 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
909 | - include_once(includeFileProcessor("actions/help.static.php",$manager_theme)); |
|
910 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
911 | - break; |
|
906 | + case 9: |
|
907 | + // get the help page |
|
908 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
909 | + include_once(includeFileProcessor("actions/help.static.php",$manager_theme)); |
|
910 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
911 | + break; |
|
912 | 912 | /********************************************************************/ |
913 | 913 | /* Template Variables - Based on Apodigm's Docvars */ |
914 | 914 | /********************************************************************/ |
915 | - case 300: |
|
916 | - // get the new document variable action |
|
917 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
918 | - include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme)); |
|
919 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
920 | - break; |
|
921 | - case 301: |
|
922 | - // get the edit document variable action |
|
923 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
924 | - include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme)); |
|
925 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
926 | - break; |
|
927 | - case 302: |
|
928 | - // get the save processor |
|
929 | - include_once(includeFileProcessor("processors/save_tmplvars.processor.php",$manager_theme)); |
|
930 | - break; |
|
931 | - case 303: |
|
932 | - // get the delete processor |
|
933 | - include_once(includeFileProcessor("processors/delete_tmplvars.processor.php",$manager_theme)); |
|
934 | - break; |
|
935 | - case 304: |
|
936 | - // get the duplicate processor |
|
937 | - include_once(includeFileProcessor("processors/duplicate_tmplvars.processor.php",$manager_theme)); |
|
938 | - break; |
|
939 | - case 305: |
|
940 | - // get the tv-rank action |
|
941 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
942 | - include_once(includeFileProcessor("actions/mutate_tv_rank.dynamic.php",$manager_theme)); |
|
943 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
944 | - break; |
|
915 | + case 300: |
|
916 | + // get the new document variable action |
|
917 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
918 | + include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme)); |
|
919 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
920 | + break; |
|
921 | + case 301: |
|
922 | + // get the edit document variable action |
|
923 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
924 | + include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme)); |
|
925 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
926 | + break; |
|
927 | + case 302: |
|
928 | + // get the save processor |
|
929 | + include_once(includeFileProcessor("processors/save_tmplvars.processor.php",$manager_theme)); |
|
930 | + break; |
|
931 | + case 303: |
|
932 | + // get the delete processor |
|
933 | + include_once(includeFileProcessor("processors/delete_tmplvars.processor.php",$manager_theme)); |
|
934 | + break; |
|
935 | + case 304: |
|
936 | + // get the duplicate processor |
|
937 | + include_once(includeFileProcessor("processors/duplicate_tmplvars.processor.php",$manager_theme)); |
|
938 | + break; |
|
939 | + case 305: |
|
940 | + // get the tv-rank action |
|
941 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
942 | + include_once(includeFileProcessor("actions/mutate_tv_rank.dynamic.php",$manager_theme)); |
|
943 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
944 | + break; |
|
945 | 945 | /********************************************************************/ |
946 | 946 | /* Event viewer: show event message log */ |
947 | 947 | /********************************************************************/ |
948 | - case 114: |
|
949 | - // get event logs |
|
950 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
951 | - include_once(includeFileProcessor("actions/eventlog.dynamic.php",$manager_theme)); |
|
952 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
953 | - break; |
|
954 | - case 115: |
|
955 | - // get event log details viewer |
|
956 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
957 | - include_once(includeFileProcessor("actions/eventlog_details.dynamic.php",$manager_theme)); |
|
958 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
959 | - break; |
|
960 | - case 116: |
|
961 | - // get the event log delete processor |
|
962 | - include_once(includeFileProcessor("processors/delete_eventlog.processor.php",$manager_theme)); |
|
963 | - break; |
|
964 | - |
|
965 | - case 501: |
|
966 | - //delete category |
|
967 | - include_once(includeFileProcessor("processors/delete_category.processor.php",$manager_theme)); |
|
968 | - break; |
|
948 | + case 114: |
|
949 | + // get event logs |
|
950 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
951 | + include_once(includeFileProcessor("actions/eventlog.dynamic.php",$manager_theme)); |
|
952 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
953 | + break; |
|
954 | + case 115: |
|
955 | + // get event log details viewer |
|
956 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
957 | + include_once(includeFileProcessor("actions/eventlog_details.dynamic.php",$manager_theme)); |
|
958 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
959 | + break; |
|
960 | + case 116: |
|
961 | + // get the event log delete processor |
|
962 | + include_once(includeFileProcessor("processors/delete_eventlog.processor.php",$manager_theme)); |
|
963 | + break; |
|
964 | + |
|
965 | + case 501: |
|
966 | + //delete category |
|
967 | + include_once(includeFileProcessor("processors/delete_category.processor.php",$manager_theme)); |
|
968 | + break; |
|
969 | 969 | /********************************************************************/ |
970 | 970 | /* default action: show not implemented message */ |
971 | 971 | /********************************************************************/ |
972 | - default : |
|
973 | - // say that what was requested doesn't do anything yet |
|
974 | - include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
975 | - echo " |
|
972 | + default : |
|
973 | + // say that what was requested doesn't do anything yet |
|
974 | + include_once(includeFileProcessor("includes/header.inc.php",$manager_theme)); |
|
975 | + echo " |
|
976 | 976 | <div class='sectionHeader'>".$_lang['functionnotimpl']."</div> |
977 | 977 | <div class='sectionBody'> |
978 | 978 | <p>".$_lang['functionnotimpl_message']."</p> |
979 | 979 | </div> |
980 | 980 | "; |
981 | - include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
981 | + include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme)); |
|
982 | 982 | } |
983 | 983 | |
984 | 984 | /********************************************************************/ |
985 | 985 | // log action, unless it's a frame request |
986 | 986 | if($action!=1 && $action!=7 && $action!=2) { |
987 | - include_once "log.class.inc.php"; |
|
988 | - $log = new logHandler; |
|
989 | - $log->initAndWriteLog(); |
|
987 | + include_once "log.class.inc.php"; |
|
988 | + $log = new logHandler; |
|
989 | + $log->initAndWriteLog(); |
|
990 | 990 | } |
991 | 991 | /********************************************************************/ |
992 | 992 | // show debug |
@@ -3,12 +3,12 @@ discard block |
||
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('delete_document')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /************ webber ********/ |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | $udperms->role = $_SESSION['mgrRole']; |
33 | 33 | |
34 | 34 | if(!$udperms->checkPermissions()) { |
35 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
35 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // get the timestamp on which the document was deleted. |
39 | 39 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
40 | 40 | $deltime = $modx->db->getValue($rs); |
41 | 41 | if(!$deltime) { |
42 | - $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
42 | + $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $children = array(); |
@@ -49,36 +49,36 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function getChildren($parent) { |
51 | 51 | |
52 | - $modx = evolutionCMS(); |
|
53 | - global $children; |
|
54 | - global $deltime; |
|
55 | - |
|
56 | - $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='".(int)$parent."' AND deleted=1 AND deletedon='".(int)$deltime."'"); |
|
57 | - // the document has children documents, we'll need to delete those too |
|
58 | - while ($row=$modx->db->getRow($rs)) { |
|
59 | - $children[] = $row['id']; |
|
60 | - getChildren($row['id']); |
|
61 | - //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
|
62 | - } |
|
52 | + $modx = evolutionCMS(); |
|
53 | + global $children; |
|
54 | + global $deltime; |
|
55 | + |
|
56 | + $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='".(int)$parent."' AND deleted=1 AND deletedon='".(int)$deltime."'"); |
|
57 | + // the document has children documents, we'll need to delete those too |
|
58 | + while ($row=$modx->db->getRow($rs)) { |
|
59 | + $children[] = $row['id']; |
|
60 | + getChildren($row['id']); |
|
61 | + //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
|
62 | + } |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | getChildren($id); |
66 | 66 | |
67 | 67 | if(count($children)>0) { |
68 | - $modx->db->update( |
|
69 | - array( |
|
70 | - 'deleted' => 0, |
|
71 | - 'deletedby' => 0, |
|
72 | - 'deletedon' => 0, |
|
73 | - ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
68 | + $modx->db->update( |
|
69 | + array( |
|
70 | + 'deleted' => 0, |
|
71 | + 'deletedby' => 0, |
|
72 | + 'deletedon' => 0, |
|
73 | + ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")"); |
|
74 | 74 | } |
75 | 75 | //'undelete' the document. |
76 | 76 | $modx->db->update( |
77 | - array( |
|
78 | - 'deleted' => 0, |
|
79 | - 'deletedby' => 0, |
|
80 | - 'deletedon' => 0, |
|
81 | - ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
77 | + array( |
|
78 | + 'deleted' => 0, |
|
79 | + 'deletedby' => 0, |
|
80 | + 'deletedon' => 0, |
|
81 | + ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
82 | 82 | |
83 | 83 | $modx->invokeEvent("OnDocFormUnDelete", |
84 | 84 | array( |
@@ -1,44 +1,44 @@ 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('delete_document')) { |
|
5 | +if (!$modx->hasPermission('delete_document')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | /************ webber ********/ |
15 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
15 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
17 | 17 | |
18 | 18 | /************** webber *************/ |
19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
22 | -$add_path=$sd.$sb.$pg; |
|
19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
22 | +$add_path = $sd.$sb.$pg; |
|
23 | 23 | |
24 | 24 | /***********************************/ |
25 | 25 | |
26 | 26 | |
27 | 27 | // check permissions on the document |
28 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
28 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
29 | 29 | $udperms = new udperms(); |
30 | 30 | $udperms->user = $modx->getLoginUserID(); |
31 | 31 | $udperms->document = $id; |
32 | 32 | $udperms->role = $_SESSION['mgrRole']; |
33 | 33 | |
34 | -if(!$udperms->checkPermissions()) { |
|
34 | +if (!$udperms->checkPermissions()) { |
|
35 | 35 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
36 | 36 | } |
37 | 37 | |
38 | 38 | // get the timestamp on which the document was deleted. |
39 | 39 | $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1"); |
40 | 40 | $deltime = $modx->db->getValue($rs); |
41 | -if(!$deltime) { |
|
41 | +if (!$deltime) { |
|
42 | 42 | $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!"); |
43 | 43 | } |
44 | 44 | |
@@ -47,15 +47,15 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * @param int $parent |
49 | 49 | */ |
50 | -function getChildren($parent) { |
|
50 | +function getChildren($parent){ |
|
51 | 51 | |
52 | 52 | $modx = evolutionCMS(); |
53 | 53 | global $children; |
54 | 54 | global $deltime; |
55 | 55 | |
56 | - $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='".(int)$parent."' AND deleted=1 AND deletedon='".(int)$deltime."'"); |
|
56 | + $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='".(int) $parent."' AND deleted=1 AND deletedon='".(int) $deltime."'"); |
|
57 | 57 | // the document has children documents, we'll need to delete those too |
58 | - while ($row=$modx->db->getRow($rs)) { |
|
58 | + while ($row = $modx->db->getRow($rs)) { |
|
59 | 59 | $children[] = $row['id']; |
60 | 60 | getChildren($row['id']); |
61 | 61 | //echo "Found childNode of parentNode $parent: ".$row['id']."<br />"; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | getChildren($id); |
66 | 66 | |
67 | -if(count($children)>0) { |
|
67 | +if (count($children) > 0) { |
|
68 | 68 | $modx->db->update( |
69 | 69 | array( |
70 | 70 | 'deleted' => 0, |
@@ -93,5 +93,5 @@ discard block |
||
93 | 93 | $modx->clearCache('full'); |
94 | 94 | |
95 | 95 | // finished emptying cache - redirect |
96 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
96 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
97 | 97 | header($header); |
@@ -47,7 +47,8 @@ |
||
47 | 47 | /** |
48 | 48 | * @param int $parent |
49 | 49 | */ |
50 | -function getChildren($parent) { |
|
50 | +function getChildren($parent) |
|
51 | +{ |
|
51 | 52 | |
52 | 53 | $modx = evolutionCMS(); |
53 | 54 | global $children; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
3 | - header('HTTP/1.0 404 Not Found'); |
|
4 | - exit('error'); |
|
3 | + header('HTTP/1.0 404 Not Found'); |
|
4 | + exit('error'); |
|
5 | 5 | } |
6 | 6 | define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
7 | 7 | define('MODX_API_MODE', true); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | include_once("{$core_path}lang/english.inc.php"); |
19 | 19 | |
20 | 20 | if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
21 | - include_once("{$core_path}lang/{$manager_language}.inc.php"); |
|
21 | + include_once("{$core_path}lang/{$manager_language}.inc.php"); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | // include the logger |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | // Initialize System Alert Message Queque |
28 | 28 | if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
29 | - $_SESSION['SystemAlertMsgQueque'] = array(); |
|
29 | + $_SESSION['SystemAlertMsgQueque'] = array(); |
|
30 | 30 | } |
31 | 31 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
32 | 32 | |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | |
42 | 42 | // invoke OnBeforeManagerLogin event |
43 | 43 | $modx->invokeEvent('OnBeforeManagerLogin', array( |
44 | - 'username' => $username, |
|
45 | - 'userpassword' => $givenPassword, |
|
46 | - 'rememberme' => $rememberme |
|
47 | - )); |
|
44 | + 'username' => $username, |
|
45 | + 'userpassword' => $givenPassword, |
|
46 | + 'rememberme' => $rememberme |
|
47 | + )); |
|
48 | 48 | $fields = 'mu.*, ua.*'; |
49 | 49 | $from = '[+prefix+]manager_users AS mu, [+prefix+]user_attributes AS ua'; |
50 | 50 | $where = "BINARY mu.username='{$username}' and ua.internalKey=mu.id"; |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | $limit = $modx->db->getRecordCount($rs); |
53 | 53 | |
54 | 54 | if($limit == 0 || $limit > 1) { |
55 | - jsAlert($_lang['login_processor_unknown_user']); |
|
56 | - return; |
|
55 | + jsAlert($_lang['login_processor_unknown_user']); |
|
56 | + return; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | $row = $modx->db->getRow($rs); |
@@ -74,127 +74,127 @@ discard block |
||
74 | 74 | // get the user settings from the database |
75 | 75 | $rs = $modx->db->select('setting_name, setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_value!=''"); |
76 | 76 | while($row = $modx->db->getRow($rs)) { |
77 | - extract($row); |
|
78 | - ${$setting_name} = $setting_value; |
|
77 | + extract($row); |
|
78 | + ${$setting_name} = $setting_value; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | // blocked due to number of login errors. |
82 | 82 | if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
83 | - @session_destroy(); |
|
84 | - session_unset(); |
|
85 | - if($cip = getenv("HTTP_CLIENT_IP")) { |
|
86 | - $ip = $cip; |
|
87 | - } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
88 | - $ip = $cip; |
|
89 | - } elseif($cip = getenv("REMOTE_ADDR")) { |
|
90 | - $ip = $cip; |
|
91 | - } else { |
|
92 | - $ip = "UNKNOWN"; |
|
93 | - } |
|
94 | - $log = new logHandler; |
|
95 | - $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
96 | - jsAlert($_lang['login_processor_many_failed_logins']); |
|
97 | - return; |
|
83 | + @session_destroy(); |
|
84 | + session_unset(); |
|
85 | + if($cip = getenv("HTTP_CLIENT_IP")) { |
|
86 | + $ip = $cip; |
|
87 | + } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
88 | + $ip = $cip; |
|
89 | + } elseif($cip = getenv("REMOTE_ADDR")) { |
|
90 | + $ip = $cip; |
|
91 | + } else { |
|
92 | + $ip = "UNKNOWN"; |
|
93 | + } |
|
94 | + $log = new logHandler; |
|
95 | + $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
96 | + jsAlert($_lang['login_processor_many_failed_logins']); |
|
97 | + return; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | // blocked due to number of login errors, but get to try again |
101 | 101 | if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
102 | - $fields = array(); |
|
103 | - $fields['failedlogincount'] = '0'; |
|
104 | - $fields['blockeduntil'] = time() - 1; |
|
105 | - $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
102 | + $fields = array(); |
|
103 | + $fields['failedlogincount'] = '0'; |
|
104 | + $fields['blockeduntil'] = time() - 1; |
|
105 | + $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | // this user has been blocked by an admin, so no way he's loggin in! |
109 | 109 | if($blocked == '1') { |
110 | - @session_destroy(); |
|
111 | - session_unset(); |
|
112 | - jsAlert($_lang['login_processor_blocked1']); |
|
113 | - return; |
|
110 | + @session_destroy(); |
|
111 | + session_unset(); |
|
112 | + jsAlert($_lang['login_processor_blocked1']); |
|
113 | + return; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | // blockuntil: this user has a block until date |
117 | 117 | if($blockeduntildate > time()) { |
118 | - @session_destroy(); |
|
119 | - session_unset(); |
|
120 | - jsAlert($_lang['login_processor_blocked2']); |
|
121 | - return; |
|
118 | + @session_destroy(); |
|
119 | + session_unset(); |
|
120 | + jsAlert($_lang['login_processor_blocked2']); |
|
121 | + return; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | // blockafter: this user has a block after date |
125 | 125 | if($blockedafterdate > 0 && $blockedafterdate < time()) { |
126 | - @session_destroy(); |
|
127 | - session_unset(); |
|
128 | - jsAlert($_lang['login_processor_blocked3']); |
|
129 | - return; |
|
126 | + @session_destroy(); |
|
127 | + session_unset(); |
|
128 | + jsAlert($_lang['login_processor_blocked3']); |
|
129 | + return; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | // allowed ip |
133 | 133 | if($allowed_ip) { |
134 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
135 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
136 | - jsAlert($_lang['login_processor_remotehost_ip']); |
|
137 | - return; |
|
138 | - } |
|
139 | - } |
|
140 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
141 | - jsAlert($_lang['login_processor_remote_ip']); |
|
142 | - return; |
|
143 | - } |
|
134 | + if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
135 | + if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
136 | + jsAlert($_lang['login_processor_remotehost_ip']); |
|
137 | + return; |
|
138 | + } |
|
139 | + } |
|
140 | + if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
141 | + jsAlert($_lang['login_processor_remote_ip']); |
|
142 | + return; |
|
143 | + } |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | // allowed days |
147 | 147 | if($allowed_days) { |
148 | - $date = getdate(); |
|
149 | - $day = $date['wday'] + 1; |
|
150 | - if(strpos($allowed_days, $day) === false) { |
|
151 | - jsAlert($_lang['login_processor_date']); |
|
152 | - return; |
|
153 | - } |
|
148 | + $date = getdate(); |
|
149 | + $day = $date['wday'] + 1; |
|
150 | + if(strpos($allowed_days, $day) === false) { |
|
151 | + jsAlert($_lang['login_processor_date']); |
|
152 | + return; |
|
153 | + } |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // invoke OnManagerAuthentication event |
157 | 157 | $rt = $modx->invokeEvent('OnManagerAuthentication', array( |
158 | - 'userid' => $internalKey, |
|
159 | - 'username' => $username, |
|
160 | - 'userpassword' => $givenPassword, |
|
161 | - 'savedpassword' => $dbasePassword, |
|
162 | - 'rememberme' => $rememberme |
|
163 | - )); |
|
158 | + 'userid' => $internalKey, |
|
159 | + 'username' => $username, |
|
160 | + 'userpassword' => $givenPassword, |
|
161 | + 'savedpassword' => $dbasePassword, |
|
162 | + 'rememberme' => $rememberme |
|
163 | + )); |
|
164 | 164 | |
165 | 165 | // check if plugin authenticated the user |
166 | 166 | $matchPassword = false; |
167 | 167 | if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
168 | - // check user password - local authentication |
|
169 | - $hashType = $modx->manager->getHashType($dbasePassword); |
|
170 | - if($hashType == 'phpass') { |
|
171 | - $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
|
172 | - } elseif($hashType == 'md5') { |
|
173 | - $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
174 | - } elseif($hashType == 'v1') { |
|
175 | - $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
176 | - } else { |
|
177 | - $matchPassword = false; |
|
178 | - } |
|
168 | + // check user password - local authentication |
|
169 | + $hashType = $modx->manager->getHashType($dbasePassword); |
|
170 | + if($hashType == 'phpass') { |
|
171 | + $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
|
172 | + } elseif($hashType == 'md5') { |
|
173 | + $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
174 | + } elseif($hashType == 'v1') { |
|
175 | + $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
|
176 | + } else { |
|
177 | + $matchPassword = false; |
|
178 | + } |
|
179 | 179 | } else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
180 | - $matchPassword = true; |
|
180 | + $matchPassword = true; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | if(!$matchPassword) { |
184 | - jsAlert($_lang['login_processor_wrong_password']); |
|
185 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
186 | - return; |
|
184 | + jsAlert($_lang['login_processor_wrong_password']); |
|
185 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
186 | + return; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | if($modx->config['use_captcha'] == 1) { |
190 | - if(!isset ($_SESSION['veriword'])) { |
|
191 | - jsAlert($_lang['login_processor_captcha_config']); |
|
192 | - return; |
|
193 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
194 | - jsAlert($_lang['login_processor_bad_code']); |
|
195 | - incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
196 | - return; |
|
197 | - } |
|
190 | + if(!isset ($_SESSION['veriword'])) { |
|
191 | + jsAlert($_lang['login_processor_captcha_config']); |
|
192 | + return; |
|
193 | + } elseif($_SESSION['veriword'] != $captcha_code) { |
|
194 | + jsAlert($_lang['login_processor_bad_code']); |
|
195 | + incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
|
196 | + return; |
|
197 | + } |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $modx->cleanupExpiredLocks(); |
@@ -229,36 +229,36 @@ discard block |
||
229 | 229 | $_SESSION['mgrToken'] = md5($currentsessionid); |
230 | 230 | |
231 | 231 | if($rememberme == '1') { |
232 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
233 | - |
|
234 | - // Set a cookie separate from the session cookie with the username in it. |
|
235 | - // Are we using secure connection? If so, make sure the cookie is secure |
|
236 | - global $https_port; |
|
237 | - |
|
238 | - $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
239 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
240 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
241 | - } else { |
|
242 | - setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
243 | - } |
|
232 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
233 | + |
|
234 | + // Set a cookie separate from the session cookie with the username in it. |
|
235 | + // Are we using secure connection? If so, make sure the cookie is secure |
|
236 | + global $https_port; |
|
237 | + |
|
238 | + $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
|
239 | + if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
240 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
|
241 | + } else { |
|
242 | + setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
|
243 | + } |
|
244 | 244 | } else { |
245 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
245 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = 0; |
|
246 | 246 | |
247 | - // Remove the Remember Me cookie |
|
248 | - setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
247 | + // Remove the Remember Me cookie |
|
248 | + setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | // Check if user already has an active session, if not check if user pressed logout end of last session |
252 | 252 | $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
253 | 253 | $activeSession = $modx->db->getValue($rs); |
254 | 254 | if(!$activeSession) { |
255 | - $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
256 | - if($lastHit = $modx->db->getValue($rs)) { |
|
257 | - $_SESSION['show_logout_reminder'] = array( |
|
258 | - 'type' => 'logout_reminder', |
|
259 | - 'lastHit' => $lastHit |
|
260 | - ); |
|
261 | - } |
|
255 | + $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
|
256 | + if($lastHit = $modx->db->getValue($rs)) { |
|
257 | + $_SESSION['show_logout_reminder'] = array( |
|
258 | + 'type' => 'logout_reminder', |
|
259 | + 'lastHit' => $lastHit |
|
260 | + ); |
|
261 | + } |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | $log = new logHandler; |
@@ -266,29 +266,29 @@ discard block |
||
266 | 266 | |
267 | 267 | // invoke OnManagerLogin event |
268 | 268 | $modx->invokeEvent('OnManagerLogin', array( |
269 | - 'userid' => $internalKey, |
|
270 | - 'username' => $username, |
|
271 | - 'userpassword' => $givenPassword, |
|
272 | - 'rememberme' => $rememberme |
|
273 | - )); |
|
269 | + 'userid' => $internalKey, |
|
270 | + 'username' => $username, |
|
271 | + 'userpassword' => $givenPassword, |
|
272 | + 'rememberme' => $rememberme |
|
273 | + )); |
|
274 | 274 | |
275 | 275 | // check if we should redirect user to a web page |
276 | 276 | $rs = $modx->db->select('setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_name='manager_login_startup'"); |
277 | 277 | $id = (int)$modx->db->getValue($rs); |
278 | 278 | if($id > 0) { |
279 | - $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
280 | - if($_POST['ajax'] == 1) { |
|
281 | - echo $header; |
|
282 | - } else { |
|
283 | - header($header); |
|
284 | - } |
|
279 | + $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
280 | + if($_POST['ajax'] == 1) { |
|
281 | + echo $header; |
|
282 | + } else { |
|
283 | + header($header); |
|
284 | + } |
|
285 | 285 | } else { |
286 | - $header = 'Location: ' . MODX_MANAGER_URL; |
|
287 | - if($_POST['ajax'] == 1) { |
|
288 | - echo $header; |
|
289 | - } else { |
|
290 | - header($header); |
|
291 | - } |
|
286 | + $header = 'Location: ' . MODX_MANAGER_URL; |
|
287 | + if($_POST['ajax'] == 1) { |
|
288 | + echo $header; |
|
289 | + } else { |
|
290 | + header($header); |
|
291 | + } |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -297,12 +297,12 @@ discard block |
||
297 | 297 | * @param string $msg |
298 | 298 | */ |
299 | 299 | function jsAlert($msg) { |
300 | - $modx = evolutionCMS(); |
|
301 | - if($_POST['ajax'] != 1) { |
|
302 | - echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>"; |
|
303 | - } else { |
|
304 | - echo $msg . "\n"; |
|
305 | - } |
|
300 | + $modx = evolutionCMS(); |
|
301 | + if($_POST['ajax'] != 1) { |
|
302 | + echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>"; |
|
303 | + } else { |
|
304 | + echo $msg . "\n"; |
|
305 | + } |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | * @return bool |
313 | 313 | */ |
314 | 314 | function login($username, $givenPassword, $dbasePassword) { |
315 | - $modx = evolutionCMS(); |
|
316 | - return $modx->phpass->CheckPassword($givenPassword, $dbasePassword); |
|
315 | + $modx = evolutionCMS(); |
|
316 | + return $modx->phpass->CheckPassword($givenPassword, $dbasePassword); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -324,26 +324,26 @@ discard block |
||
324 | 324 | * @return bool |
325 | 325 | */ |
326 | 326 | function loginV1($internalKey, $givenPassword, $dbasePassword, $username) { |
327 | - $modx = evolutionCMS(); |
|
327 | + $modx = evolutionCMS(); |
|
328 | 328 | |
329 | - $user_algo = $modx->manager->getV1UserHashAlgorithm($internalKey); |
|
329 | + $user_algo = $modx->manager->getV1UserHashAlgorithm($internalKey); |
|
330 | 330 | |
331 | - if(!isset($modx->config['pwd_hash_algo']) || empty($modx->config['pwd_hash_algo'])) { |
|
332 | - $modx->config['pwd_hash_algo'] = 'UNCRYPT'; |
|
333 | - } |
|
331 | + if(!isset($modx->config['pwd_hash_algo']) || empty($modx->config['pwd_hash_algo'])) { |
|
332 | + $modx->config['pwd_hash_algo'] = 'UNCRYPT'; |
|
333 | + } |
|
334 | 334 | |
335 | - if($user_algo !== $modx->config['pwd_hash_algo']) { |
|
336 | - $bk_pwd_hash_algo = $modx->config['pwd_hash_algo']; |
|
337 | - $modx->config['pwd_hash_algo'] = $user_algo; |
|
338 | - } |
|
335 | + if($user_algo !== $modx->config['pwd_hash_algo']) { |
|
336 | + $bk_pwd_hash_algo = $modx->config['pwd_hash_algo']; |
|
337 | + $modx->config['pwd_hash_algo'] = $user_algo; |
|
338 | + } |
|
339 | 339 | |
340 | - if($dbasePassword != $modx->manager->genV1Hash($givenPassword, $internalKey)) { |
|
341 | - return false; |
|
342 | - } |
|
340 | + if($dbasePassword != $modx->manager->genV1Hash($givenPassword, $internalKey)) { |
|
341 | + return false; |
|
342 | + } |
|
343 | 343 | |
344 | - updateNewHash($username, $givenPassword); |
|
344 | + updateNewHash($username, $givenPassword); |
|
345 | 345 | |
346 | - return true; |
|
346 | + return true; |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | /** |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | * @return bool |
355 | 355 | */ |
356 | 356 | function loginMD5($internalKey, $givenPassword, $dbasePassword, $username) { |
357 | - $modx = evolutionCMS(); |
|
357 | + $modx = evolutionCMS(); |
|
358 | 358 | |
359 | - if($dbasePassword != md5($givenPassword)) { |
|
360 | - return false; |
|
361 | - } |
|
362 | - updateNewHash($username, $givenPassword); |
|
363 | - return true; |
|
359 | + if($dbasePassword != md5($givenPassword)) { |
|
360 | + return false; |
|
361 | + } |
|
362 | + updateNewHash($username, $givenPassword); |
|
363 | + return true; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
@@ -368,11 +368,11 @@ discard block |
||
368 | 368 | * @param string $password |
369 | 369 | */ |
370 | 370 | function updateNewHash($username, $password) { |
371 | - $modx = evolutionCMS(); |
|
371 | + $modx = evolutionCMS(); |
|
372 | 372 | |
373 | - $field = array(); |
|
374 | - $field['password'] = $modx->phpass->HashPassword($password); |
|
375 | - $modx->db->update($field, '[+prefix+]manager_users', "username='{$username}'"); |
|
373 | + $field = array(); |
|
374 | + $field['password'] = $modx->phpass->HashPassword($password); |
|
375 | + $modx->db->update($field, '[+prefix+]manager_users', "username='{$username}'"); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | /** |
@@ -382,27 +382,27 @@ discard block |
||
382 | 382 | * @param int $blocked_minutes |
383 | 383 | */ |
384 | 384 | function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes) { |
385 | - $modx = evolutionCMS(); |
|
386 | - |
|
387 | - $failedlogins += 1; |
|
388 | - |
|
389 | - $fields = array('failedlogincount' => $failedlogins); |
|
390 | - if($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
391 | - { |
|
392 | - $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
|
393 | - } |
|
394 | - |
|
395 | - $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
396 | - |
|
397 | - if($failedlogins < $failed_allowed) { |
|
398 | - //sleep to help prevent brute force attacks |
|
399 | - $sleep = (int) $failedlogins / 2; |
|
400 | - if($sleep > 5) { |
|
401 | - $sleep = 5; |
|
402 | - } |
|
403 | - sleep($sleep); |
|
404 | - } |
|
405 | - @session_destroy(); |
|
406 | - session_unset(); |
|
407 | - return; |
|
385 | + $modx = evolutionCMS(); |
|
386 | + |
|
387 | + $failedlogins += 1; |
|
388 | + |
|
389 | + $fields = array('failedlogincount' => $failedlogins); |
|
390 | + if($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
391 | + { |
|
392 | + $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
|
393 | + } |
|
394 | + |
|
395 | + $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
396 | + |
|
397 | + if($failedlogins < $failed_allowed) { |
|
398 | + //sleep to help prevent brute force attacks |
|
399 | + $sleep = (int) $failedlogins / 2; |
|
400 | + if($sleep > 5) { |
|
401 | + $sleep = 5; |
|
402 | + } |
|
403 | + sleep($sleep); |
|
404 | + } |
|
405 | + @session_destroy(); |
|
406 | + session_unset(); |
|
407 | + return; |
|
408 | 408 | } |
@@ -1,23 +1,23 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
2 | +if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
3 | 3 | header('HTTP/1.0 404 Not Found'); |
4 | 4 | exit('error'); |
5 | 5 | } |
6 | -define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
|
6 | +define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through |
|
7 | 7 | define('MODX_API_MODE', true); |
8 | -include_once(__DIR__ . '/../../index.php'); |
|
8 | +include_once(__DIR__.'/../../index.php'); |
|
9 | 9 | $modx->db->connect(); |
10 | 10 | $modx->getSettings(); |
11 | 11 | $modx->invokeEvent('OnManagerPageInit'); |
12 | 12 | $modx->loadExtension('ManagerAPI'); |
13 | 13 | $modx->loadExtension('phpass'); |
14 | 14 | |
15 | -$core_path = MODX_MANAGER_PATH . 'includes/'; |
|
15 | +$core_path = MODX_MANAGER_PATH.'includes/'; |
|
16 | 16 | // include_once the language file |
17 | 17 | $_lang = array(); |
18 | 18 | include_once("{$core_path}lang/english.inc.php"); |
19 | 19 | |
20 | -if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
|
20 | +if ($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) { |
|
21 | 21 | include_once("{$core_path}lang/{$manager_language}.inc.php"); |
22 | 22 | } |
23 | 23 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | include_once("{$core_path}log.class.inc.php"); |
26 | 26 | |
27 | 27 | // Initialize System Alert Message Queque |
28 | -if(!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
28 | +if (!isset($_SESSION['SystemAlertMsgQueque'])) { |
|
29 | 29 | $_SESSION['SystemAlertMsgQueque'] = array(); |
30 | 30 | } |
31 | 31 | $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque']; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $rs = $modx->db->select($fields, $from, $where); |
52 | 52 | $limit = $modx->db->getRecordCount($rs); |
53 | 53 | |
54 | -if($limit == 0 || $limit > 1) { |
|
54 | +if ($limit == 0 || $limit > 1) { |
|
55 | 55 | jsAlert($_lang['login_processor_unknown_user']); |
56 | 56 | return; |
57 | 57 | } |
@@ -73,32 +73,32 @@ discard block |
||
73 | 73 | |
74 | 74 | // get the user settings from the database |
75 | 75 | $rs = $modx->db->select('setting_name, setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_value!=''"); |
76 | -while($row = $modx->db->getRow($rs)) { |
|
76 | +while ($row = $modx->db->getRow($rs)) { |
|
77 | 77 | extract($row); |
78 | 78 | ${$setting_name} = $setting_value; |
79 | 79 | } |
80 | 80 | |
81 | 81 | // blocked due to number of login errors. |
82 | -if($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
|
82 | +if ($failedlogins >= $failed_allowed && $blockeduntildate > time()) { |
|
83 | 83 | @session_destroy(); |
84 | 84 | session_unset(); |
85 | - if($cip = getenv("HTTP_CLIENT_IP")) { |
|
85 | + if ($cip = getenv("HTTP_CLIENT_IP")) { |
|
86 | 86 | $ip = $cip; |
87 | - } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
87 | + } elseif ($cip = getenv("HTTP_X_FORWARDED_FOR")) { |
|
88 | 88 | $ip = $cip; |
89 | - } elseif($cip = getenv("REMOTE_ADDR")) { |
|
89 | + } elseif ($cip = getenv("REMOTE_ADDR")) { |
|
90 | 90 | $ip = $cip; |
91 | 91 | } else { |
92 | 92 | $ip = "UNKNOWN"; |
93 | 93 | } |
94 | 94 | $log = new logHandler; |
95 | - $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip); |
|
95 | + $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: ".$ip); |
|
96 | 96 | jsAlert($_lang['login_processor_many_failed_logins']); |
97 | 97 | return; |
98 | 98 | } |
99 | 99 | |
100 | 100 | // blocked due to number of login errors, but get to try again |
101 | -if($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
|
101 | +if ($failedlogins >= $failed_allowed && $blockeduntildate < time()) { |
|
102 | 102 | $fields = array(); |
103 | 103 | $fields['failedlogincount'] = '0'; |
104 | 104 | $fields['blockeduntil'] = time() - 1; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | // this user has been blocked by an admin, so no way he's loggin in! |
109 | -if($blocked == '1') { |
|
109 | +if ($blocked == '1') { |
|
110 | 110 | @session_destroy(); |
111 | 111 | session_unset(); |
112 | 112 | jsAlert($_lang['login_processor_blocked1']); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | // blockuntil: this user has a block until date |
117 | -if($blockeduntildate > time()) { |
|
117 | +if ($blockeduntildate > time()) { |
|
118 | 118 | @session_destroy(); |
119 | 119 | session_unset(); |
120 | 120 | jsAlert($_lang['login_processor_blocked2']); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | // blockafter: this user has a block after date |
125 | -if($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
125 | +if ($blockedafterdate > 0 && $blockedafterdate < time()) { |
|
126 | 126 | @session_destroy(); |
127 | 127 | session_unset(); |
128 | 128 | jsAlert($_lang['login_processor_blocked3']); |
@@ -130,24 +130,24 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | // allowed ip |
133 | -if($allowed_ip) { |
|
134 | - if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
135 | - if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
133 | +if ($allowed_ip) { |
|
134 | + if (($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) { |
|
135 | + if (gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) { |
|
136 | 136 | jsAlert($_lang['login_processor_remotehost_ip']); |
137 | 137 | return; |
138 | 138 | } |
139 | 139 | } |
140 | - if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
140 | + if (!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) { |
|
141 | 141 | jsAlert($_lang['login_processor_remote_ip']); |
142 | 142 | return; |
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | 146 | // allowed days |
147 | -if($allowed_days) { |
|
147 | +if ($allowed_days) { |
|
148 | 148 | $date = getdate(); |
149 | 149 | $day = $date['wday'] + 1; |
150 | - if(strpos($allowed_days, $day) === false) { |
|
150 | + if (strpos($allowed_days, $day) === false) { |
|
151 | 151 | jsAlert($_lang['login_processor_date']); |
152 | 152 | return; |
153 | 153 | } |
@@ -164,33 +164,33 @@ discard block |
||
164 | 164 | |
165 | 165 | // check if plugin authenticated the user |
166 | 166 | $matchPassword = false; |
167 | -if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
167 | +if (!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) { |
|
168 | 168 | // check user password - local authentication |
169 | 169 | $hashType = $modx->manager->getHashType($dbasePassword); |
170 | - if($hashType == 'phpass') { |
|
170 | + if ($hashType == 'phpass') { |
|
171 | 171 | $matchPassword = login($username, $_REQUEST['password'], $dbasePassword); |
172 | - } elseif($hashType == 'md5') { |
|
172 | + } elseif ($hashType == 'md5') { |
|
173 | 173 | $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
174 | - } elseif($hashType == 'v1') { |
|
174 | + } elseif ($hashType == 'v1') { |
|
175 | 175 | $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username); |
176 | 176 | } else { |
177 | 177 | $matchPassword = false; |
178 | 178 | } |
179 | -} else if($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
179 | +} else if ($rt === true || (is_array($rt) && in_array(true, $rt))) { |
|
180 | 180 | $matchPassword = true; |
181 | 181 | } |
182 | 182 | |
183 | -if(!$matchPassword) { |
|
183 | +if (!$matchPassword) { |
|
184 | 184 | jsAlert($_lang['login_processor_wrong_password']); |
185 | 185 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
186 | 186 | return; |
187 | 187 | } |
188 | 188 | |
189 | -if($modx->config['use_captcha'] == 1) { |
|
190 | - if(!isset ($_SESSION['veriword'])) { |
|
189 | +if ($modx->config['use_captcha'] == 1) { |
|
190 | + if (!isset ($_SESSION['veriword'])) { |
|
191 | 191 | jsAlert($_lang['login_processor_captcha_config']); |
192 | 192 | return; |
193 | - } elseif($_SESSION['veriword'] != $captcha_code) { |
|
193 | + } elseif ($_SESSION['veriword'] != $captcha_code) { |
|
194 | 194 | jsAlert($_lang['login_processor_bad_code']); |
195 | 195 | incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes); |
196 | 196 | return; |
@@ -218,25 +218,25 @@ discard block |
||
218 | 218 | $_SESSION['mgrPermissions'] = $modx->db->getRow($rs); |
219 | 219 | |
220 | 220 | // successful login so reset fail count and update key values |
221 | -$modx->db->update('failedlogincount=0, ' . 'logincount=logincount+1, ' . 'lastlogin=thislogin, ' . 'thislogin=' . time() . ', ' . "sessionid='{$currentsessionid}'", '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
221 | +$modx->db->update('failedlogincount=0, '.'logincount=logincount+1, '.'lastlogin=thislogin, '.'thislogin='.time().', '."sessionid='{$currentsessionid}'", '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
|
222 | 222 | |
223 | 223 | // get user's document groups |
224 | 224 | $i = 0; |
225 | -$rs = $modx->db->select('uga.documentgroup', $modx->getFullTableName('member_groups') . ' ug |
|
226 | - INNER JOIN ' . $modx->getFullTableName('membergroup_access') . ' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'"); |
|
225 | +$rs = $modx->db->select('uga.documentgroup', $modx->getFullTableName('member_groups').' ug |
|
226 | + INNER JOIN ' . $modx->getFullTableName('membergroup_access').' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'"); |
|
227 | 227 | $_SESSION['mgrDocgroups'] = $modx->db->getColumn('documentgroup', $rs); |
228 | 228 | |
229 | 229 | $_SESSION['mgrToken'] = md5($currentsessionid); |
230 | 230 | |
231 | -if($rememberme == '1') { |
|
232 | - $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime']; |
|
231 | +if ($rememberme == '1') { |
|
232 | + $_SESSION['modx.mgr.session.cookie.lifetime'] = (int) $modx->config['session.cookie.lifetime']; |
|
233 | 233 | |
234 | 234 | // Set a cookie separate from the session cookie with the username in it. |
235 | 235 | // Are we using secure connection? If so, make sure the cookie is secure |
236 | 236 | global $https_port; |
237 | 237 | |
238 | 238 | $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
239 | - if(version_compare(PHP_VERSION, '5.2', '<')) { |
|
239 | + if (version_compare(PHP_VERSION, '5.2', '<')) { |
|
240 | 240 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure); |
241 | 241 | } else { |
242 | 242 | setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true); |
@@ -251,9 +251,9 @@ discard block |
||
251 | 251 | // Check if user already has an active session, if not check if user pressed logout end of last session |
252 | 252 | $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'"); |
253 | 253 | $activeSession = $modx->db->getValue($rs); |
254 | -if(!$activeSession) { |
|
254 | +if (!$activeSession) { |
|
255 | 255 | $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8"); |
256 | - if($lastHit = $modx->db->getValue($rs)) { |
|
256 | + if ($lastHit = $modx->db->getValue($rs)) { |
|
257 | 257 | $_SESSION['show_logout_reminder'] = array( |
258 | 258 | 'type' => 'logout_reminder', |
259 | 259 | 'lastHit' => $lastHit |
@@ -274,17 +274,17 @@ discard block |
||
274 | 274 | |
275 | 275 | // check if we should redirect user to a web page |
276 | 276 | $rs = $modx->db->select('setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_name='manager_login_startup'"); |
277 | -$id = (int)$modx->db->getValue($rs); |
|
278 | -if($id > 0) { |
|
279 | - $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full'); |
|
280 | - if($_POST['ajax'] == 1) { |
|
277 | +$id = (int) $modx->db->getValue($rs); |
|
278 | +if ($id > 0) { |
|
279 | + $header = 'Location: '.$modx->makeUrl($id, '', '', 'full'); |
|
280 | + if ($_POST['ajax'] == 1) { |
|
281 | 281 | echo $header; |
282 | 282 | } else { |
283 | 283 | header($header); |
284 | 284 | } |
285 | 285 | } else { |
286 | - $header = 'Location: ' . MODX_MANAGER_URL; |
|
287 | - if($_POST['ajax'] == 1) { |
|
286 | + $header = 'Location: '.MODX_MANAGER_URL; |
|
287 | + if ($_POST['ajax'] == 1) { |
|
288 | 288 | echo $header; |
289 | 289 | } else { |
290 | 290 | header($header); |
@@ -296,12 +296,12 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @param string $msg |
298 | 298 | */ |
299 | -function jsAlert($msg) { |
|
299 | +function jsAlert($msg){ |
|
300 | 300 | $modx = evolutionCMS(); |
301 | - if($_POST['ajax'] != 1) { |
|
302 | - echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>"; |
|
301 | + if ($_POST['ajax'] != 1) { |
|
302 | + echo "<script>window.setTimeout(\"alert('".addslashes($modx->db->escape($msg))."')\",10);history.go(-1)</script>"; |
|
303 | 303 | } else { |
304 | - echo $msg . "\n"; |
|
304 | + echo $msg."\n"; |
|
305 | 305 | } |
306 | 306 | } |
307 | 307 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | * @param string $dbasePassword |
312 | 312 | * @return bool |
313 | 313 | */ |
314 | -function login($username, $givenPassword, $dbasePassword) { |
|
314 | +function login($username, $givenPassword, $dbasePassword){ |
|
315 | 315 | $modx = evolutionCMS(); |
316 | 316 | return $modx->phpass->CheckPassword($givenPassword, $dbasePassword); |
317 | 317 | } |
@@ -323,21 +323,21 @@ discard block |
||
323 | 323 | * @param string $username |
324 | 324 | * @return bool |
325 | 325 | */ |
326 | -function loginV1($internalKey, $givenPassword, $dbasePassword, $username) { |
|
326 | +function loginV1($internalKey, $givenPassword, $dbasePassword, $username){ |
|
327 | 327 | $modx = evolutionCMS(); |
328 | 328 | |
329 | 329 | $user_algo = $modx->manager->getV1UserHashAlgorithm($internalKey); |
330 | 330 | |
331 | - if(!isset($modx->config['pwd_hash_algo']) || empty($modx->config['pwd_hash_algo'])) { |
|
331 | + if (!isset($modx->config['pwd_hash_algo']) || empty($modx->config['pwd_hash_algo'])) { |
|
332 | 332 | $modx->config['pwd_hash_algo'] = 'UNCRYPT'; |
333 | 333 | } |
334 | 334 | |
335 | - if($user_algo !== $modx->config['pwd_hash_algo']) { |
|
335 | + if ($user_algo !== $modx->config['pwd_hash_algo']) { |
|
336 | 336 | $bk_pwd_hash_algo = $modx->config['pwd_hash_algo']; |
337 | 337 | $modx->config['pwd_hash_algo'] = $user_algo; |
338 | 338 | } |
339 | 339 | |
340 | - if($dbasePassword != $modx->manager->genV1Hash($givenPassword, $internalKey)) { |
|
340 | + if ($dbasePassword != $modx->manager->genV1Hash($givenPassword, $internalKey)) { |
|
341 | 341 | return false; |
342 | 342 | } |
343 | 343 | |
@@ -353,10 +353,10 @@ discard block |
||
353 | 353 | * @param string $username |
354 | 354 | * @return bool |
355 | 355 | */ |
356 | -function loginMD5($internalKey, $givenPassword, $dbasePassword, $username) { |
|
356 | +function loginMD5($internalKey, $givenPassword, $dbasePassword, $username){ |
|
357 | 357 | $modx = evolutionCMS(); |
358 | 358 | |
359 | - if($dbasePassword != md5($givenPassword)) { |
|
359 | + if ($dbasePassword != md5($givenPassword)) { |
|
360 | 360 | return false; |
361 | 361 | } |
362 | 362 | updateNewHash($username, $givenPassword); |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | * @param string $username |
368 | 368 | * @param string $password |
369 | 369 | */ |
370 | -function updateNewHash($username, $password) { |
|
370 | +function updateNewHash($username, $password){ |
|
371 | 371 | $modx = evolutionCMS(); |
372 | 372 | |
373 | 373 | $field = array(); |
@@ -381,23 +381,23 @@ discard block |
||
381 | 381 | * @param int $failed_allowed |
382 | 382 | * @param int $blocked_minutes |
383 | 383 | */ |
384 | -function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes) { |
|
384 | +function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes){ |
|
385 | 385 | $modx = evolutionCMS(); |
386 | 386 | |
387 | 387 | $failedlogins += 1; |
388 | 388 | |
389 | 389 | $fields = array('failedlogincount' => $failedlogins); |
390 | - if($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
390 | + if ($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
391 | 391 | { |
392 | 392 | $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
393 | 393 | } |
394 | 394 | |
395 | 395 | $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
396 | 396 | |
397 | - if($failedlogins < $failed_allowed) { |
|
397 | + if ($failedlogins < $failed_allowed) { |
|
398 | 398 | //sleep to help prevent brute force attacks |
399 | 399 | $sleep = (int) $failedlogins / 2; |
400 | - if($sleep > 5) { |
|
400 | + if ($sleep > 5) { |
|
401 | 401 | $sleep = 5; |
402 | 402 | } |
403 | 403 | sleep($sleep); |
@@ -296,7 +296,8 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @param string $msg |
298 | 298 | */ |
299 | -function jsAlert($msg) { |
|
299 | +function jsAlert($msg) |
|
300 | +{ |
|
300 | 301 | $modx = evolutionCMS(); |
301 | 302 | if($_POST['ajax'] != 1) { |
302 | 303 | echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>"; |
@@ -311,7 +312,8 @@ discard block |
||
311 | 312 | * @param string $dbasePassword |
312 | 313 | * @return bool |
313 | 314 | */ |
314 | -function login($username, $givenPassword, $dbasePassword) { |
|
315 | +function login($username, $givenPassword, $dbasePassword) |
|
316 | +{ |
|
315 | 317 | $modx = evolutionCMS(); |
316 | 318 | return $modx->phpass->CheckPassword($givenPassword, $dbasePassword); |
317 | 319 | } |
@@ -323,7 +325,8 @@ discard block |
||
323 | 325 | * @param string $username |
324 | 326 | * @return bool |
325 | 327 | */ |
326 | -function loginV1($internalKey, $givenPassword, $dbasePassword, $username) { |
|
328 | +function loginV1($internalKey, $givenPassword, $dbasePassword, $username) |
|
329 | +{ |
|
327 | 330 | $modx = evolutionCMS(); |
328 | 331 | |
329 | 332 | $user_algo = $modx->manager->getV1UserHashAlgorithm($internalKey); |
@@ -353,7 +356,8 @@ discard block |
||
353 | 356 | * @param string $username |
354 | 357 | * @return bool |
355 | 358 | */ |
356 | -function loginMD5($internalKey, $givenPassword, $dbasePassword, $username) { |
|
359 | +function loginMD5($internalKey, $givenPassword, $dbasePassword, $username) |
|
360 | +{ |
|
357 | 361 | $modx = evolutionCMS(); |
358 | 362 | |
359 | 363 | if($dbasePassword != md5($givenPassword)) { |
@@ -367,7 +371,8 @@ discard block |
||
367 | 371 | * @param string $username |
368 | 372 | * @param string $password |
369 | 373 | */ |
370 | -function updateNewHash($username, $password) { |
|
374 | +function updateNewHash($username, $password) |
|
375 | +{ |
|
371 | 376 | $modx = evolutionCMS(); |
372 | 377 | |
373 | 378 | $field = array(); |
@@ -381,16 +386,19 @@ discard block |
||
381 | 386 | * @param int $failed_allowed |
382 | 387 | * @param int $blocked_minutes |
383 | 388 | */ |
384 | -function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes) { |
|
389 | +function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes) |
|
390 | +{ |
|
385 | 391 | $modx = evolutionCMS(); |
386 | 392 | |
387 | 393 | $failedlogins += 1; |
388 | 394 | |
389 | 395 | $fields = array('failedlogincount' => $failedlogins); |
390 | - if($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
396 | + if($failedlogins >= $failed_allowed) { |
|
397 | + //block user for too many fail attempts |
|
391 | 398 | { |
392 | 399 | $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
393 | 400 | } |
401 | + } |
|
394 | 402 | |
395 | 403 | $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
396 | 404 |
@@ -1,9 +1,9 @@ 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 | if(!$modx->hasPermission('save_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $modx->loadExtension('phpass'); |
@@ -45,134 +45,134 @@ discard block |
||
45 | 45 | |
46 | 46 | // verify password |
47 | 47 | if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
48 | - webAlertAndQuit("Password typed is mismatched"); |
|
48 | + webAlertAndQuit("Password typed is mismatched"); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // verify email |
52 | 52 | if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
53 | - webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
|
53 | + webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // verify admin security |
57 | 57 | if($_SESSION['mgrRole'] != 1) { |
58 | - // Check to see if user tried to spoof a "1" (admin) role |
|
59 | - if(!$modx->hasPermission('save_role')) { |
|
60 | - webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!"); |
|
61 | - } |
|
62 | - // Verify that the user being edited wasn't an admin and the user ID got spoofed |
|
63 | - $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1"); |
|
64 | - $limit = $modx->db->getValue($rs); |
|
65 | - if($limit > 0) { |
|
66 | - webAlertAndQuit("You cannot alter an administrative user."); |
|
67 | - } |
|
58 | + // Check to see if user tried to spoof a "1" (admin) role |
|
59 | + if(!$modx->hasPermission('save_role')) { |
|
60 | + webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!"); |
|
61 | + } |
|
62 | + // Verify that the user being edited wasn't an admin and the user ID got spoofed |
|
63 | + $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1"); |
|
64 | + $limit = $modx->db->getValue($rs); |
|
65 | + if($limit > 0) { |
|
66 | + webAlertAndQuit("You cannot alter an administrative user."); |
|
67 | + } |
|
68 | 68 | |
69 | 69 | } |
70 | 70 | |
71 | 71 | switch($input['mode']) { |
72 | - case '11' : // new user |
|
73 | - // check if this user name already exist |
|
74 | - $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername))); |
|
75 | - $limit = $modx->db->getValue($rs); |
|
76 | - if($limit > 0) { |
|
77 | - webAlertAndQuit("User name is already in use!"); |
|
78 | - } |
|
79 | - |
|
80 | - // check if the email address already exist |
|
81 | - $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id)); |
|
82 | - $limit = $modx->db->getValue($rs); |
|
83 | - if($limit > 0) { |
|
84 | - webAlertAndQuit("Email is already in use!"); |
|
85 | - } |
|
86 | - |
|
87 | - // generate a new password for this user |
|
88 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
89 | - if(strlen($specifiedpassword) < 6) { |
|
90 | - webAlertAndQuit("Password is too short!"); |
|
91 | - } else { |
|
92 | - $newpassword = $specifiedpassword; |
|
93 | - } |
|
94 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
95 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
96 | - } elseif($passwordgenmethod == 'g') { |
|
97 | - $newpassword = generate_password(8); |
|
98 | - } else { |
|
99 | - webAlertAndQuit("No password generation method specified!"); |
|
100 | - } |
|
101 | - |
|
102 | - // invoke OnBeforeUserFormSave event |
|
103 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
104 | - "mode" => "new", |
|
105 | - )); |
|
106 | - |
|
107 | - // create the user account |
|
108 | - $internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users); |
|
109 | - |
|
110 | - $field = array(); |
|
111 | - $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
112 | - $modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
113 | - |
|
114 | - $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
115 | - $field = $modx->db->escape($field); |
|
116 | - $modx->db->insert($field, $tbl_user_attributes); |
|
117 | - |
|
118 | - // Save user settings |
|
119 | - saveUserSettings($internalKey); |
|
120 | - |
|
121 | - // invoke OnManagerSaveUser event |
|
122 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
123 | - "mode" => "new", |
|
124 | - "userid" => $internalKey, |
|
125 | - "username" => $newusername, |
|
126 | - "userpassword" => $newpassword, |
|
127 | - "useremail" => $email, |
|
128 | - "userfullname" => $fullname, |
|
129 | - "userroleid" => $role |
|
130 | - )); |
|
131 | - |
|
132 | - // invoke OnUserFormSave event |
|
133 | - $modx->invokeEvent("OnUserFormSave", array( |
|
134 | - "mode" => "new", |
|
135 | - "id" => $internalKey |
|
136 | - )); |
|
137 | - |
|
138 | - // Set the item name for logger |
|
139 | - $_SESSION['itemname'] = $newusername; |
|
140 | - |
|
141 | - /*******************************************************************************/ |
|
142 | - // put the user in the user_groups he/ she should be in |
|
143 | - // first, check that up_perms are switched on! |
|
144 | - if($use_udperms == 1) { |
|
145 | - if(!empty($user_groups)) { |
|
146 | - for($i = 0; $i < count($user_groups); $i++) { |
|
147 | - $f = array(); |
|
148 | - $f['user_group'] = (int)$user_groups[$i]; |
|
149 | - $f['member'] = $internalKey; |
|
150 | - $modx->db->insert($f, $tbl_member_groups); |
|
151 | - } |
|
152 | - } |
|
153 | - } |
|
154 | - // end of user_groups stuff! |
|
155 | - |
|
156 | - if($passwordnotifymethod == 'e') { |
|
157 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
158 | - if($input['stay'] != '') { |
|
159 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
160 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | - header($header); |
|
162 | - } else { |
|
163 | - $header = "Location: index.php?a=75&r=2"; |
|
164 | - header($header); |
|
165 | - } |
|
166 | - } else { |
|
167 | - if($input['stay'] != '') { |
|
168 | - $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
169 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
170 | - } else { |
|
171 | - $stayUrl = "index.php?a=75&r=2"; |
|
172 | - } |
|
173 | - |
|
174 | - include_once "header.inc.php"; |
|
175 | - ?> |
|
72 | + case '11' : // new user |
|
73 | + // check if this user name already exist |
|
74 | + $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername))); |
|
75 | + $limit = $modx->db->getValue($rs); |
|
76 | + if($limit > 0) { |
|
77 | + webAlertAndQuit("User name is already in use!"); |
|
78 | + } |
|
79 | + |
|
80 | + // check if the email address already exist |
|
81 | + $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id)); |
|
82 | + $limit = $modx->db->getValue($rs); |
|
83 | + if($limit > 0) { |
|
84 | + webAlertAndQuit("Email is already in use!"); |
|
85 | + } |
|
86 | + |
|
87 | + // generate a new password for this user |
|
88 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
89 | + if(strlen($specifiedpassword) < 6) { |
|
90 | + webAlertAndQuit("Password is too short!"); |
|
91 | + } else { |
|
92 | + $newpassword = $specifiedpassword; |
|
93 | + } |
|
94 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
95 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
96 | + } elseif($passwordgenmethod == 'g') { |
|
97 | + $newpassword = generate_password(8); |
|
98 | + } else { |
|
99 | + webAlertAndQuit("No password generation method specified!"); |
|
100 | + } |
|
101 | + |
|
102 | + // invoke OnBeforeUserFormSave event |
|
103 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
104 | + "mode" => "new", |
|
105 | + )); |
|
106 | + |
|
107 | + // create the user account |
|
108 | + $internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users); |
|
109 | + |
|
110 | + $field = array(); |
|
111 | + $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
112 | + $modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'"); |
|
113 | + |
|
114 | + $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter'); |
|
115 | + $field = $modx->db->escape($field); |
|
116 | + $modx->db->insert($field, $tbl_user_attributes); |
|
117 | + |
|
118 | + // Save user settings |
|
119 | + saveUserSettings($internalKey); |
|
120 | + |
|
121 | + // invoke OnManagerSaveUser event |
|
122 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
123 | + "mode" => "new", |
|
124 | + "userid" => $internalKey, |
|
125 | + "username" => $newusername, |
|
126 | + "userpassword" => $newpassword, |
|
127 | + "useremail" => $email, |
|
128 | + "userfullname" => $fullname, |
|
129 | + "userroleid" => $role |
|
130 | + )); |
|
131 | + |
|
132 | + // invoke OnUserFormSave event |
|
133 | + $modx->invokeEvent("OnUserFormSave", array( |
|
134 | + "mode" => "new", |
|
135 | + "id" => $internalKey |
|
136 | + )); |
|
137 | + |
|
138 | + // Set the item name for logger |
|
139 | + $_SESSION['itemname'] = $newusername; |
|
140 | + |
|
141 | + /*******************************************************************************/ |
|
142 | + // put the user in the user_groups he/ she should be in |
|
143 | + // first, check that up_perms are switched on! |
|
144 | + if($use_udperms == 1) { |
|
145 | + if(!empty($user_groups)) { |
|
146 | + for($i = 0; $i < count($user_groups); $i++) { |
|
147 | + $f = array(); |
|
148 | + $f['user_group'] = (int)$user_groups[$i]; |
|
149 | + $f['member'] = $internalKey; |
|
150 | + $modx->db->insert($f, $tbl_member_groups); |
|
151 | + } |
|
152 | + } |
|
153 | + } |
|
154 | + // end of user_groups stuff! |
|
155 | + |
|
156 | + if($passwordnotifymethod == 'e') { |
|
157 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
158 | + if($input['stay'] != '') { |
|
159 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
160 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
161 | + header($header); |
|
162 | + } else { |
|
163 | + $header = "Location: index.php?a=75&r=2"; |
|
164 | + header($header); |
|
165 | + } |
|
166 | + } else { |
|
167 | + if($input['stay'] != '') { |
|
168 | + $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
|
169 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
170 | + } else { |
|
171 | + $stayUrl = "index.php?a=75&r=2"; |
|
172 | + } |
|
173 | + |
|
174 | + include_once "header.inc.php"; |
|
175 | + ?> |
|
176 | 176 | |
177 | 177 | <h1><?php echo $_lang['user_title']; ?></h1> |
178 | 178 | |
@@ -194,125 +194,125 @@ discard block |
||
194 | 194 | </div> |
195 | 195 | <?php |
196 | 196 | |
197 | - include_once "footer.inc.php"; |
|
198 | - } |
|
199 | - break; |
|
200 | - case '12' : // edit user |
|
201 | - // generate a new password for this user |
|
202 | - if($genpassword == 1) { |
|
203 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
204 | - if(strlen($specifiedpassword) < 6) { |
|
205 | - webAlertAndQuit("Password is too short!"); |
|
206 | - } else { |
|
207 | - $newpassword = $specifiedpassword; |
|
208 | - } |
|
209 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
210 | - webAlertAndQuit("You didn't specify a password for this user!"); |
|
211 | - } elseif($passwordgenmethod == 'g') { |
|
212 | - $newpassword = generate_password(8); |
|
213 | - } else { |
|
214 | - webAlertAndQuit("No password generation method specified!"); |
|
215 | - } |
|
216 | - } |
|
217 | - if($passwordnotifymethod == 'e') { |
|
218 | - sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
219 | - } |
|
220 | - |
|
221 | - // check if the username already exist |
|
222 | - $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id)); |
|
223 | - $limit = $modx->db->getValue($rs); |
|
224 | - if($limit > 0) { |
|
225 | - webAlertAndQuit("User name is already in use!"); |
|
226 | - } |
|
227 | - |
|
228 | - // check if the email address already exists |
|
229 | - $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id)); |
|
230 | - $limit = $modx->db->getValue($rs); |
|
231 | - if($limit > 0) { |
|
232 | - webAlertAndQuit("Email is already in use!"); |
|
233 | - } |
|
234 | - |
|
235 | - // invoke OnBeforeUserFormSave event |
|
236 | - $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
237 | - "mode" => "upd", |
|
238 | - "id" => $id |
|
239 | - )); |
|
240 | - |
|
241 | - // update user name and password |
|
242 | - $field = array(); |
|
243 | - $field['username'] = $modx->db->escape($newusername); |
|
244 | - if($genpassword == 1) { |
|
245 | - $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
246 | - } |
|
247 | - $modx->db->update($field, $tbl_manager_users, "id='{$id}'"); |
|
248 | - $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
249 | - $field = $modx->db->escape($field); |
|
250 | - $modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
251 | - |
|
252 | - // Save user settings |
|
253 | - saveUserSettings($id); |
|
254 | - |
|
255 | - // Set the item name for logger |
|
256 | - $_SESSION['itemname'] = $newusername; |
|
257 | - |
|
258 | - // invoke OnManagerSaveUser event |
|
259 | - $modx->invokeEvent("OnManagerSaveUser", array( |
|
260 | - "mode" => "upd", |
|
261 | - "userid" => $id, |
|
262 | - "username" => $newusername, |
|
263 | - "userpassword" => $newpassword, |
|
264 | - "useremail" => $email, |
|
265 | - "userfullname" => $fullname, |
|
266 | - "userroleid" => $role, |
|
267 | - "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
268 | - "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
269 | - )); |
|
270 | - |
|
271 | - // invoke OnManagerChangePassword event |
|
272 | - if($genpassword == 1) { |
|
273 | - $modx->invokeEvent("OnManagerChangePassword", array( |
|
274 | - "userid" => $id, |
|
275 | - "username" => $newusername, |
|
276 | - "userpassword" => $newpassword |
|
277 | - )); |
|
278 | - } |
|
279 | - |
|
280 | - // invoke OnUserFormSave event |
|
281 | - $modx->invokeEvent("OnUserFormSave", array( |
|
282 | - "mode" => "upd", |
|
283 | - "id" => $id |
|
284 | - )); |
|
285 | - |
|
286 | - /*******************************************************************************/ |
|
287 | - // put the user in the user_groups he/ she should be in |
|
288 | - // first, check that up_perms are switched on! |
|
289 | - if($use_udperms == 1) { |
|
290 | - // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
291 | - $modx->db->delete($tbl_member_groups, "member='{$id}'"); |
|
292 | - if(!empty($user_groups)) { |
|
293 | - for($i = 0; $i < count($user_groups); $i++) { |
|
294 | - $field = array(); |
|
295 | - $field['user_group'] = (int)$user_groups[$i]; |
|
296 | - $field['member'] = $id; |
|
297 | - $modx->db->insert($field, $tbl_member_groups); |
|
298 | - } |
|
299 | - } |
|
300 | - } |
|
301 | - // end of user_groups stuff! |
|
302 | - /*******************************************************************************/ |
|
303 | - if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
304 | - $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
305 | - } |
|
306 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
307 | - if($input['stay'] != '') { |
|
308 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
309 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
310 | - } else { |
|
311 | - $stayUrl = "index.php?a=75&r=2"; |
|
312 | - } |
|
313 | - |
|
314 | - include_once "header.inc.php"; |
|
315 | - ?> |
|
197 | + include_once "footer.inc.php"; |
|
198 | + } |
|
199 | + break; |
|
200 | + case '12' : // edit user |
|
201 | + // generate a new password for this user |
|
202 | + if($genpassword == 1) { |
|
203 | + if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
204 | + if(strlen($specifiedpassword) < 6) { |
|
205 | + webAlertAndQuit("Password is too short!"); |
|
206 | + } else { |
|
207 | + $newpassword = $specifiedpassword; |
|
208 | + } |
|
209 | + } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
210 | + webAlertAndQuit("You didn't specify a password for this user!"); |
|
211 | + } elseif($passwordgenmethod == 'g') { |
|
212 | + $newpassword = generate_password(8); |
|
213 | + } else { |
|
214 | + webAlertAndQuit("No password generation method specified!"); |
|
215 | + } |
|
216 | + } |
|
217 | + if($passwordnotifymethod == 'e') { |
|
218 | + sendMailMessage($email, $newusername, $newpassword, $fullname); |
|
219 | + } |
|
220 | + |
|
221 | + // check if the username already exist |
|
222 | + $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id)); |
|
223 | + $limit = $modx->db->getValue($rs); |
|
224 | + if($limit > 0) { |
|
225 | + webAlertAndQuit("User name is already in use!"); |
|
226 | + } |
|
227 | + |
|
228 | + // check if the email address already exists |
|
229 | + $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id)); |
|
230 | + $limit = $modx->db->getValue($rs); |
|
231 | + if($limit > 0) { |
|
232 | + webAlertAndQuit("Email is already in use!"); |
|
233 | + } |
|
234 | + |
|
235 | + // invoke OnBeforeUserFormSave event |
|
236 | + $modx->invokeEvent("OnBeforeUserFormSave", array( |
|
237 | + "mode" => "upd", |
|
238 | + "id" => $id |
|
239 | + )); |
|
240 | + |
|
241 | + // update user name and password |
|
242 | + $field = array(); |
|
243 | + $field['username'] = $modx->db->escape($newusername); |
|
244 | + if($genpassword == 1) { |
|
245 | + $field['password'] = $modx->phpass->HashPassword($newpassword); |
|
246 | + } |
|
247 | + $modx->db->update($field, $tbl_manager_users, "id='{$id}'"); |
|
248 | + $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter'); |
|
249 | + $field = $modx->db->escape($field); |
|
250 | + $modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'"); |
|
251 | + |
|
252 | + // Save user settings |
|
253 | + saveUserSettings($id); |
|
254 | + |
|
255 | + // Set the item name for logger |
|
256 | + $_SESSION['itemname'] = $newusername; |
|
257 | + |
|
258 | + // invoke OnManagerSaveUser event |
|
259 | + $modx->invokeEvent("OnManagerSaveUser", array( |
|
260 | + "mode" => "upd", |
|
261 | + "userid" => $id, |
|
262 | + "username" => $newusername, |
|
263 | + "userpassword" => $newpassword, |
|
264 | + "useremail" => $email, |
|
265 | + "userfullname" => $fullname, |
|
266 | + "userroleid" => $role, |
|
267 | + "oldusername" => (($oldusername != $newusername) ? $oldusername : ""), |
|
268 | + "olduseremail" => (($oldemail != $email) ? $oldemail : "") |
|
269 | + )); |
|
270 | + |
|
271 | + // invoke OnManagerChangePassword event |
|
272 | + if($genpassword == 1) { |
|
273 | + $modx->invokeEvent("OnManagerChangePassword", array( |
|
274 | + "userid" => $id, |
|
275 | + "username" => $newusername, |
|
276 | + "userpassword" => $newpassword |
|
277 | + )); |
|
278 | + } |
|
279 | + |
|
280 | + // invoke OnUserFormSave event |
|
281 | + $modx->invokeEvent("OnUserFormSave", array( |
|
282 | + "mode" => "upd", |
|
283 | + "id" => $id |
|
284 | + )); |
|
285 | + |
|
286 | + /*******************************************************************************/ |
|
287 | + // put the user in the user_groups he/ she should be in |
|
288 | + // first, check that up_perms are switched on! |
|
289 | + if($use_udperms == 1) { |
|
290 | + // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
|
291 | + $modx->db->delete($tbl_member_groups, "member='{$id}'"); |
|
292 | + if(!empty($user_groups)) { |
|
293 | + for($i = 0; $i < count($user_groups); $i++) { |
|
294 | + $field = array(); |
|
295 | + $field['user_group'] = (int)$user_groups[$i]; |
|
296 | + $field['member'] = $id; |
|
297 | + $modx->db->insert($field, $tbl_member_groups); |
|
298 | + } |
|
299 | + } |
|
300 | + } |
|
301 | + // end of user_groups stuff! |
|
302 | + /*******************************************************************************/ |
|
303 | + if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
304 | + $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
|
305 | + } |
|
306 | + if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
307 | + if($input['stay'] != '') { |
|
308 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
309 | + $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
310 | + } else { |
|
311 | + $stayUrl = "index.php?a=75&r=2"; |
|
312 | + } |
|
313 | + |
|
314 | + include_once "header.inc.php"; |
|
315 | + ?> |
|
316 | 316 | |
317 | 317 | <h1><?php echo $_lang['user_title']; ?></h1> |
318 | 318 | |
@@ -332,20 +332,20 @@ discard block |
||
332 | 332 | </div> |
333 | 333 | <?php |
334 | 334 | |
335 | - include_once "footer.inc.php"; |
|
336 | - } else { |
|
337 | - if($input['stay'] != '') { |
|
338 | - $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
339 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
340 | - header($header); |
|
341 | - } else { |
|
342 | - $header = "Location: index.php?a=75&r=2"; |
|
343 | - header($header); |
|
344 | - } |
|
345 | - } |
|
346 | - break; |
|
347 | - default: |
|
348 | - webAlertAndQuit("No operation set in request."); |
|
335 | + include_once "footer.inc.php"; |
|
336 | + } else { |
|
337 | + if($input['stay'] != '') { |
|
338 | + $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
|
339 | + $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
340 | + header($header); |
|
341 | + } else { |
|
342 | + $header = "Location: index.php?a=75&r=2"; |
|
343 | + header($header); |
|
344 | + } |
|
345 | + } |
|
346 | + break; |
|
347 | + default: |
|
348 | + webAlertAndQuit("No operation set in request."); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
@@ -357,31 +357,31 @@ discard block |
||
357 | 357 | * @param string $ufn |
358 | 358 | */ |
359 | 359 | function sendMailMessage($email, $uid, $pwd, $ufn) { |
360 | - $modx = evolutionCMS(); global $_lang, $signupemail_message; |
|
361 | - global $emailsubject, $emailsender; |
|
362 | - global $site_name; |
|
363 | - $manager_url = MODX_MANAGER_URL; |
|
364 | - $message = sprintf($signupemail_message, $uid, $pwd); // use old method |
|
365 | - // replace placeholders |
|
366 | - $message = str_replace("[+uid+]", $uid, $message); |
|
367 | - $message = str_replace("[+pwd+]", $pwd, $message); |
|
368 | - $message = str_replace("[+ufn+]", $ufn, $message); |
|
369 | - $message = str_replace("[+sname+]", $site_name, $message); |
|
370 | - $message = str_replace("[+saddr+]", $emailsender, $message); |
|
371 | - $message = str_replace("[+semail+]", $emailsender, $message); |
|
372 | - $message = str_replace("[+surl+]", $manager_url, $message); |
|
373 | - |
|
374 | - $param = array(); |
|
375 | - $param['from'] = "{$site_name}<{$emailsender}>"; |
|
376 | - $param['subject'] = $emailsubject; |
|
377 | - $param['body'] = $message; |
|
378 | - $param['to'] = $email; |
|
379 | - $param['type'] = 'text'; |
|
380 | - $rs = $modx->sendmail($param); |
|
381 | - if(!$rs) { |
|
382 | - $modx->manager->saveFormValues(); |
|
383 | - $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
|
384 | - } |
|
360 | + $modx = evolutionCMS(); global $_lang, $signupemail_message; |
|
361 | + global $emailsubject, $emailsender; |
|
362 | + global $site_name; |
|
363 | + $manager_url = MODX_MANAGER_URL; |
|
364 | + $message = sprintf($signupemail_message, $uid, $pwd); // use old method |
|
365 | + // replace placeholders |
|
366 | + $message = str_replace("[+uid+]", $uid, $message); |
|
367 | + $message = str_replace("[+pwd+]", $pwd, $message); |
|
368 | + $message = str_replace("[+ufn+]", $ufn, $message); |
|
369 | + $message = str_replace("[+sname+]", $site_name, $message); |
|
370 | + $message = str_replace("[+saddr+]", $emailsender, $message); |
|
371 | + $message = str_replace("[+semail+]", $emailsender, $message); |
|
372 | + $message = str_replace("[+surl+]", $manager_url, $message); |
|
373 | + |
|
374 | + $param = array(); |
|
375 | + $param['from'] = "{$site_name}<{$emailsender}>"; |
|
376 | + $param['subject'] = $emailsubject; |
|
377 | + $param['body'] = $message; |
|
378 | + $param['to'] = $email; |
|
379 | + $param['type'] = 'text'; |
|
380 | + $rs = $modx->sendmail($param); |
|
381 | + if(!$rs) { |
|
382 | + $modx->manager->saveFormValues(); |
|
383 | + $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
|
384 | + } |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | /** |
@@ -390,86 +390,86 @@ discard block |
||
390 | 390 | * @param int $id |
391 | 391 | */ |
392 | 392 | function saveUserSettings($id) { |
393 | - $modx = evolutionCMS(); |
|
394 | - $tbl_user_settings = $modx->getFullTableName('user_settings'); |
|
395 | - |
|
396 | - $ignore = array( |
|
397 | - 'id', |
|
398 | - 'oldusername', |
|
399 | - 'oldemail', |
|
400 | - 'newusername', |
|
401 | - 'fullname', |
|
402 | - 'newpassword', |
|
403 | - 'newpasswordcheck', |
|
404 | - 'passwordgenmethod', |
|
405 | - 'passwordnotifymethod', |
|
406 | - 'specifiedpassword', |
|
407 | - 'confirmpassword', |
|
408 | - 'email', |
|
409 | - 'phone', |
|
410 | - 'mobilephone', |
|
411 | - 'fax', |
|
412 | - 'dob', |
|
413 | - 'country', |
|
414 | - 'street', |
|
415 | - 'city', |
|
416 | - 'state', |
|
417 | - 'zip', |
|
418 | - 'gender', |
|
419 | - 'photo', |
|
420 | - 'comment', |
|
421 | - 'role', |
|
422 | - 'failedlogincount', |
|
423 | - 'blocked', |
|
424 | - 'blockeduntil', |
|
425 | - 'blockedafter', |
|
426 | - 'user_groups', |
|
427 | - 'mode', |
|
428 | - 'blockedmode', |
|
429 | - 'stay', |
|
430 | - 'save', |
|
431 | - 'theme_refresher' |
|
432 | - ); |
|
433 | - |
|
434 | - // determine which settings can be saved blank (based on 'default_{settingname}' POST checkbox values) |
|
435 | - $defaults = array( |
|
436 | - 'upload_images', |
|
437 | - 'upload_media', |
|
438 | - 'upload_flash', |
|
439 | - 'upload_files' |
|
440 | - ); |
|
441 | - |
|
442 | - // get user setting field names |
|
443 | - $settings = array(); |
|
444 | - foreach($_POST as $n => $v) { |
|
445 | - if(in_array($n, $ignore) || (!in_array($n, $defaults) && is_scalar($v) && trim($v) == '') || (!in_array($n, $defaults) && is_array($v) && empty($v))) { |
|
446 | - continue; |
|
447 | - } // ignore blacklist and empties |
|
448 | - $settings[$n] = $v; // this value should be saved |
|
449 | - } |
|
450 | - |
|
451 | - foreach($defaults as $k) { |
|
452 | - if(isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') { |
|
453 | - unset($settings[$k]); |
|
454 | - } |
|
455 | - unset($settings['default_' . $k]); |
|
456 | - } |
|
457 | - |
|
458 | - $modx->db->delete($tbl_user_settings, "user='{$id}'"); |
|
459 | - |
|
460 | - foreach($settings as $n => $vl) { |
|
461 | - if(is_array($vl)) { |
|
462 | - $vl = implode(",", $vl); |
|
463 | - } |
|
464 | - if($vl != '') { |
|
465 | - $f = array(); |
|
466 | - $f['user'] = $id; |
|
467 | - $f['setting_name'] = $n; |
|
468 | - $f['setting_value'] = $vl; |
|
469 | - $f = $modx->db->escape($f); |
|
470 | - $modx->db->insert($f, $tbl_user_settings); |
|
471 | - } |
|
472 | - } |
|
393 | + $modx = evolutionCMS(); |
|
394 | + $tbl_user_settings = $modx->getFullTableName('user_settings'); |
|
395 | + |
|
396 | + $ignore = array( |
|
397 | + 'id', |
|
398 | + 'oldusername', |
|
399 | + 'oldemail', |
|
400 | + 'newusername', |
|
401 | + 'fullname', |
|
402 | + 'newpassword', |
|
403 | + 'newpasswordcheck', |
|
404 | + 'passwordgenmethod', |
|
405 | + 'passwordnotifymethod', |
|
406 | + 'specifiedpassword', |
|
407 | + 'confirmpassword', |
|
408 | + 'email', |
|
409 | + 'phone', |
|
410 | + 'mobilephone', |
|
411 | + 'fax', |
|
412 | + 'dob', |
|
413 | + 'country', |
|
414 | + 'street', |
|
415 | + 'city', |
|
416 | + 'state', |
|
417 | + 'zip', |
|
418 | + 'gender', |
|
419 | + 'photo', |
|
420 | + 'comment', |
|
421 | + 'role', |
|
422 | + 'failedlogincount', |
|
423 | + 'blocked', |
|
424 | + 'blockeduntil', |
|
425 | + 'blockedafter', |
|
426 | + 'user_groups', |
|
427 | + 'mode', |
|
428 | + 'blockedmode', |
|
429 | + 'stay', |
|
430 | + 'save', |
|
431 | + 'theme_refresher' |
|
432 | + ); |
|
433 | + |
|
434 | + // determine which settings can be saved blank (based on 'default_{settingname}' POST checkbox values) |
|
435 | + $defaults = array( |
|
436 | + 'upload_images', |
|
437 | + 'upload_media', |
|
438 | + 'upload_flash', |
|
439 | + 'upload_files' |
|
440 | + ); |
|
441 | + |
|
442 | + // get user setting field names |
|
443 | + $settings = array(); |
|
444 | + foreach($_POST as $n => $v) { |
|
445 | + if(in_array($n, $ignore) || (!in_array($n, $defaults) && is_scalar($v) && trim($v) == '') || (!in_array($n, $defaults) && is_array($v) && empty($v))) { |
|
446 | + continue; |
|
447 | + } // ignore blacklist and empties |
|
448 | + $settings[$n] = $v; // this value should be saved |
|
449 | + } |
|
450 | + |
|
451 | + foreach($defaults as $k) { |
|
452 | + if(isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') { |
|
453 | + unset($settings[$k]); |
|
454 | + } |
|
455 | + unset($settings['default_' . $k]); |
|
456 | + } |
|
457 | + |
|
458 | + $modx->db->delete($tbl_user_settings, "user='{$id}'"); |
|
459 | + |
|
460 | + foreach($settings as $n => $vl) { |
|
461 | + if(is_array($vl)) { |
|
462 | + $vl = implode(",", $vl); |
|
463 | + } |
|
464 | + if($vl != '') { |
|
465 | + $f = array(); |
|
466 | + $f['user'] = $id; |
|
467 | + $f['setting_name'] = $n; |
|
468 | + $f['setting_value'] = $vl; |
|
469 | + $f = $modx->db->escape($f); |
|
470 | + $modx->db->insert($f, $tbl_user_settings); |
|
471 | + } |
|
472 | + } |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | /** |
@@ -478,10 +478,10 @@ discard block |
||
478 | 478 | * @param $msg |
479 | 479 | */ |
480 | 480 | function webAlertAndQuit($msg) { |
481 | - global $id, $modx; |
|
482 | - $mode = $_POST['mode']; |
|
483 | - $modx->manager->saveFormValues($mode); |
|
484 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '12' ? "&id={$id}" : '')); |
|
481 | + global $id, $modx; |
|
482 | + $mode = $_POST['mode']; |
|
483 | + $modx->manager->saveFormValues($mode); |
|
484 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '12' ? "&id={$id}" : '')); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | /** |
@@ -491,12 +491,12 @@ discard block |
||
491 | 491 | * @return string |
492 | 492 | */ |
493 | 493 | function generate_password($length = 10) { |
494 | - $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
|
495 | - $ps_len = strlen($allowable_characters); |
|
496 | - mt_srand((double) microtime() * 1000000); |
|
497 | - $pass = ""; |
|
498 | - for($i = 0; $i < $length; $i++) { |
|
499 | - $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
|
500 | - } |
|
501 | - return $pass; |
|
494 | + $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
|
495 | + $ps_len = strlen($allowable_characters); |
|
496 | + mt_srand((double) microtime() * 1000000); |
|
497 | + $pass = ""; |
|
498 | + for($i = 0; $i < $length; $i++) { |
|
499 | + $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
|
500 | + } |
|
501 | + return $pass; |
|
502 | 502 | } |
@@ -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('save_user')) { |
|
5 | +if (!$modx->hasPermission('save_user')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | $input = $_POST; |
16 | 16 | |
17 | -$id = (int)$input['id']; |
|
17 | +$id = (int) $input['id']; |
|
18 | 18 | $oldusername = $input['oldusername']; |
19 | 19 | $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User"; |
20 | 20 | $fullname = $input['fullname']; |
@@ -44,56 +44,56 @@ discard block |
||
44 | 44 | $user_groups = $input['user_groups']; |
45 | 45 | |
46 | 46 | // verify password |
47 | -if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
47 | +if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) { |
|
48 | 48 | webAlertAndQuit("Password typed is mismatched"); |
49 | 49 | } |
50 | 50 | |
51 | 51 | // verify email |
52 | -if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
52 | +if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) { |
|
53 | 53 | webAlertAndQuit("E-mail address doesn't seem to be valid!"); |
54 | 54 | } |
55 | 55 | |
56 | 56 | // verify admin security |
57 | -if($_SESSION['mgrRole'] != 1) { |
|
57 | +if ($_SESSION['mgrRole'] != 1) { |
|
58 | 58 | // Check to see if user tried to spoof a "1" (admin) role |
59 | - if(!$modx->hasPermission('save_role')) { |
|
59 | + if (!$modx->hasPermission('save_role')) { |
|
60 | 60 | webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!"); |
61 | 61 | } |
62 | 62 | // Verify that the user being edited wasn't an admin and the user ID got spoofed |
63 | 63 | $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1"); |
64 | 64 | $limit = $modx->db->getValue($rs); |
65 | - if($limit > 0) { |
|
65 | + if ($limit > 0) { |
|
66 | 66 | webAlertAndQuit("You cannot alter an administrative user."); |
67 | 67 | } |
68 | 68 | |
69 | 69 | } |
70 | 70 | |
71 | -switch($input['mode']) { |
|
71 | +switch ($input['mode']) { |
|
72 | 72 | case '11' : // new user |
73 | 73 | // check if this user name already exist |
74 | 74 | $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername))); |
75 | 75 | $limit = $modx->db->getValue($rs); |
76 | - if($limit > 0) { |
|
76 | + if ($limit > 0) { |
|
77 | 77 | webAlertAndQuit("User name is already in use!"); |
78 | 78 | } |
79 | 79 | |
80 | 80 | // check if the email address already exist |
81 | 81 | $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id)); |
82 | 82 | $limit = $modx->db->getValue($rs); |
83 | - if($limit > 0) { |
|
83 | + if ($limit > 0) { |
|
84 | 84 | webAlertAndQuit("Email is already in use!"); |
85 | 85 | } |
86 | 86 | |
87 | 87 | // generate a new password for this user |
88 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
89 | - if(strlen($specifiedpassword) < 6) { |
|
88 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
89 | + if (strlen($specifiedpassword) < 6) { |
|
90 | 90 | webAlertAndQuit("Password is too short!"); |
91 | 91 | } else { |
92 | 92 | $newpassword = $specifiedpassword; |
93 | 93 | } |
94 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
94 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
95 | 95 | webAlertAndQuit("You didn't specify a password for this user!"); |
96 | - } elseif($passwordgenmethod == 'g') { |
|
96 | + } elseif ($passwordgenmethod == 'g') { |
|
97 | 97 | $newpassword = generate_password(8); |
98 | 98 | } else { |
99 | 99 | webAlertAndQuit("No password generation method specified!"); |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | /*******************************************************************************/ |
142 | 142 | // put the user in the user_groups he/ she should be in |
143 | 143 | // first, check that up_perms are switched on! |
144 | - if($use_udperms == 1) { |
|
145 | - if(!empty($user_groups)) { |
|
146 | - for($i = 0; $i < count($user_groups); $i++) { |
|
144 | + if ($use_udperms == 1) { |
|
145 | + if (!empty($user_groups)) { |
|
146 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
147 | 147 | $f = array(); |
148 | - $f['user_group'] = (int)$user_groups[$i]; |
|
148 | + $f['user_group'] = (int) $user_groups[$i]; |
|
149 | 149 | $f['member'] = $internalKey; |
150 | 150 | $modx->db->insert($f, $tbl_member_groups); |
151 | 151 | } |
@@ -153,20 +153,20 @@ discard block |
||
153 | 153 | } |
154 | 154 | // end of user_groups stuff! |
155 | 155 | |
156 | - if($passwordnotifymethod == 'e') { |
|
156 | + if ($passwordnotifymethod == 'e') { |
|
157 | 157 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
158 | - if($input['stay'] != '') { |
|
158 | + if ($input['stay'] != '') { |
|
159 | 159 | $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
160 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
160 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
161 | 161 | header($header); |
162 | 162 | } else { |
163 | 163 | $header = "Location: index.php?a=75&r=2"; |
164 | 164 | header($header); |
165 | 165 | } |
166 | 166 | } else { |
167 | - if($input['stay'] != '') { |
|
167 | + if ($input['stay'] != '') { |
|
168 | 168 | $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11"; |
169 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
169 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
170 | 170 | } else { |
171 | 171 | $stayUrl = "index.php?a=75&r=2"; |
172 | 172 | } |
@@ -199,36 +199,36 @@ discard block |
||
199 | 199 | break; |
200 | 200 | case '12' : // edit user |
201 | 201 | // generate a new password for this user |
202 | - if($genpassword == 1) { |
|
203 | - if($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
204 | - if(strlen($specifiedpassword) < 6) { |
|
202 | + if ($genpassword == 1) { |
|
203 | + if ($specifiedpassword != "" && $passwordgenmethod == "spec") { |
|
204 | + if (strlen($specifiedpassword) < 6) { |
|
205 | 205 | webAlertAndQuit("Password is too short!"); |
206 | 206 | } else { |
207 | 207 | $newpassword = $specifiedpassword; |
208 | 208 | } |
209 | - } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
209 | + } elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") { |
|
210 | 210 | webAlertAndQuit("You didn't specify a password for this user!"); |
211 | - } elseif($passwordgenmethod == 'g') { |
|
211 | + } elseif ($passwordgenmethod == 'g') { |
|
212 | 212 | $newpassword = generate_password(8); |
213 | 213 | } else { |
214 | 214 | webAlertAndQuit("No password generation method specified!"); |
215 | 215 | } |
216 | 216 | } |
217 | - if($passwordnotifymethod == 'e') { |
|
217 | + if ($passwordnotifymethod == 'e') { |
|
218 | 218 | sendMailMessage($email, $newusername, $newpassword, $fullname); |
219 | 219 | } |
220 | 220 | |
221 | 221 | // check if the username already exist |
222 | 222 | $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id)); |
223 | 223 | $limit = $modx->db->getValue($rs); |
224 | - if($limit > 0) { |
|
224 | + if ($limit > 0) { |
|
225 | 225 | webAlertAndQuit("User name is already in use!"); |
226 | 226 | } |
227 | 227 | |
228 | 228 | // check if the email address already exists |
229 | 229 | $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id)); |
230 | 230 | $limit = $modx->db->getValue($rs); |
231 | - if($limit > 0) { |
|
231 | + if ($limit > 0) { |
|
232 | 232 | webAlertAndQuit("Email is already in use!"); |
233 | 233 | } |
234 | 234 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | // update user name and password |
242 | 242 | $field = array(); |
243 | 243 | $field['username'] = $modx->db->escape($newusername); |
244 | - if($genpassword == 1) { |
|
244 | + if ($genpassword == 1) { |
|
245 | 245 | $field['password'] = $modx->phpass->HashPassword($newpassword); |
246 | 246 | } |
247 | 247 | $modx->db->update($field, $tbl_manager_users, "id='{$id}'"); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | )); |
270 | 270 | |
271 | 271 | // invoke OnManagerChangePassword event |
272 | - if($genpassword == 1) { |
|
272 | + if ($genpassword == 1) { |
|
273 | 273 | $modx->invokeEvent("OnManagerChangePassword", array( |
274 | 274 | "userid" => $id, |
275 | 275 | "username" => $newusername, |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | /*******************************************************************************/ |
287 | 287 | // put the user in the user_groups he/ she should be in |
288 | 288 | // first, check that up_perms are switched on! |
289 | - if($use_udperms == 1) { |
|
289 | + if ($use_udperms == 1) { |
|
290 | 290 | // as this is an existing user, delete his/ her entries in the groups before saving the new groups |
291 | 291 | $modx->db->delete($tbl_member_groups, "member='{$id}'"); |
292 | - if(!empty($user_groups)) { |
|
293 | - for($i = 0; $i < count($user_groups); $i++) { |
|
292 | + if (!empty($user_groups)) { |
|
293 | + for ($i = 0; $i < count($user_groups); $i++) { |
|
294 | 294 | $field = array(); |
295 | - $field['user_group'] = (int)$user_groups[$i]; |
|
295 | + $field['user_group'] = (int) $user_groups[$i]; |
|
296 | 296 | $field['member'] = $id; |
297 | 297 | $modx->db->insert($field, $tbl_member_groups); |
298 | 298 | } |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | } |
301 | 301 | // end of user_groups stuff! |
302 | 302 | /*******************************************************************************/ |
303 | - if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
303 | + if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) { |
|
304 | 304 | $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";'); |
305 | 305 | } |
306 | - if($genpassword == 1 && $passwordnotifymethod == 's') { |
|
307 | - if($input['stay'] != '') { |
|
306 | + if ($genpassword == 1 && $passwordnotifymethod == 's') { |
|
307 | + if ($input['stay'] != '') { |
|
308 | 308 | $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
309 | - $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
309 | + $stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay']; |
|
310 | 310 | } else { |
311 | 311 | $stayUrl = "index.php?a=75&r=2"; |
312 | 312 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | <div class="sectionHeader"><?php echo $_lang['user_title']; ?></div> |
327 | 327 | <div class="sectionBody"> |
328 | 328 | <div id="disp"> |
329 | - <p><?php echo sprintf($_lang["password_msg"], $modx->htmlspecialchars($newusername), $modx->htmlspecialchars($newpassword)) . (($id == $modx->getLoginUserID()) ? ' ' . $_lang['user_changeddata'] : ''); ?></p> |
|
329 | + <p><?php echo sprintf($_lang["password_msg"], $modx->htmlspecialchars($newusername), $modx->htmlspecialchars($newpassword)).(($id == $modx->getLoginUserID()) ? ' '.$_lang['user_changeddata'] : ''); ?></p> |
|
330 | 330 | </div> |
331 | 331 | </div> |
332 | 332 | </div> |
@@ -334,9 +334,9 @@ discard block |
||
334 | 334 | |
335 | 335 | include_once "footer.inc.php"; |
336 | 336 | } else { |
337 | - if($input['stay'] != '') { |
|
337 | + if ($input['stay'] != '') { |
|
338 | 338 | $a = ($input['stay'] == '2') ? "12&id={$id}" : "11"; |
339 | - $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay']; |
|
339 | + $header = "Location: index.php?a={$a}&r=2&stay=".$input['stay']; |
|
340 | 340 | header($header); |
341 | 341 | } else { |
342 | 342 | $header = "Location: index.php?a=75&r=2"; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * @param string $pwd |
357 | 357 | * @param string $ufn |
358 | 358 | */ |
359 | -function sendMailMessage($email, $uid, $pwd, $ufn) { |
|
359 | +function sendMailMessage($email, $uid, $pwd, $ufn){ |
|
360 | 360 | $modx = evolutionCMS(); global $_lang, $signupemail_message; |
361 | 361 | global $emailsubject, $emailsender; |
362 | 362 | global $site_name; |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | $param['to'] = $email; |
379 | 379 | $param['type'] = 'text'; |
380 | 380 | $rs = $modx->sendmail($param); |
381 | - if(!$rs) { |
|
381 | + if (!$rs) { |
|
382 | 382 | $modx->manager->saveFormValues(); |
383 | 383 | $modx->messageQuit("{$email} - {$_lang['error_sending_email']}"); |
384 | 384 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * |
390 | 390 | * @param int $id |
391 | 391 | */ |
392 | -function saveUserSettings($id) { |
|
392 | +function saveUserSettings($id){ |
|
393 | 393 | $modx = evolutionCMS(); |
394 | 394 | $tbl_user_settings = $modx->getFullTableName('user_settings'); |
395 | 395 | |
@@ -441,27 +441,27 @@ discard block |
||
441 | 441 | |
442 | 442 | // get user setting field names |
443 | 443 | $settings = array(); |
444 | - foreach($_POST as $n => $v) { |
|
445 | - if(in_array($n, $ignore) || (!in_array($n, $defaults) && is_scalar($v) && trim($v) == '') || (!in_array($n, $defaults) && is_array($v) && empty($v))) { |
|
444 | + foreach ($_POST as $n => $v) { |
|
445 | + if (in_array($n, $ignore) || (!in_array($n, $defaults) && is_scalar($v) && trim($v) == '') || (!in_array($n, $defaults) && is_array($v) && empty($v))) { |
|
446 | 446 | continue; |
447 | 447 | } // ignore blacklist and empties |
448 | 448 | $settings[$n] = $v; // this value should be saved |
449 | 449 | } |
450 | 450 | |
451 | - foreach($defaults as $k) { |
|
452 | - if(isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') { |
|
451 | + foreach ($defaults as $k) { |
|
452 | + if (isset($settings['default_'.$k]) && $settings['default_'.$k] == '1') { |
|
453 | 453 | unset($settings[$k]); |
454 | 454 | } |
455 | - unset($settings['default_' . $k]); |
|
455 | + unset($settings['default_'.$k]); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | $modx->db->delete($tbl_user_settings, "user='{$id}'"); |
459 | 459 | |
460 | - foreach($settings as $n => $vl) { |
|
461 | - if(is_array($vl)) { |
|
460 | + foreach ($settings as $n => $vl) { |
|
461 | + if (is_array($vl)) { |
|
462 | 462 | $vl = implode(",", $vl); |
463 | 463 | } |
464 | - if($vl != '') { |
|
464 | + if ($vl != '') { |
|
465 | 465 | $f = array(); |
466 | 466 | $f['user'] = $id; |
467 | 467 | $f['setting_name'] = $n; |
@@ -477,11 +477,11 @@ discard block |
||
477 | 477 | * |
478 | 478 | * @param $msg |
479 | 479 | */ |
480 | -function webAlertAndQuit($msg) { |
|
480 | +function webAlertAndQuit($msg){ |
|
481 | 481 | global $id, $modx; |
482 | 482 | $mode = $_POST['mode']; |
483 | 483 | $modx->manager->saveFormValues($mode); |
484 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '12' ? "&id={$id}" : '')); |
|
484 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode == '12' ? "&id={$id}" : '')); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | /** |
@@ -490,12 +490,12 @@ discard block |
||
490 | 490 | * @param int $length |
491 | 491 | * @return string |
492 | 492 | */ |
493 | -function generate_password($length = 10) { |
|
493 | +function generate_password($length = 10){ |
|
494 | 494 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
495 | 495 | $ps_len = strlen($allowable_characters); |
496 | 496 | mt_srand((double) microtime() * 1000000); |
497 | 497 | $pass = ""; |
498 | - for($i = 0; $i < $length; $i++) { |
|
498 | + for ($i = 0; $i < $length; $i++) { |
|
499 | 499 | $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)]; |
500 | 500 | } |
501 | 501 | return $pass; |
@@ -356,7 +356,8 @@ discard block |
||
356 | 356 | * @param string $pwd |
357 | 357 | * @param string $ufn |
358 | 358 | */ |
359 | -function sendMailMessage($email, $uid, $pwd, $ufn) { |
|
359 | +function sendMailMessage($email, $uid, $pwd, $ufn) |
|
360 | +{ |
|
360 | 361 | $modx = evolutionCMS(); global $_lang, $signupemail_message; |
361 | 362 | global $emailsubject, $emailsender; |
362 | 363 | global $site_name; |
@@ -389,7 +390,8 @@ discard block |
||
389 | 390 | * |
390 | 391 | * @param int $id |
391 | 392 | */ |
392 | -function saveUserSettings($id) { |
|
393 | +function saveUserSettings($id) |
|
394 | +{ |
|
393 | 395 | $modx = evolutionCMS(); |
394 | 396 | $tbl_user_settings = $modx->getFullTableName('user_settings'); |
395 | 397 | |
@@ -477,7 +479,8 @@ discard block |
||
477 | 479 | * |
478 | 480 | * @param $msg |
479 | 481 | */ |
480 | -function webAlertAndQuit($msg) { |
|
482 | +function webAlertAndQuit($msg) |
|
483 | +{ |
|
481 | 484 | global $id, $modx; |
482 | 485 | $mode = $_POST['mode']; |
483 | 486 | $modx->manager->saveFormValues($mode); |
@@ -490,7 +493,8 @@ discard block |
||
490 | 493 | * @param int $length |
491 | 494 | * @return string |
492 | 495 | */ |
493 | -function generate_password($length = 10) { |
|
496 | +function generate_password($length = 10) |
|
497 | +{ |
|
494 | 498 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
495 | 499 | $ps_len = strlen($allowable_characters); |
496 | 500 | mt_srand((double) microtime() * 1000000); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.'); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('save_plugin')) { |
6 | 6 | $modx->webAlertAndQuit($_lang['error_no_privileges']); |
7 | 7 | } |
8 | 8 | |
9 | -$id = (int)$_POST['id']; |
|
9 | +$id = (int) $_POST['id']; |
|
10 | 10 | $name = $modx->db->escape(trim($_POST['name'])); |
11 | 11 | $description = $modx->db->escape($_POST['description']); |
12 | 12 | $locked = $_POST['locked'] == 'on' ? '1' : '0'; |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | |
21 | 21 | //Kyle Jaebker - added category support |
22 | 22 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
23 | - $categoryid = (int)$_POST['categoryid']; |
|
23 | + $categoryid = (int) $_POST['categoryid']; |
|
24 | 24 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
25 | 25 | $categoryid = 0; |
26 | 26 | } else { |
27 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
27 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
28 | 28 | $categoryid = getCategory($_POST['newcategory']); |
29 | 29 | } |
30 | 30 | |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid; |
41 | 41 | |
42 | 42 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
43 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
43 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
44 | 44 | if ($version) { |
45 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
45 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
46 | 46 | } |
47 | 47 | if (isset($parsed['modx_category'])) { |
48 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
48 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
49 | 49 | $categoryid = getCategory($parsed['modx_category']); |
50 | 50 | } |
51 | 51 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | // finished emptying cache - redirect |
104 | 104 | if ($_POST['stay'] != '') { |
105 | 105 | $a = ($_POST['stay'] == '2') ? "102&id=$newid" : '101'; |
106 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
106 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
107 | 107 | header($header); |
108 | 108 | } else { |
109 | 109 | $header = 'Location: index.php?a=76&r=2'; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | // finished emptying cache - redirect |
159 | 159 | if ($_POST['stay'] != '') { |
160 | 160 | $a = ($_POST['stay'] == '2') ? "102&id=$id" : '101'; |
161 | - $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay']; |
|
161 | + $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay']; |
|
162 | 162 | header($header); |
163 | 163 | } else { |
164 | 164 | $modx->unlockElement(5, $id); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | // save selected system events |
178 | 178 | $formEventList = array(); |
179 | 179 | foreach ($sysevents as $evtId) { |
180 | - if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId); |
|
180 | + if (!preg_match('@^[1-9][0-9]*$@', $evtId)) $evtId = getEventIdByName($evtId); |
|
181 | 181 | if ($mode == '101') { |
182 | 182 | $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'"); |
183 | 183 | } else { |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | $rs = $modx->db->select('*', '[+prefix+]site_plugin_events', sprintf("pluginid='%s'", $id)); |
203 | 203 | $dbEventList = array(); |
204 | 204 | $del = array(); |
205 | - while($row = $modx->db->getRow($rs)) { |
|
206 | - if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
205 | + while ($row = $modx->db->getRow($rs)) { |
|
206 | + if (!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
207 | 207 | } |
208 | 208 | |
209 | - if(empty($del)) return; |
|
209 | + if (empty($del)) return; |
|
210 | 210 | |
211 | - foreach($del as $delid) { |
|
211 | + foreach ($del as $delid) { |
|
212 | 212 | $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id)); |
213 | 213 | } |
214 | 214 | } |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | function getEventIdByName($name) |
221 | 221 | { |
222 | 222 | $modx = evolutionCMS(); |
223 | - static $eventIds=array(); |
|
223 | + static $eventIds = array(); |
|
224 | 224 | |
225 | - if(isset($eventIds[$name])) return $eventIds[$name]; |
|
225 | + if (isset($eventIds[$name])) return $eventIds[$name]; |
|
226 | 226 | |
227 | 227 | $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames'); |
228 | 228 | while ($row = $modx->db->getRow($rs)) { |
@@ -177,7 +177,9 @@ discard block |
||
177 | 177 | // save selected system events |
178 | 178 | $formEventList = array(); |
179 | 179 | foreach ($sysevents as $evtId) { |
180 | - if(!preg_match('@^[1-9][0-9]*$@',$evtId)) $evtId = getEventIdByName($evtId); |
|
180 | + if(!preg_match('@^[1-9][0-9]*$@',$evtId)) { |
|
181 | + $evtId = getEventIdByName($evtId); |
|
182 | + } |
|
181 | 183 | if ($mode == '101') { |
182 | 184 | $rs = $modx->db->select('max(priority) as priority', '[+prefix+]site_plugin_events', "evtid='{$evtId}'"); |
183 | 185 | } else { |
@@ -203,10 +205,14 @@ discard block |
||
203 | 205 | $dbEventList = array(); |
204 | 206 | $del = array(); |
205 | 207 | while($row = $modx->db->getRow($rs)) { |
206 | - if(!in_array($row['evtid'], $evtids)) $del[] = $row['evtid']; |
|
208 | + if(!in_array($row['evtid'], $evtids)) { |
|
209 | + $del[] = $row['evtid']; |
|
210 | + } |
|
207 | 211 | } |
208 | 212 | |
209 | - if(empty($del)) return; |
|
213 | + if(empty($del)) { |
|
214 | + return; |
|
215 | + } |
|
210 | 216 | |
211 | 217 | foreach($del as $delid) { |
212 | 218 | $modx->db->delete('[+prefix+]site_plugin_events', sprintf("evtid='%s' AND pluginid='%s'", $delid, $id)); |
@@ -222,7 +228,9 @@ discard block |
||
222 | 228 | $modx = evolutionCMS(); |
223 | 229 | static $eventIds=array(); |
224 | 230 | |
225 | - if(isset($eventIds[$name])) return $eventIds[$name]; |
|
231 | + if(isset($eventIds[$name])) { |
|
232 | + return $eventIds[$name]; |
|
233 | + } |
|
226 | 234 | |
227 | 235 | $rs = $modx->db->select('id, name', '[+prefix+]system_eventnames'); |
228 | 236 | while ($row = $modx->db->getRow($rs)) { |
@@ -79,7 +79,8 @@ discard block |
||
79 | 79 | * @return string |
80 | 80 | */ |
81 | 81 | public function getParents($id, $path = '') |
82 | - { // modx:returns child's parent |
|
82 | + { |
|
83 | +// modx:returns child's parent |
|
83 | 84 | $modx = evolutionCMS(); |
84 | 85 | if (empty($this->aliases)) { |
85 | 86 | $f = "id, IF(alias='', id, alias) AS alias, parent, alias_visible"; |
@@ -456,7 +457,8 @@ discard block |
||
456 | 457 | $_ = trim($_); |
457 | 458 | } |
458 | 459 | $lastChar = substr($_, -1); |
459 | - if (!in_array($lastChar, $chars)) {// ,320,327,288,284,289 |
|
460 | + if (!in_array($lastChar, $chars)) { |
|
461 | +// ,320,327,288,284,289 |
|
460 | 462 | if (!in_array($prev_token, |
461 | 463 | array(T_FOREACH, T_WHILE, T_FOR, T_BOOLEAN_AND, T_BOOLEAN_OR, T_DOUBLE_ARROW))) { |
462 | 464 | $_ .= ' '; |
@@ -3,7 +3,7 @@ discard block |
||
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('edit_document')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | // check user has permission to move document to chosen location |
26 | 26 | |
27 | 27 | if ($use_udperms == 1) { |
28 | - if ($oldparent != $newParentID) { |
|
29 | - include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
30 | - $udperms = new udperms(); |
|
31 | - $udperms->user = $modx->getLoginUserID(); |
|
32 | - $udperms->document = $newParentID; |
|
33 | - $udperms->role = $_SESSION['mgrRole']; |
|
34 | - |
|
35 | - if (!$udperms->checkPermissions()) { |
|
36 | - $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
37 | - } |
|
38 | - } |
|
28 | + if ($oldparent != $newParentID) { |
|
29 | + include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
30 | + $udperms = new udperms(); |
|
31 | + $udperms->user = $modx->getLoginUserID(); |
|
32 | + $udperms->document = $newParentID; |
|
33 | + $udperms->role = $_SESSION['mgrRole']; |
|
34 | + |
|
35 | + if (!$udperms->checkPermissions()) { |
|
36 | + $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]); |
|
37 | + } |
|
38 | + } |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -43,67 +43,67 @@ discard block |
||
43 | 43 | * @return array |
44 | 44 | */ |
45 | 45 | function allChildren($currDocID) { |
46 | - $modx = evolutionCMS(); |
|
47 | - $children= array(); |
|
48 | - $currDocID = $modx->db->escape($currDocID); |
|
49 | - $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'"); |
|
50 | - while ($child= $modx->db->getRow($rs)) { |
|
51 | - $children[]= $child['id']; |
|
52 | - $children= array_merge($children, allChildren($child['id'])); |
|
53 | - } |
|
54 | - return $children; |
|
46 | + $modx = evolutionCMS(); |
|
47 | + $children= array(); |
|
48 | + $currDocID = $modx->db->escape($currDocID); |
|
49 | + $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'"); |
|
50 | + while ($child= $modx->db->getRow($rs)) { |
|
51 | + $children[]= $child['id']; |
|
52 | + $children= array_merge($children, allChildren($child['id'])); |
|
53 | + } |
|
54 | + return $children; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
58 | - "id_document" => $documentID, |
|
59 | - "old_parent" => $oldparent, |
|
60 | - "new_parent" => $newParentID |
|
58 | + "id_document" => $documentID, |
|
59 | + "old_parent" => $oldparent, |
|
60 | + "new_parent" => $newParentID |
|
61 | 61 | )); |
62 | 62 | if (is_array($evtOut) && count($evtOut) > 0){ |
63 | - $newParent = array_pop($evtOut); |
|
64 | - if($newParent == $oldparent) { |
|
65 | - $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
66 | - }else{ |
|
67 | - $newParentID = $newParent; |
|
68 | - } |
|
63 | + $newParent = array_pop($evtOut); |
|
64 | + if($newParent == $oldparent) { |
|
65 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
66 | + }else{ |
|
67 | + $newParentID = $newParent; |
|
68 | + } |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $children = allChildren($documentID); |
72 | 72 | if (!array_search($newParentID, $children)) { |
73 | - $modx->db->update(array( |
|
74 | - 'isfolder' => 1, |
|
75 | - ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
76 | - |
|
77 | - $modx->db->update(array( |
|
78 | - 'parent' => $newParentID, |
|
79 | - 'editedby' => $modx->getLoginUserID(), |
|
80 | - 'editedon' => time(), |
|
81 | - ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
82 | - |
|
83 | - // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
84 | - $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
85 | - $limit = $modx->db->getValue($rs); |
|
86 | - |
|
87 | - if(!$limit>0) { |
|
88 | - $modx->db->update(array( |
|
89 | - 'isfolder' => 0, |
|
90 | - ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
91 | - } |
|
92 | - // Set the item name for logger |
|
93 | - $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
94 | - $_SESSION['itemname'] = $pagetitle; |
|
95 | - |
|
96 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
97 | - "id_document" => $documentID, |
|
98 | - "old_parent" => $oldparent, |
|
99 | - "new_parent" => $newParentID |
|
100 | - )); |
|
101 | - |
|
102 | - // empty cache & sync site |
|
103 | - $modx->clearCache('full'); |
|
104 | - |
|
105 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
106 | - header($header); |
|
73 | + $modx->db->update(array( |
|
74 | + 'isfolder' => 1, |
|
75 | + ), $modx->getFullTableName('site_content'), "id='{$newParentID}'"); |
|
76 | + |
|
77 | + $modx->db->update(array( |
|
78 | + 'parent' => $newParentID, |
|
79 | + 'editedby' => $modx->getLoginUserID(), |
|
80 | + 'editedon' => time(), |
|
81 | + ), $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
|
82 | + |
|
83 | + // finished moving the document, now check to see if the old_parent should no longer be a folder. |
|
84 | + $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
|
85 | + $limit = $modx->db->getValue($rs); |
|
86 | + |
|
87 | + if(!$limit>0) { |
|
88 | + $modx->db->update(array( |
|
89 | + 'isfolder' => 0, |
|
90 | + ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
|
91 | + } |
|
92 | + // Set the item name for logger |
|
93 | + $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
|
94 | + $_SESSION['itemname'] = $pagetitle; |
|
95 | + |
|
96 | + $modx->invokeEvent("onAfterMoveDocument", array ( |
|
97 | + "id_document" => $documentID, |
|
98 | + "old_parent" => $oldparent, |
|
99 | + "new_parent" => $newParentID |
|
100 | + )); |
|
101 | + |
|
102 | + // empty cache & sync site |
|
103 | + $modx->clearCache('full'); |
|
104 | + |
|
105 | + $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
106 | + header($header); |
|
107 | 107 | } else { |
108 | - $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
108 | + $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
|
109 | 109 | } |
@@ -1,20 +1,20 @@ 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('edit_document')) { |
|
5 | +if (!$modx->hasPermission('edit_document')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0; |
|
10 | -$documentID = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
9 | +$newParentID = isset($_REQUEST['new_parent']) ? (int) $_REQUEST['new_parent'] : 0; |
|
10 | +$documentID = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
11 | 11 | |
12 | 12 | // ok, two things to check. |
13 | 13 | // first, document cannot be moved to itself |
14 | 14 | // second, new parent must be a folder. If not, set it to folder. |
15 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
15 | +if ($documentID == $newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | +if ($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | +if ($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
18 | 18 | |
19 | 19 | $parents = $modx->getParentIds($newParentID); |
20 | 20 | if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | if ($use_udperms == 1) { |
28 | 28 | if ($oldparent != $newParentID) { |
29 | - include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
29 | + include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
30 | 30 | $udperms = new udperms(); |
31 | 31 | $udperms->user = $modx->getLoginUserID(); |
32 | 32 | $udperms->document = $newParentID; |
@@ -42,28 +42,28 @@ discard block |
||
42 | 42 | * @param int $currDocID |
43 | 43 | * @return array |
44 | 44 | */ |
45 | -function allChildren($currDocID) { |
|
45 | +function allChildren($currDocID){ |
|
46 | 46 | $modx = evolutionCMS(); |
47 | - $children= array(); |
|
47 | + $children = array(); |
|
48 | 48 | $currDocID = $modx->db->escape($currDocID); |
49 | 49 | $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent = '{$currDocID}'"); |
50 | - while ($child= $modx->db->getRow($rs)) { |
|
51 | - $children[]= $child['id']; |
|
52 | - $children= array_merge($children, allChildren($child['id'])); |
|
50 | + while ($child = $modx->db->getRow($rs)) { |
|
51 | + $children[] = $child['id']; |
|
52 | + $children = array_merge($children, allChildren($child['id'])); |
|
53 | 53 | } |
54 | 54 | return $children; |
55 | 55 | } |
56 | 56 | |
57 | -$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array ( |
|
57 | +$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array( |
|
58 | 58 | "id_document" => $documentID, |
59 | 59 | "old_parent" => $oldparent, |
60 | 60 | "new_parent" => $newParentID |
61 | 61 | )); |
62 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
62 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
63 | 63 | $newParent = array_pop($evtOut); |
64 | - if($newParent == $oldparent) { |
|
64 | + if ($newParent == $oldparent) { |
|
65 | 65 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
66 | - }else{ |
|
66 | + } else { |
|
67 | 67 | $newParentID = $newParent; |
68 | 68 | } |
69 | 69 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'"); |
85 | 85 | $limit = $modx->db->getValue($rs); |
86 | 86 | |
87 | - if(!$limit>0) { |
|
87 | + if (!$limit > 0) { |
|
88 | 88 | $modx->db->update(array( |
89 | 89 | 'isfolder' => 0, |
90 | 90 | ), $modx->getFullTableName('site_content'), "id='{$oldparent}'"); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'")); |
94 | 94 | $_SESSION['itemname'] = $pagetitle; |
95 | 95 | |
96 | - $modx->invokeEvent("onAfterMoveDocument", array ( |
|
96 | + $modx->invokeEvent("onAfterMoveDocument", array( |
|
97 | 97 | "id_document" => $documentID, |
98 | 98 | "old_parent" => $oldparent, |
99 | 99 | "new_parent" => $newParentID |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | // empty cache & sync site |
103 | 103 | $modx->clearCache('full'); |
104 | 104 | |
105 | - $header="Location: index.php?a=3&id={$documentID}&r=9"; |
|
105 | + $header = "Location: index.php?a=3&id={$documentID}&r=9"; |
|
106 | 106 | header($header); |
107 | 107 | } else { |
108 | 108 | $modx->webAlertAndQuit("You cannot move a document to a child document!"); |
@@ -12,12 +12,20 @@ discard block |
||
12 | 12 | // ok, two things to check. |
13 | 13 | // first, document cannot be moved to itself |
14 | 14 | // second, new parent must be a folder. If not, set it to folder. |
15 | -if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
16 | -if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
17 | -if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
15 | +if($documentID==$newParentID) { |
|
16 | + $modx->webAlertAndQuit($_lang["error_movedocument1"]); |
|
17 | +} |
|
18 | +if($documentID <= 0) { |
|
19 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
20 | +} |
|
21 | +if($newParentID < 0) { |
|
22 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
23 | +} |
|
18 | 24 | |
19 | 25 | $parents = $modx->getParentIds($newParentID); |
20 | -if (in_array($documentID, $parents)) $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
26 | +if (in_array($documentID, $parents)) { |
|
27 | + $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
|
28 | +} |
|
21 | 29 | |
22 | 30 | $rs = $modx->db->select('parent', $modx->getFullTableName('site_content'), "id='{$documentID}'"); |
23 | 31 | $oldparent = $modx->db->getValue($rs); |
@@ -42,7 +50,8 @@ discard block |
||
42 | 50 | * @param int $currDocID |
43 | 51 | * @return array |
44 | 52 | */ |
45 | -function allChildren($currDocID) { |
|
53 | +function allChildren($currDocID) |
|
54 | +{ |
|
46 | 55 | $modx = evolutionCMS(); |
47 | 56 | $children= array(); |
48 | 57 | $currDocID = $modx->db->escape($currDocID); |
@@ -59,11 +68,11 @@ discard block |
||
59 | 68 | "old_parent" => $oldparent, |
60 | 69 | "new_parent" => $newParentID |
61 | 70 | )); |
62 | -if (is_array($evtOut) && count($evtOut) > 0){ |
|
71 | +if (is_array($evtOut) && count($evtOut) > 0) { |
|
63 | 72 | $newParent = array_pop($evtOut); |
64 | 73 | if($newParent == $oldparent) { |
65 | 74 | $modx->webAlertAndQuit($_lang["error_movedocument2"]); |
66 | - }else{ |
|
75 | + } else { |
|
67 | 76 | $newParentID = $newParent; |
68 | 77 | } |
69 | 78 | } |