Merge commit 'origin/fusionax' into account
[platal.git] / classes / platalglobals.php.in
index e4b1b94..f49b279 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  Copyright (C) 2003-2009 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -26,6 +26,7 @@ class PlatalGlobals extends PlGlobals
 
     /** db params */
     public $dbdb               = 'x4dat';
+    public $dbprefix           = '';
     public $dbhost             = 'localhost';
     public $dbuser             = 'x4dat';
     public $dbpwd              = 'x4dat';
@@ -49,40 +50,27 @@ class PlatalGlobals extends PlGlobals
         $this->bootstrap(array('NbValid'), array($this, 'updateNbValid'));
     }
 
-    public function asso($key=null)
+    public function asso($key = null)
     {
         static $aid = null;
 
-        if (is_null($aid)) {
+        if (isset($GLOBALS['IS_XNET_SITE']) && is_null($aid)) {
             $gp = Get::v('n');
             if ($p = strpos($gp, '/')) {
                 $gp = substr($gp, 0, $p);
             }
 
-            if ($gp) {
-                $res = XDB::query('SELECT  a.*, d.nom AS domnom,
-                                           FIND_IN_SET(\'wiki_desc\', a.flags) AS wiki_desc,
-                                           FIND_IN_SET(\'notif_unsub\', a.flags) AS notif_unsub
-                                     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();
-                }
-            } else {
-                $aid = array();
-            }
+            $aid = Group::get($gp);
         }
         if (empty($key)) {
             return $aid;
-        } elseif ( isset($aid[$key]) ) {
-            return $aid[$key];
+        } elseif (isset($aid->$key) ) {
+            return $aid->$key;
         } else {
             return null;
         }
     }
 
-
     public function updateNbIns()
     {
         $res = XDB::query("SELECT  COUNT(*)