".$Char."";
$i++;
if ($i>100) {
break;
}
}
return $string;
}
// Read a styled string
function ReadNextChar(&$_Str, &$_Style) {
$Char = current($_Str);
next($_Str);
if ($Char == '\r') { // skip \r
return ReadNextChar($_Str, $_Style);
}
if ($Char != '$') { // detect markup start sequence '$'
return $Char;
}
$Char = current($_Str);
next($_Str);
if ($Char === FALSE) {
return 0;
}
$MarkupCode = $Char;
switch ($MarkupCode) {
// color
case '0': case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9': case 'a': case 'b':
case 'c': case 'd': case 'e': case 'f': case 'A': case 'B':
case 'C': case 'D': case 'E': case 'F':
{
$RGB = NULL;
for ($Count = 0; $Count < 3; $Count ++) {
if ($Count > 0) {
$Char = current($_Str);
next($_Str);
if ($Char === FALSE) {
return 0;
}
}
$RGB .= $Char.$Char;
}
$_Style .= "color:#".$RGB.";";
}
break;
// no color
case 'G': case 'g':
$_Style .= "color:;";
break;
// Shodowed / Embossed
case 'S': case 's':
break;
// Italic
case 'I': case 'i':
$_Style .= "font-style:italic;";
break;
// Wide
case 'W': case 'w':
$_Style .= "letter-spacing:1px;";
break;
// Narrow
case 'N': case 'n':
$_Style .= "letter-spacing:-1px;";
break;
// Medium
case 'M': case 'm':
$_Style .= "letter-spacing:0px;";
break;
// underlined
case 'U': case 'u':
$_Style .= "text-decoration:underline;";
break;
// reset all
case 'Z': case 'z':
$_Style = "";
break;
// escaped char.
case '$': case '[':
return $MarkupCode;
default:
// eat silently the character...
break;
};
return ReadNextChar($_Str, $_Style); // tail recursion.
}
function catchError($errno, $errstr, $errfile, $errline){
echo("
$errstr (line:$errline)
");
}
set_error_handler('catchError');
function MwTimeToString($MwTime)
{
if ($MwTime == -1) {
return "???";
} else {
$minutes = floor($MwTime/(1000*60));
return $minutes.":".floor(($MwTime-$minutes*60*1000)/1000);
}
}
function ParseArgument(&$ArgumentValue, $ArgumentName, $DefaultValue)
{
if (array_key_exists($ArgumentName, $_POST)) {
$ArgumentValue = $_POST[$ArgumentName];
} else if (array_key_exists($ArgumentName, $_GET)) {
$ArgumentValue = $_GET[$ArgumentName];
} else {
$ArgumentValue = $DefaultValue;
}
}
// parse the arguments.
ParseArgument( $AuthLogin, 'authLogin', "SuperAdmin" );
ParseArgument( $AuthPassword, 'authPassword', "SuperAdmin" );
ParseArgument( $OldAuthLogin, 'oldAuthLogin', $AuthLogin );
ParseArgument( $OldAuthPassword, 'oldAuthPassword', $AuthPassword );
ParseArgument( $port, 'port', 5000 );
ParseArgument( $MSLogin, 'mslogin', "" );
ParseArgument( $MSPassword, 'mspassword', "" );
if (array_key_exists('action', $_POST)) {
$Action = $_POST['action'];
/*} else if (array_key_exists('action', $_GET))
$Action = $_GET['action'];*/
} else {
$Action="";
}
echo " - Trackmania Forever dedicated server - ";
// ----------------------------------------------------------------
// connect
// ----------------------------------------------------------------
$client = new IXR_Client_Gbx;
if (!$client->Init($port)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
if (!$client->query("Authenticate", $AuthLogin, $AuthPassword)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
$AuthLogin = $OldAuthLogin;
$AuthPassword = $OldAuthPassword;
}
else
{
$OldAuthLogin = $AuthLogin;
$OldAuthPassword = $AuthPassword;
}
// ----------------------------------------------------------------
// do the job.
// ----------------------------------------------------------------
$SimpleActions = array('RestartChallenge', 'NextChallenge', 'StopServer', 'QuitGame', 'CleanBanList');
if (in_array($Action, $SimpleActions)) {
if (!$client->query($Action)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
} else if ($Action == 'SetServerOptions') {
$IsP2PUpload = array_key_exists('IsP2PUpload', $_POST);
$IsP2PDownload = array_key_exists('IsP2PDownload', $_POST);
$AutoSaveReplays = array_key_exists('AutoSaveReplays', $_POST);
$AutoSaveValidationReplays = array_key_exists('AutoSaveValidationReplays', $_POST);
$AllowChallengeDownload = array_key_exists('AllowChallengeDownload', $_POST);
$struct = array( 'Name' => $_POST['ServerName'],
'Comment' => $_POST['ServerComment'],
'Password' => $_POST['ServerPassword'],
'PasswordForSpectator' => $_POST['SpectatorPassword'],
'NextMaxPlayers' => $_POST['NextMaxPlayers']+0,
'NextMaxSpectators' => $_POST['NextMaxSpectators']+0,
'IsP2PUpload' => $IsP2PUpload,
'IsP2PDownload' => $IsP2PDownload,
'NextLadderMode' => $_POST['NextLadderMode']+0,
'NextVehicleNetQuality' => $_POST['NextVehicleNetQuality']+0,
'NextCallVoteTimeOut' => $_POST['NextCallVoteTimeOut']+0,
'CallVoteRatio' => $_POST['CallVoteRatio']+0,
'RefereePassword' => $_POST['RefereePassword'],
'RefereeMode' => $_POST['RefereeMode']+0,
'AllowChallengeDownload' => $AllowChallengeDownload,
'AutoSaveValidationReplays' => $AutoSaveValidationReplays,
'AutoSaveReplays' => $AutoSaveReplays);
if (!$client->query('SetServerOptions', $struct)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
} else if ($Action == 'StartServerInternet' || $Action == 'StartServerLan') {
$struct = array( 'Login' => $_POST['Login'],
'Password' => $_POST['Password']);
if (!$client->query($Action, $struct)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
} else if ($Action == 'RemoveChallenge' || $Action == 'AddChallenge' || $Action == 'ChooseNextChallenge') {
if (!$client->query($Action, urldecode($_POST['ChallengeFileName']))) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
} else if ($Action == 'Kick' || $Action == 'Ban' || $Action == 'UnBan' || $Action == 'AddGuest' || $Action == 'RemoveGuest' || $Action == 'BlackList' || $Action == 'UnBlackList') {
if (!$client->query($Action, urldecode($_POST['PlayerLogin']))) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
} else if ($Action == 'SaveMatchSettings' || $Action == 'LoadMatchSettings' || $Action == 'AppendPlaylistFromMatchSettings') {
if (!$client->query($Action, urldecode($_POST['MatchSettingsFileName']))) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
} else if ($Action == 'LoadGuestList' || $Action == 'SaveGuestList' ) {
if (!$client->query($Action, urldecode($_POST['GuestListFileName']))) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
} else if ($Action == 'LoadBlackList' || $Action == 'SaveBlackList' ) {
if (!$client->query($Action, urldecode($_POST['BlackListFileName']))) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
} else if ($Action == 'SetGameInfos') {
$NextRoundsUseNewRules = array_key_exists('NextRoundsUseNewRules', $_POST);
$NextTeamUseNewRules = array_key_exists('NextTeamUseNewRules', $_POST);
$NextDisableRespawn = array_key_exists('NextDisableRespawn', $_POST);
$struct = array( 'GameMode' => $_POST['NextGameMode']+0,
'ChatTime' => $_POST['NextChatTime']+0,
'FinishTimeout' => $_POST['NextFinishTimeout']+0,
'RoundsPointsLimit' => $_POST['NextRoundsPointsLimit']+0,
'RoundsForcedLaps' => $_POST['NextRoundsForcedLaps']+0,
'RoundsUseNewRules' => $NextRoundsUseNewRules,
'RoundsPointsLimitNewRules' => $_POST['NextRoundsPointsLimitNewRules']+0,
'TimeAttackLimit' => $_POST['NextTimeAttackLimit']+0,
'TimeAttackSynchStartPeriod' => $_POST['NextTimeAttackSynchStartPeriod']+0,
'TeamPointsLimit' => $_POST['NextTeamPointsLimit']+0,
'TeamMaxPoints' => $_POST['NextTeamMaxPoints']+0,
'TeamUseNewRules' => $NextTeamUseNewRules,
'TeamPointsLimitNewRules' => $_POST['NextTeamPointsLimitNewRules']+0,
'CupPointsLimit' => $_POST['NextCupPointsLimit']+0,
'CupRoundsPerChallenge' => $_POST['NextCupRoundsPerChallenge']+0,
'CupNbWinners' => $_POST['NextCupNbWinners']+0,
'CupWarmUpDuration' => $_POST['NextCupWarmUpDuration']+0,
'DisableRespawn' => False,
'ForceShowAllOpponents' => False,
'LapsNbLaps' => $_POST['NextLapsNbLaps']+0,
'LapsTimeLimit' => $_POST['NextLapsTimeLimit']+0,
'AllWarmUpDuration' => 0);
if (!$client->query('SetGameInfos', $struct)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
} else if ($Action == 'ChangeAuthPassword') {
if (!$client->query('ChangeAuthPassword', $_POST['newLogin'], $_POST['newPassword'])) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else if( $AuthLogin==$_POST['newLogin'] )
{
$AuthLogin = $_POST['newLogin'];
$AuthPassword = $_POST['newLogin'];
$OldAuthLogin = $AuthLogin;
$OldAuthPassword = $AuthPassword;
}
} else if( ($Action == 'ChatSend') || ($Action == 'ChatSendServerMessage') ){
if (!$client->query($Action, urldecode($_POST['ChatText']))) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
} else if($Action == 'SendDisplayManialinkPage'){
$AutoHide = array_key_exists('AutoHide', $_POST);
if (!$client->query($Action, $_POST['Maniacode'], $_POST['TimeOut']+0, $AutoHide)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
} else if($Action == 'SendDisplayServerMessageToLogin'){
$AutoHide = array_key_exists('AutoHide', $_POST);
if (!$client->query($Action, $_POST['Login'], $_POST['Maniacode'],$_POST['TimeOut']+0, $AutoHide)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
} else if($Action == 'SendHideManialinkPage'){
if (!$client->query($Action)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
} else if($Action == 'SendHideManialinkPageToLogin'){
if (!$client->query($Action, $_POST['Login'])) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
}
// ----------------------------------------------------------------
// connection info
// ----------------------------------------------------------------
echo "\nConnection Status: \n";
if (!$client->query('GetVersion')) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$AuthSuperAdmin = $AuthLogin=="SuperAdmin" ? "selected" : "";
$AuthAdmin = $AuthLogin=="Admin" ? "selected" : "";
$AuthUser = $AuthLogin=="User" ? "selected" : "";
echo <<
END;
if( $AuthLogin=="SuperAdmin" )
{
echo <<
END;
}
$Version = $client->getResponse();
echo "Connected to " . $Version['Name']. " - " . $Version['Version'] . " ";
}
// ----------------------------------------------------------------
// status info
// ----------------------------------------------------------------
echo "\nServer Status: \n";
if (!$client->query('GetStatus')) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$Status = $client->getResponse();
echo "Status: ".$Status['Name'];
echo <<
END;
if ($Status['Code'] == 1) {
// ----------------------------------------------------------------
// start server
// ----------------------------------------------------------------
echo <<
END;
echo <<
END;
} else if ( ($Status['Code'] == 3) || ($Status['Code'] == 4) || ($Status['Code'] == 5) ) {
if (!$client->query('GetCurrentChallengeInfo')) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$CurrentChallengeInfo = $client->getResponse();
echo "Current challenge : " . $CurrentChallengeInfo['UId'] . " - " . styledString($CurrentChallengeInfo['Name']) . " - " . $CurrentChallengeInfo['Author'] . " ";
}
// ----------------------------------------------------------------
// in game actions
// ----------------------------------------------------------------
if( $Status['Code'] == 4 )
{
echo <<
END;
}
else
{
echo " ";
}
echo "Players: ";
if (!$client->query('GetPlayerList', 50, 0)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$PlayerList = $client->getResponse();
echo '';
foreach ($PlayerList as $player) {
$PlayerLogin = $player['Login'];
$PlayerName = styledString($player['NickName']);
$PlayerRanking = $player['LadderRanking'];
$PlayerIsSpectator = ($player['IsSpectator']!=0) ? "Spectator" : "Player";
$PlayerIsInOfficialMode = ($player['IsInOfficialMode']!=0) ? "Official" : "Not Official";
$PlayerTeamId = $player['TeamId'];
if( $PlayerTeamId == -1)
$PlayerTeam = "No Team";
else if( $PlayerTeamId == 0)
$PlayerTeam = "Blue Team";
else
$PlayerTeam = "Red Team";
echo <<$PlayerLogin $PlayerName $PlayerTeam $PlayerIsSpectator $PlayerIsInOfficialMode $PlayerRanking
END;
}
echo "
";
}
echo <<
END;
$AutoHide = False;
echo <<
END;
echo "Ranking: ";
if (!$client->query('GetCurrentRanking', 50, 0)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$CurrentRanking = $client->getResponse();
echo '';
foreach ($CurrentRanking as $Ranking) {
$PlayerLogin = $Ranking['Login'];
$PlayerName = styledString($Ranking['NickName']);
$PlayerRank = $Ranking['Rank'];
$PlayerBestTime = $Ranking['BestTime'];
$PlayerScore = $Ranking['Score'];
$PlayerNbrLaps = $Ranking['NbrLapsFinished'];
$PlayerLadderScore = $Ranking['LadderScore'];
echo <<$PlayerLogin $PlayerName $PlayerRank $PlayerBestTime $PlayerScore $PlayerNbrLaps $PlayerLadderScore
END;
}
echo "
";
}
} else if ($Status['Code'] == 2) {
echo "server busy.. ";
}
echo "GuestList: ";
if (!$client->query('GetGuestList', 50, 0)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$GuestList = $client->getResponse();
echo '';
foreach ($GuestList as $player) {
$PlayerLogin=$player['Login'];
echo <<$PlayerLogin
END;
}
echo "
";
echo <<
END;
echo <<
END;
}
echo "BlackList: ";
if (!$client->query('GetBlackList', 50, 0)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$BlackList = $client->getResponse();
echo '';
foreach ($BlackList as $player) {
$PlayerLogin=$player['Login'];
echo <<$PlayerLogin
END;
}
echo "
";
echo <<
END;
echo <<
END;
}
echo "BanList: ";
if (!$client->query('GetBanList', 50, 0)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$BanList = $client->getResponse();
echo '';
foreach ($BanList as $player) {
$PlayerLogin=$player['Login'];
echo <<$PlayerLogin
END;
}
echo "
";
echo <<
END;
}
}
// ----------------------------------------------------------------
// Server options
// ----------------------------------------------------------------
echo "\nServer options: \n";
if (!$client->query('GetServerOptions', 1)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$ServerOptions = $client->getResponse();
$repGetServerName = $ServerOptions['Name'];
$repServerComment = $ServerOptions['Comment'];
$repServerPassword = $ServerOptions['Password'];
$repPasswordForSpectator = $ServerOptions['PasswordForSpectator'];
$repRefereePassword = $ServerOptions['RefereePassword'];
$repRefereeMode = $ServerOptions['RefereeMode'];
$repCurrentMaxPlayer = $ServerOptions['CurrentMaxPlayers'];
$repNextMaxPlayer = $ServerOptions['NextMaxPlayers'];
$repCurrentMaxSpectator = $ServerOptions['CurrentMaxSpectators'];
$repNextMaxSpectator = $ServerOptions['NextMaxSpectators'];
$repP2PUpload = ($ServerOptions['IsP2PUpload']!=0) ? "checked" : " ";
$repP2PDownload = ($ServerOptions['IsP2PDownload']!=0) ? "checked" : " ";
$repCurrentLadderMode = $ServerOptions['CurrentLadderMode'];
$repNextLadderMode = $ServerOptions['NextLadderMode'];
$repCurrentVehicleNetQuality = $ServerOptions['CurrentVehicleNetQuality'];
$repNextVehicleNetQuality = $ServerOptions['NextVehicleNetQuality'];
$repCurrentCallVoteTimeOut = $ServerOptions['CurrentCallVoteTimeOut'];
$repNextCallVoteTimeOut = $ServerOptions['NextCallVoteTimeOut'];
$repCallVoteRatio = $ServerOptions['CallVoteRatio'];
$repAllowChallengeDownload = ($ServerOptions['AllowChallengeDownload']!=0) ? "checked" : " ";
$repAutoSaveReplays = ($ServerOptions['AutoSaveReplays']!=0) ? "checked" : " ";
$repAutoSaveValidationReplays = ($ServerOptions['AutoSaveValidationReplays']!=0) ? "checked" : " ";
if( $repCurrentLadderMode==0 )
$CurrentLadderMode = "Inactive";
else if( $repCurrentLadderMode==1 )
$CurrentLadderMode = "Forced";
else
$CurrentLadderMode = "Undefined";
if( $repNextLadderMode==0 )
{
$NextLadderModeInactive = "selected";
$NextLadderModeForced = "";
}
{
$NextLadderModeInactive = "";
$NextLadderModeForced = "selected";
}
if( $repCurrentVehicleNetQuality==0 )
$CurrentVehicleNetQuality = "Fast";
else if( $repCurrentVehicleNetQuality==1 )
$CurrentVehicleNetQuality = "High";
else
$CurrentLadderMode = "Undefined";
if( $repNextVehicleNetQuality==1 )
{
$NextVehicleNetQualityFast = "";
$NextVehicleNetQualityHigh = "selected";
}
else
{
$NextVehicleNetQualityFast = "selected";
$NextVehicleNetQualityHigh = "";
}
echo <<
END;
}
// ----------------------------------------------------------------
// Game infos
// ----------------------------------------------------------------
echo "\nGame infos: \n";
if (!$client->query('GetGameInfos', 1)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$GameInfos = $client->getResponse();
$CurrentGameInfo = $GameInfos['CurrentGameInfos'];
$NextGameInfo = $GameInfos['NextGameInfos'];
$ChatTime = $CurrentGameInfo['ChatTime'];
$NbChallenge = $CurrentGameInfo['NbChallenge'];
if( $CurrentGameInfo['GameMode']==0 )
$GameMode = "Rounds";
else if( $CurrentGameInfo['GameMode']==1 )
$GameMode = "TimeAttack";
else if( $CurrentGameInfo['GameMode']==2 )
$GameMode = "Team";
else if( $CurrentGameInfo['GameMode']==3 )
$GameMode = "Laps";
else if( $CurrentGameInfo['GameMode']==4 )
$GameMode = "Stunts";
else if( $CurrentGameInfo['GameMode']==5 )
$GameMode = "Cup";
else
$GameMode = "Undefined";
$RoundsPointsLimit = $CurrentGameInfo['RoundsPointsLimit'];
$RoundsPointsLimitNewRules = $CurrentGameInfo['RoundsPointsLimitNewRules'];
$RoundsUseNewRules = ($CurrentGameInfo['RoundsUseNewRules']!=0) ? "True" : "False";
$RoundsForcedLaps = $CurrentGameInfo['RoundsForcedLaps'];
$FinishTimeout = $CurrentGameInfo['FinishTimeout'];
$TimeAttackLimit = $CurrentGameInfo['TimeAttackLimit'];
$TimeAttackSynchStartPeriod = $CurrentGameInfo['TimeAttackSynchStartPeriod'];
$TeamPointsLimit = $CurrentGameInfo['TeamPointsLimit'];
$TeamPointsLimitNewRules = $CurrentGameInfo['TeamPointsLimitNewRules'];
$TeamMaxPoints = $CurrentGameInfo['TeamMaxPoints'];
$TeamUseNewRules = ($CurrentGameInfo['TeamUseNewRules']!=0) ? "True" : "False";
$CupPointsLimit = $CurrentGameInfo['CupPointsLimit'];
$CupRoundsPerChallenge = $CurrentGameInfo['CupRoundsPerChallenge'];
$CupNbWinners = $CurrentGameInfo['CupNbWinners'];
$CupWarmUpDuration = $CurrentGameInfo['CupWarmUpDuration'];
$LapsNbLaps = $CurrentGameInfo['LapsNbLaps'];
$LapsTimeLimit = $CurrentGameInfo['LapsTimeLimit'];
$NextChatTime = $NextGameInfo['ChatTime'];
$NextGameMode0 = $NextGameInfo['GameMode']==0 ? "selected" : "";
$NextGameMode1 = $NextGameInfo['GameMode']==1 ? "selected" : "";
$NextGameMode2 = $NextGameInfo['GameMode']==2 ? "selected" : "";
$NextGameMode3 = $NextGameInfo['GameMode']==3 ? "selected" : "";
$NextGameMode4 = $NextGameInfo['GameMode']==4 ? "selected" : "";
$NextGameMode5 = $NextGameInfo['GameMode']==5 ? "selected" : "";
$NextRoundsPointsLimit = $NextGameInfo['RoundsPointsLimit'];
$NextRoundsPointsLimitNewRules = $NextGameInfo['RoundsPointsLimitNewRules'];
$NextRoundsUseNewRules = ($NextGameInfo['RoundsUseNewRules']!=0) ? "checked" : " ";
$NextRoundsForcedLaps = $NextGameInfo['RoundsForcedLaps'];
$NextFinishTimeout = $NextGameInfo['FinishTimeout'];
$NextTimeAttackLimit = $NextGameInfo['TimeAttackLimit'];
$NextTimeAttackSynchStartPeriod = $NextGameInfo['TimeAttackSynchStartPeriod'];
$NextTeamPointsLimit = $NextGameInfo['TeamPointsLimit'];
$NextTeamPointsLimitNewRules = $NextGameInfo['TeamPointsLimitNewRules'];
$NextTeamMaxPoints = $NextGameInfo['TeamMaxPoints'];
$NextTeamUseNewRules = ($NextGameInfo['TeamUseNewRules']!=0) ? "checked" : " ";
$NextCupPointsLimit = $NextGameInfo['CupPointsLimit'];
$NextCupRoundsPerChallenge = $NextGameInfo['CupRoundsPerChallenge'];
$NextCupNbWinners = $NextGameInfo['CupNbWinners'];
$NextCupWarmUpDuration = $NextGameInfo['CupWarmUpDuration'];
$NextLapsNbLaps = $NextGameInfo['LapsNbLaps'];
$NextLapsTimeLimit = $NextGameInfo['LapsTimeLimit'];
echo <<
END;
}
// ----------------------------------------------------------------
// challenges
// ----------------------------------------------------------------
// debug
echo "\nChallenges: \n";
if (!$client->query('GetChallengeList', 50, 0)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$ChallengeList = $client->getResponse();
echo '';
foreach ($ChallengeList as $challenge) {
$ChallengeUId = $challenge['UId'];
$ChallengeAuthor = $challenge['Author'];
$ChallengeName = styledString($challenge['Name']);
$FileName = $challenge['FileName'];
$FileNameUrl = urlencode($FileName);
$Environnement = $challenge['Environnement'];
$GoldTime = MwTimeToString($challenge['GoldTime']);
$CopperPrice = $challenge['CopperPrice'];
echo <<$ChallengeName $ChallengeUId $FileName $Environnement $ChallengeAuthor $GoldTime $CopperPrice
END;
}
echo "
";
}
echo <<
END;
echo <<
END;
/*
// uncomment to test the callbacks..
echo "callbacks: ";
if (!$client->query('EnableCallbacks', true)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
flush();
while (true) {
$client->readCB(5);
$calls = $client->getCBResponses();
if (!empty($calls)) {
foreach ($calls as $call) {
echo "call: ".$call[0]." ";
}
} else {
echo "no calls... ";
}
flush();
}
*/
$client->Terminate();
?>