Backported customizable 404 page from unstable (thanks Vadi); made customizable 404 page have a {STANDARD404} variable available to allow embedding the "default" 404 content.
--- a/includes/pageprocess.php Mon Aug 04 11:44:20 2008 -0400
+++ b/includes/pageprocess.php Tue Aug 05 14:02:18 2008 -0400
@@ -1303,23 +1303,25 @@
$this->header();
$this->do_breadcrumbs();
+ $standard_404 = '';
+
if ( $userpage )
{
- echo '<h3>There is no page with this title yet.</h3>
+ $standard_404 .= '<h3>There is no page with this title yet.</h3>
<p>This user has not created his or her user page yet.';
}
else
{
- echo '<h3>There is no page with this title yet.</h3>
+ $standard_404 .= '<h3>There is no page with this title yet.</h3>
<p>You have requested a page that doesn\'t exist yet.';
}
if ( $session->get_permissions('create_page') )
{
- echo ' You can <a href="'.makeUrlNS($this->namespace, $this->page_id, 'do=edit', true).'" onclick="ajaxEditor(); return false;">create this page</a>, or return to the <a href="'.makeUrl(getConfig('main_page')).'">homepage</a>.';
+ $standard_404 .= ' You can <a href="'.makeUrlNS($this->namespace, $this->page_id, 'do=edit', true).'" onclick="ajaxEditor(); return false;">create this page</a>, or return to the <a href="'.makeUrl(getConfig('main_page')).'">homepage</a>.';
}
else
{
- echo ' Return to the <a href="'.makeUrl(getConfig('main_page')).'">homepage</a>.</p>';
+ $standard_404 .= ' Return to the <a href="'.makeUrl(getConfig('main_page')).'">homepage</a>.</p>';
}
if ( $session->get_permissions('history_rollback') )
{
@@ -1331,17 +1333,27 @@
if ( $db->numrows() > 0 )
{
$r = $db->fetchrow();
- echo '<p><b>This page was deleted on ' . $r['date_string'] . '.</b> The stated reason was:</p><blockquote>' . $r['edit_summary'] . '</blockquote><p>You can probably <a href="'.makeUrl($paths->page, 'do=rollback&id='.$r['time_id']).'" onclick="ajaxRollback(\''.$r['time_id'].'\'); return false;">roll back</a> the deletion.</p>';
+ $standard_404 .= '<p><b>This page was deleted on ' . $r['date_string'] . '.</b> The stated reason was:</p><blockquote>' . $r['edit_summary'] . '</blockquote><p>You can probably <a href="'.makeUrl($paths->page, 'do=rollback&id='.$r['time_id']).'" onclick="ajaxRollback(\''.$r['time_id'].'\'); return false;">roll back</a> the deletion.</p>';
if ( $session->user_level >= USER_LEVEL_ADMIN )
{
- echo '<p>Additional admin options: <a href="' . makeUrl($paths->page, 'do=detag', true) . '" title="Remove any tags on this page">detag page</a></p>';
+ $standard_404 .= '<p>Additional admin options: <a href="' . makeUrl($paths->page, 'do=detag', true) . '" title="Remove any tags on this page">detag page</a></p>';
}
}
$db->free_result();
}
- echo '<p>
+ $standard_404 .= '<p>
HTTP Error: 404 Not Found
</p>';
+
+ $msg = ( $pp = $paths->sysmsg('Page_not_found') ) ? RenderMan::render($pp) : '{STANDARD404}';
+ $parser = $template->makeParserText($msg);
+ $parser->assign_vars(array(
+ 'STANDARD404' => $standard_404
+ ));
+
+ $msg = $parser->run();
+ eval( '?>' . $msg );
+
$this->footer();
}