Ejemplo n.º 1
0
 public function getGlobals()
 {
     $result = array();
     if (User::isLoggedIn()) {
         $u = User::getUserInfo();
         $config = UserConfig::getAll();
         foreach ($config as $key => $val) {
             $this->addGlobal($result, $key, $val);
         }
         $this->addGlobal($result, 'sessionusername', $u['username']);
         $this->addGlobal($result, 'sessionuserid', $u['id']);
         $this->addGlobal($result, 'sessionadmin', (bool) $u['admin']);
         $this->addGlobal($result, 'sessionmoderator', (bool) $u['moderator']);
     }
     global $mdb;
     $killsLastHour = new RedisTtlCounter('killsLastHour', 3600);
     $this->addGlobal($result, 'killsLastHour', $killsLastHour->count(), 0);
     return $result;
 }
Ejemplo n.º 2
0
 public function getGlobals()
 {
     global $showAds;
     $result = array();
     if (isset($_SESSION["loggedin"])) {
         $u = User::getUserInfo();
         $config = UserConfig::getAll();
         foreach ($config as $key => $val) {
             $this->addGlobal($result, $key, $val);
         }
         $this->addGlobal($result, "sessionusername", $u["username"]);
         $this->addGlobal($result, "sessionuserid", $u["id"]);
         $this->addGlobal($result, "sessionadmin", (bool) $u["admin"]);
         $this->addGlobal($result, "sessionmoderator", (bool) $u["moderator"]);
     }
     $this->addGlobal($result, "killsLastHour", Storage::retrieve("KillsLastHour", 0));
     $this->addGlobal($result, "showAds", $showAds);
     return $result;
 }