includes/pageprocess.php
changeset 9 1e61232606d6
parent 4 0b3a0aedfd53
child 15 ad5986a53197
equal deleted inserted replaced
8:4bb20dddef00 9:1e61232606d6
   146                 <p>$message</p>";
   146                 <p>$message</p>";
   147         }
   147         }
   148         return false;
   148         return false;
   149       }
   149       }
   150     }
   150     }
   151     else if ( in_array($this->namespace, array('Article', 'User', 'Project', 'Help', 'File', 'Category')) && $this->page_exists )
   151     else if ( ( $this->namespace == 'Template' || $this->namespace == 'System' ) && $this->page_exists )
       
   152     {
       
   153       $this->header();
       
   154       
       
   155       $text = $this->fetch_text();
       
   156       $text = preg_replace('/<noinclude>(.*?)<\/noinclude>/is', '\\1', $text);
       
   157       $text = preg_replace('/<nodisplay>(.*?)<\/nodisplay>/is', '', $text);
       
   158       
       
   159       $text = RenderMan::render( $text );
       
   160       
       
   161       echo $text;
       
   162       
       
   163       $this->footer();
       
   164       
       
   165     }
       
   166     else if ( !$this->page_exists )
       
   167     {
       
   168       // Perhaps this is hooked?
       
   169       ob_start();
       
   170       
       
   171       $code = $plugins->setHook('page_not_found');
       
   172       foreach ( $code as $cmd )
       
   173       {
       
   174         eval($cmd);
       
   175       }
       
   176       
       
   177       $ob = ob_get_contents();
       
   178       
       
   179       if ( empty($ob) )
       
   180       {
       
   181         $this->err_page_not_existent();
       
   182       }
       
   183     }
       
   184     else // if ( in_array($this->namespace, array('Article', 'User', 'Project', 'Help', 'File', 'Category')) && $this->page_exists )
   152     {
   185     {
   153       // Send as regular page
   186       // Send as regular page
   154       $text = $this->fetch_text();
   187       $text = $this->fetch_text();
   155       if ( $text == 'err_no_text_rows' )
   188       if ( $text == 'err_no_text_rows' )
   156       {
   189       {
   160       else
   193       else
   161       {
   194       {
   162         $this->render();
   195         $this->render();
   163       }
   196       }
   164     }
   197     }
   165     else if ( ( $this->namespace == 'Template' || $this->namespace == 'System' ) && $this->page_exists )
       
   166     {
       
   167       $this->header();
       
   168       
       
   169       $text = $this->fetch_text();
       
   170       $text = preg_replace('/<noinclude>(.*?)<\/noinclude>/is', '\\1', $text);
       
   171       $text = preg_replace('/<nodisplay>(.*?)<\/nodisplay>/is', '', $text);
       
   172       
       
   173       $text = RenderMan::render( $text );
       
   174       
       
   175       echo $text;
       
   176       
       
   177       $this->footer();
       
   178       
       
   179     }
       
   180     else if ( !$this->page_exists )
       
   181     {
       
   182       // Perhaps this is hooked?
       
   183       ob_start();
       
   184       
       
   185       $code = $plugins->setHook('page_not_found');
       
   186       foreach ( $code as $cmd )
       
   187       {
       
   188         eval($cmd);
       
   189       }
       
   190       
       
   191       $ob = ob_get_contents();
       
   192       
       
   193       if ( empty($ob) )
       
   194       {
       
   195         $this->err_page_not_existent();
       
   196       }
       
   197     }
       
   198     
   198     
   199     
   199     
   200   }
   200   }
   201   
   201   
   202   /**
   202   /**
   244   function render()
   244   function render()
   245   {
   245   {
   246     $text = $this->fetch_text();
   246     $text = $this->fetch_text();
   247     
   247     
   248     $this->header();
   248     $this->header();
   249     display_page_headers();
   249     if ( $this->send_headers )
   250     echo RenderMan::render($text);
   250     {
   251     display_page_footers();
   251       display_page_headers();
       
   252     }
       
   253     
       
   254     $text = '?>' . RenderMan::render($text);
       
   255     // echo('<pre>'.htmlspecialchars($text).'</pre>');
       
   256     eval ( $text );
       
   257     
       
   258     if ( $this->send_headers )
       
   259     {
       
   260       display_page_footers();
       
   261     }
       
   262     
   252     $this->footer();
   263     $this->footer();
   253   }
   264   }
   254   
   265   
   255   /**
   266   /**
   256    * Sends the page header, dependent on, of course, whether we're supposed to.
   267    * Sends the page header, dependent on, of course, whether we're supposed to.