includes/paths.php
changeset 692 78473351a6c9
parent 685 17ebe24cdf85
child 696 bd5069e1f19a
equal deleted inserted replaced
691:dab7850c098d 692:78473351a6c9
    17  * @see http://enanocms.org/Help:API_Documentation
    17  * @see http://enanocms.org/Help:API_Documentation
    18  */
    18  */
    19  
    19  
    20 class pathManager
    20 class pathManager
    21 {
    21 {
    22   public $pages, $custom_page, $cpage, $page, $fullpage, $page_exists, $page_id, $namespace, $nslist, $admin_tree, $wiki_mode, $page_protected, $template_cache, $anonymous_page;
    22   public $pages, $custom_page, $cpage, $page, $fullpage, $page_exists, $page_id, $namespace, $nslist, $admin_tree, $wiki_mode, $page_protected, $template_cache, $external_api_page;
    23   
    23   
    24   /**
    24   /**
    25    * List of custom processing functions for namespaces. This is protected so trying to do anything with it will throw an error.
    25    * List of custom processing functions for namespaces. This is protected so trying to do anything with it will throw an error.
    26    * @access private
    26    * @access private
    27    * @var array
    27    * @var array
    46       'Admin'   =>'Admin:',
    46       'Admin'   =>'Admin:',
    47       'Special' =>'Special:',
    47       'Special' =>'Special:',
    48       'System'  =>'Enano:',
    48       'System'  =>'Enano:',
    49       'Template'=>'Template:',
    49       'Template'=>'Template:',
    50       'Category'=>'Category:',
    50       'Category'=>'Category:',
    51       'Anonymous'=>'PhysicalRedirect:',
    51       'API'=>'SystemAPI:',
    52       'Project' =>sanitize_page_id(getConfig('site_name')).':',
    52       'Project' =>sanitize_page_id(getConfig('site_name')).':',
    53       );
    53       );
    54     
    54     
    55     // ACL types
    55     // ACL types
    56     // These can also be added from within plugins
    56     // These can also be added from within plugins
   235       else
   235       else
   236       {
   236       {
   237         $title = basename($_SERVER['SCRIPT_NAME']);
   237         $title = basename($_SERVER['SCRIPT_NAME']);
   238       }
   238       }
   239       $base_uri = str_replace( scriptPath . '/', '', $_SERVER['SCRIPT_NAME'] );
   239       $base_uri = str_replace( scriptPath . '/', '', $_SERVER['SCRIPT_NAME'] );
   240       $this->page = $this->nslist['Anonymous'] . sanitize_page_id($base_uri);
   240       $this->page = $this->nslist['API'] . sanitize_page_id($base_uri);
   241       $this->fullpage = $this->nslist['Anonymous'] . sanitize_page_id($base_uri);
   241       $this->fullpage = $this->nslist['API'] . sanitize_page_id($base_uri);
   242       $this->namespace = 'Anonymous';
   242       $this->namespace = 'API';
   243       $this->cpage = array(
   243       $this->cpage = array(
   244           'name' => $title,
   244           'name' => $title,
   245           'urlname' => sanitize_page_id($base_uri),
   245           'urlname' => sanitize_page_id($base_uri),
   246           'namespace' => 'Anonymous',
   246           'namespace' => 'API',
   247           'special' => 1,
   247           'special' => 1,
   248           'visible' => 1,
   248           'visible' => 1,
   249           'comments_on' => 1,
   249           'comments_on' => 1,
   250           'protected' => 1,
   250           'protected' => 1,
   251           'delvotes' => 0,
   251           'delvotes' => 0,
   252           'delvote_ips' => ''
   252           'delvote_ips' => ''
   253         );
   253         );
   254       $this->anonymous_page = true;
   254       $this->external_api_page = true;
   255       $code = $plugins->setHook('paths_anonymous_page');
   255       $code = $plugins->setHook('paths_external_api_page');
   256       foreach ( $code as $cmd )
   256       foreach ( $code as $cmd )
   257       {
   257       {
   258         eval($cmd);
   258         eval($cmd);
   259       }
   259       }
   260     }
   260     }
   353       
   353       
   354       if($this->namespace=='System') 
   354       if($this->namespace=='System') 
   355       {
   355       {
   356         $this->cpage['protected'] = 1;
   356         $this->cpage['protected'] = 1;
   357       }
   357       }
   358       if($this->namespace == 'Special' && !$this->anonymous_page)
   358       if($this->namespace == 'Special' && !$this->external_api_page)
   359       {
   359       {
   360         // Can't load nonexistent pages
   360         // Can't load nonexistent pages
   361         if( is_string(getConfig('main_page')) )
   361         if( is_string(getConfig('main_page')) )
   362         {
   362         {
   363           $main_page = makeUrl(getConfig('main_page'));
   363           $main_page = makeUrl(getConfig('main_page'));