Ignore:
Timestamp:
May 25, 2014, 12:33:20 AM (10 years ago)
Author:
chronos
Message:
  • Modified: Do not register all possible redirected pages to main URL route tree in Redirection module. Instead register itself as System->OnPageNotFound handler.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Redirection/Redirection.php

    r800 r807  
    1717  function Start()
    1818  {
    19         $this->System->RegisterPage('team.php', 'PageRedirection');
    20     $this->System->RegisterPage('version.php', 'PageRedirection');
    21     $this->System->RegisterPage('phpBB3', 'PageRedirection');
    22     $this->System->RegisterPage('phpbb3', 'PageRedirection');
    23     $this->System->RegisterPage(array('forum', 'index.php'), 'PageRedirection');
    24     $this->System->RegisterPage('statistic.php', 'PageRedirection');
    25     $this->System->RegisterPage('register.php', 'PageRedirection');
    26     $this->System->RegisterPage('dictionary.php', 'PageRedirection');
    27     $this->System->RegisterPage(array('dictionary', 'user.php'), 'PageRedirection');
    28     $this->System->RegisterPage(array('team', 'userlist.php'), 'PageRedirection');
    29     $this->System->RegisterPage('download-addon.php', 'PageRedirection');
    30     $this->System->RegisterPage('banners.php', 'PageRedirection');
    31     $this->System->RegisterPage('download.php', 'PageRedirection');
    32     $this->System->RegisterPage('serverlist.php', 'PageRedirection');
     19        $this->System->OnPageNotFound = array($this, 'ShowRedirect');
    3320  }
    34 }
    3521
    36 class PageRedirection extends Page
    37 {
    38         function Show()
     22  function ShowRedirect()
    3923  {
    4024    Header($_SERVER['SERVER_PROTOCOL'].' 301 Moved Permanently');
     
    6044        if(($this->System->PathItems[0] == 'forum') and ($this->System->PathItems[1] == 'index.php'))
    6145          Header('Location: '.$this->System->Link('/forum/'));
     46        if(($this->System->PathItems[0] == 'phpbb3') and ($this->System->PathItems[1] == 'index.php'))
     47          Header('Location: '.$this->System->Link('/forum/'));
     48        if(($this->System->PathItems[0] == 'phpBB3') and ($this->System->PathItems[1] == 'index.php'))
     49          Header('Location: '.$this->System->Link('/forum/'));
    6250      }
    6351    }
Note: See TracChangeset for help on using the changeset viewer.