* @apiParam {string} mode Optional. The display mode to use. Can hold the following values: 'normal' - The default. Sends a normal page. 'printable' - Sends a printable version of the page. 'contentonly' - Sends only the content of the page, not the extra stuff around it. 'parsedsourceonly' - Sends only the raw rendered source of the page, as it appears just after it has come out of the page parser. Useful for writing external tools (see also the `raw` action).
* @apiError NonExistentPageError The page doesn't exist and editing is disabled in the wiki's settings. If editing isn't disabled, you will be redirected to the edit page instead.
* @apiError NonExistentRevisionError The specified revision was not found.
*/
/*
* ██ ██ ██ ███████ ██ ██
* ██ ██ ██ ██ ██ ██
* ██ ██ ██ █████ ██ █ ██
* ██ ██ ██ ██ ██ ███ ██
* ████ ██ ███████ ███ ███
*/
add_action("view", function() {
global $pageindex, $settings, $env;
// Check to make sure that the page exists
$page = $env->page;
if(!isset($pageindex->$page))
{
// 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
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>"));
}
}
header("last-modified: " . gmdate('D, d M Y H:i:s T', $pageindex->{$env->page}->lastmodified));
// Perform a redirect if the requested page is a redirect page
$content .= "<h1>Revision #{$env->history->revision_number} of $env->page</h1>\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 a visit parent page link if we're a subpage
$settings->footer_message = "$env->page was last edited by {$pageindex->{$env->page}->lasteditor} at " . date('h:ia T \o\n j F Y', $pageindex->{$env->page}->lastmodified) . ".</p>\n<p>" . $settings->footer_message; // Add the last edited time to the footer