diff --git a/modules/feature-upload.php b/modules/feature-upload.php index 0568ad6..313c028 100644 --- a/modules/feature-upload.php +++ b/modules/feature-upload.php @@ -23,6 +23,7 @@ register_module([ * @apiParam {string} name The name of the file to upload. * @apiParam {string} description A description of the file. * @apiParam {file} file The file to upload. + * @apiParam {boolean} avatar Whether this upload should be uploaded as the current user's avatar. If specified, any filenames provided will be ignored. * * @apiUse UserNotLoggedInError * @apiError UploadsDisabledError Uploads are currently disabled in the wiki's settings. @@ -43,6 +44,8 @@ register_module([ add_action("upload", function() { global $settings, $env, $pageindex, $paths; + $is_avatar = !empty($_POST["avatar"]) || !empty($_GET["avatar"]); + switch($_SERVER["REQUEST_METHOD"]) { case "GET": @@ -54,8 +57,22 @@ register_module([ exit(page_renderer::render("Upload Error - $settings->sitename", "
You are not currently logged in, so you can't upload anything.
Try logging in first.
")); + if($is_avatar) { + exit(page_renderer::render("Upload avatar - $settings->sitenamae", "Select an image below, and then press upload. $settings->sitename currently supports the following file types (though not all of them may be suitable for an avatar): " . implode(", ", $settings->upload_allowed_file_types) . "
+ ")); + } + exit(page_renderer::render("Upload - $settings->sitename", "Select an image below, and then type a name for it in the box. This server currently supports uploads up to " . human_filesize(get_max_upload_size()) . " in size.
+Select an image or file below, and then type a name for it in the box. This server currently supports uploads up to " . human_filesize(get_max_upload_size()) . " in size.
$settings->sitename currently supports uploading of the following file types: " . implode(", ", $settings->upload_allowed_file_types) . ".