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 $fetched = false; static $aid = null; 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; } elseif (isset($aid->$key) ) { return $aid->$key; } else { return null; } } public function updateNbIns() { $count = XDB::rawFetchOneCell("SELECT COUNT(*) FROM accounts AS a INNER JOIN account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET('owner', ap.perms)) INNER JOIN profiles AS p ON (ap.pid = p.pid) WHERE a.state = 'active' AND p.deathdate IS NULL"); $this->changeDynamicConfig(array('NbIns' => $count)); } public function updateNbValid() { $res = XDB::query("SELECT COUNT(*) FROM requests"); $this->changeDynamicConfig(array('NbValid' => $res->fetchOneCell())); } public function cacheEnabled() { return ($this->debug & self::DEBUG_NOCACHE) == 0; } } /****************************************************************************** * Dynamic configuration update/edition stuff *****************************************************************************/ // vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8: ?>