mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-12-22 13:45:02 +00:00
Point page viewer at the correct filename based on the revision #
This commit is contained in:
parent
9c760789f4
commit
446ca98c23
3 changed files with 33 additions and 5 deletions
|
@ -4359,7 +4359,7 @@ register_module([
|
|||
{
|
||||
// Editing is disabled, show an error message
|
||||
http_response_code(404);
|
||||
exit(page_renderer::render_main("$env->page - 404 - $settings->sitename", "<p>$env->page does not exist.</p><p>Since editing is currently disabled on this wiki, you may not create this page. If you feel that this page should exist, try contacting this wiki's Administrator.</p>"));
|
||||
exit(page_renderer::render_main("404: Page not found - $env->page - $settings->sitename", "<p>$env->page does not exist.</p><p>Since editing is currently disabled on this wiki, you may not create this page. If you feel that this page should exist, try contacting this wiki's Administrator.</p>"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4386,6 +4386,13 @@ register_module([
|
|||
// We have a revision number!
|
||||
$isHistoryRevision = true;
|
||||
$revisionNumber = intval($_GET["revision"]);
|
||||
|
||||
// Make sure that the revision exists for later on
|
||||
if(!isset($pageindex->{$env->page}->history[$revisionNumber]))
|
||||
{
|
||||
http_response_code(404);
|
||||
exit(page_renderer::render_main("404: Revision Not Found - $env->page - $settings->sitename", "<p>Revision #$revisionNumer 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>"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -4405,7 +4412,14 @@ register_module([
|
|||
if(isset($_GET["redirected_from"]))
|
||||
$content .= "<p><em>Redirected from <a href='?page=" . rawurlencode($_GET["redirected_from"]) . "&redirect=no'>" . $_GET["redirected_from"] . "</a>.</em></p>";
|
||||
|
||||
$pageFilename = "$env->storage_prefix$env->page.md";
|
||||
// Construct the filename
|
||||
$pageFilename = "$env->storage_prefix";
|
||||
if($isHistoryRevision)
|
||||
{
|
||||
$pageFilename .= $pageindex->{$env->page}->history[$revisionNumber]->filename;
|
||||
}
|
||||
else
|
||||
$pageFilename .= $pageindex->{$env->page}->filename;
|
||||
|
||||
$parsing_start = microtime(true);
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@
|
|||
"author": "Starbeamrainbowlabs",
|
||||
"description": "Allows you to view pages. You really should include this one.",
|
||||
"id": "page-view",
|
||||
"lastupdate": 1465063434,
|
||||
"lastupdate": 1465063952,
|
||||
"optional": false
|
||||
},
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ register_module([
|
|||
{
|
||||
// Editing is disabled, show an error message
|
||||
http_response_code(404);
|
||||
exit(page_renderer::render_main("$env->page - 404 - $settings->sitename", "<p>$env->page does not exist.</p><p>Since editing is currently disabled on this wiki, you may not create this page. If you feel that this page should exist, try contacting this wiki's Administrator.</p>"));
|
||||
exit(page_renderer::render_main("404: Page not found - $env->page - $settings->sitename", "<p>$env->page does not exist.</p><p>Since editing is currently disabled on this wiki, you may not create this page. If you feel that this page should exist, try contacting this wiki's Administrator.</p>"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,13 @@ register_module([
|
|||
// We have a revision number!
|
||||
$isHistoryRevision = true;
|
||||
$revisionNumber = intval($_GET["revision"]);
|
||||
|
||||
// Make sure that the revision exists for later on
|
||||
if(!isset($pageindex->{$env->page}->history[$revisionNumber]))
|
||||
{
|
||||
http_response_code(404);
|
||||
exit(page_renderer::render_main("404: Revision Not Found - $env->page - $settings->sitename", "<p>Revision #$revisionNumer 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>"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,7 +85,14 @@ register_module([
|
|||
if(isset($_GET["redirected_from"]))
|
||||
$content .= "<p><em>Redirected from <a href='?page=" . rawurlencode($_GET["redirected_from"]) . "&redirect=no'>" . $_GET["redirected_from"] . "</a>.</em></p>";
|
||||
|
||||
$pageFilename = "$env->storage_prefix$env->page.md";
|
||||
// Construct the filename
|
||||
$pageFilename = "$env->storage_prefix";
|
||||
if($isHistoryRevision)
|
||||
{
|
||||
$pageFilename .= $pageindex->{$env->page}->history[$revisionNumber]->filename;
|
||||
}
|
||||
else
|
||||
$pageFilename .= $pageindex->{$env->page}->filename;
|
||||
|
||||
$parsing_start = microtime(true);
|
||||
|
||||
|
|
Loading…
Reference in a new issue