| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | class ModuleRedirection extends Module
|
|---|
| 4 | {
|
|---|
| 5 | public array $Excludes;
|
|---|
| 6 |
|
|---|
| 7 | function __construct(System $System)
|
|---|
| 8 | {
|
|---|
| 9 | parent::__construct($System);
|
|---|
| 10 | $this->Name = 'Redirection';
|
|---|
| 11 | $this->Version = '1.0';
|
|---|
| 12 | $this->Creator = 'Chronos';
|
|---|
| 13 | $this->License = 'GNU/GPL';
|
|---|
| 14 | $this->Description = 'Redirects erlier obsolete addresses to new ones.';
|
|---|
| 15 | $this->Dependencies = array();
|
|---|
| 16 |
|
|---|
| 17 | $this->Excludes = array();
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | function DoStart(): void
|
|---|
| 21 | {
|
|---|
| 22 | Core::Cast($this->System)->OnPageNotFound = array($this, 'ShowRedirect');
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | function Redirect($Location)
|
|---|
| 26 | {
|
|---|
| 27 | Header($_SERVER['SERVER_PROTOCOL'].' 301 Moved Permanently');
|
|---|
| 28 | Header('Location: '.$Location);
|
|---|
| 29 | return '<h3 align="center">'.T('').'</h3>';
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | function ShowRedirect()
|
|---|
| 33 | {
|
|---|
| 34 | $Output = '';
|
|---|
| 35 | if (count(Core::Cast($this->System)->PathItems) > 0)
|
|---|
| 36 | {
|
|---|
| 37 | if (Core::Cast($this->System)->PathItems[0] == 'user.php') $Output = $this->Redirect($this->System->Link('/user/'));
|
|---|
| 38 | if (Core::Cast($this->System)->PathItems[0] == 'team.php') $Output = $this->Redirect($this->System->Link('/team/'));
|
|---|
| 39 | if (Core::Cast($this->System)->PathItems[0] == 'version.php') $Output = $this->Redirect($this->System->Link('/client-version/'));
|
|---|
| 40 | if (Core::Cast($this->System)->PathItems[0] == 'phpBB3') $Output = $this->Redirect($this->System->Link('/forum/'));
|
|---|
| 41 | if (Core::Cast($this->System)->PathItems[0] == 'phpbb3') $Output = $this->Redirect($this->System->Link('/forum/'));
|
|---|
| 42 | if (Core::Cast($this->System)->PathItems[0] == 'statistic.php') $Output = $this->Redirect($this->System->Link('/progress/'));
|
|---|
| 43 | if (Core::Cast($this->System)->PathItems[0] == 'register.php') $Output = $this->Redirect($this->System->Link('/registration/'));
|
|---|
| 44 | if (Core::Cast($this->System)->PathItems[0] == 'registrace.php') $Output = $this->Redirect($this->System->Link('/registration/'));
|
|---|
| 45 | if (Core::Cast($this->System)->PathItems[0] == 'dictionary.php') $Output = $this->Redirect($this->System->Link('/dictionary/'));
|
|---|
| 46 | if (Core::Cast($this->System)->PathItems[0] == 'download-addon.php') $Output = $this->Redirect($this->System->Link('/download/'));
|
|---|
| 47 | if (Core::Cast($this->System)->PathItems[0] == 'banners.php') $Output = $this->Redirect($this->System->Link('/referrer/'));
|
|---|
| 48 | if (Core::Cast($this->System)->PathItems[0] == 'download.php') $Output = $this->Redirect($this->System->Link('/download/'));
|
|---|
| 49 | if (Core::Cast($this->System)->PathItems[0] == 'serverlist.php') $Output = $this->Redirect($this->System->Link('/server/'));
|
|---|
| 50 | if (Core::Cast($this->System)->PathItems[0] == 'info.php') $Output = $this->Redirect($this->System->Link('/info/'));
|
|---|
| 51 | if (Core::Cast($this->System)->PathItems[0] == 'userlist.php') $Output = $this->Redirect($this->System->Link('/users/'));
|
|---|
| 52 | if (Core::Cast($this->System)->PathItems[0] == 'promotion.php') $Output = $this->Redirect($this->System->Link('/promotion/'));
|
|---|
| 53 | if (Core::Cast($this->System)->PathItems[0] == 'log.php') $Output = $this->Redirect($this->System->Link('/log/'));
|
|---|
| 54 | if (count(Core::Cast($this->System)->PathItems) > 1)
|
|---|
| 55 | {
|
|---|
| 56 | if ((Core::Cast($this->System)->PathItems[0] == 'team') and (Core::Cast($this->System)->PathItems[1] == 'userlist.php'))
|
|---|
| 57 | $Output = $this->Redirect($this->System->Link('/userlist/'));
|
|---|
| 58 | if ((Core::Cast($this->System)->PathItems[0] == 'dictionary') and (Core::Cast($this->System)->PathItems[1] == 'user.php'))
|
|---|
| 59 | $Output = $this->Redirect($this->System->Link('/user/'));
|
|---|
| 60 | if ((Core::Cast($this->System)->PathItems[0] == 'forum') and (Core::Cast($this->System)->PathItems[1] == 'index.php'))
|
|---|
| 61 | $Output = $this->Redirect($this->System->Link('/forum/'));
|
|---|
| 62 | if ((Core::Cast($this->System)->PathItems[0] == 'phpbb3') and (Core::Cast($this->System)->PathItems[1] == 'index.php'))
|
|---|
| 63 | $Output = $this->Redirect($this->System->Link('/forum/'));
|
|---|
| 64 | if ((Core::Cast($this->System)->PathItems[0] == 'phpBB3') and (Core::Cast($this->System)->PathItems[1] == 'index.php'))
|
|---|
| 65 | $Output = $this->Redirect($this->System->Link('/forum/'));
|
|---|
| 66 | if ((Core::Cast($this->System)->PathItems[0] == 'download') and (Core::Cast($this->System)->PathItems[1] == 'ceske_fonty_do_wow.zip'))
|
|---|
| 67 | $Output = $this->Redirect($this->System->Link('/files/ceske_fonty_do_wow.zip'));
|
|---|
| 68 | }
|
|---|
| 69 | }
|
|---|
| 70 | return $Output;
|
|---|
| 71 | }
|
|---|
| 72 | }
|
|---|