1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-25 17:23:00 +00:00

Bugfix: open mimechecker correctly

This commit is contained in:
Starbeamrainbowlabs 2015-10-22 08:43:29 +01:00
parent 48ebd5ebfe
commit aea3294c92
3 changed files with 5 additions and 5 deletions

View file

@ -1280,7 +1280,7 @@ register_module([
$target_name = makepathsafe($_POST["name"]); $target_name = makepathsafe($_POST["name"]);
$temp_filename = $_FILES["file"]["tmp_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); $mime_type = finfo_file($mimechecker, $temp_filename);
// Perform appropriate checks based on the *real* filetype // Perform appropriate checks based on the *real* filetype
@ -1300,7 +1300,7 @@ register_module([
exit(page_renderer::render("Upload Error - $settings->sitename", "<p>You uploaded a video, but $settings->sitename doesn't support them yet. Please try again later.</p>")); exit(page_renderer::render("Upload Error - $settings->sitename", "<p>You uploaded a video, but $settings->sitename doesn't support them yet. Please try again later.</p>"));
default: default:
exit(page_renderer::render("Upload Error - $settings->sitename", "<p>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.</p>")); exit(page_renderer::render("Upload Error - $settings->sitename", "<p>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.</p>"));
} }
$file_extension = system_mime_type_extension($mime_type); $file_extension = system_mime_type_extension($mime_type);

View file

@ -50,7 +50,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File:' prefix.", "description": "Adds the ability to upload files to Pepperminty Wiki. Uploaded files act as pages and have the special 'File:' prefix.",
"id": "feature-upload", "id": "feature-upload",
"lastupdate": 1445499647, "lastupdate": 1445499784,
"optional": false "optional": false
}, },
{ {

View file

@ -62,7 +62,7 @@ register_module([
$target_name = makepathsafe($_POST["name"]); $target_name = makepathsafe($_POST["name"]);
$temp_filename = $_FILES["file"]["tmp_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); $mime_type = finfo_file($mimechecker, $temp_filename);
// Perform appropriate checks based on the *real* filetype // Perform appropriate checks based on the *real* filetype
@ -82,7 +82,7 @@ register_module([
exit(page_renderer::render("Upload Error - $settings->sitename", "<p>You uploaded a video, but $settings->sitename doesn't support them yet. Please try again later.</p>")); exit(page_renderer::render("Upload Error - $settings->sitename", "<p>You uploaded a video, but $settings->sitename doesn't support them yet. Please try again later.</p>"));
default: default:
exit(page_renderer::render("Upload Error - $settings->sitename", "<p>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.</p>")); exit(page_renderer::render("Upload Error - $settings->sitename", "<p>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.</p>"));
} }
$file_extension = system_mime_type_extension($mime_type); $file_extension = system_mime_type_extension($mime_type);