includes/namespaces/special.php
changeset 953 323c4cd1aa37
parent 805 b2dc28b9f367
child 1072 604213a07ce0
equal deleted inserted replaced
952:d52dfa1f08da 953:323c4cd1aa37
    18   {
    18   {
    19     global $db, $session, $paths, $template, $plugins; // Common objects
    19     global $db, $session, $paths, $template, $plugins; // Common objects
    20     
    20     
    21     $this->page_id = sanitize_page_id($page_id);
    21     $this->page_id = sanitize_page_id($page_id);
    22     $this->namespace = $namespace;
    22     $this->namespace = $namespace;
       
    23     $this->build_cdata();
    23     $this->revision_id = intval($revision_id);
    24     $this->revision_id = intval($revision_id);
    24     
    25     
       
    26     $this->page_protected = true;
       
    27     $this->wiki_mode = 0;
       
    28   }
       
    29   
       
    30   public function build_cdata()
       
    31   {
       
    32     global $db, $session, $paths, $template, $plugins; // Common objects
       
    33     global $lang;
       
    34     
    25     $this->exists = function_exists("page_{$this->namespace}_{$this->page_id}");
    35     $this->exists = function_exists("page_{$this->namespace}_{$this->page_id}");
       
    36     
       
    37     if ( isset($paths->pages[ $paths->get_pathskey($this->page_id, $this->namespace) ]) )
       
    38     {
       
    39       $page_name = $paths->pages[ $paths->get_pathskey($this->page_id, $this->namespace) ]['name'];
       
    40     }
       
    41     else
       
    42     {
       
    43       $page_name = "{$paths->nslist[ $this->namespace ]}{$this->page_id}";
       
    44       if ( ($_ = $lang->get('specialpage_' . strtolower($this->page_id))) !== 'specialpage_' . strtolower($this->page_id) )
       
    45       {
       
    46         $page_name = $_;
       
    47       }
       
    48     }
       
    49     
       
    50     $this->cdata = array(
       
    51         'name' => $page_name,
       
    52         'urlname' => $this->page_id,
       
    53         'namespace' => $this->namespace,
       
    54         'special' => 0,
       
    55         'visible' => 0,
       
    56         'comments_on' => 0,
       
    57         'protected' => 0,
       
    58         'delvotes' => 0,
       
    59         'delvote_ips' => '',
       
    60         'wiki_mode' => 2,
       
    61         'page_exists' => false,
       
    62         'page_format' => getConfig('default_page_format', 'wikitext')
       
    63       );
       
    64     $this->cdata = Namespace_Default::bake_cdata($this->cdata);
       
    65     
       
    66     $this->title =& $this->cdata['name'];
    26   }
    67   }
    27   
    68   
    28   function send()
    69   function send()
    29   {
    70   {
    30     global $output;
    71     global $output;
    31     
    72     
    32     if ( $this->exists )
    73     if ( $this->exists )
    33     {
    74     {
    34       @call_user_func("page_{$this->namespace}_{$this->page_id}");
    75       call_user_func("page_{$this->namespace}_{$this->page_id}");
    35     }
    76     }
    36     else
    77     else
    37     {
    78     {
    38       $output->header();
    79       $output->header();
    39       $this->error_404();
    80       $this->error_404();
    55     $output->set_title($title);
    96     $output->set_title($title);
    56     $output->header();
    97     $output->header();
    57     echo "<p>$message</p>";
    98     echo "<p>$message</p>";
    58     $output->footer();
    99     $output->footer();
    59   }
   100   }
       
   101   
       
   102   function set_conds()
       
   103   {
       
   104     parent::set_conds();
       
   105     
       
   106     $this->conds['printable'] = false;
       
   107     $this->conds['adminpage'] = false;
       
   108   }
    60 }
   109 }