Fix the valid URL guess on 404
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 15 Sep 2007 11:57:42 +0000 (13:57 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 15 Sep 2007 11:57:42 +0000 (13:57 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
ChangeLog
classes/platal.php

index 1ca1de4..5ac484e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,7 +55,6 @@ Bug/Wish:
         - #695: More details about payments                                -FRU
         - #719: More consistent subscription count                         -FRU
 
-
 From 0.9.14 branch:
 
     * Payment:
index 46de900..e307782 100644 (file)
@@ -116,6 +116,7 @@ class Platal
                 continue;
             }
             $lev = levenshtein($key, $k);
+
             if ((!isset($val) || $lev < $val) && $lev <= (strlen($k)*2)/3) {
                 $val  = $lev;
                 $best = $k;
@@ -123,7 +124,7 @@ class Platal
         }
         if (!isset($best) && $has_end) {
             return "#final#";
-        } else {
+        } else if (isset($best)) {
             return $best;
         }
         return null;
@@ -133,7 +134,7 @@ class Platal
     {
         $hooks = array();
         foreach ($this->__hooks as $hook=>$handler) {
-            if (!empty($handler['perms']) && $handler['perms'] != S::v('perms')) {
+            if (!$this->check_perms($handler['perms'])) {
                 continue;
             }
             $parts = split('/', $hook);