Uniformizes pid and uid fields in database (Closes #1207).
[platal.git] / classes / platalglobals.php.in
index 975b683..3f0085d 100644 (file)
 
 class PlatalGlobals extends PlGlobals
 {
+    const DEBUG_NOCACHE = DEBUG_USERBASE;
+
     /** The x.org version */
     public $version = '@VERSION@';
 
     /** db params */
-    public $dbdb               = 'x4dat';
+    public $dbdb               = null;
     public $dbprefix           = '';
     public $dbhost             = 'localhost';
-    public $dbuser             = 'x4dat';
-    public $dbpwd              = 'x4dat';
+    public $dbuser             = null;
+    public $dbpwd              = null;
     public $dbcharset          = 'utf8';
 
     /** default skin */
@@ -52,15 +54,17 @@ class PlatalGlobals extends PlGlobals
 
     public function asso($key = null)
     {
+        static $fetched = false;
         static $aid = null;
 
-        if (isset($GLOBALS['IS_XNET_SITE']) && is_null($aid)) {
+        if (isset($GLOBALS['IS_XNET_SITE']) && !$fetched) {
             $gp = Get::v('n');
             if ($p = strpos($gp, '/')) {
                 $gp = substr($gp, 0, $p);
             }
 
             $aid = Group::get($gp);
+            $fetched = true;
         }
         if (empty($key)) {
             return $aid;
@@ -86,8 +90,12 @@ class PlatalGlobals extends PlGlobals
                              FROM  requests");
         $this->changeDynamicConfig(array('NbValid' => $res->fetchOneCell()));
     }
-}
 
+    public function cacheEnabled()
+    {
+        return ($this->debug & self::DEBUG_NOCACHE) == 0;
+    }
+}
 
 /******************************************************************************
  * Dynamic configuration update/edition stuff