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

Bugfix: Clear up a bunch of issues with the recent history overhaul.

This commit is contained in:
Starbeamrainbowlabs 2016-10-18 18:46:41 +01:00
parent dfeb2a9399
commit 9883b58379
4 changed files with 13 additions and 11 deletions

View file

@ -1320,14 +1320,15 @@ if(isset($_GET["revision"]) and is_numeric($_GET["revision"]))
// We have a revision number!
$env->is_history_revision = true;
$env->history->revision_number = intval($_GET["revision"]);
$env->history->revision_data = $pageindex->{$env->page}->history[$revisionNumber];
// Make sure that the revision exists for later on
if(!isset($pageindex->{$env->page}->history[$revisionNumber]))
if(!isset($pageindex->{$env->page}->history[$env->history->revision_number]))
{
http_response_code(404);
exit(page_renderer::render_main("404: Revision Not Found - $env->page - $settings->sitename", "<p>Revision #{$env->history->revision_number} of $env->page doesn't appear to exist. Try viewing the <a href='?action=history&page=" . rawurlencode($env->page) . "'>list of revisions for $env->page</a>, or viewing <a href='?page=" . rawurlencode($env->page) . "'>the latest revision</a> instead.</p>"));
}
$env->history->revision_data = $pageindex->{$env->page}->history[$env->history->revision_number];
}
// Construct the page's filename
$env->page_filename = $env->storage_prefix;
@ -4688,7 +4689,7 @@ register_module([
register_module([
"name" => "Page viewer",
"version" => "0.16",
"version" => "0.16.1",
"author" => "Starbeamrainbowlabs",
"description" => "Allows you to view pages. You really should include this one.",
"id" => "page-view",
@ -4780,7 +4781,7 @@ register_module([
else
{
$content .= "<h1>Revision #{$env->history->revision_number} of $env->page</h1>\n";
$content .= "<p class='revision-note'><em>(Revision saved by $revisionData->editor " . render_timestamp($env->history->revision_data->timestamp) . ". <a href='?page=" . rawurlencode($env->page) . "'>Jump to the current revision</a> or see a <a href='?action=history&page=" . rawurlencode($env->page) . "'>list of all revisions</a> for this page.)</em></p>\n";
$content .= "<p class='revision-note'><em>(Revision saved by {$env->history->revision_data->editor} " . render_timestamp($env->history->revision_data->timestamp) . ". <a href='?page=" . rawurlencode($env->page) . "'>Jump to the current revision</a> or see a <a href='?action=history&page=" . rawurlencode($env->page) . "'>list of all revisions</a> for this page.)</em></p>\n";
}
// Add an extra message if the requester was redirected from another page

View file

@ -1019,14 +1019,15 @@ if(isset($_GET["revision"]) and is_numeric($_GET["revision"]))
// We have a revision number!
$env->is_history_revision = true;
$env->history->revision_number = intval($_GET["revision"]);
$env->history->revision_data = $pageindex->{$env->page}->history[$revisionNumber];
// Make sure that the revision exists for later on
if(!isset($pageindex->{$env->page}->history[$revisionNumber]))
if(!isset($pageindex->{$env->page}->history[$env->history->revision_number]))
{
http_response_code(404);
exit(page_renderer::render_main("404: Revision Not Found - $env->page - $settings->sitename", "<p>Revision #{$env->history->revision_number} of $env->page doesn't appear to exist. Try viewing the <a href='?action=history&page=" . rawurlencode($env->page) . "'>list of revisions for $env->page</a>, or viewing <a href='?page=" . rawurlencode($env->page) . "'>the latest revision</a> instead.</p>"));
}
$env->history->revision_data = $pageindex->{$env->page}->history[$env->history->revision_number];
}
// Construct the page's filename
$env->page_filename = $env->storage_prefix;

View file

@ -23,7 +23,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds a 'raw' action that shows you the raw source of a page.",
"id": "action-raw",
"lastupdate": 1476812239,
"lastupdate": 1476812652,
"optional": false
},
{
@ -181,11 +181,11 @@
},
{
"name": "Page viewer",
"version": "0.16",
"version": "0.16.1",
"author": "Starbeamrainbowlabs",
"description": "Allows you to view pages. You really should include this one.",
"id": "page-view",
"lastupdate": 1476812218,
"lastupdate": 1476812765,
"optional": false
},
{

View file

@ -1,7 +1,7 @@
<?php
register_module([
"name" => "Page viewer",
"version" => "0.16",
"version" => "0.16.1",
"author" => "Starbeamrainbowlabs",
"description" => "Allows you to view pages. You really should include this one.",
"id" => "page-view",
@ -93,7 +93,7 @@ register_module([
else
{
$content .= "<h1>Revision #{$env->history->revision_number} of $env->page</h1>\n";
$content .= "<p class='revision-note'><em>(Revision saved by $revisionData->editor " . render_timestamp($env->history->revision_data->timestamp) . ". <a href='?page=" . rawurlencode($env->page) . "'>Jump to the current revision</a> or see a <a href='?action=history&page=" . rawurlencode($env->page) . "'>list of all revisions</a> for this page.)</em></p>\n";
$content .= "<p class='revision-note'><em>(Revision saved by {$env->history->revision_data->editor} " . render_timestamp($env->history->revision_data->timestamp) . ". <a href='?page=" . rawurlencode($env->page) . "'>Jump to the current revision</a> or see a <a href='?action=history&page=" . rawurlencode($env->page) . "'>list of all revisions</a> for this page.)</em></p>\n";
}
// Add an extra message if the requester was redirected from another page