예제 #1
0
  * Initialize players class
  */
 $pl = new rcon\Players();
 /**
  * Initialize IgVoting class
  */
 $igv = new IgVoting($rc, $sv, $ct, $pl, $db, $config, $settings);
 /**
  * Initialize IgaCommands class
  */
 $igc = new IgCommands($rc, $sv, $ct, $pl, $db, $config, $igv, $settings);
 $igv->setIgc($igc);
 /**
  * Fetch the messages
  */
 $chats = $ct->fetch();
 /**
  * Read chatmessages
  */
 foreach ($chats as $chat) {
     /**
      * Check if the message begins with one of the prefixes
      * Check if it's not a message from the Admin
      */
     if (in_array(substr($chat->message, 0, 1), $config['cmd_prefixes']) && $chat->origin != 'Admin') {
         /**
          * The message in different pieces
          */
         $pieces = explode(' ', $chat->message, 2);
         /**
          * Prepare command information
예제 #2
0
    // Connect to server
    if (!$rc->connect($cn, $cs) || !$rc->init()) {
        $response['msg'] = $lang['msg_serverdown'] . ' ' . date($settings['cp_date_format_full'], $settings['server_last_stream']);
    } else {
        $cmg = new GameMaps();
        $sv = new rcon\Server();
        $pl = new rcon\Players();
        $ct = new rcon\Chat();
        if ($userInfo['rights_server'] == 'yes') {
            $response['status'] = 'OK';
            $response['info'] = (array) $sv->fetch();
            $response['info']['mapName'] = $cmg->getMapName($response['info']['map']);
            $response['info']['gameModeName'] = $cmg->getGameMode($response['info']['gameMode']);
            if (isset($_GET['players'])) {
                $response['players'] = $pl->fetch();
            }
            if (isset($_GET['chat'])) {
                $response['chat'] = $ct->fetch();
            }
            if (isset($_GET['igaAdmins'])) {
                $response['igaAdmins'] = $sv->fetchIgaAdmins();
            }
        } else {
            $response['msg'] = $lang['msg_cmd_noaccess'];
        }
    }
} else {
    $response['msg'] = $lang['msg_nologin'];
}
// Output response
echo json_encode($response);