예제 #1
0
header('Content-type: application/json');
// Logs class
$log = new Log($db, $config);
// Whitelist class
$wl = new Whitelist($db, $config);
// Blacklist class
$bl = new Blacklist($db, $config);
// Accounts class
$acc = new Accounts($db, $config);
// Default response template
$response = array('status' => 'ERROR', 'msg' => '');
if ($user->checkLogin()) {
    if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['cmd']) && isset($_POST['vars'])) {
        $sv = new rcon\Server();
        $pl = new rcon\Players();
        $ct = new rcon\Chat();
        // Commands
        switch ($_POST['cmd']) {
            /**
             * Add a VIP
             */
            case 'addVip':
                if (isset($_POST['vars']['name']) && isset($_POST['vars']['profileId'])) {
                    if ($userInfo['rights_vips'] == 'yes') {
                        // Connect to server
                        $rc->connect($cn, $cs);
                        $cn = $rc->init();
                        if ($cn) {
                            $sv->setVip($_POST['vars']['name'], $_POST['vars']['profileId'], 1);
                            $response['status'] = 'OK';
                            $response['msg'] = $lang['tool_vipm_vipadded'];
예제 #2
0
 * along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 */
require_once '../../core/init.php';
use T4G\BFP4F\Rcon as rcon;
header('Content-type: application/json');
// Default response template
$response = array('status' => 'ERROR', 'msg' => '', 'request_date' => date($settings['cp_date_format_full']), 'last_stream' => date($settings['cp_date_format_full'], $settings['server_last_stream']), 'info' => array(), 'players' => array(), 'chat' => array(), 'igaAdmins' => array());
if ($user->checkLogin()) {
    // 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 {
예제 #3
0
use T4G\BFP4F\Rcon as rcon;
/**
 * Check if the in-game commands are enabled
 */
if ($settings['tool_igcmds'] == 'false') {
    die('[' . date($settings['cp_date_format_full']) . '] In-game commands are disabled.');
}
if ($rc->connect($cn, $cs) && $rc->init()) {
    /**
     * Initialize server class
     */
    $sv = new rcon\Server();
    /**
     * Initialize chat class
     */
    $ct = new rcon\Chat();
    /**
     * 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
예제 #4
0
 * RUN THIS SCRIPT WITH A CRONJOB!
 * RUN THIS SCRIPT WITH A CRONJOB!
 * RUN THIS SCRIPT WITH A CRONJOB!
 * RUN THIS SCRIPT WITH A CRONJOB!
 * RUN THIS SCRIPT WITH A CRONJOB!
 * 
 * Run this script every 30 seconds is recommended.
 */
require_once dirname(dirname(__FILE__)) . '/core/init.php';
use T4G\BFP4F\Rcon as rcon;
if ($rc->connect($cn, $cs) && $rc->init()) {
    /**
     * Initialize the classes and stuff...
     */
    $pl = new rcon\Players();
    $ct = new rcon\Chat();
    $sv = new rcon\Server();
    $it = new Itemlist($db, $config);
    $bl = new Blacklist($db, $config);
    $wl = new WhiteList($db, $config);
    /**
     * LIMITERS
     *
     * NOTE: The blacklist comes first before the whitelist
     */
    /**
     * Fetch the players
     */
    $players = $pl->fetch();
    /**
     * Fetch the itemlist