Make view source message more meaningful when editing is disabled & disallow uploads when editing is disdabled

This commit is contained in:
Starbeamrainbowlabs 2017-12-31 23:17:25 +00:00
parent 0405fbfbf8
commit 4f9f3cb395
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
5 changed files with 26 additions and 8 deletions

View File

@ -5,6 +5,10 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
### Fixed
- Properly escaped content of short code box on file pages
- Display a more meaningful message to a logged in user if editing is disabled
### Changed
- Disallow uploads if editing is disabled. Previously files could still be uploaded even if editing was disabled - unless `upload_enabled` was set to `false`.
## v0.15.1

View File

@ -4845,7 +4845,7 @@ function stats_save($stats)
register_module([
"name" => "Uploader",
"version" => "0.5.11",
"version" => "0.5.12",
"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",
@ -4945,6 +4945,10 @@ register_module([
case "POST":
// Recieve file
if(!$settings->editing) {
exit(page_renderer::render_main("Upload failed - $settings->sitename", "<p>Your upload couldn't be processed because editing is currently disabled on $settings->sitename. Please contact $settings->admindetails_name, $settings->sitename's administrator for more information - their contact details can be found at the bottom of this page. <a href='index.php'>Go back to the main page</a>."));
}
// Make sure uploads are enabled
if(!$settings->upload_enabled)
{
@ -6103,7 +6107,7 @@ register_module([
register_module([
"name" => "Page editor",
"version" => "0.17.1",
"version" => "0.17.2",
"author" => "Starbeamrainbowlabs",
"description" => "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
"id" => "page-edit",
@ -6190,6 +6194,9 @@ register_module([
if($env->is_logged_in)
$sourceViewContent = "<p>$env->page is protected, and you aren't an administrator or moderator. You can view the source of $env->page below, but you can't edit it.</p>\n";
if(!$settings->editing)
$sourceViewContent = "<p>$settings->sitename currently has editing disabled, so you can't make changes to this page at this time. Please contact $settings->admindetails_name, $settings->sitename's administrator for more information - their contact details can be found at the bottom of this page. Even so, you can still view the source of this page. It's disabled below:</p>";
if($isOtherUsersPage)
$sourceViewContent = "<p>$env->page is a special user page which acutally belongs to " . extract_user_from_userpage($env->page) . ", another user on $settings->sitename. Because of this, you are not allowed to edit it (though you can always edit your own page and any pages under it if you're logged in). You can, however, vieww it's source below.</p>";

View File

@ -118,11 +118,11 @@
},
{
"name": "Uploader",
"version": "0.5.11",
"version": "0.5.12",
"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",
"lastupdate": 1514641395,
"lastupdate": 1514762001,
"optional": false
},
{
@ -163,11 +163,11 @@
},
{
"name": "Page editor",
"version": "0.17.1",
"version": "0.17.2",
"author": "Starbeamrainbowlabs",
"description": "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
"id": "page-edit",
"lastupdate": 1512919152,
"lastupdate": 1514762051,
"optional": false
},
{

View File

@ -1,7 +1,7 @@
<?php
register_module([
"name" => "Uploader",
"version" => "0.5.11",
"version" => "0.5.12",
"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",
@ -101,6 +101,10 @@ register_module([
case "POST":
// Recieve file
if(!$settings->editing) {
exit(page_renderer::render_main("Upload failed - $settings->sitename", "<p>Your upload couldn't be processed because editing is currently disabled on $settings->sitename. Please contact $settings->admindetails_name, $settings->sitename's administrator for more information - their contact details can be found at the bottom of this page. <a href='index.php'>Go back to the main page</a>."));
}
// Make sure uploads are enabled
if(!$settings->upload_enabled)
{

View File

@ -1,7 +1,7 @@
<?php
register_module([
"name" => "Page editor",
"version" => "0.17.1",
"version" => "0.17.2",
"author" => "Starbeamrainbowlabs",
"description" => "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
"id" => "page-edit",
@ -88,6 +88,9 @@ register_module([
if($env->is_logged_in)
$sourceViewContent = "<p>$env->page is protected, and you aren't an administrator or moderator. You can view the source of $env->page below, but you can't edit it.</p>\n";
if(!$settings->editing)
$sourceViewContent = "<p>$settings->sitename currently has editing disabled, so you can't make changes to this page at this time. Please contact $settings->admindetails_name, $settings->sitename's administrator for more information - their contact details can be found at the bottom of this page. Even so, you can still view the source of this page. It's disabled below:</p>";
if($isOtherUsersPage)
$sourceViewContent = "<p>$env->page is a special user page which acutally belongs to " . extract_user_from_userpage($env->page) . ", another user on $settings->sitename. Because of this, you are not allowed to edit it (though you can always edit your own page and any pages under it if you're logged in). You can, however, vieww it's source below.</p>";