core->sitename = 'Polytechnique.net'; } } public function init() { $this->bootstrap(array('NbIns'), array($this, 'updateNbIns')); $this->bootstrap(array('NbValid'), array($this, 'updateNbValid')); } public function asso($key = null) { static $aid = null; if (isset($GLOBALS['IS_XNET_SITE']) && is_null($aid)) { $gp = Get::v('n'); if ($p = strpos($gp, '/')) { $gp = substr($gp, 0, $p); } $aid = Group::get($gp); } if (empty($key)) { return $aid; } elseif (isset($aid->$key) ) { return $aid->$key; } else { return null; } } public function updateNbIns() { $res = XDB::query("SELECT COUNT(*) FROM accounts WHERE state = 'active'"); $cnt = $res->fetchOneCell(); $this->changeDynamicConfig(array('NbIns' => $cnt)); } public function updateNbValid() { $res = XDB::query("SELECT COUNT(*) FROM requests"); $this->changeDynamicConfig(array('NbValid' => $res->fetchOneCell())); } } /****************************************************************************** * Dynamic configuration update/edition stuff *****************************************************************************/ // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>