mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-12-22 13:45:02 +00:00
feature-upload: add function / class existence checks where functions from php extensions are required
This commit is contained in:
parent
fb9eec2d33
commit
e7b3f5e0d0
2 changed files with 15 additions and 1 deletions
|
@ -14,6 +14,8 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
|
|||
- Updated the [configuration guide](https://starbeamrainbowlabs.com/labs/peppermint/peppermint-config-info.php) to include count of how many settings we have
|
||||
- Also send a `x-robots-tag: noindex, nofollow` HTTP header for the login page (Semrush Bot, you better obey this one)
|
||||
- Support `page` as either a GET parameter or a POST parameter (GET takes precedence over POST)
|
||||
- Preview generation: If php-imagick is not installed but required for a particular operation, return a proper error message
|
||||
- File upload: If fileinfo is not installed, return a proper error message when someone attempts to upload a file
|
||||
|
||||
|
||||
## Fixed
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
register_module([
|
||||
"name" => "Uploader",
|
||||
"version" => "0.7",
|
||||
"version" => "0.7.1",
|
||||
"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",
|
||||
|
@ -140,6 +140,11 @@ register_module([
|
|||
|
||||
}
|
||||
|
||||
if(!function_exists("finfo_file")) {
|
||||
http_response_code(503);
|
||||
exit(page_renderer::render("Upload failed - Server error - $settings->sitename", "<p>Your upload couldn't be processed because <code>fileinfo</code> is not installed on the server. This is required to properly check the file type of uploaded files.</p>><p>Please contact $settings->admindetails_name, $settings->sitename's administrator for help.</p>"));
|
||||
}
|
||||
|
||||
// Calculate the target name, removing any characters we
|
||||
// are unsure about.
|
||||
// Also trim off whitespace (from both ends), and full stops (from the end)
|
||||
|
@ -383,6 +388,13 @@ register_module([
|
|||
}
|
||||
*/
|
||||
|
||||
|
||||
if(!class_exists("Imagick")) {
|
||||
http_response_code(503);
|
||||
header("content-type: text/plain");
|
||||
exit("Error: The PHP Imagick extension is required to perform this operation but is not installed. Please contact the system administrator.");
|
||||
}
|
||||
|
||||
$preview = new Imagick();
|
||||
switch(substr($mime_type, 0, strpos($mime_type, "/")))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue