@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * Flag indicating if unrecognized mimetypes should be allowed (use with precaution ! may lead to security issues ) |
| 76 | 76 | */ |
| 77 | 77 | |
| 78 | - public $allowUnknownTypes = false; |
|
| 78 | + public $allowUnknownTypes = false; |
|
| 79 | 79 | public $mediaName; |
| 80 | 80 | public $mediaType; |
| 81 | 81 | public $mediaSize; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | 14 => 'iff', |
| 127 | 127 | 15 => 'wbmp', |
| 128 | 128 | 16 => 'xbm'); |
| 129 | - public $randomFilename = false; |
|
| 129 | + public $randomFilename = false; |
|
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | 132 | * Constructor |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | return false; |
| 149 | 149 | } |
| 150 | 150 | if (is_array($allowedMimeTypes)) { |
| 151 | - $this->allowedMimeTypes =& $allowedMimeTypes; |
|
| 151 | + $this->allowedMimeTypes = & $allowedMimeTypes; |
|
| 152 | 152 | } |
| 153 | 153 | $this->uploadDir = $uploadDir; |
| 154 | 154 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | if (isset($randomFilename)) { |
| 173 | 173 | $this->randomFilename = $randomFilename; |
| 174 | 174 | } |
| 175 | - if (!include_once $GLOBALS['xoops']->path('language/' . $GLOBALS['xoopsConfig']['language'] . '/uploader.php')) { |
|
| 175 | + if (!include_once $GLOBALS['xoops']->path('language/'.$GLOBALS['xoopsConfig']['language'].'/uploader.php')) { |
|
| 176 | 176 | include_once $GLOBALS['xoops']->path('language/english/uploader.php'); |
| 177 | 177 | } |
| 178 | 178 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $this->mediaName = get_magic_quotes_gpc() ? stripslashes($_FILES[$media_name]['name'][$index]) : $_FILES[$media_name]['name'][$index]; |
| 239 | 239 | if ($this->randomFilename) { |
| 240 | 240 | $unique = uniqid(); |
| 241 | - $this->mediaName = '' . $unique . '--' . $this->mediaName; |
|
| 241 | + $this->mediaName = ''.$unique.'--'.$this->mediaName; |
|
| 242 | 242 | } |
| 243 | 243 | $this->mediaType = $_FILES[$media_name]['type'][$index]; |
| 244 | 244 | $this->mediaSize = $_FILES[$media_name]['size'][$index]; |
@@ -249,11 +249,11 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | return false; |
| 251 | 251 | } else { |
| 252 | - $media_name =& $_FILES[$media_name]; |
|
| 252 | + $media_name = & $_FILES[$media_name]; |
|
| 253 | 253 | $this->mediaName = get_magic_quotes_gpc() ? stripslashes($media_name['name']) : $media_name['name']; |
| 254 | 254 | if ($this->randomFilename) { |
| 255 | 255 | $unique = uniqid(); |
| 256 | - $this->mediaName = '' . $unique . '--' . $this->mediaName; |
|
| 256 | + $this->mediaName = ''.$unique.'--'.$this->mediaName; |
|
| 257 | 257 | } |
| 258 | 258 | $this->mediaType = $media_name['type']; |
| 259 | 259 | $this->mediaSize = $media_name['size']; |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | $this->errors = array(); |
| 271 | 271 | if ($this->mediaError > 0) { |
| 272 | - switch($this->mediaError){ |
|
| 272 | + switch ($this->mediaError) { |
|
| 273 | 273 | case UPLOAD_ERR_INI_SIZE: |
| 274 | 274 | $this->setErrors(_ER_UP_INISIZE); |
| 275 | 275 | return false; |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | if (isset($this->targetFileName)) { |
| 469 | 469 | $this->savedFileName = $this->targetFileName; |
| 470 | 470 | } elseif (isset($this->prefix)) { |
| 471 | - $this->savedFileName = uniqid($this->prefix) . '.' . strtolower($matched[1]); |
|
| 471 | + $this->savedFileName = uniqid($this->prefix).'.'.strtolower($matched[1]); |
|
| 472 | 472 | } else { |
| 473 | 473 | $this->savedFileName = strtolower($this->mediaName); |
| 474 | 474 | } |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | $this->savedFileName = preg_replace('!\s+!', '_', $this->savedFileName); |
| 478 | 478 | $this->savedFileName = preg_replace("/[^a-zA-Z0-9\._-]/", '', $this->savedFileName); |
| 479 | 479 | |
| 480 | - $this->savedDestination = $this->uploadDir . '/' . $this->savedFileName; |
|
| 480 | + $this->savedDestination = $this->uploadDir.'/'.$this->savedFileName; |
|
| 481 | 481 | if (!move_uploaded_file($this->mediaTmpName, $this->savedDestination)) { |
| 482 | 482 | $this->setErrors(sprintf(_ER_UP_FAILEDSAVEFILE, $this->savedDestination)); |
| 483 | 483 | |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | public function checkMimeType() |
| 573 | 573 | { |
| 574 | 574 | // if the browser supplied mime type looks suspicious, refuse it |
| 575 | - $structureCheck = (bool) preg_match('/^\w+\/[-+.\w]+$/', $this->mediaType); |
|
| 575 | + $structureCheck = (bool)preg_match('/^\w+\/[-+.\w]+$/', $this->mediaType); |
|
| 576 | 576 | if (false === $structureCheck) { |
| 577 | 577 | $this->mediaType = 'invalid'; |
| 578 | 578 | $this->setErrors(_ER_UP_UNKNOWNFILETYPEREJECTED); |
@@ -628,8 +628,8 @@ discard block |
||
| 628 | 628 | $patterns = array(); |
| 629 | 629 | $replaces = array(); |
| 630 | 630 | foreach ($this->extensionsToBeSanitized as $ext) { |
| 631 | - $patterns[] = "/\." . preg_quote($ext) . "\./i"; |
|
| 632 | - $replaces[] = '_' . $ext . '.'; |
|
| 631 | + $patterns[] = "/\.".preg_quote($ext)."\./i"; |
|
| 632 | + $replaces[] = '_'.$ext.'.'; |
|
| 633 | 633 | } |
| 634 | 634 | $this->mediaName = preg_replace($patterns, $replaces, $this->mediaName); |
| 635 | 635 | } |
@@ -657,9 +657,9 @@ discard block |
||
| 657 | 657 | } else { |
| 658 | 658 | $ret = ''; |
| 659 | 659 | if (count($this->errors) > 0) { |
| 660 | - $ret = '<h4>' . sprintf(_ER_UP_ERRORSRETURNED, htmlspecialchars($this->mediaName, ENT_QUOTES)) . '</h4>'; |
|
| 660 | + $ret = '<h4>'.sprintf(_ER_UP_ERRORSRETURNED, htmlspecialchars($this->mediaName, ENT_QUOTES)).'</h4>'; |
|
| 661 | 661 | foreach ($this->errors as $error) { |
| 662 | - $ret .= $error . '<br>'; |
|
| 662 | + $ret .= $error.'<br>'; |
|
| 663 | 663 | } |
| 664 | 664 | } |
| 665 | 665 | |