Example #1
0
 function display()
 {
     $statusBox = new box("EVE Status");
     $statusApi = new API_ServerStatus();
     if ($statusApi->fetchXML()) {
         if ($statusApi->getserverOpen()) {
             $statusBox->addOption("caption", "EVE Server is <span><strong><font color=green>ONLINE</font></strong></span>");
             $statusBox->addOption("caption", "Players Online: " . $statusApi->getOnlinePlayers());
         } else {
             $statusBox->addOption("caption", "EVE Server is <span><strong><font color=red>OFFLINE</font></strong></span>");
         }
     } else {
         $statusBox->addOption("caption", "EVE Server is <span><strong><font color=red>UNKNOWN</font></strong></span>");
         $statusBox->addOption("caption", "Players Online: Unknown");
         $statusBox->addOption("caption", "EVE API is <span><strong><font color=red>DOWN</font></strong></span>");
     }
     if (config::get("show_clock")) {
         $statusBox->addOption("caption", "EVE Time:  <span><strong><font color=orange>" . gmdate("H:i") . "</font></strong></span>");
     }
     return $statusBox->generate();
 }
Example #2
0
 function fetchXML()
 {
     PhealConfig::getInstance()->http_timeout = 5;
     try {
         $data = $this->CallAPI("server", "ServerStatus", null, null, null);
     } catch (Exception $e) {
         return false;
     }
     if ($data == false) {
         return false;
     }
     self::$serverOpen = (bool) $data->serverOpen;
     self::$onlinePlayers = (int) $data->onlinePlayers;
     return true;
 }