includes/pageprocess.php
changeset 61 e9708657875a
parent 47 d6361ccbd2bd
child 62 9dc4fded30e6
--- a/includes/pageprocess.php	Tue Jul 10 11:59:02 2007 -0400
+++ b/includes/pageprocess.php	Tue Jul 10 12:31:12 2007 -0400
@@ -130,10 +130,11 @@
   }
   
   /**
-   * The main method to send the page content. Also responsible for checking permissions.
+   * The main method to send the page content. Also responsible for checking permissions and calling the statistics counter.
+   * @param bool If true, the stat counter is called. Defaults to false.
    */
   
-  function send()
+  function send( $do_stats = false )
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
     if ( !$this->perms->get_permissions('read') )
@@ -160,6 +161,10 @@
         }
       }
     }
+    if ( $this->page_exists && $this->namespace != 'Special' && $this->namespace != 'Admin' && $do_stats )
+    {
+      doStats($this->page_id, $this->namespace);
+    }
     if ( $this->namespace == 'Special' || $this->namespace == 'Admin' )
     {
       if ( !$this->page_exists )
@@ -226,8 +231,17 @@
       
       if ( empty($ob) )
       {
+        die('ob is empty');
         $this->err_page_not_existent();
       }
+      else
+      {
+        // Something sent content, so we'll assume the page exist...ed at least according to the plugin
+        if ( $this->namespace != 'Special' && $this->namespace != 'Admin' && $do_stats )
+        {
+          doStats($this->page_id, $this->namespace);
+        }
+      }
     }
     else // (disabled for compatibility reasons) if ( in_array($this->namespace, array('Article', 'User', 'Project', 'Help', 'File', 'Category')) && $this->page_exists )
     {