Example #1
0
<?php

// ENREGISTREMENT
if (isset($_POST['savegameinfos'])) {
    // Variables
    $struct = AdminServ::getGameInfosStructFromPOST();
    // RequĂȘtes
    if (!$client->query('SetGameInfos', $struct) && $client->getErrorMessage() != 'Script not allowed for this title.') {
        AdminServ::error();
    } else {
        // Team info
        if (SERVER_VERSION_NAME == 'ManiaPlanet' && isset($_POST['teamInfo1Name'])) {
            $team1 = array('name' => $_POST['teamInfo1Name'], 'color' => $_POST['teamInfo1Color'], 'colorhex' => $_POST['teamInfo1ColorHex'], 'country' => $_POST['teamInfo1Country']);
            $team2 = array('name' => $_POST['teamInfo2Name'], 'color' => $_POST['teamInfo2Color'], 'colorhex' => $_POST['teamInfo2ColorHex'], 'country' => $_POST['teamInfo2Country']);
            AdminServ::setTeamInfo($team1, $team2);
        }
        // RoundCustomPoints
        if (isset($_POST['NextRoundCustomPoints']) && $_POST['NextRoundCustomPoints'] != null) {
            $NextRoundCustomPoints = explode(',', $_POST['NextRoundCustomPoints']);
            $NextRoundCustomPointsArray = array();
            if (count($NextRoundCustomPoints) > 0) {
                foreach ($NextRoundCustomPoints as $point) {
                    $NextRoundCustomPointsArray[] = intval(trim($point));
                }
            }
            if (!$client->query('SetRoundCustomPoints', $NextRoundCustomPointsArray)) {
                AdminServ::error();
            }
        }
        // MatchSettings
        if (SERVER_MATCHSET) {
<?php

// ENREGISTREMENT
if (isset($_POST['savematchsetting']) && isset($_SESSION['adminserv']['matchset_maps_selected'])) {
    // Filename
    $matchSettingName = Str::replaceChars($_POST['matchSettingName']);
    $filename = $data['mapsDirectoryPath'] . $args['directory'] . $matchSettingName;
    if (File::getExtension($matchSettingName) != 'txt') {
        $filename .= '.txt';
    }
    $struct = array();
    // Gameinfos
    $gameinfos = AdminServ::getGameInfosStructFromPOST();
    $struct['gameinfos'] = array('game_mode' => $gameinfos['GameMode'], 'chat_time' => $gameinfos['ChatTime'], 'finishtimeout' => $gameinfos['FinishTimeout'], 'allwarmupduration' => $gameinfos['AllWarmUpDuration'], 'disablerespawn' => $gameinfos['DisableRespawn'], 'forceshowallopponents' => $gameinfos['ForceShowAllOpponents'], 'rounds_pointslimit' => $gameinfos['RoundsPointsLimit'], 'rounds_custom_points' => $gameinfos['RoundCustomPoints'], 'rounds_usenewrules' => $gameinfos['RoundsUseNewRules'], 'rounds_forcedlaps' => $gameinfos['RoundsForcedLaps'], 'rounds_pointslimitnewrules' => $gameinfos['RoundsPointsLimitNewRules'], 'team_pointslimit' => $gameinfos['TeamPointsLimit'], 'team_maxpoints' => $gameinfos['TeamMaxPoints'], 'team_usenewrules' => $gameinfos['TeamUseNewRules'], 'team_pointslimitnewrules' => $gameinfos['TeamPointsLimitNewRules'], 'timeattack_limit' => $gameinfos['TimeAttackLimit'], 'timeattack_synchstartperiod' => $gameinfos['TimeAttackSynchStartPeriod'], 'laps_nblaps' => $gameinfos['LapsNbLaps'], 'laps_timelimit' => $gameinfos['LapsTimeLimit'], 'cup_pointslimit' => $gameinfos['CupPointsLimit'], 'cup_roundsperchallenge' => $gameinfos['CupRoundsPerMap'], 'cup_nbwinners' => $gameinfos['CupNbWinners'], 'cup_warmupduration' => $gameinfos['CupWarmUpDuration']);
    if (SERVER_VERSION_NAME != 'TmForever') {
        $struct['gameinfos']['script_name'] = $gameinfos['ScriptName'];
    }
    // HotSeat
    $struct['hotseat'] = array('game_mode' => intval($_POST['hotSeatGameMode']), 'time_limit' => TimeDate::secToMillisec(intval($_POST['hotSeatTimeLimit'])), 'rounds_count' => intval($_POST['hotSeatCountRound']));
    // Filter
    $struct['filter'] = array('is_lan' => array_key_exists('filterIsLan', $_POST), 'is_internet' => array_key_exists('filterIsInternet', $_POST), 'is_solo' => array_key_exists('filterIsSolo', $_POST), 'is_hotseat' => array_key_exists('filterIsHotSeat', $_POST), 'sort_index' => intval($_POST['filterSortIndex']), 'random_map_order' => array_key_exists('filterRandomMaps', $_POST), 'force_default_gamemode' => intval($_POST['filterDefaultGameMode']));
    // ScriptSettings
    if (!$client->query('GetModeScriptInfo')) {
        AdminServ::error();
    } else {
        $scriptsettings = $client->getResponse();
        if (!empty($scriptsettings['ParamDescs'])) {
            foreach ($scriptsettings['ParamDescs'] as $param) {
                $struct['scriptsettings'][] = array('name' => $param['Name'], 'type' => $param['Type'], 'value' => $param['Default']);
            }
        }