Apply fixes from StyleCI (#1242)

Co-authored-by: StyleCI Bot <bot@styleci.io>
This commit is contained in:
Yury Pikhtarev 2023-12-20 22:49:00 +04:00 committed by GitHub
commit c57233414f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -734,22 +734,25 @@ class Attach
$file = $_FILES['fileupload']['tmp_name']; $file = $_FILES['fileupload']['tmp_name'];
$this->type = $_FILES['fileupload']['type']; $this->type = $_FILES['fileupload']['type'];
if (isset($_FILES['fileupload']['error'])) { if (isset($_FILES['fileupload']['error'])) {
switch($_FILES['fileupload']['error']) { switch($_FILES['fileupload']['error']) {
case UPLOAD_ERR_NO_FILE: case UPLOAD_ERR_NO_FILE:
bb_die('No file content sent'); bb_die('No file content sent');
case UPLOAD_ERR_INI_SIZE: // no break
bb_die('upload_max_filesize setting: ' . ini_get('upload_max_filesize')); case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_CANT_WRITE: bb_die('upload_max_filesize setting: ' . ini_get('upload_max_filesize'));
bb_die('Failed to write file to disk, check permissions'); // no break
case UPLOAD_ERR_PARTIAL: case UPLOAD_ERR_CANT_WRITE:
bb_die('The uploaded file was only partially uploaded'); bb_die('Failed to write file to disk, check permissions');
// no break
case UPLOAD_ERR_PARTIAL:
bb_die('The uploaded file was only partially uploaded');
}
} }
}
if (isset($_FILES['fileupload']['size']) && $_FILES['fileupload']['size'] === 0) { if (isset($_FILES['fileupload']['size']) && $_FILES['fileupload']['size'] === 0) {
bb_die('Tried to upload empty file'); bb_die('Tried to upload empty file');
} }
$this->type = strtolower($this->type); $this->type = strtolower($this->type);
$this->extension = strtolower(get_extension($this->filename)); $this->extension = strtolower(get_extension($this->filename));