Backports
[platal.git] / classes / xnet.php
index c29ec14..4554d25 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
+ *  Copyright (C) 2003-2007 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -38,6 +38,25 @@ class Xnet extends Platal
         }
     }
 
+    function find_nearest_key($key, &$array)
+    {
+        global $globals;
+        if (in_array('%grp', array_keys($array)) &&  $key == $globals->asso('diminutif')) {
+            return '%grp';
+        }
+        return parent::find_nearest_key($key, $array);
+    }
+
+    function near_hook()
+    {
+        global $globals;
+        $link = str_replace('%grp', $globals->asso('diminutif'), parent::near_hook());
+        if ($link != $this->path) {
+            return $link;
+        }   
+        return null; 
+    }
+
     function find_hook()
     {
         $ans = parent::find_hook();