From: x2003bruneau Date: Wed, 20 Dec 2006 13:48:15 +0000 (+0000) Subject: Ignore '.php' when looking for the best match hook in case of 404 X-Git-Tag: xorg/0.9.13~163 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=338a593464bb61f1bd54754e116a07db618ca73b;p=platal.git Ignore '.php' when looking for the best match hook in case of 404 Do not propose the requested URL in case of 404 git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1304 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/classes/platal.php b/classes/platal.php index e64e4c8..cdae5e9 100644 --- a/classes/platal.php +++ b/classes/platal.php @@ -94,6 +94,10 @@ class Platal return $key; } + if (($pos = strpos($key, '.php')) !== false) { + $key = substr($key, 0, $pos); + } + $has_end = in_array("#final#", $keys); if (strlen($key) > 24 && $has_end) { return "#final#"; @@ -161,7 +165,10 @@ class Platal return null; } } - return $link; + if ($link != $this->path) { + return $link; + } + return null; } function call_hook(&$page) diff --git a/classes/xnet.php b/classes/xnet.php index 1e76f67..cf180ff 100644 --- a/classes/xnet.php +++ b/classes/xnet.php @@ -50,7 +50,11 @@ class Xnet extends Platal function near_hook() { global $globals; - return str_replace('%grp', $globals->asso('diminutif'), parent::near_hook()); + $link = str_replace('%grp', $globals->asso('diminutif'), parent::near_hook()); + if ($link != $this->path) { + return $link; + } + return null; } function find_hook() diff --git a/modules/core.php b/modules/core.php index 0fec9e2..a7e6142 100644 --- a/modules/core.php +++ b/modules/core.php @@ -43,16 +43,25 @@ class CoreModule extends PLModule function handler_403(&$page) { + global $globals; header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); - $page->changeTpl('core/403.tpl'); + if ($globals->asso()) { + new_skinned_page('core/403.tpl'); + } else { + $page->changeTpl('core/403.tpl'); + } } function handler_404(&$page) { - global $platal; + global $globals, $platal; header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); + if ($globals->asso()) { + new_group_open_page('core/404.tpl'); + } else { + $page->changeTpl('core/404.tpl'); + } $page->assign('near', $platal->near_hook()); - $page->changeTpl('core/404.tpl'); } function handler_favicon(&$page)