From 594ba12ea3c5a8d2f82aea343432d7dd4c1f1bbb Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Wed, 13 Oct 2021 21:50:54 +0200 Subject: [PATCH] fix for #1356 --- bl-kernel/functions.php | 5 ++++- bl-kernel/helpers/filesystem.class.php | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bl-kernel/functions.php b/bl-kernel/functions.php index 957d3821..99fe7cda 100644 --- a/bl-kernel/functions.php +++ b/bl-kernel/functions.php @@ -566,8 +566,11 @@ function uploadPageFile($pageKey) { $filename = Filesystem::filename($_FILES['file']['name']); $absoluteURL = DOMAIN_UPLOADS_PAGES.$pageKey.DS.$filename.'.'.$fileExtension; $absolutePath = PATH_UPLOADS_PAGES.$pageKey.DS.$filename.'.'.$fileExtension; + // Move the original file to a page folder if (Filesystem::mv($_FILES['file']['tmp_name'], $absolutePath)) { - // Create thumbnail if the files is an image + // Change permissions files to rw-r-r + Filesystem::chmod($absolutePath, 0644); + // Create the thumbnails only if the file is an image $thumbnail = ''; if (in_array($fileMimeType, $GLOBALS['ALLOWED_IMG_MIMETYPES'])) { try { diff --git a/bl-kernel/helpers/filesystem.class.php b/bl-kernel/helpers/filesystem.class.php index 65185b82..46830e79 100644 --- a/bl-kernel/helpers/filesystem.class.php +++ b/bl-kernel/helpers/filesystem.class.php @@ -319,4 +319,8 @@ class Filesystem { return false; } + public static function chmod(string $file, int $permissions): bool { + return chmod($file, $permissions); + } + }