X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplatalglobals.php.in;h=774a809a9a5570edab7d40f8d622af6ea7f41739;hb=f6e35ff3fefafe908e1675690340ab93265192a0;hp=00353f7adaed314833585e2406561e30ee78e9eb;hpb=6d1747b3dbcf944c995dc2d87e8561c7a66f3aa6;p=platal.git diff --git a/classes/platalglobals.php.in b/classes/platalglobals.php.in index 00353f7..774a809 100644 --- a/classes/platalglobals.php.in +++ b/classes/platalglobals.php.in @@ -1,6 +1,6 @@ bootstrap(array('NbValid'), array($this, 'updateNbValid')); } - public function asso($key=null) + public function asso($key = null) { + static $fetched = false; static $aid = null; - if (is_null($aid)) { + if (isset($GLOBALS['IS_XNET_SITE']) && !$fetched) { $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); + $fetched = true; } 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(*)