@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | } |
442 | 442 | |
443 | 443 | /** |
444 | - * @return bool |
|
444 | + * @return null|boolean |
|
445 | 445 | */ |
446 | 446 | protected function act_delete() |
447 | 447 | { |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | |
797 | 797 | /** |
798 | 798 | * @param $file |
799 | - * @param $dir |
|
799 | + * @param string $dir |
|
800 | 800 | * @return string |
801 | 801 | */ |
802 | 802 | protected function moveUploadFile($file, $dir) |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | } |
852 | 852 | |
853 | 853 | /** |
854 | - * @param null $file |
|
854 | + * @param string $file |
|
855 | 855 | */ |
856 | 856 | protected function sendDefaultThumb($file = null) |
857 | 857 | { |
@@ -1102,7 +1102,7 @@ discard block |
||
1102 | 1102 | } |
1103 | 1103 | |
1104 | 1104 | /** |
1105 | - * @param $message |
|
1105 | + * @param string $message |
|
1106 | 1106 | * @param array|null $data |
1107 | 1107 | */ |
1108 | 1108 | protected function errorMsg($message, array $data = null) |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $this->get['dir'] = $dir; |
43 | 43 | } |
44 | 44 | |
45 | - $thumbsDir = $this->config['uploadDir'] . "/" . $this->config['thumbsDir']; |
|
45 | + $thumbsDir = $this->config['uploadDir']."/".$this->config['thumbsDir']; |
|
46 | 46 | if (( |
47 | 47 | !is_dir($thumbsDir) && |
48 | 48 | !@mkdir($thumbsDir, $this->config['dirPerms']) |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $this->session['dir'] = $this->type; |
115 | 115 | } else { |
116 | 116 | $type = $this->getTypeFromPath($this->session['dir']); |
117 | - $dir = $this->config['uploadDir'] . "/" . $this->session['dir']; |
|
117 | + $dir = $this->config['uploadDir']."/".$this->session['dir']; |
|
118 | 118 | if (($type != $this->type) || !is_dir($dir) || !is_readable($dir)) { |
119 | 119 | $this->session['dir'] = $this->type; |
120 | 120 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | $file = "{$this->thumbsDir}/{$this->type}/{$this->get['dir']}/$file"; |
190 | 190 | if (!is_file($file) || !is_readable($file)) { |
191 | - $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/" . basename($file); |
|
191 | + $file = "{$this->config['uploadDir']}/{$this->type}/{$this->get['dir']}/".basename($file); |
|
192 | 192 | if (!is_file($file) || !is_readable($file)) { |
193 | 193 | $this->sendDefaultThumb($file); |
194 | 194 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | protected function act_chDir() |
228 | 228 | { |
229 | 229 | $this->postDir(); // Just for existing check |
230 | - $this->session['dir'] = $this->type . "/" . $this->post['dir']; |
|
230 | + $this->session['dir'] = $this->type."/".$this->post['dir']; |
|
231 | 231 | $dirWritable = dir::isWritable("{$this->config['uploadDir']}/{$this->session['dir']}"); |
232 | 232 | |
233 | 233 | return json_encode(array( |
@@ -292,12 +292,12 @@ discard block |
||
292 | 292 | if (substr($newName, 0, 1) == ".") { |
293 | 293 | $this->errorMsg("Folder name shouldn't begins with '.'"); |
294 | 294 | } |
295 | - if (!@rename($dir, dirname($dir) . "/$newName")) { |
|
295 | + if (!@rename($dir, dirname($dir)."/$newName")) { |
|
296 | 296 | $this->errorMsg("Cannot rename the folder."); |
297 | 297 | } |
298 | 298 | $thumbDir = "$this->thumbsTypeDir/{$this->post['dir']}"; |
299 | 299 | if (is_dir($thumbDir)) { |
300 | - @rename($thumbDir, dirname($thumbDir) . "/$newName"); |
|
300 | + @rename($thumbDir, dirname($thumbDir)."/$newName"); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | return json_encode(array('name' => $newName)); |
@@ -375,9 +375,9 @@ discard block |
||
375 | 375 | header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
376 | 376 | header("Cache-Control: private", false); |
377 | 377 | header("Content-Type: application/octet-stream"); |
378 | - header('Content-Disposition: attachment; filename="' . str_replace('"', "_", $this->post['file']) . '"'); |
|
378 | + header('Content-Disposition: attachment; filename="'.str_replace('"', "_", $this->post['file']).'"'); |
|
379 | 379 | header("Content-Transfer-Encoding: binary"); |
380 | - header("Content-Length: " . filesize($file)); |
|
380 | + header("Content-Length: ".filesize($file)); |
|
381 | 381 | readfile($file); |
382 | 382 | die; |
383 | 383 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | $thumbFile = "$thumbDir/{$this->post['file']}"; |
435 | 435 | |
436 | 436 | if (file_exists($thumbFile)) { |
437 | - @rename($thumbFile, "$thumbDir/" . basename($newName)); |
|
437 | + @rename($thumbFile, "$thumbDir/".basename($newName)); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | return true; |
@@ -514,11 +514,11 @@ discard block |
||
514 | 514 | if (!file_exists($path)) { |
515 | 515 | $error[] = $this->label("The file '{file}' does not exist.", $replace); |
516 | 516 | } elseif (substr($base, 0, 1) == ".") { |
517 | - $error[] = "$base: " . $this->label("File name shouldn't begins with '.'"); |
|
517 | + $error[] = "$base: ".$this->label("File name shouldn't begins with '.'"); |
|
518 | 518 | } elseif (!$this->validateExtension($ext, $type)) { |
519 | - $error[] = "$base: " . $this->label("Denied file extension."); |
|
519 | + $error[] = "$base: ".$this->label("Denied file extension."); |
|
520 | 520 | } elseif (file_exists("$dir/$base")) { |
521 | - $error[] = "$base: " . $this->label("A file or folder with that name already exists."); |
|
521 | + $error[] = "$base: ".$this->label("A file or folder with that name already exists."); |
|
522 | 522 | } elseif (!is_readable($path) || !is_file($path)) { |
523 | 523 | $error[] = $this->label("Cannot read '{file}'.", $replace); |
524 | 524 | } elseif (!@copy($path, "$dir/$base")) { |
@@ -578,11 +578,11 @@ discard block |
||
578 | 578 | if (!file_exists($path)) { |
579 | 579 | $error[] = $this->label("The file '{file}' does not exist.", $replace); |
580 | 580 | } elseif (substr($base, 0, 1) == ".") { |
581 | - $error[] = "$base: " . $this->label("File name shouldn't begins with '.'"); |
|
581 | + $error[] = "$base: ".$this->label("File name shouldn't begins with '.'"); |
|
582 | 582 | } elseif (!$this->validateExtension($ext, $type)) { |
583 | - $error[] = "$base: " . $this->label("Denied file extension."); |
|
583 | + $error[] = "$base: ".$this->label("Denied file extension."); |
|
584 | 584 | } elseif (file_exists("$dir/$base")) { |
585 | - $error[] = "$base: " . $this->label("A file or folder with that name already exists."); |
|
585 | + $error[] = "$base: ".$this->label("A file or folder with that name already exists."); |
|
586 | 586 | } elseif (!is_readable($path) || !is_file($path)) { |
587 | 587 | $error[] = $this->label("Cannot read '{file}'.", $replace); |
588 | 588 | } elseif (!file::isWritable($path) || !@rename($path, "$dir/$base")) { |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | } |
636 | 636 | $path = "{$this->config['uploadDir']}/$file"; |
637 | 637 | $base = basename($file); |
638 | - $filepath = str_replace('/' . $base, '', $path); |
|
638 | + $filepath = str_replace('/'.$base, '', $path); |
|
639 | 639 | $replace = array('file' => $base); |
640 | 640 | if (!is_file($path)) { |
641 | 641 | $error[] = $this->label("The file '{file}' does not exist.", $replace); |
@@ -681,15 +681,15 @@ discard block |
||
681 | 681 | if (!isset($this->post['dir']) || $this->config['denyZipDownload']) { |
682 | 682 | $this->errorMsg("Unknown error."); |
683 | 683 | } |
684 | - $filename = basename($dir) . ".zip"; |
|
684 | + $filename = basename($dir).".zip"; |
|
685 | 685 | do { |
686 | - $file = md5(time() . session_id()); |
|
686 | + $file = md5(time().session_id()); |
|
687 | 687 | $file = "{$this->config['uploadDir']}/$file.zip"; |
688 | 688 | } while (file_exists($file)); |
689 | 689 | new zipFolder($file, $dir); |
690 | 690 | header("Content-Type: application/x-zip"); |
691 | - header('Content-Disposition: attachment; filename="' . str_replace('"', "_", $filename) . '"'); |
|
692 | - header("Content-Length: " . filesize($file)); |
|
691 | + header('Content-Disposition: attachment; filename="'.str_replace('"', "_", $filename).'"'); |
|
692 | + header("Content-Length: ".filesize($file)); |
|
693 | 693 | readfile($file); |
694 | 694 | unlink($file); |
695 | 695 | die; |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | } |
724 | 724 | |
725 | 725 | do { |
726 | - $file = md5(time() . session_id()); |
|
726 | + $file = md5(time().session_id()); |
|
727 | 727 | $file = "{$this->config['uploadDir']}/$file.zip"; |
728 | 728 | } while (file_exists($file)); |
729 | 729 | |
@@ -736,8 +736,8 @@ discard block |
||
736 | 736 | $zip->close(); |
737 | 737 | } |
738 | 738 | header("Content-Type: application/x-zip"); |
739 | - header('Content-Disposition: attachment; filename="selected_files_' . basename($file) . '"'); |
|
740 | - header("Content-Length: " . filesize($file)); |
|
739 | + header('Content-Disposition: attachment; filename="selected_files_'.basename($file).'"'); |
|
740 | + header("Content-Length: ".filesize($file)); |
|
741 | 741 | readfile($file); |
742 | 742 | unlink($file); |
743 | 743 | die; |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | if ($type != $this->type) { |
767 | 767 | continue; |
768 | 768 | } |
769 | - $file = $this->config['uploadDir'] . "/$file"; |
|
769 | + $file = $this->config['uploadDir']."/$file"; |
|
770 | 770 | if (!is_file($file) || !is_readable($file)) { |
771 | 771 | continue; |
772 | 772 | } |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | } |
775 | 775 | |
776 | 776 | do { |
777 | - $file = md5(time() . session_id()); |
|
777 | + $file = md5(time().session_id()); |
|
778 | 778 | $file = "{$this->config['uploadDir']}/$file.zip"; |
779 | 779 | } while (file_exists($file)); |
780 | 780 | |
@@ -787,8 +787,8 @@ discard block |
||
787 | 787 | $zip->close(); |
788 | 788 | } |
789 | 789 | header("Content-Type: application/x-zip"); |
790 | - header('Content-Disposition: attachment; filename="clipboard_' . basename($file) . '"'); |
|
791 | - header("Content-Length: " . filesize($file)); |
|
790 | + header('Content-Disposition: attachment; filename="clipboard_'.basename($file).'"'); |
|
791 | + header("Content-Length: ".filesize($file)); |
|
792 | 792 | readfile($file); |
793 | 793 | unlink($file); |
794 | 794 | die; |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | return $response; |
825 | 825 | } |
826 | 826 | $filename = $this->normalizeFilename($file['name']); |
827 | - $target = "$dir/" . file::getInexistantFilename($filename, $dir); |
|
827 | + $target = "$dir/".file::getInexistantFilename($filename, $dir); |
|
828 | 828 | |
829 | 829 | if (!@move_uploaded_file($file['tmp_name'], $target) && |
830 | 830 | !@rename($file['tmp_name'], $target) && |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | if (!$this->config['noThumbnailsRecreation'] && in_array(strtolower($ext), array('png', 'jpg', 'gif', 'jpeg'))) { |
888 | 888 | $size = @getimagesize($file); |
889 | 889 | if (is_array($size) && count($size)) { |
890 | - $thumb_file = "$thumbDir/" . basename($file); |
|
890 | + $thumb_file = "$thumbDir/".basename($file); |
|
891 | 891 | if (!is_file($thumb_file) || filemtime($file) > filemtime($thumb_file)) { |
892 | 892 | $this->makeThumb($file); |
893 | 893 | } |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | } |
904 | 904 | $name = basename($file); |
905 | 905 | $types = $this->config['types']; |
906 | - $types = explode(' ', $types['images'] . ' ' . $types['image']); |
|
906 | + $types = explode(' ', $types['images'].' '.$types['image']); |
|
907 | 907 | if (substr($name, 0, 1) == '.' && !$this->config['showHiddenFiles']) { |
908 | 908 | continue; |
909 | 909 | } |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | { |
983 | 983 | $dir = $this->typeDir; |
984 | 984 | if (isset($this->post['dir'])) { |
985 | - $dir .= "/" . $this->post['dir']; |
|
985 | + $dir .= "/".$this->post['dir']; |
|
986 | 986 | } |
987 | 987 | if ($existent && (!is_dir($dir) || !is_readable($dir))) { |
988 | 988 | $this->errorMsg("Inexistant or inaccessible folder."); |
@@ -999,7 +999,7 @@ discard block |
||
999 | 999 | { |
1000 | 1000 | $dir = $this->typeDir; |
1001 | 1001 | if (isset($this->get['dir'])) { |
1002 | - $dir .= "/" . $this->get['dir']; |
|
1002 | + $dir .= "/".$this->get['dir']; |
|
1003 | 1003 | } |
1004 | 1004 | if ($existent && (!is_dir($dir) || !is_readable($dir))) { |
1005 | 1005 | $this->errorMsg("Inexistant or inaccessible folder."); |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | /** |
314 | 314 | * @param $filename |
315 | - * @return mixed|string |
|
315 | + * @return string |
|
316 | 316 | */ |
317 | 317 | protected function normalizeFilename($filename) { |
318 | 318 | if ($this->getTransaliasSettings()) { |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
327 | - * @param $dirname |
|
327 | + * @param string $dirname |
|
328 | 328 | * @return string |
329 | 329 | */ |
330 | 330 | protected function normalizeDirname($dirname) { |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @param $dir |
409 | 409 | * @param bool $inclType |
410 | 410 | * @param bool $existing |
411 | - * @return bool|string |
|
411 | + * @return false|string |
|
412 | 412 | */ |
413 | 413 | protected function checkInputDir($dir, $inclType=true, $existing=true) { |
414 | 414 | $dir = path::normalize($dir); |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | /** |
440 | - * @param $ext |
|
440 | + * @param string $ext |
|
441 | 441 | * @param $type |
442 | 442 | * @return bool |
443 | 443 | */ |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | |
469 | 469 | /** |
470 | 470 | * @param $path |
471 | - * @return mixed |
|
471 | + * @return string |
|
472 | 472 | */ |
473 | 473 | protected function getTypeFromPath($path) { |
474 | 474 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | } |
477 | 477 | |
478 | 478 | /** |
479 | - * @param $path |
|
479 | + * @param string $path |
|
480 | 480 | * @return string |
481 | 481 | */ |
482 | 482 | protected function removeTypeFromPath($path) { |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | } |
695 | 695 | |
696 | 696 | /** |
697 | - * @param $url |
|
697 | + * @param string $url |
|
698 | 698 | * @param string $message |
699 | 699 | */ |
700 | 700 | protected function callBack($url, $message="") { |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc Uploader class |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.54 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010-2014 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - */ |
|
4 | + * |
|
5 | + * @desc Uploader class |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.54 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010-2014 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class uploader { |
16 | 16 | |
@@ -18,92 +18,92 @@ discard block |
||
18 | 18 | const VERSION = "2.54"; |
19 | 19 | |
20 | 20 | /** Config session-overrided settings |
21 | - * @var array */ |
|
21 | + * @var array */ |
|
22 | 22 | protected $config = array(); |
23 | 23 | |
24 | 24 | /** Default image driver |
25 | - * @var string */ |
|
25 | + * @var string */ |
|
26 | 26 | protected $imageDriver = "gd"; |
27 | 27 | |
28 | 28 | /** Opener applocation properties |
29 | - * $opener['name'] Got from $_GET['opener']; |
|
30 | - * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
31 | - * $opener['TinyMCE'] Boolean |
|
32 | - * @var array */ |
|
29 | + * $opener['name'] Got from $_GET['opener']; |
|
30 | + * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
31 | + * $opener['TinyMCE'] Boolean |
|
32 | + * @var array */ |
|
33 | 33 | protected $opener = array(); |
34 | 34 | |
35 | 35 | /** Got from $_GET['type'] or first one $config['types'] array key, if inexistant |
36 | - * @var string */ |
|
36 | + * @var string */ |
|
37 | 37 | protected $type; |
38 | 38 | |
39 | 39 | /** Helper property. Local filesystem path to the Type Directory |
40 | - * Equivalent: $config['uploadDir'] . "/" . $type |
|
41 | - * @var string */ |
|
40 | + * Equivalent: $config['uploadDir'] . "/" . $type |
|
41 | + * @var string */ |
|
42 | 42 | protected $typeDir; |
43 | 43 | |
44 | 44 | /** Helper property. Web URL to the Type Directory |
45 | - * Equivalent: $config['uploadURL'] . "/" . $type |
|
46 | - * @var string */ |
|
45 | + * Equivalent: $config['uploadURL'] . "/" . $type |
|
46 | + * @var string */ |
|
47 | 47 | protected $typeURL; |
48 | 48 | |
49 | 49 | /** Linked to $config['types'] |
50 | - * @var array */ |
|
50 | + * @var array */ |
|
51 | 51 | protected $types = array(); |
52 | 52 | |
53 | 53 | /** Settings which can override default settings if exists as keys in $config['types'][$type] array |
54 | - * @var array */ |
|
54 | + * @var array */ |
|
55 | 55 | protected $typeSettings = array('disabled', 'theme', 'dirPerms', 'filePerms', 'denyZipDownload', 'maxImageWidth', 'maxImageHeight', 'thumbWidth', 'thumbHeight', 'jpegQuality', 'access', 'filenameChangeChars', 'dirnameChangeChars', 'denyExtensionRename', 'deniedExts', 'watermark'); |
56 | 56 | |
57 | 57 | /** Got from language file |
58 | - * @var string */ |
|
58 | + * @var string */ |
|
59 | 59 | protected $charset; |
60 | 60 | |
61 | 61 | /** The language got from $_GET['lng'] or $_GET['lang'] or... Please see next property |
62 | - * @var string */ |
|
62 | + * @var string */ |
|
63 | 63 | protected $lang = 'en'; |
64 | 64 | |
65 | 65 | /** Possible language $_GET keys |
66 | - * @var array */ |
|
66 | + * @var array */ |
|
67 | 67 | protected $langInputNames = array('lang', 'langCode', 'lng', 'language', 'lang_code'); |
68 | 68 | |
69 | 69 | /** Uploaded file(s) info. Linked to first $_FILES element |
70 | - * @var array */ |
|
70 | + * @var array */ |
|
71 | 71 | protected $file; |
72 | 72 | |
73 | 73 | /** Next three properties are got from the current language file |
74 | - * @var string */ |
|
74 | + * @var string */ |
|
75 | 75 | protected $dateTimeFull; // Currently not used |
76 | 76 | protected $dateTimeMid; // Currently not used |
77 | 77 | protected $dateTimeSmall; |
78 | 78 | |
79 | 79 | /** Contain Specified language labels |
80 | - * @var array */ |
|
80 | + * @var array */ |
|
81 | 81 | protected $labels = array(); |
82 | 82 | |
83 | 83 | /** Contain unprocessed $_GET array. Please use this instead of $_GET |
84 | - * @var array */ |
|
84 | + * @var array */ |
|
85 | 85 | protected $get; |
86 | 86 | |
87 | 87 | /** Contain unprocessed $_POST array. Please use this instead of $_POST |
88 | - * @var array */ |
|
88 | + * @var array */ |
|
89 | 89 | protected $post; |
90 | 90 | |
91 | 91 | /** Contain unprocessed $_COOKIE array. Please use this instead of $_COOKIE |
92 | - * @var array */ |
|
92 | + * @var array */ |
|
93 | 93 | protected $cookie; |
94 | 94 | |
95 | 95 | /** Session array. Please use this property instead of $_SESSION |
96 | - * @var array */ |
|
96 | + * @var array */ |
|
97 | 97 | protected $session; |
98 | 98 | |
99 | 99 | /** CMS integration attribute (got from $_GET['cms']) |
100 | - * @var string */ |
|
100 | + * @var string */ |
|
101 | 101 | protected $cms = ""; |
102 | 102 | |
103 | 103 | protected $modx = null; |
104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
105 | - * @param string $property |
|
106 | - * @return mixed */ |
|
105 | + * @param string $property |
|
106 | + * @return mixed */ |
|
107 | 107 | public function __get($property) { |
108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
109 | 109 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | ) |
137 | 137 | $this->cms = $this->get['cms']; |
138 | 138 | |
139 | - // LINKING UPLOADED FILE |
|
139 | + // LINKING UPLOADED FILE |
|
140 | 140 | if (count($_FILES)) |
141 | 141 | $this->file = &$_FILES[key($_FILES)]; |
142 | 142 | |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
218 | 218 | ? path::normalize($this->config['uploadDir']) |
219 | 219 | : path::url2fullPath("/$path"); |
220 | - $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
221 | - $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
220 | + $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
221 | + $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
222 | 222 | |
223 | 223 | // SITE ROOT |
224 | 224 | } elseif ($this->config['uploadURL'] == "/") { |
@@ -291,23 +291,23 @@ discard block |
||
291 | 291 | * @return array|bool|int|null|string|void |
292 | 292 | */ |
293 | 293 | protected function getTransaliasSettings() { |
294 | - $modx = evolutionCMS(); |
|
295 | - |
|
296 | - // Cleaning uploaded filename? |
|
297 | - $setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
298 | - if ($modx->getDatabase()->getValue($setting)>0) { |
|
299 | - // Transalias plugin active? |
|
300 | - $res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
301 | - if ($properties = $modx->getDatabase()->getValue($res)) { |
|
302 | - $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
303 | - } else { |
|
304 | - $properties = NULL; |
|
305 | - } |
|
306 | - } else { |
|
307 | - $properties = NULL; |
|
308 | - } |
|
309 | - return $properties; |
|
310 | - } |
|
294 | + $modx = evolutionCMS(); |
|
295 | + |
|
296 | + // Cleaning uploaded filename? |
|
297 | + $setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
298 | + if ($modx->getDatabase()->getValue($setting)>0) { |
|
299 | + // Transalias plugin active? |
|
300 | + $res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
301 | + if ($properties = $modx->getDatabase()->getValue($res)) { |
|
302 | + $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
303 | + } else { |
|
304 | + $properties = NULL; |
|
305 | + } |
|
306 | + } else { |
|
307 | + $properties = NULL; |
|
308 | + } |
|
309 | + return $properties; |
|
310 | + } |
|
311 | 311 | |
312 | 312 | |
313 | 313 | /** |
@@ -315,13 +315,13 @@ discard block |
||
315 | 315 | * @return mixed|string |
316 | 316 | */ |
317 | 317 | protected function normalizeFilename($filename) { |
318 | - if ($this->getTransaliasSettings()) { |
|
319 | - $format = strrchr($filename, "."); |
|
320 | - $filename = str_replace($format, "", $filename); |
|
321 | - $filename = $this->modx->stripAlias($filename).$format; |
|
322 | - } |
|
323 | - return $filename; |
|
324 | - } |
|
318 | + if ($this->getTransaliasSettings()) { |
|
319 | + $format = strrchr($filename, "."); |
|
320 | + $filename = str_replace($format, "", $filename); |
|
321 | + $filename = $this->modx->stripAlias($filename).$format; |
|
322 | + } |
|
323 | + return $filename; |
|
324 | + } |
|
325 | 325 | |
326 | 326 | /** |
327 | 327 | * @param $dirname |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | return $this->label("The image is too big and/or cannot be resized."); |
397 | 397 | |
398 | 398 | |
399 | - // CHECK FOR MODX MAX FILE SIZE |
|
400 | - $actualfilesize=filesize($file['tmp_name']); |
|
401 | - if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
402 | - return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
399 | + // CHECK FOR MODX MAX FILE SIZE |
|
400 | + $actualfilesize=filesize($file['tmp_name']); |
|
401 | + if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
402 | + return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
403 | 403 | |
404 | 404 | return true; |
405 | 405 | } |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $top = isset($this->config['watermark']['top']) |
576 | 576 | ? $this->config['watermark']['top'] : false; |
577 | 577 | $img->watermark($this->config['watermark']['file'], $left, $top); |
578 | - } |
|
578 | + } |
|
579 | 579 | |
580 | 580 | $options = array( 'file' => $file ); |
581 | 581 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class uploader { |
|
15 | +class uploader{ |
|
16 | 16 | |
17 | 17 | /** Release version */ |
18 | 18 | const VERSION = "2.54"; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | |
73 | 73 | /** Next three properties are got from the current language file |
74 | 74 | * @var string */ |
75 | - protected $dateTimeFull; // Currently not used |
|
76 | - protected $dateTimeMid; // Currently not used |
|
75 | + protected $dateTimeFull; // Currently not used |
|
76 | + protected $dateTimeMid; // Currently not used |
|
77 | 77 | protected $dateTimeSmall; |
78 | 78 | |
79 | 79 | /** Contain Specified language labels |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
105 | 105 | * @param string $property |
106 | 106 | * @return mixed */ |
107 | - public function __get($property) { |
|
107 | + public function __get($property){ |
|
108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
109 | 109 | } |
110 | 110 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * uploader constructor. |
113 | 113 | * @param DocumentParser $modx |
114 | 114 | */ |
115 | - public function __construct(DocumentParser $modx) { |
|
115 | + public function __construct(DocumentParser $modx){ |
|
116 | 116 | |
117 | 117 | //MODX |
118 | 118 | try { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | // COOKIES INIT |
197 | 197 | $ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'; |
198 | - $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/'; |
|
198 | + $ip = '/^'.implode('\.', array($ip, $ip, $ip, $ip)).'$/'; |
|
199 | 199 | if (preg_match($ip, $_SERVER['HTTP_HOST']) || |
200 | 200 | preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST']) |
201 | 201 | ) |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | ) { |
214 | 214 | list($unused, $protocol, $domain, $unused, $port, $path) = $patt; |
215 | 215 | $path = path::normalize($path); |
216 | - $this->config['uploadURL'] = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/$path"; |
|
216 | + $this->config['uploadURL'] = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/$path"; |
|
217 | 217 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
218 | 218 | ? path::normalize($this->config['uploadDir']) |
219 | 219 | : path::url2fullPath("/$path"); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | foreach ($this->langInputNames as $key) |
257 | 257 | if (isset($this->get[$key]) && |
258 | 258 | preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) && |
259 | - file_exists("lang/" . strtolower($this->get[$key]) . ".php") |
|
259 | + file_exists("lang/".strtolower($this->get[$key]).".php") |
|
260 | 260 | ) { |
261 | 261 | $this->lang = $this->get[$key]; |
262 | 262 | break; |
@@ -290,12 +290,12 @@ discard block |
||
290 | 290 | /** |
291 | 291 | * @return array|bool|int|null|string|void |
292 | 292 | */ |
293 | - protected function getTransaliasSettings() { |
|
293 | + protected function getTransaliasSettings(){ |
|
294 | 294 | $modx = evolutionCMS(); |
295 | 295 | |
296 | 296 | // Cleaning uploaded filename? |
297 | 297 | $setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
298 | - if ($modx->getDatabase()->getValue($setting)>0) { |
|
298 | + if ($modx->getDatabase()->getValue($setting) > 0) { |
|
299 | 299 | // Transalias plugin active? |
300 | 300 | $res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
301 | 301 | if ($properties = $modx->getDatabase()->getValue($res)) { |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @param $filename |
315 | 315 | * @return mixed|string |
316 | 316 | */ |
317 | - protected function normalizeFilename($filename) { |
|
317 | + protected function normalizeFilename($filename){ |
|
318 | 318 | if ($this->getTransaliasSettings()) { |
319 | 319 | $format = strrchr($filename, "."); |
320 | 320 | $filename = str_replace($format, "", $filename); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @param $dirname |
328 | 328 | * @return string |
329 | 329 | */ |
330 | - protected function normalizeDirname($dirname) { |
|
330 | + protected function normalizeDirname($dirname){ |
|
331 | 331 | return $this->modx->stripAlias($dirname); |
332 | 332 | } |
333 | 333 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * @param array|null $aFile |
336 | 336 | * @return bool|mixed |
337 | 337 | */ |
338 | - protected function checkUploadedFile(array $aFile=null) { |
|
338 | + protected function checkUploadedFile(array $aFile = null){ |
|
339 | 339 | $config = &$this->config; |
340 | 340 | $file = ($aFile === null) ? $this->file : $aFile; |
341 | 341 | |
@@ -361,8 +361,7 @@ discard block |
||
361 | 361 | ($file['error'] == UPLOAD_ERR_NO_TMP_DIR) ? |
362 | 362 | $this->label("Missing a temporary folder.") : ( |
363 | 363 | ($file['error'] == UPLOAD_ERR_CANT_WRITE) ? |
364 | - $this->label("Failed to write file.") : |
|
365 | - $this->label("Unknown error.") |
|
364 | + $this->label("Failed to write file.") : $this->label("Unknown error.") |
|
366 | 365 | ))))); |
367 | 366 | |
368 | 367 | // HIDDEN FILENAMES CHECK |
@@ -397,7 +396,7 @@ discard block |
||
397 | 396 | |
398 | 397 | |
399 | 398 | // CHECK FOR MODX MAX FILE SIZE |
400 | - $actualfilesize=filesize($file['tmp_name']); |
|
399 | + $actualfilesize = filesize($file['tmp_name']); |
|
401 | 400 | if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
402 | 401 | return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
403 | 402 | |
@@ -410,7 +409,7 @@ discard block |
||
410 | 409 | * @param bool $existing |
411 | 410 | * @return bool|string |
412 | 411 | */ |
413 | - protected function checkInputDir($dir, $inclType=true, $existing=true) { |
|
412 | + protected function checkInputDir($dir, $inclType = true, $existing = true){ |
|
414 | 413 | $dir = path::normalize($dir); |
415 | 414 | if (substr($dir, 0, 1) == "/") |
416 | 415 | $dir = substr($dir, 1); |
@@ -441,7 +440,7 @@ discard block |
||
441 | 440 | * @param $type |
442 | 441 | * @return bool |
443 | 442 | */ |
444 | - protected function validateExtension($ext, $type) { |
|
443 | + protected function validateExtension($ext, $type){ |
|
445 | 444 | $ext = trim(strtolower($ext)); |
446 | 445 | if (!isset($this->types[$type])) |
447 | 446 | return false; |
@@ -470,7 +469,7 @@ discard block |
||
470 | 469 | * @param $path |
471 | 470 | * @return mixed |
472 | 471 | */ |
473 | - protected function getTypeFromPath($path) { |
|
472 | + protected function getTypeFromPath($path){ |
|
474 | 473 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
475 | 474 | ? $patt[1] : $path; |
476 | 475 | } |
@@ -479,7 +478,7 @@ discard block |
||
479 | 478 | * @param $path |
480 | 479 | * @return string |
481 | 480 | */ |
482 | - protected function removeTypeFromPath($path) { |
|
481 | + protected function removeTypeFromPath($path){ |
|
483 | 482 | return preg_match('/^[^\/]*\/(.*)$/', $path, $patt) |
484 | 483 | ? $patt[1] : ""; |
485 | 484 | } |
@@ -489,7 +488,7 @@ discard block |
||
489 | 488 | * @param null $file |
490 | 489 | * @return bool |
491 | 490 | */ |
492 | - protected function imageResize($image, $file=null) { |
|
491 | + protected function imageResize($image, $file = null){ |
|
493 | 492 | |
494 | 493 | if (!($image instanceof image)) { |
495 | 494 | $img = image::factory($this->imageDriver, $image); |
@@ -577,19 +576,19 @@ discard block |
||
577 | 576 | $img->watermark($this->config['watermark']['file'], $left, $top); |
578 | 577 | } |
579 | 578 | |
580 | - $options = array( 'file' => $file ); |
|
579 | + $options = array('file' => $file); |
|
581 | 580 | |
582 | - $type = exif_imagetype( $file ); |
|
581 | + $type = exif_imagetype($file); |
|
583 | 582 | |
584 | - switch ( $type ) { |
|
583 | + switch ($type) { |
|
585 | 584 | case IMAGETYPE_GIF: |
586 | - return $img->output( 'gif', $options ); |
|
585 | + return $img->output('gif', $options); |
|
587 | 586 | |
588 | 587 | case IMAGETYPE_PNG: |
589 | - return $img->output( 'png', $options ); |
|
588 | + return $img->output('png', $options); |
|
590 | 589 | |
591 | 590 | default: |
592 | - return $img->output( 'jpeg', array_merge( $options, array( 'quality' => $this->config['jpegQuality'] ) ) ); |
|
591 | + return $img->output('jpeg', array_merge($options, array('quality' => $this->config['jpegQuality']))); |
|
593 | 592 | } |
594 | 593 | |
595 | 594 | } |
@@ -599,7 +598,7 @@ discard block |
||
599 | 598 | * @param bool $overwrite |
600 | 599 | * @return bool |
601 | 600 | */ |
602 | - protected function makeThumb($file, $overwrite=true) { |
|
601 | + protected function makeThumb($file, $overwrite = true){ |
|
603 | 602 | $img = image::factory($this->imageDriver, $file); |
604 | 603 | |
605 | 604 | // Drop files which are not images |
@@ -607,7 +606,7 @@ discard block |
||
607 | 606 | return true; |
608 | 607 | |
609 | 608 | $thumb = substr($file, strlen($this->config['uploadDir'])); |
610 | - $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb; |
|
609 | + $thumb = $this->config['uploadDir']."/".$this->config['thumbsDir']."/".$thumb; |
|
611 | 610 | $thumb = path::normalize($thumb); |
612 | 611 | $thumbDir = dirname($thumb); |
613 | 612 | if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) |
@@ -630,15 +629,15 @@ discard block |
||
630 | 629 | if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) |
631 | 630 | return false; |
632 | 631 | |
633 | - if ( $this->imageDriver == 'gd' ) { |
|
634 | - $width = imagesx( $img->image ); |
|
635 | - $height = imagesy( $img->image ); |
|
636 | - $back = image::factory( $this->imageDriver, array( $width, $height ) ); |
|
637 | - $tile = image::factory( $this->imageDriver, __DIR__ . '/../themes/' . $this->config['theme'] . '/img/bg_transparent.png' ); |
|
632 | + if ($this->imageDriver == 'gd') { |
|
633 | + $width = imagesx($img->image); |
|
634 | + $height = imagesy($img->image); |
|
635 | + $back = image::factory($this->imageDriver, array($width, $height)); |
|
636 | + $tile = image::factory($this->imageDriver, __DIR__.'/../themes/'.$this->config['theme'].'/img/bg_transparent.png'); |
|
638 | 637 | |
639 | - imagesettile( $back->image, $tile->image ); |
|
640 | - imagefilledrectangle( $back->image, 0, 0, $width, $height, IMG_COLOR_TILED ); |
|
641 | - imagecopy( $back->image, $img->image, 0, 0, 0, 0, $width, $height ); |
|
638 | + imagesettile($back->image, $tile->image); |
|
639 | + imagefilledrectangle($back->image, 0, 0, $width, $height, IMG_COLOR_TILED); |
|
640 | + imagecopy($back->image, $img->image, 0, 0, 0, 0, $width, $height); |
|
642 | 641 | |
643 | 642 | $img = $back; |
644 | 643 | } |
@@ -653,7 +652,7 @@ discard block |
||
653 | 652 | /** |
654 | 653 | * @param $langCode |
655 | 654 | */ |
656 | - protected function localize($langCode) { |
|
655 | + protected function localize($langCode){ |
|
657 | 656 | require "lang/{$langCode}.php"; |
658 | 657 | setlocale(LC_ALL, $lang['_locale']); |
659 | 658 | $this->charset = $lang['_charset']; |
@@ -673,7 +672,7 @@ discard block |
||
673 | 672 | * @param array|null $data |
674 | 673 | * @return mixed |
675 | 674 | */ |
676 | - protected function label($string, array $data=null) { |
|
675 | + protected function label($string, array $data = null){ |
|
677 | 676 | $return = isset($this->labels[$string]) ? $this->labels[$string] : $string; |
678 | 677 | if (is_array($data)) |
679 | 678 | foreach ($data as $key => $val) |
@@ -685,7 +684,7 @@ discard block |
||
685 | 684 | * @param $message |
686 | 685 | * @param array|null $data |
687 | 686 | */ |
688 | - protected function backMsg($message, array $data=null) { |
|
687 | + protected function backMsg($message, array $data = null){ |
|
689 | 688 | $message = $this->label($message, $data); |
690 | 689 | if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) |
691 | 690 | @unlink($this->file['tmp_name']); |
@@ -697,7 +696,7 @@ discard block |
||
697 | 696 | * @param $url |
698 | 697 | * @param string $message |
699 | 698 | */ |
700 | - protected function callBack($url, $message="") { |
|
699 | + protected function callBack($url, $message = ""){ |
|
701 | 700 | $message = text::jsValue($message); |
702 | 701 | $CKfuncNum = isset($this->opener['CKEditor']['funcNum']) |
703 | 702 | ? $this->opener['CKEditor']['funcNum'] : 0; |
@@ -741,7 +740,7 @@ discard block |
||
741 | 740 | /** |
742 | 741 | * @return string |
743 | 742 | */ |
744 | - protected function get_htaccess() { |
|
743 | + protected function get_htaccess(){ |
|
745 | 744 | return "<IfModule mod_php4.c> |
746 | 745 | php_value engine off |
747 | 746 | </IfModule> |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class uploader { |
|
15 | +class uploader |
|
16 | +{ |
|
16 | 17 | |
17 | 18 | /** Release version */ |
18 | 19 | const VERSION = "2.54"; |
@@ -104,7 +105,8 @@ discard block |
||
104 | 105 | /** Magic method which allows read-only access to protected or private class properties |
105 | 106 | * @param string $property |
106 | 107 | * @return mixed */ |
107 | - public function __get($property) { |
|
108 | + public function __get($property) |
|
109 | + { |
|
108 | 110 | return property_exists($this, $property) ? $this->$property : null; |
109 | 111 | } |
110 | 112 | |
@@ -112,13 +114,16 @@ discard block |
||
112 | 114 | * uploader constructor. |
113 | 115 | * @param DocumentParser $modx |
114 | 116 | */ |
115 | - public function __construct(DocumentParser $modx) { |
|
117 | + public function __construct(DocumentParser $modx) |
|
118 | + { |
|
116 | 119 | |
117 | 120 | //MODX |
118 | 121 | try { |
119 | 122 | if ($modx instanceof DocumentParser) { |
120 | 123 | $this->modx = $modx; |
121 | - } else throw new Exception('MODX should be instance of DocumentParser'); |
|
124 | + } else { |
|
125 | + throw new Exception('MODX should be instance of DocumentParser'); |
|
126 | + } |
|
122 | 127 | } catch (Exception $e) { |
123 | 128 | die($e->getMessage()); |
124 | 129 | } |
@@ -133,12 +138,14 @@ discard block |
||
133 | 138 | // SET CMS INTEGRATION ATTRIBUTE |
134 | 139 | if (isset($this->get['cms']) && |
135 | 140 | in_array($this->get['cms'], array("drupal")) |
136 | - ) |
|
137 | - $this->cms = $this->get['cms']; |
|
141 | + ) { |
|
142 | + $this->cms = $this->get['cms']; |
|
143 | + } |
|
138 | 144 | |
139 | 145 | // LINKING UPLOADED FILE |
140 | - if (count($_FILES)) |
|
141 | - $this->file = &$_FILES[key($_FILES)]; |
|
146 | + if (count($_FILES)) { |
|
147 | + $this->file = &$_FILES[key($_FILES)]; |
|
148 | + } |
|
142 | 149 | |
143 | 150 | // LOAD DEFAULT CONFIGURATION |
144 | 151 | require "config.php"; |
@@ -148,31 +155,37 @@ discard block |
||
148 | 155 | if (isset($_CONFIG['_sessionVar']) && |
149 | 156 | is_array($_CONFIG['_sessionVar']) |
150 | 157 | ) { |
151 | - foreach ($_CONFIG['_sessionVar'] as $key => $val) |
|
152 | - if ((substr($key, 0, 1) != "_") && isset($_CONFIG[$key])) |
|
158 | + foreach ($_CONFIG['_sessionVar'] as $key => $val) { |
|
159 | + if ((substr($key, 0, 1) != "_") && isset($_CONFIG[$key])) |
|
153 | 160 | $this->config[$key] = $val; |
154 | - if (!isset($this->config['_sessionVar']['self'])) |
|
155 | - $this->config['_sessionVar']['self'] = array(); |
|
161 | + } |
|
162 | + if (!isset($this->config['_sessionVar']['self'])) { |
|
163 | + $this->config['_sessionVar']['self'] = array(); |
|
164 | + } |
|
156 | 165 | $this->session = &$this->config['_sessionVar']['self']; |
157 | - } else |
|
158 | - $this->session = &$_SESSION; |
|
166 | + } else { |
|
167 | + $this->session = &$_SESSION; |
|
168 | + } |
|
159 | 169 | |
160 | 170 | // IMAGE DRIVER INIT |
161 | 171 | if (isset($this->config['imageDriversPriority'])) { |
162 | 172 | $this->config['imageDriversPriority'] = |
163 | 173 | text::clearWhitespaces($this->config['imageDriversPriority']); |
164 | 174 | $driver = image::getDriver(explode(' ', $this->config['imageDriversPriority'])); |
165 | - if ($driver !== false) |
|
166 | - $this->imageDriver = $driver; |
|
175 | + if ($driver !== false) { |
|
176 | + $this->imageDriver = $driver; |
|
177 | + } |
|
167 | 178 | } |
168 | 179 | if ((!isset($driver) || ($driver === false)) && |
169 | 180 | (image::getDriver(array($this->imageDriver)) === false) |
170 | - ) |
|
171 | - die("Cannot find any of the supported PHP image extensions!"); |
|
181 | + ) { |
|
182 | + die("Cannot find any of the supported PHP image extensions!"); |
|
183 | + } |
|
172 | 184 | |
173 | 185 | // WATERMARK INIT |
174 | - if (isset($this->config['watermark']) && is_string($this->config['watermark'])) |
|
175 | - $this->config['watermark'] = array('file' => $this->config['watermark']); |
|
186 | + if (isset($this->config['watermark']) && is_string($this->config['watermark'])) { |
|
187 | + $this->config['watermark'] = array('file' => $this->config['watermark']); |
|
188 | + } |
|
176 | 189 | |
177 | 190 | // GET TYPE DIRECTORY |
178 | 191 | $this->types = &$this->config['types']; |
@@ -186,9 +199,10 @@ discard block |
||
186 | 199 | |
187 | 200 | // LOAD TYPE DIRECTORY SPECIFIC CONFIGURATION IF EXISTS |
188 | 201 | if (is_array($this->types[$this->type])) { |
189 | - foreach ($this->types[$this->type] as $key => $val) |
|
190 | - if (in_array($key, $this->typeSettings)) |
|
202 | + foreach ($this->types[$this->type] as $key => $val) { |
|
203 | + if (in_array($key, $this->typeSettings)) |
|
191 | 204 | $this->config[$key] = $val; |
205 | + } |
|
192 | 206 | $this->types[$this->type] = isset($this->types[$this->type]['type']) |
193 | 207 | ? $this->types[$this->type]['type'] : ""; |
194 | 208 | } |
@@ -198,12 +212,14 @@ discard block |
||
198 | 212 | $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/'; |
199 | 213 | if (preg_match($ip, $_SERVER['HTTP_HOST']) || |
200 | 214 | preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST']) |
201 | - ) |
|
202 | - $this->config['cookieDomain'] = ""; |
|
203 | - elseif (!strlen($this->config['cookieDomain'])) |
|
204 | - $this->config['cookieDomain'] = $_SERVER['HTTP_HOST']; |
|
205 | - if (!strlen($this->config['cookiePath'])) |
|
206 | - $this->config['cookiePath'] = "/"; |
|
215 | + ) { |
|
216 | + $this->config['cookieDomain'] = ""; |
|
217 | + } elseif (!strlen($this->config['cookieDomain'])) { |
|
218 | + $this->config['cookieDomain'] = $_SERVER['HTTP_HOST']; |
|
219 | + } |
|
220 | + if (!strlen($this->config['cookiePath'])) { |
|
221 | + $this->config['cookiePath'] = "/"; |
|
222 | + } |
|
207 | 223 | |
208 | 224 | // UPLOAD FOLDER INIT |
209 | 225 | |
@@ -239,26 +255,30 @@ discard block |
||
239 | 255 | $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
240 | 256 | $this->typeURL = "{$this->config['uploadURL']}/{$this->type}"; |
241 | 257 | } |
242 | - if (!is_dir($this->config['uploadDir'])) |
|
243 | - @mkdir($this->config['uploadDir'], $this->config['dirPerms']); |
|
258 | + if (!is_dir($this->config['uploadDir'])) { |
|
259 | + @mkdir($this->config['uploadDir'], $this->config['dirPerms']); |
|
260 | + } |
|
244 | 261 | |
245 | 262 | // HOST APPLICATIONS INIT |
246 | - if (isset($this->get['CKEditorFuncNum'])) |
|
247 | - $this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum']; |
|
263 | + if (isset($this->get['CKEditorFuncNum'])) { |
|
264 | + $this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum']; |
|
265 | + } |
|
248 | 266 | if (isset($this->get['opener']) && |
249 | 267 | (strtolower($this->get['opener']) == "tinymce") && |
250 | 268 | isset($this->config['_tinyMCEPath']) && |
251 | 269 | strlen($this->config['_tinyMCEPath']) |
252 | - ) |
|
253 | - $this->opener['TinyMCE'] = true; |
|
270 | + ) { |
|
271 | + $this->opener['TinyMCE'] = true; |
|
272 | + } |
|
254 | 273 | |
255 | 274 | // LOCALIZATION |
256 | - foreach ($this->langInputNames as $key) |
|
257 | - if (isset($this->get[$key]) && |
|
275 | + foreach ($this->langInputNames as $key) { |
|
276 | + if (isset($this->get[$key]) && |
|
258 | 277 | preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) && |
259 | 278 | file_exists("lang/" . strtolower($this->get[$key]) . ".php") |
260 | 279 | ) { |
261 | 280 | $this->lang = $this->get[$key]; |
281 | + } |
|
262 | 282 | break; |
263 | 283 | } |
264 | 284 | $this->localize($this->lang); |
@@ -269,28 +289,34 @@ discard block |
||
269 | 289 | ) { |
270 | 290 | $htaccess = "{$this->config['uploadDir']}/.htaccess"; |
271 | 291 | if (!file_exists($htaccess)) { |
272 | - if (!@file_put_contents($htaccess, $this->get_htaccess())) |
|
273 | - $this->backMsg("Cannot write to upload folder. {$this->config['uploadDir']}"); |
|
292 | + if (!@file_put_contents($htaccess, $this->get_htaccess())) { |
|
293 | + $this->backMsg("Cannot write to upload folder. {$this->config['uploadDir']}"); |
|
294 | + } |
|
274 | 295 | } else { |
275 | - if (false === ($data = @file_get_contents($htaccess))) |
|
276 | - $this->backMsg("Cannot read .htaccess"); |
|
277 | - if (($data != $this->get_htaccess()) && !@file_put_contents($htaccess, $data)) |
|
278 | - $this->backMsg("Incorrect .htaccess file. Cannot rewrite it!"); |
|
296 | + if (false === ($data = @file_get_contents($htaccess))) { |
|
297 | + $this->backMsg("Cannot read .htaccess"); |
|
298 | + } |
|
299 | + if (($data != $this->get_htaccess()) && !@file_put_contents($htaccess, $data)) { |
|
300 | + $this->backMsg("Incorrect .htaccess file. Cannot rewrite it!"); |
|
301 | + } |
|
279 | 302 | } |
280 | 303 | } |
281 | 304 | |
282 | 305 | // CHECK & CREATE UPLOAD FOLDER |
283 | 306 | if (!is_dir($this->typeDir)) { |
284 | - if (!mkdir($this->typeDir, $this->config['dirPerms'])) |
|
285 | - $this->backMsg("Cannot create {dir} folder.", array('dir' => $this->type)); |
|
286 | - } elseif (!is_readable($this->typeDir)) |
|
287 | - $this->backMsg("Cannot read upload folder."); |
|
307 | + if (!mkdir($this->typeDir, $this->config['dirPerms'])) { |
|
308 | + $this->backMsg("Cannot create {dir} folder.", array('dir' => $this->type)); |
|
309 | + } |
|
310 | + } elseif (!is_readable($this->typeDir)) { |
|
311 | + $this->backMsg("Cannot read upload folder."); |
|
312 | + } |
|
288 | 313 | } |
289 | 314 | |
290 | 315 | /** |
291 | 316 | * @return array|bool|int|null|string|void |
292 | 317 | */ |
293 | - protected function getTransaliasSettings() { |
|
318 | + protected function getTransaliasSettings() |
|
319 | + { |
|
294 | 320 | $modx = evolutionCMS(); |
295 | 321 | |
296 | 322 | // Cleaning uploaded filename? |
@@ -314,7 +340,8 @@ discard block |
||
314 | 340 | * @param $filename |
315 | 341 | * @return mixed|string |
316 | 342 | */ |
317 | - protected function normalizeFilename($filename) { |
|
343 | + protected function normalizeFilename($filename) |
|
344 | + { |
|
318 | 345 | if ($this->getTransaliasSettings()) { |
319 | 346 | $format = strrchr($filename, "."); |
320 | 347 | $filename = str_replace($format, "", $filename); |
@@ -327,7 +354,8 @@ discard block |
||
327 | 354 | * @param $dirname |
328 | 355 | * @return string |
329 | 356 | */ |
330 | - protected function normalizeDirname($dirname) { |
|
357 | + protected function normalizeDirname($dirname) |
|
358 | + { |
|
331 | 359 | return $this->modx->stripAlias($dirname); |
332 | 360 | } |
333 | 361 | |
@@ -335,19 +363,21 @@ discard block |
||
335 | 363 | * @param array|null $aFile |
336 | 364 | * @return bool|mixed |
337 | 365 | */ |
338 | - protected function checkUploadedFile(array $aFile=null) { |
|
366 | + protected function checkUploadedFile(array $aFile=null) |
|
367 | + { |
|
339 | 368 | $config = &$this->config; |
340 | 369 | $file = ($aFile === null) ? $this->file : $aFile; |
341 | 370 | |
342 | - if (!is_array($file) || !isset($file['name'])) |
|
343 | - return $this->label("Unknown error."); |
|
371 | + if (!is_array($file) || !isset($file['name'])) { |
|
372 | + return $this->label("Unknown error."); |
|
373 | + } |
|
344 | 374 | |
345 | 375 | $extension = file::getExtension($file['name']); |
346 | 376 | $typePatt = strtolower(text::clearWhitespaces($this->types[$this->type])); |
347 | 377 | |
348 | 378 | // CHECK FOR UPLOAD ERRORS |
349 | - if ($file['error']) |
|
350 | - return |
|
379 | + if ($file['error']) { |
|
380 | + return |
|
351 | 381 | ($file['error'] == UPLOAD_ERR_INI_SIZE) ? |
352 | 382 | $this->label("The uploaded file exceeds {size} bytes.", |
353 | 383 | array('size' => ini_get('upload_max_filesize'))) : ( |
@@ -364,14 +394,17 @@ discard block |
||
364 | 394 | $this->label("Failed to write file.") : |
365 | 395 | $this->label("Unknown error.") |
366 | 396 | ))))); |
397 | + } |
|
367 | 398 | |
368 | 399 | // HIDDEN FILENAMES CHECK |
369 | - elseif (substr($file['name'], 0, 1) == ".") |
|
370 | - return $this->label("File name shouldn't begins with '.'"); |
|
400 | + elseif (substr($file['name'], 0, 1) == ".") { |
|
401 | + return $this->label("File name shouldn't begins with '.'"); |
|
402 | + } |
|
371 | 403 | |
372 | 404 | // EXTENSION CHECK |
373 | - elseif (!$this->validateExtension($extension, $this->type)) |
|
374 | - return $this->label("Denied file extension."); |
|
405 | + elseif (!$this->validateExtension($extension, $this->type)) { |
|
406 | + return $this->label("Denied file extension."); |
|
407 | + } |
|
375 | 408 | |
376 | 409 | // SPECIAL DIRECTORY TYPES CHECK (e.g. *img) |
377 | 410 | elseif (preg_match('/^\*([^ ]+)(.*)?$/s', $typePatt, $patt)) { |
@@ -381,25 +414,30 @@ discard block |
||
381 | 414 | $type = new $class(); |
382 | 415 | $cfg = $config; |
383 | 416 | $cfg['filename'] = $file['name']; |
384 | - if (strlen($params)) |
|
385 | - $cfg['params'] = trim($params); |
|
417 | + if (strlen($params)) { |
|
418 | + $cfg['params'] = trim($params); |
|
419 | + } |
|
386 | 420 | $response = $type->checkFile($file['tmp_name'], $cfg); |
387 | - if ($response !== true) |
|
388 | - return $this->label($response); |
|
389 | - } else |
|
390 | - return $this->label("Non-existing directory type."); |
|
421 | + if ($response !== true) { |
|
422 | + return $this->label($response); |
|
423 | + } |
|
424 | + } else { |
|
425 | + return $this->label("Non-existing directory type."); |
|
426 | + } |
|
391 | 427 | } |
392 | 428 | |
393 | 429 | // IMAGE RESIZE |
394 | 430 | $img = image::factory($this->imageDriver, $file['tmp_name']); |
395 | - if (!$img->initError && !$this->imageResize($img, $file['tmp_name'])) |
|
396 | - return $this->label("The image is too big and/or cannot be resized."); |
|
431 | + if (!$img->initError && !$this->imageResize($img, $file['tmp_name'])) { |
|
432 | + return $this->label("The image is too big and/or cannot be resized."); |
|
433 | + } |
|
397 | 434 | |
398 | 435 | |
399 | 436 | // CHECK FOR MODX MAX FILE SIZE |
400 | 437 | $actualfilesize=filesize($file['tmp_name']); |
401 | - if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
402 | - return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
438 | + if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) { |
|
439 | + return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
440 | + } |
|
403 | 441 | |
404 | 442 | return true; |
405 | 443 | } |
@@ -410,27 +448,32 @@ discard block |
||
410 | 448 | * @param bool $existing |
411 | 449 | * @return bool|string |
412 | 450 | */ |
413 | - protected function checkInputDir($dir, $inclType=true, $existing=true) { |
|
451 | + protected function checkInputDir($dir, $inclType=true, $existing=true) |
|
452 | + { |
|
414 | 453 | $dir = path::normalize($dir); |
415 | - if (substr($dir, 0, 1) == "/") |
|
416 | - $dir = substr($dir, 1); |
|
454 | + if (substr($dir, 0, 1) == "/") { |
|
455 | + $dir = substr($dir, 1); |
|
456 | + } |
|
417 | 457 | |
418 | - if ((substr($dir, 0, 1) == ".") || (substr(basename($dir), 0, 1) == ".")) |
|
419 | - return false; |
|
458 | + if ((substr($dir, 0, 1) == ".") || (substr(basename($dir), 0, 1) == ".")) { |
|
459 | + return false; |
|
460 | + } |
|
420 | 461 | |
421 | 462 | if ($inclType) { |
422 | 463 | $first = explode("/", $dir); |
423 | 464 | $first = $first[0]; |
424 | - if ($first != $this->type) |
|
425 | - return false; |
|
465 | + if ($first != $this->type) { |
|
466 | + return false; |
|
467 | + } |
|
426 | 468 | $return = $this->removeTypeFromPath($dir); |
427 | 469 | } else { |
428 | 470 | $return = $dir; |
429 | 471 | $dir = "{$this->type}/$dir"; |
430 | 472 | } |
431 | 473 | |
432 | - if (!$existing) |
|
433 | - return $return; |
|
474 | + if (!$existing) { |
|
475 | + return $return; |
|
476 | + } |
|
434 | 477 | |
435 | 478 | $path = "{$this->config['uploadDir']}/$dir"; |
436 | 479 | return (is_dir($path) && is_readable($path)) ? $return : false; |
@@ -441,21 +484,25 @@ discard block |
||
441 | 484 | * @param $type |
442 | 485 | * @return bool |
443 | 486 | */ |
444 | - protected function validateExtension($ext, $type) { |
|
487 | + protected function validateExtension($ext, $type) |
|
488 | + { |
|
445 | 489 | $ext = trim(strtolower($ext)); |
446 | - if (!isset($this->types[$type])) |
|
447 | - return false; |
|
490 | + if (!isset($this->types[$type])) { |
|
491 | + return false; |
|
492 | + } |
|
448 | 493 | |
449 | 494 | $exts = strtolower(text::clearWhitespaces($this->config['deniedExts'])); |
450 | 495 | if (strlen($exts)) { |
451 | 496 | $exts = explode(" ", $exts); |
452 | - if (in_array($ext, $exts)) |
|
453 | - return false; |
|
497 | + if (in_array($ext, $exts)) { |
|
498 | + return false; |
|
499 | + } |
|
454 | 500 | } |
455 | 501 | |
456 | 502 | $exts = trim($this->types[$type]); |
457 | - if (!strlen($exts) || substr($exts, 0, 1) == "*") |
|
458 | - return true; |
|
503 | + if (!strlen($exts) || substr($exts, 0, 1) == "*") { |
|
504 | + return true; |
|
505 | + } |
|
459 | 506 | |
460 | 507 | if (substr($exts, 0, 1) == "!") { |
461 | 508 | $exts = explode(" ", trim(strtolower(substr($exts, 1)))); |
@@ -470,7 +517,8 @@ discard block |
||
470 | 517 | * @param $path |
471 | 518 | * @return mixed |
472 | 519 | */ |
473 | - protected function getTypeFromPath($path) { |
|
520 | + protected function getTypeFromPath($path) |
|
521 | + { |
|
474 | 522 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
475 | 523 | ? $patt[1] : $path; |
476 | 524 | } |
@@ -479,7 +527,8 @@ discard block |
||
479 | 527 | * @param $path |
480 | 528 | * @return string |
481 | 529 | */ |
482 | - protected function removeTypeFromPath($path) { |
|
530 | + protected function removeTypeFromPath($path) |
|
531 | + { |
|
483 | 532 | return preg_match('/^[^\/]*\/(.*)$/', $path, $patt) |
484 | 533 | ? $patt[1] : ""; |
485 | 534 | } |
@@ -489,16 +538,20 @@ discard block |
||
489 | 538 | * @param null $file |
490 | 539 | * @return bool |
491 | 540 | */ |
492 | - protected function imageResize($image, $file=null) { |
|
541 | + protected function imageResize($image, $file=null) |
|
542 | + { |
|
493 | 543 | |
494 | 544 | if (!($image instanceof image)) { |
495 | 545 | $img = image::factory($this->imageDriver, $image); |
496 | - if ($img->initError) return false; |
|
546 | + if ($img->initError) { |
|
547 | + return false; |
|
548 | + } |
|
497 | 549 | $file = $image; |
498 | - } elseif ($file === null) |
|
499 | - return false; |
|
500 | - else |
|
501 | - $img = $image; |
|
550 | + } elseif ($file === null) { |
|
551 | + return false; |
|
552 | + } else { |
|
553 | + $img = $image; |
|
554 | + } |
|
502 | 555 | |
503 | 556 | $orientation = 1; |
504 | 557 | if (function_exists("exif_read_data")) { |
@@ -520,8 +573,9 @@ discard block |
||
520 | 573 | ) |
521 | 574 | ) && |
522 | 575 | ($orientation == 1) |
523 | - ) |
|
524 | - return true; |
|
576 | + ) { |
|
577 | + return true; |
|
578 | + } |
|
525 | 579 | |
526 | 580 | |
527 | 581 | // PROPORTIONAL RESIZE |
@@ -541,15 +595,17 @@ discard block |
||
541 | 595 | $width = $img->getPropWidth($height); |
542 | 596 | } |
543 | 597 | |
544 | - if (isset($width) && isset($height) && !$img->resize($width, $height)) |
|
545 | - return false; |
|
598 | + if (isset($width) && isset($height) && !$img->resize($width, $height)) { |
|
599 | + return false; |
|
600 | + } |
|
546 | 601 | |
547 | 602 | // RESIZE TO FIT |
548 | 603 | } elseif ( |
549 | 604 | $this->config['maxImageWidth'] && $this->config['maxImageHeight'] && |
550 | 605 | !$img->resizeFit($this->config['maxImageWidth'], $this->config['maxImageHeight']) |
551 | - ) |
|
552 | - return false; |
|
606 | + ) { |
|
607 | + return false; |
|
608 | + } |
|
553 | 609 | |
554 | 610 | // AUTO FLIP AND ROTATE FROM EXIF |
555 | 611 | if ((($orientation == 2) && !$img->flipHorizontal()) || |
@@ -559,11 +615,13 @@ discard block |
||
559 | 615 | (($orientation == 6) && !$img->rotate(90)) || |
560 | 616 | (($orientation == 7) && (!$img->flipHorizontal() || !$img->rotate(90))) || |
561 | 617 | (($orientation == 8) && !$img->rotate(270)) |
562 | - ) |
|
563 | - return false; |
|
564 | - if (($orientation >= 2) && ($orientation <= 8) && ($this->imageDriver == "imagick")) |
|
565 | - try { |
|
618 | + ) { |
|
619 | + return false; |
|
620 | + } |
|
621 | + if (($orientation >= 2) && ($orientation <= 8) && ($this->imageDriver == "imagick")) { |
|
622 | + try { |
|
566 | 623 | $img->image->setImageProperty('exif:Orientation', "1"); |
624 | + } |
|
567 | 625 | } catch (Exception $e) {} |
568 | 626 | |
569 | 627 | // WATERMARK |
@@ -599,22 +657,26 @@ discard block |
||
599 | 657 | * @param bool $overwrite |
600 | 658 | * @return bool |
601 | 659 | */ |
602 | - protected function makeThumb($file, $overwrite=true) { |
|
660 | + protected function makeThumb($file, $overwrite=true) |
|
661 | + { |
|
603 | 662 | $img = image::factory($this->imageDriver, $file); |
604 | 663 | |
605 | 664 | // Drop files which are not images |
606 | - if ($img->initError) |
|
607 | - return true; |
|
665 | + if ($img->initError) { |
|
666 | + return true; |
|
667 | + } |
|
608 | 668 | |
609 | 669 | $thumb = substr($file, strlen($this->config['uploadDir'])); |
610 | 670 | $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb; |
611 | 671 | $thumb = path::normalize($thumb); |
612 | 672 | $thumbDir = dirname($thumb); |
613 | - if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) |
|
614 | - return false; |
|
673 | + if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) { |
|
674 | + return false; |
|
675 | + } |
|
615 | 676 | |
616 | - if (!$overwrite && is_file($thumb)) |
|
617 | - return true; |
|
677 | + if (!$overwrite && is_file($thumb)) { |
|
678 | + return true; |
|
679 | + } |
|
618 | 680 | |
619 | 681 | // Images with smaller resolutions than thumbnails |
620 | 682 | /*if (($img->width <= $this->config['thumbWidth']) && |
@@ -627,8 +689,9 @@ discard block |
||
627 | 689 | |
628 | 690 | // Resize image |
629 | 691 | } else */ |
630 | - if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) |
|
631 | - return false; |
|
692 | + if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) { |
|
693 | + return false; |
|
694 | + } |
|
632 | 695 | |
633 | 696 | if ( $this->imageDriver == 'gd' ) { |
634 | 697 | $width = imagesx( $img->image ); |
@@ -653,7 +716,8 @@ discard block |
||
653 | 716 | /** |
654 | 717 | * @param $langCode |
655 | 718 | */ |
656 | - protected function localize($langCode) { |
|
719 | + protected function localize($langCode) |
|
720 | + { |
|
657 | 721 | require "lang/{$langCode}.php"; |
658 | 722 | setlocale(LC_ALL, $lang['_locale']); |
659 | 723 | $this->charset = $lang['_charset']; |
@@ -673,11 +737,13 @@ discard block |
||
673 | 737 | * @param array|null $data |
674 | 738 | * @return mixed |
675 | 739 | */ |
676 | - protected function label($string, array $data=null) { |
|
740 | + protected function label($string, array $data=null) |
|
741 | + { |
|
677 | 742 | $return = isset($this->labels[$string]) ? $this->labels[$string] : $string; |
678 | - if (is_array($data)) |
|
679 | - foreach ($data as $key => $val) |
|
743 | + if (is_array($data)) { |
|
744 | + foreach ($data as $key => $val) |
|
680 | 745 | $return = str_replace("{{$key}}", $val, $return); |
746 | + } |
|
681 | 747 | return $return; |
682 | 748 | } |
683 | 749 | |
@@ -685,10 +751,12 @@ discard block |
||
685 | 751 | * @param $message |
686 | 752 | * @param array|null $data |
687 | 753 | */ |
688 | - protected function backMsg($message, array $data=null) { |
|
754 | + protected function backMsg($message, array $data=null) |
|
755 | + { |
|
689 | 756 | $message = $this->label($message, $data); |
690 | - if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) |
|
691 | - @unlink($this->file['tmp_name']); |
|
757 | + if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) { |
|
758 | + @unlink($this->file['tmp_name']); |
|
759 | + } |
|
692 | 760 | $this->callBack("", $message); |
693 | 761 | die; |
694 | 762 | } |
@@ -697,11 +765,14 @@ discard block |
||
697 | 765 | * @param $url |
698 | 766 | * @param string $message |
699 | 767 | */ |
700 | - protected function callBack($url, $message="") { |
|
768 | + protected function callBack($url, $message="") |
|
769 | + { |
|
701 | 770 | $message = text::jsValue($message); |
702 | 771 | $CKfuncNum = isset($this->opener['CKEditor']['funcNum']) |
703 | 772 | ? $this->opener['CKEditor']['funcNum'] : 0; |
704 | - if (!$CKfuncNum) $CKfuncNum = 0; |
|
773 | + if (!$CKfuncNum) { |
|
774 | + $CKfuncNum = 0; |
|
775 | + } |
|
705 | 776 | header("Content-Type: text/html; charset={$this->charset}"); |
706 | 777 | |
707 | 778 | ?><html> |
@@ -741,7 +812,8 @@ discard block |
||
741 | 812 | /** |
742 | 813 | * @return string |
743 | 814 | */ |
744 | - protected function get_htaccess() { |
|
815 | + protected function get_htaccess() |
|
816 | + { |
|
745 | 817 | return "<IfModule mod_php4.c> |
746 | 818 | php_value engine off |
747 | 819 | </IfModule> |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | <tr> |
7 | 7 | <td nowrap class="warning"><?php echo $_lang['rb_title']?><br><small>[(use_browser)]</small></td> |
8 | 8 | <td> |
9 | - <?php echo wrap_label($_lang['yes'],form_radio('use_browser', 1, 'id="rbRowOn"'));?><br /> |
|
10 | - <?php echo wrap_label($_lang['no'], form_radio('use_browser', 0, 'id="rbRowOff"'));?> |
|
9 | + <?php echo wrap_label($_lang['yes'], form_radio('use_browser', 1, 'id="rbRowOn"')); ?><br /> |
|
10 | + <?php echo wrap_label($_lang['no'], form_radio('use_browser', 0, 'id="rbRowOff"')); ?> |
|
11 | 11 | </td> |
12 | 12 | </tr> |
13 | 13 | <tr> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | <td colspan="2"><div class="split"></div></td> |
19 | 19 | </tr> |
20 | 20 | |
21 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
21 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
22 | 22 | <td nowrap class="warning"><?php echo $_lang['which_browser_default_title']?><br><small>[(which_browser)]</small></td> |
23 | 23 | <td> |
24 | 24 | <select name="which_browser" size="1" class="inputBox" onchange="documentDirty=true;"> |
@@ -27,125 +27,125 @@ discard block |
||
27 | 27 | $dir = str_replace('\\', '/', $dir); |
28 | 28 | $browser_name = substr($dir, strrpos($dir, '/') + 1); |
29 | 29 | $selected = $browser_name == $which_browser ? ' selected="selected"' : ''; |
30 | - echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n"; |
|
30 | + echo '<option value="'.$browser_name.'"'.$selected.'>'."{$browser_name}</option>\n"; |
|
31 | 31 | } |
32 | 32 | ?> |
33 | 33 | </select> |
34 | 34 | </td> |
35 | 35 | </tr> |
36 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
36 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
37 | 37 | <td width="200"> </td> |
38 | 38 | <td class="comment"><?php echo $_lang['which_browser_default_msg']?></td> |
39 | 39 | </tr> |
40 | 40 | <tr> |
41 | 41 | <td colspan="2"><div class="split"></div></td> |
42 | 42 | </tr> |
43 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
43 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
44 | 44 | <td nowrap class="warning"><?php echo $_lang['rb_webuser_title']?><br><small>[(rb_webuser)]</small></td> |
45 | 45 | <td> |
46 | - <label><input type="radio" name="rb_webuser" value="1" <?php echo $rb_webuser=='1' ? 'checked="checked"' : "" ; ?> /> |
|
46 | + <label><input type="radio" name="rb_webuser" value="1" <?php echo $rb_webuser == '1' ? 'checked="checked"' : ""; ?> /> |
|
47 | 47 | <?php echo $_lang['yes']?></label><br /> |
48 | - <label><input type="radio" name="rb_webuser" value="0" <?php echo $rb_webuser=='0' ? 'checked="checked"' : "" ; ?> /> |
|
48 | + <label><input type="radio" name="rb_webuser" value="0" <?php echo $rb_webuser == '0' ? 'checked="checked"' : ""; ?> /> |
|
49 | 49 | <?php echo $_lang['no']?></label> |
50 | 50 | </td> |
51 | 51 | </tr> |
52 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
52 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
53 | 53 | <td width="200"> </td> |
54 | 54 | <td class="comment"><?php echo $_lang['rb_webuser_message']?></td> |
55 | 55 | </tr> |
56 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
56 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
57 | 57 | <td colspan="2"><div class="split"></div></td> |
58 | 58 | </tr> |
59 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
59 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
60 | 60 | <td nowrap class="warning"><?php echo $_lang['rb_base_dir_title']?><br><small>[(rb_base_dir)]</small></td> |
61 | 61 | <td> |
62 | 62 | <?php echo $_lang['default']; ?> <span id="default_rb_base_dir">[(base_path)]assets/</span><br /> |
63 | 63 | <input onchange="documentDirty=true;" type="text" maxlength="255" style="width: 250px;" name="rb_base_dir" id="rb_base_dir" value="<?php echo $rb_base_dir; ?>" /> <input type="button" onclick="reset_path('rb_base_dir');" value="<?php echo $_lang['reset']; ?>" name="reset_rb_base_dir"> |
64 | 64 | </td> |
65 | 65 | </tr> |
66 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
66 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
67 | 67 | <td width="200"> </td> |
68 | 68 | <td class="comment"><?php echo $_lang['rb_base_dir_message']?></td> |
69 | 69 | </tr> |
70 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
70 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
71 | 71 | <td colspan="2"><div class="split"></div></td> |
72 | 72 | </tr> |
73 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
73 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
74 | 74 | <td nowrap class="warning"><?php echo $_lang['rb_base_url_title']?><br><small>[(rb_base_url)]</small></td> |
75 | 75 | <td> |
76 | 76 | <input onchange="documentDirty=true;" type="text" maxlength="255" style="width: 250px;" name="rb_base_url" value="<?php echo $rb_base_url; ?>" /> |
77 | 77 | </td> |
78 | 78 | </tr> |
79 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
79 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
80 | 80 | <td width="200"> </td> |
81 | 81 | <td class="comment"><?php echo $_lang['rb_base_url_message']?></td> |
82 | 82 | </tr> |
83 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
83 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
84 | 84 | <td colspan="2"><div class="split"></div></td> |
85 | 85 | </tr> |
86 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
86 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
87 | 87 | <td nowrap class="warning"><?php echo $_lang['clean_uploaded_filename']?><br><small>[(clean_uploaded_filename)]</small></td> |
88 | 88 | <td> |
89 | - <label><input type="radio" name="clean_uploaded_filename" value="1" <?php echo $clean_uploaded_filename=='1' ? 'checked="checked"' : "" ; ?> /> |
|
89 | + <label><input type="radio" name="clean_uploaded_filename" value="1" <?php echo $clean_uploaded_filename == '1' ? 'checked="checked"' : ""; ?> /> |
|
90 | 90 | <?php echo $_lang['yes']?></label><br /> |
91 | - <label><input type="radio" name="clean_uploaded_filename" value="0" <?php echo $clean_uploaded_filename=='0' ? 'checked="checked"' : "" ; ?> /> |
|
91 | + <label><input type="radio" name="clean_uploaded_filename" value="0" <?php echo $clean_uploaded_filename == '0' ? 'checked="checked"' : ""; ?> /> |
|
92 | 92 | <?php echo $_lang['no']?></label> |
93 | 93 | </td> |
94 | 94 | </tr> |
95 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
95 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
96 | 96 | <td width="200"> </td> |
97 | - <td class="comment"><?php echo $_lang['clean_uploaded_filename_message'];?></td> |
|
97 | + <td class="comment"><?php echo $_lang['clean_uploaded_filename_message']; ?></td> |
|
98 | 98 | </tr> |
99 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
99 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
100 | 100 | <td colspan="2"><div class="split"></div></td> |
101 | 101 | </tr> |
102 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
102 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
103 | 103 | <td nowrap class="warning"><?php echo $_lang['settings_strip_image_paths_title']?><br><small>[(strip_image_paths)]</small></td> |
104 | 104 | <td> |
105 | - <label><input type="radio" name="strip_image_paths" value="1" <?php echo $strip_image_paths=='1' ? 'checked="checked"' : "" ; ?> /> |
|
105 | + <label><input type="radio" name="strip_image_paths" value="1" <?php echo $strip_image_paths == '1' ? 'checked="checked"' : ""; ?> /> |
|
106 | 106 | <?php echo $_lang['yes']?></label><br /> |
107 | - <label><input type="radio" name="strip_image_paths" value="0" <?php echo $strip_image_paths=='0' ? 'checked="checked"' : "" ; ?> /> |
|
107 | + <label><input type="radio" name="strip_image_paths" value="0" <?php echo $strip_image_paths == '0' ? 'checked="checked"' : ""; ?> /> |
|
108 | 108 | <?php echo $_lang['no']?></label> |
109 | 109 | </td> |
110 | 110 | </tr> |
111 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
111 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
112 | 112 | <td width="200"> </td> |
113 | 113 | <td class="comment"><?php echo $_lang['settings_strip_image_paths_message']?></td> |
114 | 114 | </tr> |
115 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
115 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
116 | 116 | <td colspan="2"><div class="split"></div></td> |
117 | 117 | </tr> |
118 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
118 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
119 | 119 | <td nowrap class="warning"><?php echo $_lang['maxImageWidth']?><br><small>[(maxImageWidth)]</small></td> |
120 | 120 | <td> |
121 | 121 | <input onchange="documentDirty=true;" type="text" maxlength="4" style="width: 50px;" name="maxImageWidth" value="<?php echo $maxImageWidth; ?>" /> |
122 | 122 | </td> |
123 | 123 | </tr> |
124 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
124 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
125 | 125 | <td width="200"> </td> |
126 | 126 | <td class="comment"><?php echo $_lang['maxImageWidth_message']?></td> |
127 | 127 | </tr> |
128 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
128 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
129 | 129 | <td colspan="2"><div class="split"></div></td> |
130 | 130 | </tr> |
131 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
131 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
132 | 132 | <td nowrap class="warning"><?php echo $_lang['maxImageHeight']?><br><small>[(maxImageHeight)]</small></td> |
133 | 133 | <td> |
134 | 134 | <input onchange="documentDirty=true;" type="text" maxlength="4" style="width: 50px;" name="maxImageHeight" value="<?php echo $maxImageHeight; ?>" /> |
135 | 135 | </td> |
136 | 136 | </tr> |
137 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
137 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
138 | 138 | <td width="200"> </td> |
139 | 139 | <td class="comment"><?php echo $_lang['maxImageHeight_message']?></td> |
140 | 140 | </tr> |
141 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
141 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
142 | 142 | <td colspan="2"><div class="split"></div></td> |
143 | 143 | </tr> |
144 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
144 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
145 | 145 | <td nowrap class="warning"><?php echo $_lang['clientResize']?><br><small>[(clientResize)]</small></td> |
146 | 146 | <td> |
147 | - <?php echo wrap_label($_lang['yes'],form_radio('clientResize', 1, ''));?><br /> |
|
148 | - <?php echo wrap_label($_lang['no'], form_radio('clientResize', 0, ''));?> |
|
147 | + <?php echo wrap_label($_lang['yes'], form_radio('clientResize', 1, '')); ?><br /> |
|
148 | + <?php echo wrap_label($_lang['no'], form_radio('clientResize', 0, '')); ?> |
|
149 | 149 | </td> |
150 | 150 | </tr> |
151 | 151 | <tr> |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | <tr> |
156 | 156 | <td colspan="2"><div class="split"></div></td> |
157 | 157 | </tr> |
158 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
158 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
159 | 159 | <td nowrap class="warning"><?php echo $_lang['noThumbnailsRecreation']?><br><small>[(noThumbnailsRecreation)]</small></td> |
160 | 160 | <td> |
161 | - <?php echo wrap_label($_lang['yes'],form_radio('noThumbnailsRecreation', 1, ''));?><br /> |
|
162 | - <?php echo wrap_label($_lang['no'], form_radio('noThumbnailsRecreation', 0, ''));?> |
|
161 | + <?php echo wrap_label($_lang['yes'], form_radio('noThumbnailsRecreation', 1, '')); ?><br /> |
|
162 | + <?php echo wrap_label($_lang['no'], form_radio('noThumbnailsRecreation', 0, '')); ?> |
|
163 | 163 | </td> |
164 | 164 | </tr> |
165 | 165 | <tr> |
@@ -170,92 +170,92 @@ discard block |
||
170 | 170 | <td colspan="2"><div class="split"></div></td> |
171 | 171 | </tr> |
172 | 172 | |
173 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
173 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
174 | 174 | <td nowrap class="warning"><?php echo $_lang['thumbWidth']?><br><small>[(thumbWidth)]</small></td> |
175 | 175 | <td> |
176 | 176 | <input onchange="documentDirty=true;" type="text" maxlength="4" style="width: 50px;" name="thumbWidth" value="<?php echo $thumbWidth; ?>" /> |
177 | 177 | </td> |
178 | 178 | </tr> |
179 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
179 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
180 | 180 | <td width="200"> </td> |
181 | 181 | <td class="comment"><?php echo $_lang['thumbWidth_message']?></td> |
182 | 182 | </tr> |
183 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
183 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
184 | 184 | <td colspan="2"><div class="split"></div></td> |
185 | 185 | </tr> |
186 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
186 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
187 | 187 | <td nowrap class="warning"><?php echo $_lang['thumbHeight']?><br><small>[(thumbHeight)]</small></td> |
188 | 188 | <td> |
189 | 189 | <input onchange="documentDirty=true;" type="text" maxlength="4" style="width: 50px;" name="thumbHeight" value="<?php echo $thumbHeight; ?>" /> |
190 | 190 | </td> |
191 | 191 | </tr> |
192 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
192 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
193 | 193 | <td width="200"> </td> |
194 | 194 | <td class="comment"><?php echo $_lang['thumbHeight_message']?></td> |
195 | 195 | </tr> |
196 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
196 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
197 | 197 | <td colspan="2"><div class="split"></div></td> |
198 | 198 | </tr> |
199 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
199 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
200 | 200 | <td nowrap class="warning"><?php echo $_lang['thumbsDir']?><br><small>[(thumbsDir)]</small></td> |
201 | 201 | <td> |
202 | 202 | <input onchange="documentDirty=true;" type="text" maxlength="255" style="width: 250px;" name="thumbsDir" value="<?php echo $thumbsDir; ?>" /> |
203 | 203 | </td> |
204 | 204 | </tr> |
205 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
205 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
206 | 206 | <td width="200"> </td> |
207 | 207 | <td class="comment"><?php echo $_lang['thumbsDir_message']?></td> |
208 | 208 | </tr> |
209 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
209 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
210 | 210 | <td colspan="2"><div class="split"></div></td> |
211 | 211 | </tr> |
212 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
212 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
213 | 213 | <td nowrap class="warning"><?php echo $_lang['jpegQuality']?><br><small>[(jpegQuality)]</small></td> |
214 | 214 | <td> |
215 | 215 | <input onchange="documentDirty=true;" type="text" maxlength="4" style="width: 50px;" name="jpegQuality" value="<?php echo $jpegQuality; ?>" /> |
216 | 216 | </td> |
217 | 217 | </tr> |
218 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
218 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
219 | 219 | <td width="200"> </td> |
220 | 220 | <td class="comment"><?php echo $_lang['jpegQuality_message']?></td> |
221 | 221 | </tr> |
222 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
222 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
223 | 223 | <td colspan="2"><div class="split"></div></td> |
224 | 224 | </tr> |
225 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
225 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
226 | 226 | <td nowrap class="warning"><?php echo $_lang['denyZipDownload'] ?><br><small>[(denyZipDownload)]</small></td> |
227 | 227 | <td> |
228 | - <label><input type="radio" name="denyZipDownload" value="0" <?php echo $denyZipDownload=='0' ? 'checked="checked"' : ""; ?> /> |
|
228 | + <label><input type="radio" name="denyZipDownload" value="0" <?php echo $denyZipDownload == '0' ? 'checked="checked"' : ""; ?> /> |
|
229 | 229 | <?php echo $_lang['no']?></label><br /> |
230 | - <label><input type="radio" name="denyZipDownload" value="1" <?php echo $denyZipDownload=='1' ? 'checked="checked"' : ""; ?> /> |
|
230 | + <label><input type="radio" name="denyZipDownload" value="1" <?php echo $denyZipDownload == '1' ? 'checked="checked"' : ""; ?> /> |
|
231 | 231 | <?php echo $_lang['yes']?></label> |
232 | 232 | </td> |
233 | 233 | </tr> |
234 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
234 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
235 | 235 | <td colspan="2"><div class="split"></div></td> |
236 | 236 | </tr> |
237 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
237 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
238 | 238 | <td nowrap class="warning"><?php echo $_lang['denyExtensionRename'] ?><br><small>[(denyExtensionRename)]</small></td> |
239 | 239 | <td> |
240 | - <label><input type="radio" name="denyExtensionRename" value="0" <?php echo $denyExtensionRename=='0' ? 'checked="checked"' : ""; ?> /> |
|
240 | + <label><input type="radio" name="denyExtensionRename" value="0" <?php echo $denyExtensionRename == '0' ? 'checked="checked"' : ""; ?> /> |
|
241 | 241 | <?php echo $_lang['no']?></label><br /> |
242 | - <label><input type="radio" name="denyExtensionRename" value="1" <?php echo $denyExtensionRename=='1' ? 'checked="checked"' : ""; ?> /> |
|
242 | + <label><input type="radio" name="denyExtensionRename" value="1" <?php echo $denyExtensionRename == '1' ? 'checked="checked"' : ""; ?> /> |
|
243 | 243 | <?php echo $_lang['yes']?></label> |
244 | 244 | </td> |
245 | 245 | </tr> |
246 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
246 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
247 | 247 | <td colspan="2"><div class="split"></div></td> |
248 | 248 | </tr> |
249 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
249 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
250 | 250 | <td nowrap class="warning"><?php echo $_lang['showHiddenFiles'] ?><br><small>[(showHiddenFiles)]</small></td> |
251 | 251 | <td> |
252 | - <label><input type="radio" name="showHiddenFiles" value="0" <?php echo $showHiddenFiles=='0' ? 'checked="checked"' : ""; ?> /> |
|
252 | + <label><input type="radio" name="showHiddenFiles" value="0" <?php echo $showHiddenFiles == '0' ? 'checked="checked"' : ""; ?> /> |
|
253 | 253 | <?php echo $_lang['no']?></label><br /> |
254 | - <label><input type="radio" name="showHiddenFiles" value="1" <?php echo $showHiddenFiles=='1' ? 'checked="checked"' : ""; ?> /> |
|
254 | + <label><input type="radio" name="showHiddenFiles" value="1" <?php echo $showHiddenFiles == '1' ? 'checked="checked"' : ""; ?> /> |
|
255 | 255 | <?php echo $_lang['yes']?></label> |
256 | 256 | </td> |
257 | 257 | </tr> |
258 | - <tr class="rbRow" <?php echo showHide($use_browser==1);?>> |
|
258 | + <tr class="rbRow" <?php echo showHide($use_browser == 1); ?>> |
|
259 | 259 | <td colspan="2"><div class="split"></div></td> |
260 | 260 | </tr> |
261 | 261 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | <?php |
265 | 265 | // invoke OnMiscSettingsRender event |
266 | 266 | $evtOut = $modx->invokeEvent('OnMiscSettingsRender'); |
267 | - if(is_array($evtOut)) echo implode("",$evtOut); |
|
267 | + if (is_array($evtOut)) echo implode("", $evtOut); |
|
268 | 268 | ?> |
269 | 269 | </td> |
270 | 270 | </tr> |
@@ -72,8 +72,8 @@ |
||
72 | 72 | 'maxImageWidth' => $modx->config['maxImageWidth'], |
73 | 73 | 'maxImageHeight' => $modx->config['maxImageHeight'], |
74 | 74 | 'clientResize' => $modx->config['clientResize'] && $modx->config['maxImageWidth'] && $modx->config['maxImageHeight'] ? array('maxWidth' => $modx->config['maxImageWidth'], |
75 | - 'maxHeight' => $modx->config['maxImageHeight'], |
|
76 | - 'quality' => $modx->config['jpegQuality'] / 100 |
|
75 | + 'maxHeight' => $modx->config['maxImageHeight'], |
|
76 | + 'quality' => $modx->config['jpegQuality'] / 100 |
|
77 | 77 | ) : array(), |
78 | 78 | |
79 | 79 | 'thumbWidth' => $modx->config['thumbWidth'], |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | 'assetsURL' => rtrim($modx->config['rb_base_url'], '/'), |
30 | 30 | 'dirPerms' => intval($modx->config['new_folder_permissions'], 8), |
31 | 31 | 'filePerms' => intval($modx->config['new_file_permissions'], 8), |
32 | - 'maxfilesize' => (int)$modx->config['upload_maxsize'], |
|
32 | + 'maxfilesize' => (int) $modx->config['upload_maxsize'], |
|
33 | 33 | 'noThumbnailsRecreation' => $modx->config['noThumbnailsRecreation'], |
34 | 34 | |
35 | 35 | 'access' => array( |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | // THE FOLLOWING SETTINGS CANNOT BE OVERRIDED WITH SESSION CONFIGURATION |
90 | 90 | '_check4htaccess' => false, |
91 | - '_tinyMCEPath' => MODX_BASE_URL . "assets/plugins/tinymce/tiny_mce", |
|
91 | + '_tinyMCEPath' => MODX_BASE_URL."assets/plugins/tinymce/tiny_mce", |
|
92 | 92 | |
93 | 93 | '_sessionVar' => &$_SESSION['KCFINDER'], |
94 | 94 | //'_sessionLifetime' => 30, |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | <script src="js/FileAPI/FileAPI.exif.js" type="text/javascript"></script> |
8 | 8 | <script src="js/browser/joiner.php" type="text/javascript"></script> |
9 | 9 | <script src="js_localize.php?lng=<?php echo $this->lang ?>" type="text/javascript"></script> |
10 | -<?php IF (isset($this->opener['TinyMCE']) && $this->opener['TinyMCE']): ?> |
|
10 | +<?php if (isset($this->opener['TinyMCE']) && $this->opener['TinyMCE']): ?> |
|
11 | 11 | <script src="<?php echo $this->config['_tinyMCEPath'] ?>/tiny_mce_popup.js" type="text/javascript"></script> |
12 | -<?php ENDIF ?> |
|
13 | -<?php IF (file_exists("themes/{$this->config['theme']}/init.js")): ?> |
|
12 | +<?php endif ?> |
|
13 | +<?php if (file_exists("themes/{$this->config['theme']}/init.js")): ?> |
|
14 | 14 | <script src="themes/<?php echo $this->config['theme'] ?>/init.js" type="text/javascript"></script> |
15 | -<?php ENDIF ?> |
|
15 | +<?php endif ?> |
|
16 | 16 | <script type="text/javascript"> |
17 | 17 | browser.version = "<?php echo self::VERSION ?>"; |
18 | 18 | browser.support.chromeFrame = <?php echo (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), " chromeframe") !== false) ? "true" : "false" ?>; |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | browser.allowedExts = /<?php echo str_replace(' ', '|', strtolower(text::clearWhitespaces($this->types[$this->type]))) ?>$/; |
30 | 30 | browser.deniedExts = /<?php echo str_replace(' ', '|', strtolower(text::clearWhitespaces($this->config['deniedExts']))) ?>$/; |
31 | 31 | browser.maxFileSize = <?php echo text::jsValue($this->config['maxfilesize']) ?>; |
32 | -<?php IF (isset($this->get['opener']) && strlen($this->get['opener'])): ?> |
|
32 | +<?php if (isset($this->get['opener']) && strlen($this->get['opener'])): ?> |
|
33 | 33 | browser.opener.name = "<?php echo text::jsValue($this->get['opener']) ?>"; |
34 | -<?php ENDIF ?> |
|
35 | -<?php IF (isset($this->opener['CKEditor']['funcNum']) && preg_match('/^\d+$/', $this->opener['CKEditor']['funcNum'])): ?> |
|
34 | +<?php endif ?> |
|
35 | +<?php if (isset($this->opener['CKEditor']['funcNum']) && preg_match('/^\d+$/', $this->opener['CKEditor']['funcNum'])): ?> |
|
36 | 36 | browser.opener.CKEditor = {}; |
37 | 37 | browser.opener.CKEditor.funcNum = <?php echo $this->opener['CKEditor']['funcNum'] ?>; |
38 | -<?php ENDIF ?> |
|
39 | -<?php IF (isset($this->opener['TinyMCE']) && $this->opener['TinyMCE']): ?> |
|
38 | +<?php endif ?> |
|
39 | +<?php if (isset($this->opener['TinyMCE']) && $this->opener['TinyMCE']): ?> |
|
40 | 40 | browser.opener.TinyMCE = true; |
41 | -<?php ENDIF ?> |
|
42 | -<?php IF (isset($this->get['opener']) && ($this->get['opener'] == "tinymce4") && isset($this->get['field'])): ?> |
|
41 | +<?php endif ?> |
|
42 | +<?php if (isset($this->get['opener']) && ($this->get['opener'] == "tinymce4") && isset($this->get['field'])): ?> |
|
43 | 43 | browser.opener.TinyMCE4 = "<?= text::jsValue($this->get['field']) ?>"; |
44 | -<?php ENDIF ?> |
|
44 | +<?php endif ?> |
|
45 | 45 | browser.cms = "<?php echo text::jsValue($this->cms) ?>"; |
46 | 46 | _.kuki.domain = "<?php echo text::jsValue($this->config['cookieDomain']) ?>"; |
47 | 47 | _.kuki.path = "<?php echo text::jsValue($this->config['cookiePath']) ?>"; |
@@ -1,24 +1,24 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc This file is included first, before each other |
|
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 | - * This file is the place you can put any code (at the end of the file), |
|
15 | - * which will be executed before any other. Suitable for: |
|
16 | - * 1. Set PHP ini settings using ini_set() |
|
17 | - * 2. Custom session save handler with session_set_save_handler() |
|
18 | - * 3. Any custom integration code. If you use any global variables |
|
19 | - * here, they can be accessed in config.php via $GLOBALS array. |
|
20 | - * It's recommended to use constants instead. |
|
21 | - */ |
|
4 | + * |
|
5 | + * @desc This file is included first, before each other |
|
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 | + * This file is the place you can put any code (at the end of the file), |
|
15 | + * which will be executed before any other. Suitable for: |
|
16 | + * 1. Set PHP ini settings using ini_set() |
|
17 | + * 2. Custom session save handler with session_set_save_handler() |
|
18 | + * 3. Any custom integration code. If you use any global variables |
|
19 | + * here, they can be accessed in config.php via $GLOBALS array. |
|
20 | + * It's recommended to use constants instead. |
|
21 | + */ |
|
22 | 22 | define('IN_MANAGER_MODE', true); |
23 | 23 | define('MODX_API_MODE', true); |
24 | 24 | include_once(__DIR__."/../../../../../index.php"); |
@@ -26,19 +26,19 @@ discard block |
||
26 | 26 | if (empty ($modx->config)) { |
27 | 27 | $modx->getSettings(); |
28 | 28 | } |
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 | $manager_language = $modx->config['manager_language']; |
33 | 33 | // Pass language code from MODX to KCFinder |
34 | -if(!file_exists("../../../includes/lang/".$manager_language.".inc.php")) { |
|
34 | +if (!file_exists("../../../includes/lang/".$manager_language.".inc.php")) { |
|
35 | 35 | $manager_language = "english"; // if not set, get the english language file. |
36 | 36 | } |
37 | 37 | include_once "../../../includes/lang/".$manager_language.".inc.php"; |
38 | 38 | $_GET['langCode'] = $modx_lang_attribute; |
39 | 39 | |
40 | 40 | // MAGIC AUTOLOAD CLASSES FUNCTION |
41 | -function autoloadda9d06472ccb71b84928677ce2a6ca89($class) { |
|
41 | +function autoloadda9d06472ccb71b84928677ce2a6ca89($class){ |
|
42 | 42 | static $classes = null; |
43 | 43 | if ($classes === null) { |
44 | 44 | $classes = array( |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | ); |
63 | 63 | } |
64 | 64 | if (isset($classes[$class])) { |
65 | - require dirname(__FILE__) . $classes[$class]; |
|
65 | + require dirname(__FILE__).$classes[$class]; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | spl_autoload_register('autoloadda9d06472ccb71b84928677ce2a6ca89', true); |
@@ -38,7 +38,8 @@ |
||
38 | 38 | $_GET['langCode'] = $modx_lang_attribute; |
39 | 39 | |
40 | 40 | // MAGIC AUTOLOAD CLASSES FUNCTION |
41 | -function autoloadda9d06472ccb71b84928677ce2a6ca89($class) { |
|
41 | +function autoloadda9d06472ccb71b84928677ce2a6ca89($class) |
|
42 | +{ |
|
42 | 43 | static $classes = null; |
43 | 44 | if ($classes === null) { |
44 | 45 | $classes = array( |