diff -r 9bcc185dc151 -r 85f91037cd4f includes/pageutils.php --- a/includes/pageutils.php Tue Jan 29 17:29:08 2008 -0500 +++ b/includes/pageutils.php Tue Jan 29 23:15:44 2008 -0500 @@ -89,7 +89,7 @@ } /** - * Basically a frontend to RenderMan::getPage(), with the ability to send valid data for nonexistent pages + * DEPRECATED. Previously returned the full rendered contents of a page. * @param $page the full page id (Namespace:Pagename) * @param $send_headers true if the theme headers should be sent (still dependent on current page settings), false otherwise * @return string @@ -98,226 +98,6 @@ public static function getpage($page, $send_headers = false, $hist_id = false) { die('PageUtils->getpage is deprecated.'); - global $db, $session, $paths, $template, $plugins; // Common objects - ob_start(); - $pid = RenderMan::strToPageID($page); - //die('
'.print_r($pid, true).'
'); - if(isset($paths->pages[$page]['password']) && strlen($paths->pages[$page]['password']) == 40) - { - password_prompt($page); - } - if(isset($paths->pages[$page])) - { - doStats($pid[0], $pid[1]); - } - if($paths->custom_page || $pid[1] == 'Special') - { - // If we don't have access to the page, get out and quick! - if(!$session->get_permissions('read') && $pid[0] != 'Login' && $pid[0] != 'Register') - { - $template->tpl_strings['PAGE_NAME'] = 'Access denied'; - - if ( $send_headers ) - { - $template->header(); - } - - echo '
Access to this page is denied.
This may be because you are not logged in or you have not met certain criteria for viewing this page.
'; - - if ( $send_headers ) - { - $template->footer(); - } - - $r = ob_get_contents(); - ob_end_clean(); - return $r; - } - - $fname = 'page_' . $pid[1] . '_' . $paths->pages[$page]['urlname_nons']; - @call_user_func($fname); - - } - else if ( $pid[1] == 'Admin' ) - { - // If we don't have access to the page, get out and quick! - if(!$session->get_permissions('read')) - { - $template->tpl_strings['PAGE_NAME'] = 'Access denied'; - if ( $send_headers ) - { - $template->header(); - } - echo '
Access to this page is denied.
This may be because you are not logged in or you have not met certain criteria for viewing this page.
'; - if ( $send_headers ) - { - $template->footer(); - } - $r = ob_get_contents(); - ob_end_clean(); - return $r; - } - - $fname = 'page_' . $pid[1] . '_' . $pid[0]; - if ( !function_exists($fname) ) - { - $title = 'Page backend not found'; - $message = "The administration page you are looking for was properly registered using the page API, but the backend function - ($fname) was not found. If this is a plugin page, then this is almost certainly a bug with the plugin."; - if ( $send_headers ) - { - die_friendly($title, "

$message

"); - } - else - { - echo "

$title

\n

$message

"; - } - } - @call_user_func($fname); - } - else if ( !isset( $paths->pages[$page] ) ) - { - ob_start(); - $code = $plugins->setHook('page_not_found'); - foreach ( $code as $cmd ) - { - eval($cmd); - } - $text = ob_get_contents(); - if ( $text != '' ) - { - ob_end_clean(); - return $text; - } - $template->header(); - if($m = $paths->sysmsg('Page_not_found')) - { - eval('?>'.RenderMan::render($m)); - } - else - { - header('HTTP/1.1 404 Not Found'); - echo '

There is no page with this title yet.

-

You have requested a page that doesn\'t exist yet.'; - if($session->get_permissions('create_page')) echo ' You can create this page, or return to the homepage.'; - else echo ' Return to the homepage.

'; - if ( $session->get_permissions('history_rollback') ) - { - $e = $db->sql_query('SELECT * FROM ' . table_prefix.'logs WHERE action=\'delete\' AND page_id=\'' . $paths->page_id . '\' AND namespace=\'' . $pid[1] . '\' ORDER BY time_id DESC;'); - if ( !$e ) - { - $db->_die('The deletion log could not be selected.'); - } - if ($db->numrows() > 0 ) - { - $r = $db->fetchrow(); - echo '

This page also appears to have some log entries in the database - it seems that it was deleted on ' . enano_date('d M Y h:i a', intval($r['time_id'])) . '. You can probably roll back the deletion.

'; - } - $db->free_result(); - } - echo '

- HTTP Error: 404 Not Found -

'; - } - $template->footer(); - } - else - { - - // If we don't have access to the page, get out and quick! - if(!$session->get_permissions('read')) - { - $template->tpl_strings['PAGE_NAME'] = 'Access denied'; - if($send_headers) $template->header(); - echo '
Access to this page is denied.
This may be because you are not logged in or you have not met certain criteria for viewing this page.
'; - if($send_headers) $template->footer(); - $r = ob_get_contents(); - ob_end_clean(); - return $r; - } - - ob_start(); - $code = $plugins->setHook('page_custom_handler'); - foreach ( $code as $cmd ) - { - eval($cmd); - } - $text = ob_get_contents(); - if ( $text != '' ) - { - ob_end_clean(); - return $text; - } - - if ( $hist_id ) - { - $e = $db->sql_query('SELECT page_text,date_string,char_tag FROM ' . table_prefix.'logs WHERE page_id=\'' . $paths->pages[$page]['urlname_nons'] . '\' AND namespace=\'' . $pid[1] . '\' AND log_type=\'page\' AND action=\'edit\' AND time_id=' . $db->escape($hist_id) . ''); - if($db->numrows() < 1) - { - $db->_die('There were no rows in the text table that matched the page text query.'); - } - $r = $db->fetchrow(); - $db->free_result(); - $message = '
Notice:
The page you are viewing was archived on ' . enano_date('d M Y h:i a', intval($r['time_id'])) . '.
View current version | Restore this version

'.RenderMan::render($r['page_text']); - - if( !$paths->pages[$page]['special'] ) - { - if($send_headers) - { - $template->header(); - } - display_page_headers(); - } - - eval('?>' . $message); - - if( !$paths->pages[$page]['special'] ) - { - display_page_footers(); - if($send_headers) - { - $template->footer(); - } - } - - } else { - if(!$paths->pages[$page]['special']) - { - $message = RenderMan::getPage($paths->pages[$page]['urlname_nons'], $pid[1]); - } - else - { - $message = RenderMan::getPage($paths->pages[$page]['urlname_nons'], $pid[1], 0, false, false, false, false); - } - // This line is used to debug wikiformatted code - // die('
'.htmlspecialchars($message).'
'); - - if( !$paths->pages[$page]['special'] ) - { - if($send_headers) - { - $template->header(); - } - display_page_headers(); - } - - // This is it, this is what all of Enano has been working up to... - - eval('?>' . $message); - - if( !$paths->pages[$page]['special'] ) - { - display_page_footers(); - if($send_headers) - { - $template->footer(); - } - } - } - } - $ret = ob_get_contents(); - ob_end_clean(); - return $ret; } /**