mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-25 05:22:59 +00:00
feature-upload: squash unlink() warning when file fails to upload
This commit is contained in:
parent
698a666061
commit
d294c7e89a
2 changed files with 5 additions and 4 deletions
|
@ -37,6 +37,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
|
|||
- Multiple tags in search results and on page lists now have a margin between them
|
||||
- Newline characters (`\r` and `\n`) are now replaced with spaces in internal links (#186, thanks @SeanFromIT!)
|
||||
- Inbuilt help documentation corrections (#185, thanks @SeanFromIT!)
|
||||
- Fixed a warning message when a file fails to upload (thanks for the test file, @SeanFromIT)
|
||||
|
||||
### Changed
|
||||
- Improved the search indexing system performance - again
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
register_module([
|
||||
"name" => "Uploader",
|
||||
"version" => "0.6.2",
|
||||
"version" => "0.6.3",
|
||||
"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",
|
||||
|
@ -117,7 +117,7 @@ register_module([
|
|||
// Make sure that the user is logged in
|
||||
if(!$env->is_logged_in)
|
||||
{
|
||||
if(!empty($_FILES["file"]))
|
||||
if(!empty($_FILES["file"]) && file_exists($_FILES["file"]))
|
||||
unlink($_FILES["file"]["tmp_name"]);
|
||||
http_response_code(401);
|
||||
exit(page_renderer::render("Upload failed - $settings->sitename", "<p>Your upload couldn't be processed because you are not logged in.</p><p>Try <a href='?action=login&returnto=" . rawurlencode("?action=upload") . "'>logging in</a> first."));
|
||||
|
@ -126,7 +126,7 @@ register_module([
|
|||
// Check for php upload errors
|
||||
if($_FILES["file"]["error"] > 0)
|
||||
{
|
||||
if(!empty($_FILES["file"]))
|
||||
if(!empty($_FILES["file"]) && file_exists($_FILES["file"]))
|
||||
unlink($_FILES["file"]["tmp_name"]);
|
||||
if($_FILES["file"]["error"] == 1 || $_FILES["file"]["error"] == 2)
|
||||
http_response_code(413); // file is too large
|
||||
|
@ -216,7 +216,7 @@ register_module([
|
|||
if($is_avatar && isset($pageindex->$new_pagepath) && $pageindex->$new_pagepath->uploadedfile)
|
||||
unlink($pageindex->$new_pagepath->uploadedfilepath);
|
||||
|
||||
// Make sure that the palce we're uploading to exists
|
||||
// Make sure that the place we're uploading to exists
|
||||
if(!file_exists(dirname($env->storage_prefix . $new_filename)))
|
||||
mkdir(dirname($env->storage_prefix . $new_filename), 0775, true);
|
||||
|
||||
|
|
Loading…
Reference in a new issue