includes/paths.php
changeset 253 6c7060d36a23
parent 252 a007145a0ff6
child 256 f8356d9c3481
equal deleted inserted replaced
252:a007145a0ff6 253:6c7060d36a23
    36       'Admin'   =>'Admin:',
    36       'Admin'   =>'Admin:',
    37       'Special' =>'Special:',
    37       'Special' =>'Special:',
    38       'System'  =>'Enano:',
    38       'System'  =>'Enano:',
    39       'Template'=>'Template:',
    39       'Template'=>'Template:',
    40       'Category'=>'Category:',
    40       'Category'=>'Category:',
       
    41       'Anonymous'=>'PhysicalRedirect:',
    41       'Project' =>sanitize_page_id(getConfig('site_name')).':',
    42       'Project' =>sanitize_page_id(getConfig('site_name')).':',
    42       );
    43       );
    43     
    44     
    44     // ACL types
    45     // ACL types
    45     // These can also be added from within plugins
    46     // These can also be added from within plugins
   146       $this->pages[$r['urlname']] = $r;
   147       $this->pages[$r['urlname']] = $r;
   147       $this->pages[] =& $this->pages[$r['urlname']];
   148       $this->pages[] =& $this->pages[$r['urlname']];
   148       
   149       
   149     }
   150     }
   150     $db->free_result();
   151     $db->free_result();
   151     if ( defined('ENANO_INTERFACE_INDEX') || defined('ENANO_INTERFACE_AJAX') )
   152     if ( defined('ENANO_INTERFACE_INDEX') || defined('ENANO_INTERFACE_AJAX') || defined('IN_ENANO_INSTALL') || defined('IN_ENANO_UPGRADE') )
   152     {
   153     {
   153       if( isset($_GET['title']) )
   154       if( isset($_GET['title']) )
   154       {
   155       {
   155         if ( $_GET['title'] == '' && getConfig('main_page') != '' )
   156         if ( $_GET['title'] == '' && getConfig('main_page') != '' )
   156         {
   157         {
   256       // metadata for an anonymous page and avoid redirection at all costs.
   257       // metadata for an anonymous page and avoid redirection at all costs.
   257       if ( isset($GLOBALS['title']) )
   258       if ( isset($GLOBALS['title']) )
   258       {
   259       {
   259         $title =& $GLOBALS['title'];
   260         $title =& $GLOBALS['title'];
   260       }
   261       }
   261       else if ( isset($_SERVER['REQUEST_URI']) )
       
   262       {
       
   263         $title = basename($_SERVER['REQUEST_URI']);
       
   264       }
       
   265       else
   262       else
   266       {
   263       {
   267         $title = 'Untitled page';
   264         $title = basename($_SERVER['SCRIPT_NAME']);
   268       }
   265       }
   269       $this->page = $this->nslist['Special'] . 'AnonymousPage';
   266       $base_uri = str_replace( scriptPath . '/', '', $_SERVER['SCRIPT_NAME'] );
   270       $this->fullpage = $this->nslist['Special'] . 'AnonymousPage';
   267       $this->page = $this->nslist['Anonymous'] . sanitize_page_id($base_uri);
       
   268       $this->fullpage = $this->nslist['Anonymous'] . sanitize_page_id($base_uri);
       
   269       $this->namespace = 'Anonymous';
   271       $this->cpage = array(
   270       $this->cpage = array(
   272           'name' => $title,
   271           'name' => $title,
   273           'urlname' => 'AnonymousPage',
   272           'urlname' => sanitize_page_id($base_uri),
   274           'namespace' => 'Special',
   273           'namespace' => 'Anonymous',
   275           'special' => 0,
   274           'special' => 1,
   276           'visible' => 1,
   275           'visible' => 1,
   277           'comments_on' => 0,
   276           'comments_on' => 1,
   278           'protected' => 1,
   277           'protected' => 1,
   279           'delvotes' => 0,
   278           'delvotes' => 0,
   280           'delvote_ips' => ''
   279           'delvote_ips' => ''
   281         );
   280         );
   282       $this->anonymous_page = true;
   281       $this->anonymous_page = true;
       
   282       $code = $plugins->setHook('paths_anonymous_page');
       
   283       foreach ( $code as $cmd )
       
   284       {
       
   285         eval($cmd);
       
   286       }
   283     }
   287     }
   284     
   288     
   285     $this->page = sanitize_page_id($this->page);
   289     $this->page = sanitize_page_id($this->page);
   286     $this->fullpage = sanitize_page_id($this->fullpage);
   290     $this->fullpage = sanitize_page_id($this->fullpage);
   287     
   291