From aea3294c9269fdab1e1245072757c1d80bdb6f24 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Thu, 22 Oct 2015 08:43:29 +0100 Subject: [PATCH] Bugfix: open mimechecker correctly --- build/index.php | 4 ++-- module_index.json | 2 +- modules/feature-upload.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/index.php b/build/index.php index a432a22..761556c 100644 --- a/build/index.php +++ b/build/index.php @@ -1280,7 +1280,7 @@ register_module([ $target_name = makepathsafe($_POST["name"]); $temp_filename = $_FILES["file"]["tmp_name"]; - $mimechecker = new finfo(FILEINFO_MIME_TYPE); + $mimechecker = finfo_open(FILEINFO_MIME_TYPE); $mime_type = finfo_file($mimechecker, $temp_filename); // Perform appropriate checks based on the *real* filetype @@ -1300,7 +1300,7 @@ register_module([ exit(page_renderer::render("Upload Error - $settings->sitename", "

You uploaded a video, but $settings->sitename doesn't support them yet. Please try again later.

")); default: - exit(page_renderer::render("Upload Error - $settings->sitename", "

You uploaded an unnknown file type which couldn't be processed. $settings->sitename thinks that the file you uploaded was a(n) $mime_type, which isn't supported.

")); + exit(page_renderer::render("Upload Error - $settings->sitename", "

You uploaded an unnknown file type which couldn't be processed. $settings->sitename thinks that the file you uploaded was a(n) '$mime_type', which isn't supported.

")); } $file_extension = system_mime_type_extension($mime_type); diff --git a/module_index.json b/module_index.json index 4cc1bcf..0c11324 100644 --- a/module_index.json +++ b/module_index.json @@ -50,7 +50,7 @@ "author": "Starbeamrainbowlabs", "description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File:' prefix.", "id": "feature-upload", - "lastupdate": 1445499647, + "lastupdate": 1445499784, "optional": false }, { diff --git a/modules/feature-upload.php b/modules/feature-upload.php index 4ce9b02..acb9bbe 100644 --- a/modules/feature-upload.php +++ b/modules/feature-upload.php @@ -62,7 +62,7 @@ register_module([ $target_name = makepathsafe($_POST["name"]); $temp_filename = $_FILES["file"]["tmp_name"]; - $mimechecker = new finfo(FILEINFO_MIME_TYPE); + $mimechecker = finfo_open(FILEINFO_MIME_TYPE); $mime_type = finfo_file($mimechecker, $temp_filename); // Perform appropriate checks based on the *real* filetype @@ -82,7 +82,7 @@ register_module([ exit(page_renderer::render("Upload Error - $settings->sitename", "

You uploaded a video, but $settings->sitename doesn't support them yet. Please try again later.

")); default: - exit(page_renderer::render("Upload Error - $settings->sitename", "

You uploaded an unnknown file type which couldn't be processed. $settings->sitename thinks that the file you uploaded was a(n) $mime_type, which isn't supported.

")); + exit(page_renderer::render("Upload Error - $settings->sitename", "

You uploaded an unnknown file type which couldn't be processed. $settings->sitename thinks that the file you uploaded was a(n) '$mime_type', which isn't supported.

")); } $file_extension = system_mime_type_extension($mime_type);