@@ -107,34 +107,34 @@ discard block |
||
| 107 | 107 | throw new BadDependencyCallException('UPLOADER_E_FINFO_EXTENSION'); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if (isset($config[ 'path' ])) { |
|
| 111 | - $config[ 'path' ] = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $config[ 'path' ]); |
|
| 110 | + if (isset($config['path'])) { |
|
| 111 | + $config['path'] = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $config['path']); |
|
| 112 | 112 | |
| 113 | - if (is_dir($config[ 'path' ])) { |
|
| 114 | - $this->path = $config[ 'path' ]; |
|
| 113 | + if (is_dir($config['path'])) { |
|
| 114 | + $this->path = $config['path']; |
|
| 115 | 115 | } elseif (defined('PATH_STORAGE')) { |
| 116 | - if (is_dir($config[ 'path' ])) { |
|
| 117 | - $this->path = $config[ 'path' ]; |
|
| 116 | + if (is_dir($config['path'])) { |
|
| 117 | + $this->path = $config['path']; |
|
| 118 | 118 | } else { |
| 119 | - $this->path = PATH_STORAGE . str_replace(PATH_STORAGE, '', $config[ 'path' ]); |
|
| 119 | + $this->path = PATH_STORAGE . str_replace(PATH_STORAGE, '', $config['path']); |
|
| 120 | 120 | } |
| 121 | 121 | } else { |
| 122 | - $this->path = dirname($_SERVER[ 'SCRIPT_FILENAME' ]) . DIRECTORY_SEPARATOR . $config[ 'path' ]; |
|
| 122 | + $this->path = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR . $config['path']; |
|
| 123 | 123 | } |
| 124 | 124 | } elseif (defined('PATH_STORAGE')) { |
| 125 | 125 | $this->path = PATH_STORAGE; |
| 126 | 126 | } else { |
| 127 | - $this->path = dirname($_SERVER[ 'SCRIPT_FILENAME' ]) . DIRECTORY_SEPARATOR . 'upload'; |
|
| 127 | + $this->path = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR . 'upload'; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $this->path = rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
| 131 | 131 | |
| 132 | - if (isset($config[ 'allowedMimes' ])) { |
|
| 133 | - $this->setAllowedMimes($config[ 'allowedMimes' ]); |
|
| 132 | + if (isset($config['allowedMimes'])) { |
|
| 133 | + $this->setAllowedMimes($config['allowedMimes']); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if (isset($config[ 'allowedExtensions' ])) { |
|
| 137 | - $this->setAllowedExtensions($config[ 'allowedExtensions' ]); |
|
| 136 | + if (isset($config['allowedExtensions'])) { |
|
| 137 | + $this->setAllowedExtensions($config['allowedExtensions']); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $this->uploadedFiles = new ArrayIterator(); |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $this->path = PATH_STORAGE . str_replace(PATH_STORAGE, '', $path); |
| 207 | 207 | } |
| 208 | 208 | } else { |
| 209 | - $this->path = dirname($_SERVER[ 'SCRIPT_FILENAME' ]) . DIRECTORY_SEPARATOR . $path; |
|
| 209 | + $this->path = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR . $path; |
|
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | break; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - $this->allowedFileSize[ 'min' ] = (int)$fileSize; |
|
| 242 | + $this->allowedFileSize['min'] = (int)$fileSize; |
|
| 243 | 243 | |
| 244 | 244 | return $this; |
| 245 | 245 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | break; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - $this->allowedFileSize[ 'max' ] = (int)$fileSize; |
|
| 276 | + $this->allowedFileSize['max'] = (int)$fileSize; |
|
| 277 | 277 | |
| 278 | 278 | return $this; |
| 279 | 279 | } |
@@ -429,21 +429,21 @@ discard block |
||
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | /* Validate min size */ |
| 432 | - if ($this->allowedFileSize[ 'min' ] > 0) { |
|
| 433 | - if ($file->getSize() < $this->allowedFileSize[ 'min' ]) { |
|
| 432 | + if ($this->allowedFileSize['min'] > 0) { |
|
| 433 | + if ($file->getSize() < $this->allowedFileSize['min']) { |
|
| 434 | 434 | $this->errors[] = language()->getLine( |
| 435 | 435 | 'UPLOADER_E_ALLOWED_MIN_FILESIZE', |
| 436 | - [$this->allowedFileSize[ 'min' ], $file->getSize()] |
|
| 436 | + [$this->allowedFileSize['min'], $file->getSize()] |
|
| 437 | 437 | ); |
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /* Validate max size */ |
| 442 | - if ($this->allowedFileSize[ 'max' ] > 0) { |
|
| 443 | - if ($file->getSize() > $this->allowedFileSize[ 'max' ]) { |
|
| 442 | + if ($this->allowedFileSize['max'] > 0) { |
|
| 443 | + if ($file->getSize() > $this->allowedFileSize['max']) { |
|
| 444 | 444 | $this->errors[] = language()->getLine( |
| 445 | 445 | 'UPLOADER_E_ALLOWED_MAX_FILESIZE', |
| 446 | - [$this->allowedFileSize[ 'max' ], $file->getSize()] |
|
| 446 | + [$this->allowedFileSize['max'], $file->getSize()] |
|
| 447 | 447 | ); |
| 448 | 448 | } |
| 449 | 449 | } |