コード例 #1
0
ファイル: vips.php プロジェクト: Rafal0686/bf2servertool
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 */
require_once '../core/init.php';
$user->checkLogin(true);
// Check his rights
if ($userInfo['rights_vips'] == 'no') {
    header('Location: ' . HOME_URL . 'panel/accessDenied.php');
    die;
}
// Connect to server
use T4G\BFP4F\Rcon as rcon;
$sv = new rcon\Server();
$pageTitle = $lang['tool_vipm'];
include CORE_DIR . '/cp_header.php';
$rc->connect($cn, $cs);
?>
			
			<div class="row">
				<div class="col-md-10 col-md-offset-1">
					
					<h2><i class="fa fa-star orange"></i> <?php 
echo $lang['tool_vipm'];
?>
 <small><?php 
echo $lang['tool_vipm_desc'];
?>
</small></h2>
コード例 #2
0
ファイル: server.php プロジェクト: Rafal0686/bf2servertool
use T4G\BFP4F\Rcon as rcon;
$sv = new rcon\Server();
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);
コード例 #3
0
ファイル: rotation.php プロジェクト: Rafal0686/bf2servertool
        } else {
            foreach ($_POST['rotation'] as $map) {
                $rotation[] = explode('|', $map);
            }
        }
    }
    // Check rpm
    if (!is_numeric($_POST['rpm'])) {
        $errors[] = $lang['tool_sl_err3'];
    } else {
        $_POST['rpm'] = round($_POST['rpm']);
    }
    // Check errors and stuff
    if (count($errors) == 0) {
        if (updateSetting('tool_mrot_rpm', $_POST['rpm'])) {
            $sv = new rcon\Server();
            $sv->clearRotation();
            foreach ($rotation as $map) {
                $sv->appendMap($map[0], $map[1]);
            }
            $sv->setNumOfRounds($_POST['rpm']);
            $status = '<div class="alert alert-success alert-block"><h4><i class="fa fa-check"></i> ' . $lang['word_ok'] . '</h4><p>' . $lang['msg_settings_saved'] . '</p></div>';
            $log->insertActionLog($userInfo['user_id'], 'Map rotation edited');
        } else {
            $status = '<div class="alert alert-danger alert-block"><h4><i class="fa fa-times"></i> ' . $lang['word_error'] . '</h4><p>' . $result['message'] . '</p></div>';
        }
    } else {
        $status = '<div class="alert alert-danger alert-block"><h4><i class="fa fa-times"></i> ' . $lang['word_error'] . '</h4><p>' . $lang['msg_error'] . '</p><ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>';
    }
}
// Fetch the current rotation
コード例 #4
0
 * 
 * You should have received a copy of the GNU General Public License
 * 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();