Cleared up a few discrepancies in page handling, template var init, and how NewsBoy works.
authorDan
Thu, 16 Apr 2009 22:48:59 -0400
changeset 935 9e124177c9a4
parent 934 ebefca69f3fd
child 936 41090c4d2648
Cleared up a few discrepancies in page handling, template var init, and how NewsBoy works.
includes/namespaces/default.php
includes/pageprocess.php
includes/paths.php
includes/template.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();
     }
--- 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
--- 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);
--- 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 )
       {