Ignore '.php' when looking for the best match hook in case of 404
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 20 Dec 2006 13:48:15 +0000 (13:48 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 20 Dec 2006 13:48:15 +0000 (13:48 +0000)
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

classes/platal.php
classes/xnet.php
modules/core.php

index e64e4c8..cdae5e9 100644 (file)
@@ -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)
index 1e76f67..cf180ff 100644 (file)
@@ -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()
index 0fec9e2..a7e6142 100644 (file)
@@ -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)