includes/namespaces/special.php
changeset 800 9cdfe82c56cd
child 801 eb8b23f11744
equal deleted inserted replaced
799:4629ad98ee88 800:9cdfe82c56cd
       
     1 <?php
       
     2 
       
     3 /*
       
     4  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
       
     5  * Version 1.1.5 (Caoineag alpha 5)
       
     6  * Copyright (C) 2006-2008 Dan Fuhry
       
     7  *
       
     8  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
       
     9  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
       
    10  *
       
    11  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
       
    12  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
       
    13  */
       
    14 
       
    15 class Namespace_Special extends Namespace_Default
       
    16 {
       
    17   public function __construct($page_id, $namespace, $revision_id = 0)
       
    18   {
       
    19     global $db, $session, $paths, $template, $plugins; // Common objects
       
    20     
       
    21     $this->page_id = sanitize_page_id($page_id);
       
    22     $this->namespace = $namespace;
       
    23     $this->revision_id = intval($revision_id);
       
    24     
       
    25     $this->exists = function_exists("page_{$this->namespace}_{$this->page_id}");
       
    26   }
       
    27   
       
    28   function send()
       
    29   {
       
    30     global $output;
       
    31     
       
    32     if ( $this->exists )
       
    33     {
       
    34       @call_user_func("page_{$this->namespace}_{$this->page_id}");
       
    35     }
       
    36     else
       
    37     {
       
    38       $output->header();
       
    39       $this->error_404();
       
    40       $output->footer();
       
    41     }
       
    42   }
       
    43   
       
    44   function error_404()
       
    45   {
       
    46     global $lang, $output;
       
    47     $func_name = "page_{$this->namespace}_{$this->page_id}";
       
    48     
       
    49     if ( $this->namespace == 'Admin' )
       
    50       die_semicritical($lang->get('page_msg_admin_404_title'), $lang->get('page_msg_admin_404_body', array('func_name' => $func_name)), true);
       
    51     
       
    52     $title = $lang->get('page_err_custompage_function_missing_title');
       
    53     $message = $lang->get('page_err_custompage_function_missing_body', array( 'function_name' => $fname ));
       
    54                 
       
    55     $output->set_title($title);
       
    56     $output->header();
       
    57     echo "<p>$message</p>";
       
    58     $output->footer();
       
    59   }
       
    60 }