fix incorrect parameter type for mkdir() and chmod()

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-01-25 15:47:37 +01:00
parent 6fdf2636fc
commit 61dfeb947f

View File

@@ -2,6 +2,7 @@
namespace Froxlor\Settings;
use Froxlor\Database\Database;
use Froxlor\FileDir;
use Froxlor\Settings;
class Store
@@ -373,17 +374,18 @@ class Store
if (isset($fielddata['settinggroup'], $fielddata['varname']) && is_array($fielddata) && $fielddata['settinggroup'] !== '' && $fielddata['varname'] !== '') {
$save_to = null;
$path = \Froxlor\Froxlor::getInstallDir().'/img/';
$path = \Froxlor\FileDir::makeCorrectDir($path);
// New file?
if (isset($_FILES[$fieldname]) && $_FILES[$fieldname]['tmp_name']) {
// Make sure upload directory exists
if (!is_dir($path) && !mkdir($path, '0775')) {
if (!is_dir($path) && !mkdir($path, 0775)) {
throw new \Exception("img directory does not exist and cannot be created");
}
// Make sure we can write to the upload directory
if (!is_writable($path)) {
if (!chmod($path, '0775')) {
if (!chmod($path, 0775)) {
throw new \Exception("Cannot write to img directory");
}
}