includes/pageprocess.php
changeset 61 e9708657875a
parent 47 d6361ccbd2bd
child 62 9dc4fded30e6
equal deleted inserted replaced
60:71b50f8c8f85 61:e9708657875a
   128     $this->_setup( $page_id, $namespace, $revision_id );
   128     $this->_setup( $page_id, $namespace, $revision_id );
   129     
   129     
   130   }
   130   }
   131   
   131   
   132   /**
   132   /**
   133    * The main method to send the page content. Also responsible for checking permissions.
   133    * The main method to send the page content. Also responsible for checking permissions and calling the statistics counter.
   134    */
   134    * @param bool If true, the stat counter is called. Defaults to false.
   135   
   135    */
   136   function send()
   136   
       
   137   function send( $do_stats = false )
   137   {
   138   {
   138     global $db, $session, $paths, $template, $plugins; // Common objects
   139     global $db, $session, $paths, $template, $plugins; // Common objects
   139     if ( !$this->perms->get_permissions('read') )
   140     if ( !$this->perms->get_permissions('read') )
   140     {
   141     {
   141       $this->err_access_denied();
   142       $this->err_access_denied();
   157         {
   158         {
   158           $this->err_wrong_password();
   159           $this->err_wrong_password();
   159           return false;
   160           return false;
   160         }
   161         }
   161       }
   162       }
       
   163     }
       
   164     if ( $this->page_exists && $this->namespace != 'Special' && $this->namespace != 'Admin' && $do_stats )
       
   165     {
       
   166       doStats($this->page_id, $this->namespace);
   162     }
   167     }
   163     if ( $this->namespace == 'Special' || $this->namespace == 'Admin' )
   168     if ( $this->namespace == 'Special' || $this->namespace == 'Admin' )
   164     {
   169     {
   165       if ( !$this->page_exists )
   170       if ( !$this->page_exists )
   166       {
   171       {
   224       
   229       
   225       $ob = ob_get_contents();
   230       $ob = ob_get_contents();
   226       
   231       
   227       if ( empty($ob) )
   232       if ( empty($ob) )
   228       {
   233       {
       
   234         die('ob is empty');
   229         $this->err_page_not_existent();
   235         $this->err_page_not_existent();
       
   236       }
       
   237       else
       
   238       {
       
   239         // Something sent content, so we'll assume the page exist...ed at least according to the plugin
       
   240         if ( $this->namespace != 'Special' && $this->namespace != 'Admin' && $do_stats )
       
   241         {
       
   242           doStats($this->page_id, $this->namespace);
       
   243         }
   230       }
   244       }
   231     }
   245     }
   232     else // (disabled for compatibility reasons) if ( in_array($this->namespace, array('Article', 'User', 'Project', 'Help', 'File', 'Category')) && $this->page_exists )
   246     else // (disabled for compatibility reasons) if ( in_array($this->namespace, array('Article', 'User', 'Project', 'Help', 'File', 'Category')) && $this->page_exists )
   233     {
   247     {
   234       // Send as regular page
   248       // Send as regular page