Changeset 807


Ignore:
Timestamp:
May 25, 2014, 12:33:20 AM (11 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.
Location:
trunk
Files:
3 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    }
  • trunk/includes/Version.php

    r806 r807  
    66// and system will need database update.
    77
    8 $Revision = 806; // Subversion revision
     8$Revision = 807; // Subversion revision
    99$DatabaseRevision = 803; // Database structure revision
    1010$ReleaseTime = '2014-05-24';
  • trunk/includes/system.php

    r805 r807  
    1212  var $Menu;
    1313  var $DoNotShowPage;
     14  var $OnPageNotFound;
    1415
    1516  function __construct()
     
    1920    $this->RSSChannels = array();
    2021    $this->DoNotShowPage = false;
     22    $this->OnPageNotFound = array();
    2123  }
    2224
     
    245247      if($Page->RawPage == false) $Output = $this->BaseView->ShowPage($Output);
    246248    } else {
    247         $Output = $this->PageNotFound();
    248         $this->BaseView->Title = T('Page not found');
    249         $Output = $this->BaseView->ShowPage($Output);
    250     }
     249        if((count($this->OnPageNotFound) == 2)
     250  and method_exists($this->OnPageNotFound[0], $this->OnPageNotFound[1]))
     251          $Output = $this->BaseView->ShowPage(call_user_func_array($this->OnPageNotFound, array()));
     252                else
     253                {
     254                        $Output = $this->PageNotFound();
     255            $this->BaseView->Title = T('Page not found');
     256                $Output = $this->BaseView->ShowPage($Output);
     257                }
     258        }
    251259    echo($Output);
    252260  }
     
    443451        {
    444452                $Output = $this->ShowHeader().$Content.$this->ShowFooter();
    445                 //if($this->System->Config['Web']['FormatOutput']) $Output = $this->FormatOutput($Output);
     453                if($this->System->Config['Web']['FormatOutput'])
     454              $Output = $this->FormatOutput($Output);
    446455                return($Output);
    447456        }
Note: See TracChangeset for help on using the changeset viewer.