# HG changeset patch # User Dan # Date 1217959146 14400 # Node ID 47413d71c2d9bda708401897d8abac8a426fb6df # Parent 872f0048dd81899815c4bc1e627b7225d2d5b7b6 Made customizable 404 page have a {STANDARD404} variable available to allow embedding the "default" 404 content. diff -r 872f0048dd81 -r 47413d71c2d9 includes/pageprocess.php --- a/includes/pageprocess.php Tue Aug 05 11:13:05 2008 -0400 +++ b/includes/pageprocess.php Tue Aug 05 13:59:06 2008 -0400 @@ -1929,68 +1929,72 @@ $this->header(); $this->do_breadcrumbs(); - $msg = $paths->sysmsg('Page_not_found'); - if ( $msg ) + $msg = ( $pp = $paths->sysmsg('Page_not_found') ) ? $pp : '{STANDARD404}'; + + $standard_404 = ''; + + if ( $userpage ) { - $msg = RenderMan::render($msg); - eval( '?>' . $msg ); + $standard_404 .= '
' . $lang->get('page_msg_404_body_userpage'); + } + else + { + $standard_404 .= '
' . $lang->get('page_msg_404_body'); + } + if ( $session->get_permissions('create_page') ) + { + $standard_404 .= ' ' . $lang->get('page_msg_404_create', array( + 'create_flags' => 'href="'.makeUrlNS($this->namespace, $this->page_id, 'do=edit', true).'" onclick="ajaxEditor(); return false;"', + 'mainpage_link' => makeUrl(getConfig('main_page'), false, true) + )); } else { - if ( $userpage ) - { - echo '
' . $lang->get('page_msg_404_body_userpage'); - } - else - { - echo '
' . $lang->get('page_msg_404_body'); - } - if ( $session->get_permissions('create_page') ) - { - echo ' ' . $lang->get('page_msg_404_create', array( - 'create_flags' => 'href="'.makeUrlNS($this->namespace, $this->page_id, 'do=edit', true).'" onclick="ajaxEditor(); return false;"', - 'mainpage_link' => makeUrl(getConfig('main_page'), false, true) - )); - } - else + $standard_404 .= ' ' . $lang->get('page_msg_404_gohome', array( + 'mainpage_link' => makeUrl(getConfig('main_page'), false, true) + )); + } + $standard_404 .= '
'; + if ( $session->get_permissions('history_rollback') ) + { + $e = $db->sql_query('SELECT * FROM ' . table_prefix . 'logs WHERE action=\'delete\' AND page_id=\'' . $this->page_id . '\' AND namespace=\'' . $this->namespace . '\' ORDER BY time_id DESC;'); + if ( !$e ) { - echo ' ' . $lang->get('page_msg_404_gohome', array( - 'mainpage_link' => makeUrl(getConfig('main_page'), false, true) - )); + $db->_die('The deletion log could not be selected.'); } - echo ''; - if ( $session->get_permissions('history_rollback') ) + if ( $db->numrows() > 0 ) { - $e = $db->sql_query('SELECT * FROM ' . table_prefix . 'logs WHERE action=\'delete\' AND page_id=\'' . $this->page_id . '\' AND namespace=\'' . $this->namespace . '\' ORDER BY time_id DESC;'); - if ( !$e ) + $r = $db->fetchrow(); + $standard_404 .= '' . $lang->get('page_msg_404_was_deleted', array( + 'delete_time' => enano_date('d M Y h:i a', $r['time_id']), + 'delete_reason' => htmlspecialchars($r['edit_summary']), + 'rollback_flags' => 'href="'.makeUrl($paths->page, 'do=rollback&id='.$r['log_id']).'" onclick="ajaxRollback(\''.$r['log_id'].'\'); return false;"' + )) + . '
'; + if ( $session->user_level >= USER_LEVEL_ADMIN ) { - $db->_die('The deletion log could not be selected.'); - } - if ( $db->numrows() > 0 ) - { - $r = $db->fetchrow(); - echo '' . $lang->get('page_msg_404_was_deleted', array( - 'delete_time' => enano_date('d M Y h:i a', $r['time_id']), - 'delete_reason' => htmlspecialchars($r['edit_summary']), - 'rollback_flags' => 'href="'.makeUrl($paths->page, 'do=rollback&id='.$r['log_id']).'" onclick="ajaxRollback(\''.$r['log_id'].'\'); return false;"' + $standard_404 .= '
' . $lang->get('page_msg_404_admin_opts', array( + 'detag_link' => makeUrl($paths->page, 'do=detag', true) )) . '
'; - if ( $session->user_level >= USER_LEVEL_ADMIN ) - { - echo '' . $lang->get('page_msg_404_admin_opts', array( - 'detag_link' => makeUrl($paths->page, 'do=detag', true) - )) - . '
'; - } } - $db->free_result(); } - echo '- ' . $lang->get('page_msg_404_http_response') . ' -
'; + $db->free_result(); } + $standard_404 .= '+ ' . $lang->get('page_msg_404_http_response') . ' +
'; + + $parser = $template->makeParserText($msg); + $parser->assign_vars(array( + 'STANDARD404' => $standard_404 + )); + + $msg = RenderMan::render($parser->run()); + eval( '?>' . $msg ); + $this->footer(); }