public function requirements()
 {
     $requirements = array();
     $requirements['lgsl_library'] = array('title' => t('LGSL Library'), 'value' => t('Found'), 'severity' => REQUIREMENT_INFO);
     $path = gameservers_get_path_library('lgsl');
     if (file_exists($path . '/lgsl_protocol.php')) {
         gameservers_include_library('lgsl_protocol.php', 'lgsl');
     }
     if (!function_exists('lgsl_query_live')) {
         $requirements['lgsl_library']['description'] = t('Your PHP installation is too old. Drupal requires at least PHP %version.', array('%version' => DRUPAL_MINIMUM_PHP));
         $requirements['lgsl_library']['severity'] = REQUIREMENT_ERROR;
     }
     return $requirements;
 }
 protected function queryServer($server, &$response)
 {
     gameservers_include_library('GameQ.php', 'gameq');
     $gq = new GameQ();
     $gq->addServer($server->id, array($server->config['query']['gametype'], $server->hostname, $server->port));
     //$gq->setOption('timeout', 200);
     // Send requests, and parse the data
     $gq->setFilter('normalise');
     //$gq->setFilter('sortplayers', 'name');
     $results = $gq->requestData();
     if (isset($results[$server->id])) {
         $data = $results[$server->id];
         $response['raw'] = $data;
         $response['address'] = $data['gq_address'];
         $response['port'] = $data['gq_port'];
         $response['online'] = $data['gq_online'] ? TRUE : FALSE;
         $response['protocol'] = $data['gq_prot'];
         $response['game'] = $data['gq_mod'];
         $response['servername'] = $data['gq_hostname'];
         $response['mapname'] = $data['gq_mapname'];
         $response['numplayers'] = $data['gq_numplayers'];
         $response['maxplayers'] = $data['gq_maxplayers'];
         $response['extra'] = array();
         foreach ($data as $key => $value) {
             if (strpos($key, 'gq_') !== 0) {
                 $response['extra'][$key] = $value;
             }
         }
         if (!empty($data['players'])) {
             foreach ($data['players'] as $player_info) {
                 if ($name = $player_info['name']) {
                     $player = new stdClass();
                     $player->name = check_plain($name);
                     $player->score = 0;
                     $player->time = 0;
                     $response['players'][] = $player;
                 }
             }
         }
         return TRUE;
     }
     return FALSE;
 }