Merge branch 'master' of /home/git/platal into profile_edit
[platal.git] / classes / xnet.php
index 3d5dbb1..ad8a0b7 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   *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-require_once dirname(__FILE__).'/Platal.php';
-
 class Xnet extends Platal
 {
-    function Xnet()
+    public function __construct()
     {
         $modules = func_get_args();
-        call_user_func_array(array(&$this, 'Platal'), $modules);
+        parent::__construct($modules);
 
         global $globals;
         if ($globals->asso()) {
@@ -40,9 +38,29 @@ class Xnet extends Platal
         }
     }
 
-    function find_hook()
+    protected function find_nearest_key($key, array &$array)
+    {
+        global $globals;
+        if (in_array('%grp', array_keys($array)) &&  $key == $globals->asso('diminutif')) {
+            return '%grp';
+        }
+        return parent::find_nearest_key($key, $array);
+    }
+
+    public function near_hook()
+    {
+        global $globals;
+        $link = str_replace('%grp', $globals->asso('diminutif'), parent::near_hook());
+        if ($link != $this->path) {
+            return $link;
+        }
+        return null;
+    }
+
+    protected function find_hook()
     {
         $ans = parent::find_hook();
+        $this->https = false;
         if ($ans && $this->ns) {
             $this->path    = $this->ns . substr($this->path, 5);
             $this->argv[0] = $this->ns . substr($this->argv[0], 5);
@@ -50,10 +68,11 @@ class Xnet extends Platal
         return $ans;
     }
 
-    function force_login(&$page)
+    public function force_login(&$page)
     {
         http_redirect(S::v('loginX'));
     }
 }
 
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>