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

Squash a warning when uploading a file

This commit is contained in:
Starbeamrainbowlabs 2019-06-01 19:57:03 +01:00
parent 712e95474c
commit a5572bcbd4
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 3 additions and 2 deletions

View file

@ -12,6 +12,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Consolidated `email` and `emailAddress` fields into the latter in the user table (#167) - Consolidated `email` and `emailAddress` fields into the latter in the user table (#167)
- Fixed a crash when trying to access the user table when not logged in as an administrator. - Fixed a crash when trying to access the user table when not logged in as an administrator.
- Fixed help text for the file upload module - Fixed help text for the file upload module
- Squashed a warning when uploading a file
### Added ### Added
- [Module API] Added new extra data system. See `parser-parsedown` and `page-edit` for an example. - [Module API] Added new extra data system. See `parser-parsedown` and `page-edit` for an example.

View file

@ -1,7 +1,7 @@
<?php <?php
register_module([ register_module([
"name" => "Uploader", "name" => "Uploader",
"version" => "0.5.16", "version" => "0.5.17",
"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",
@ -108,7 +108,7 @@ register_module([
// Make sure uploads are enabled // Make sure uploads are enabled
if(!$settings->upload_enabled) if(!$settings->upload_enabled)
{ {
if(!empty($_FILES["file"])) if(!empty($_FILES["file"]) && file_exists($_FILES["file"]["tmp_name"]))
unlink($_FILES["file"]["tmp_name"]); unlink($_FILES["file"]["tmp_name"]);
http_response_code(412); http_response_code(412);
exit(page_renderer::render("Upload failed - $settings->sitename", "<p>Your upload couldn't be processed because uploads are currently disabled on $settings->sitename. <a href='index.php'>Go back to the main page</a>.</p>")); exit(page_renderer::render("Upload failed - $settings->sitename", "<p>Your upload couldn't be processed because uploads are currently disabled on $settings->sitename. <a href='index.php'>Go back to the main page</a>.</p>"));