From 61dfeb947fff922219817b83e18a1cae19d23b35 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Tue, 25 Jan 2022 15:47:37 +0100 Subject: [PATCH] fix incorrect parameter type for mkdir() and chmod() Signed-off-by: Michael Kaufmann --- lib/Froxlor/Settings/Store.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Froxlor/Settings/Store.php b/lib/Froxlor/Settings/Store.php index d282947c..d642de1c 100644 --- a/lib/Froxlor/Settings/Store.php +++ b/lib/Froxlor/Settings/Store.php @@ -2,6 +2,7 @@ namespace Froxlor\Settings; use Froxlor\Database\Database; +use Froxlor\FileDir; use Froxlor\Settings; class Store @@ -373,20 +374,21 @@ 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"); } - } + } // Make sure mime-type matches an image if (!in_array(mime_content_type($_FILES[$fieldname]['tmp_name']), ['image/jpeg','image/jpg','image/png','image/gif'])) {