Use new URI scheme for event read/unread state
[platal.git] / include / xnet / globals.inc.php
index f1ee414..b1aec4a 100644 (file)
@@ -21,8 +21,6 @@
 
 require_once('platal/globals.inc.php');
 
-// {{{ class XorgGlobals
-
 class XnetGlobals extends PlatalGlobals
 {
     function XnetGlobals()
@@ -33,37 +31,31 @@ class XnetGlobals extends PlatalGlobals
     function init()
     {
         global $globals;
-        require_once('xorg/hook.inc.php');
 
         $globals       = new XnetGlobals;
         $globals->core = new CoreConfig;
-        $globals->root = dirname(dirname(dirname(__FILE__)));
-        $globals->hook = new XOrgHook();
-
-        $globals->hook->config(null);
 
         $globals->read_config();
-        
+
         $globals->dbconnect();
         if ($globals->debug & 1) {
             $globals->db->trace_on();
         }
-        $globals->xdb =& new XOrgDB;
     }
 
     function asso($key=null)
     {
         static $aid = null;
-        if ($aid === null) {
-            $gp  = basename(dirname($_SERVER['PHP_SELF']));
-            // for url like /groupex/event.php/file.csv
-            if (substr($gp, -4) == ".php")
-                $gp = basename(dirname(dirname($_SERVER['PHP_SELF'])));
-            if (strlen($gp) != 0) {
-                $res = $this->xdb->query('SELECT  a.*, d.nom AS domnom
-                                            FROM  groupex.asso AS a
-                                       LEFT JOIN  groupex.dom  AS d ON d.id = a.dom
-                                           WHERE  diminutif = {?}', $gp);
+
+        if (is_null($aid)) {
+            $gp = Get::v('n');
+            $gp = substr($gp, 0, strpos($gp, '/'));
+
+            if ($gp) {
+                $res = XDB::query('SELECT  a.*, d.nom AS domnom
+                                     FROM  groupex.asso AS a
+                                LEFT JOIN  groupex.dom  AS d ON d.id = a.dom
+                                    WHERE  diminutif = {?}', $gp);
                 if (!($aid = $res->fetchOneAssoc())) {
                     $aid = array();
                 }
@@ -81,7 +73,5 @@ class XnetGlobals extends PlatalGlobals
     }
 }
 
-// }}}
-
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
 ?>