# HG changeset patch # User Dan # Date 1239936539 14400 # Node ID 9e124177c9a4e882f42e675e9fd4a1625d119acb # Parent ebefca69f3fd0c4283594f8971feb7e0fdb32d6a Cleared up a few discrepancies in page handling, template var init, and how NewsBoy works. diff -r ebefca69f3fd -r 9e124177c9a4 includes/namespaces/default.php --- a/includes/namespaces/default.php Thu Apr 16 21:01:47 2009 -0400 +++ b/includes/namespaces/default.php Thu Apr 16 22:48:59 2009 -0400 @@ -331,6 +331,7 @@ if ( $send_headers ) { + $template->init_vars($this); $output->set_title($this->title); $output->header(); } diff -r ebefca69f3fd -r 9e124177c9a4 includes/pageprocess.php --- a/includes/pageprocess.php Thu Apr 16 21:01:47 2009 -0400 +++ b/includes/pageprocess.php Thu Apr 16 22:48:59 2009 -0400 @@ -1043,6 +1043,16 @@ } /** + * Tells us if the page exists. + * @return bool + */ + + function exists() + { + return $this->ns->exists(); + } + + /** * Pushes to the redirect stack and resets the instance. This depends on the page ID and namespace already being validated and sanitized, and does not check the size of the redirect stack. * @param string Page ID to redirect to * @param string Namespace to redirect to diff -r ebefca69f3fd -r 9e124177c9a4 includes/paths.php --- a/includes/paths.php Thu Apr 16 21:01:47 2009 -0400 +++ b/includes/paths.php Thu Apr 16 22:48:59 2009 -0400 @@ -1023,6 +1023,11 @@ $new_index = $search->index; + if ( count($search->index) == 0 ) + // o_O + // nothing indexed. + return true; + if ( ENANO_DBLAYER == 'MYSQL' ) { $keys = array_keys($search->index); diff -r ebefca69f3fd -r 9e124177c9a4 includes/template.php --- a/includes/template.php Thu Apr 16 21:01:47 2009 -0400 +++ b/includes/template.php Thu Apr 16 22:48:59 2009 -0400 @@ -391,7 +391,7 @@ @define('ENANO_TEMPLATE_LOADED', ''); } - if ( is_object($page) && @get_class($page) == 'PageProcessor' ) + if ( is_object($page) && ( @get_class($page) == 'PageProcessor' || preg_match('/^Namespace_/', @get_class($page)) ) ) { $page_append = substr($paths->fullpage, strlen($paths->page)); if ( isset($paths->nslist[$page->namespace]) ) @@ -405,7 +405,7 @@ $local_fullpage = $local_page . $page_append; $local_page_id =& $page->page_id; $local_namespace =& $page->namespace; - $local_page_exists =& $page->page_exists; + $local_page_exists = $page->exists(); $perms =& $page->perms; } else @@ -584,6 +584,7 @@ // Initialize the toolbar $tb = ''; + $this->toolbar_menu = ''; // Create "xx page" button @@ -605,7 +606,6 @@ // Comments button if ( $perms->get_permissions('read') && getConfig('enable_comments', '1')=='1' && $local_cdata['comments_on'] == 1 ) { - $e = $db->sql_query('SELECT approved FROM '.table_prefix.'comments WHERE page_id=\''.$local_page_id.'\' AND namespace=\''.$local_namespace.'\';'); if ( !$e ) {