mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-12-22 13:45:02 +00:00
Bugfix: Display link when redirect page sends user to a another page that doesn't exist Note that this only shows for users with permission to edit the target page at the moment.
This commit is contained in:
parent
79ddc234d2
commit
237d10f908
3 changed files with 12 additions and 7 deletions
|
@ -28,6 +28,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
|
|||
|
||||
### Fixed
|
||||
- Squashed a warning when using the fenced code block syntax
|
||||
- If a redirect page sends you to a page that doesn't exist, a link back to the redirect page itself is now displayed
|
||||
|
||||
|
||||
## v0.21
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
register_module([
|
||||
"name" => "Page editor",
|
||||
"version" => "0.17.7",
|
||||
"version" => "0.17.8",
|
||||
"author" => "Starbeamrainbowlabs",
|
||||
"description" => "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
|
||||
"id" => "page-edit",
|
||||
|
@ -72,8 +72,7 @@ register_module([
|
|||
$isOtherUsersPage // this page actually belongs to another user
|
||||
)
|
||||
{
|
||||
if(!$creatingpage)
|
||||
{
|
||||
if(!$creatingpage) {
|
||||
// The page already exists - let the user view the page source
|
||||
$sourceViewContent = "<p>$settings->sitename does not allow anonymous users to make edits. You can view the source of $env->page below, but you can't edit it. You could, however, try <a href='index.php?action=login&returnto=" . rawurlencode($_SERVER["REQUEST_URI"]) . "'>logging in</a>.</p>\n";
|
||||
|
||||
|
@ -91,8 +90,7 @@ register_module([
|
|||
|
||||
exit(page_renderer::render_main("Viewing source for $env->page", $sourceViewContent));
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$errorMessage = "<p>The page <code>$env->page</code> does not exist, but you do not have permission to create it.</p><p>If you haven't already, perhaps you should try <a href='index.php?action=login&returnto=" . rawurlencode($_SERVER["REQUEST_URI"]) . "'>logging in</a>.</p>\n";
|
||||
|
||||
if($isOtherUsersPage) {
|
||||
|
@ -111,6 +109,9 @@ register_module([
|
|||
if(!$env->is_logged_in and $settings->anonedits) {
|
||||
$content .= "<p><strong>Warning: You are not logged in! Your IP address <em>may</em> be recorded.</strong></p>";
|
||||
}
|
||||
if(isset($_GET["redirected_from"])) {
|
||||
$content .= "<p><em>Redirected from <a href='?page=".rawurlencode($_GET["redirected_from"])."&redirect=no'>".htmlentities($_GET["redirected_from"])."</a></em></p>\n";
|
||||
}
|
||||
|
||||
// Include preview, if set
|
||||
if(isset($_POST['preview-edit']) && isset($_POST['content'])) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
register_module([
|
||||
"name" => "Page viewer",
|
||||
"version" => "0.16.8",
|
||||
"version" => "0.16.9",
|
||||
"author" => "Starbeamrainbowlabs",
|
||||
"description" => "Allows you to view pages. You really should include this one.",
|
||||
"id" => "page-view",
|
||||
|
@ -40,8 +40,11 @@ register_module([
|
|||
// TODO: make this intelligent so we only redirect if the user is actually able to create the page
|
||||
if($settings->editing) {
|
||||
// Editing is enabled, redirect to the editing page
|
||||
$redirectUrl = "index.php?action=edit&newpage=yes&page=".rawurlencode($env->page);
|
||||
if(isset($_GET["redirected_from"]))
|
||||
$redirectUrl .= "&redirected_from=".rawurlencode($_GET["redirected_from"]);
|
||||
http_response_code(307); // Temporary redirect
|
||||
header("location: index.php?action=edit&newpage=yes&page=" . rawurlencode($env->page));
|
||||
header("location: $redirectUrl");
|
||||
exit();
|
||||
} else {
|
||||
// Editing is disabled, show an error message
|
||||
|
|
Loading…
Reference in a new issue