updated dedicated-server-api
This commit is contained in:
0
application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/Base64.php
Normal file → Executable file
0
application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/Base64.php
Normal file → Executable file
0
application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/Exception.php
Normal file → Executable file
0
application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/Exception.php
Normal file → Executable file
75
application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/FaultException.php
Normal file → Executable file
75
application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/FaultException.php
Normal file → Executable file
@ -34,35 +34,26 @@ class FaultException extends Exception
|
||||
return new LockedFeatureException($faultString, $faultCode);
|
||||
case 'Login or Uid unknown.':
|
||||
case 'Login unknown.':
|
||||
return new LoginUnknownException($faultString, $faultCode); //@todo remove this line
|
||||
//return new UnknownPlayerException($faultString, $faultCode);
|
||||
return new UnknownPlayerException($faultString, $faultCode);
|
||||
case 'The player is not a spectator':
|
||||
case 'The player is not a spectator.':
|
||||
return new PlayerIsNotSpectatorException($faultString, $faultCode); //@todo remove this line
|
||||
case 'Not a network player.':
|
||||
case 'Player is not a fake player':
|
||||
return new PlayerStateException($faultString, $faultCode);
|
||||
case 'Player already ignored.':
|
||||
return new PlayerAlreadyIgnoredException($faultString, $faultCode); //@todo remove this line
|
||||
case 'Player already black listed.':
|
||||
case 'Player already on guest list.':
|
||||
case 'Map already added.':
|
||||
return new AlreadyInListException($faultString, $faultCode);
|
||||
case 'Login not banned.':
|
||||
return new NotInListException($faultString, $faultCode); //@todo remove this line
|
||||
case 'Player not ignored.':
|
||||
return new PlayerNotIgnoredException($faultString, $faultCode); //@todo remove this line
|
||||
case 'Player not black listed.':
|
||||
case 'Player not on guest list.':
|
||||
return new NotInListException($faultString, $faultCode); //@todo remove this line
|
||||
case 'Map not in the selection.':
|
||||
case 'The map isn\'t in the current selection.':
|
||||
return new MapNotInCurrentSelectionException($faultString, $faultCode); //@todo remove this line
|
||||
case 'Map not found.':
|
||||
return new MapNotFoundException($faultString, $faultCode); //@todo remove this line
|
||||
//return new NotInListException($faultString, $faultCode);
|
||||
return new NotInListException($faultString, $faultCode);
|
||||
case 'Start index out of bound.':
|
||||
return new StartIndexOutOfBoundException($faultString, $faultCode); //@todo remove this line
|
||||
case 'invalid index':
|
||||
return new IndexOutOfBoundException($faultString, $faultCode);
|
||||
case 'the next map must be different from the current one.':
|
||||
@ -71,7 +62,6 @@ class FaultException extends Exception
|
||||
return new ChangeInProgressException($faultString, $faultCode);
|
||||
case 'Incompatible map type.':
|
||||
case 'Map not complete.':
|
||||
return new MapNotCompatibleOrCompleteException($faultString, $faultCode); //@todo remove this line
|
||||
case 'The map doesn\'t match the server packmask.':
|
||||
return new InvalidMapException($faultString, $faultCode);
|
||||
case 'Ladder mode unknown.':
|
||||
@ -80,19 +70,14 @@ class FaultException extends Exception
|
||||
return new ServerOptionsException($faultString, $faultCode);
|
||||
case 'New mode unknown.':
|
||||
case 'You need to stop the server to change to/from script mode.':
|
||||
return new GameModeException($faultString, $faultCode); //@todo remove this line
|
||||
case 'Not in script mode.':
|
||||
return new NotInScriptModeException($faultString, $faultCode); //@todo remove this line
|
||||
case 'Not in Team mode.':
|
||||
return new NotInTeamModeException($faultString, $faultCode); //@todo remove this line
|
||||
case 'Not in Rounds or Laps mode.':
|
||||
case 'The scores must be decreasing.':
|
||||
return new GameModeException($faultString, $faultCode);
|
||||
case 'Unable to write the black list file.':
|
||||
case 'Unable to write the guest list file.':
|
||||
return new FileException($faultString, $faultCode); //@todo remove this line
|
||||
case 'Unable to write the playlist file.':
|
||||
return new CouldNotWritePlaylistFileException($faultString, $faultCode); //@todo remove this line
|
||||
case 'Could not save file.':
|
||||
case 'Map unknown.':
|
||||
case 'The playlist file does not exist.':
|
||||
@ -123,59 +108,3 @@ class InvalidMapException extends FaultException{}
|
||||
class GameModeException extends FaultException {}
|
||||
class ServerOptionsException extends FaultException {}
|
||||
class FileException extends FaultException {}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see UnknownPlayerException
|
||||
*/
|
||||
class LoginUnknownException extends UnknownPlayerException {}
|
||||
/**
|
||||
* @deprecated
|
||||
* @see FileException
|
||||
*/
|
||||
class CouldNotWritePlaylistFileException extends FileException {}
|
||||
/**
|
||||
* @deprecated
|
||||
* @see IndexOutOfBoundException
|
||||
*/
|
||||
class StartIndexOutOfBoundException extends IndexOutOfBoundException {}
|
||||
/**
|
||||
* @deprecated
|
||||
* @see GameModeException
|
||||
*/
|
||||
class NotInScriptModeException extends GameModeException {}
|
||||
/**
|
||||
* @deprecated
|
||||
* @see PlayerStateException
|
||||
*/
|
||||
class PlayerIsNotSpectatorException extends PlayerStateException {}
|
||||
/**
|
||||
* @deprecated
|
||||
* @see AlreadyInListException
|
||||
*/
|
||||
class PlayerAlreadyIgnoredException extends AlreadyInListException {}
|
||||
/**
|
||||
* @deprecated
|
||||
* @see NotInListException
|
||||
*/
|
||||
class PlayerNotIgnoredException extends NotInListException {}
|
||||
/**
|
||||
* @deprecated
|
||||
* @see GameModeException
|
||||
*/
|
||||
class NotInTeamModeException extends GameModeException {}
|
||||
/**
|
||||
* @deprecated
|
||||
* @see NotInListException
|
||||
*/
|
||||
class MapNotInCurrentSelectionException extends NotInListException {}
|
||||
/**
|
||||
* @deprecated
|
||||
* @see InvalidMapException
|
||||
*/
|
||||
class MapNotCompatibleOrCompleteException extends InvalidMapException {}
|
||||
/**
|
||||
* @deprecated
|
||||
* @see NotInListException
|
||||
*/
|
||||
class MapNotFoundException extends NotInListException {}
|
||||
|
@ -150,12 +150,17 @@ class GbxRemote
|
||||
switch(count($this->multicallBuffer))
|
||||
{
|
||||
case 0:
|
||||
return;
|
||||
return array();
|
||||
case 1:
|
||||
$call = array_shift($this->multicallBuffer);
|
||||
return $this->query($call['methodName'], $call['params']);
|
||||
return array($this->query($call['methodName'], $call['params']));
|
||||
default:
|
||||
$result = $this->query('system.multicall', array($this->multicallBuffer));
|
||||
foreach($result as &$value)
|
||||
if(isset($value['faultCode']))
|
||||
$value = FaultException::create($value['faultString'], $value['faultCode']);
|
||||
else
|
||||
$value = $value[0];
|
||||
$this->multicallBuffer = array();
|
||||
return $result;
|
||||
}
|
||||
|
16
application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/Request.php
Normal file → Executable file
16
application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/Request.php
Normal file → Executable file
@ -13,7 +13,7 @@ if(extension_loaded('xmlrpc'))
|
||||
{
|
||||
private static $options = array(
|
||||
'encoding' => 'utf-8',
|
||||
'escaping' => 'cdata',
|
||||
'escaping' => 'markup',
|
||||
'verbosity' => 'no_white_space'
|
||||
);
|
||||
|
||||
@ -83,11 +83,11 @@ else
|
||||
switch(gettype($v))
|
||||
{
|
||||
case 'boolean':
|
||||
return '<boolean>'.self::escape((int) $v, $escape).'</boolean>';
|
||||
return '<boolean>'.((int) $v).'</boolean>';
|
||||
case 'integer':
|
||||
return '<int>'.self::escape($v, $escape).'</int>';
|
||||
return '<int>'.$v.'</int>';
|
||||
case 'double':
|
||||
return '<double>'.self::escape($v, $escape).'</double>';
|
||||
return '<double>'.$v.'</double>';
|
||||
case 'string':
|
||||
case 'NULL':
|
||||
if(!$v)
|
||||
@ -98,17 +98,17 @@ else
|
||||
{
|
||||
if(!$v->scalar)
|
||||
return '<base64/>';
|
||||
return '<base64>'.self::escape(base64_encode($v->scalar), $escape).'</base64>';
|
||||
return '<base64>'.base64_encode($v->scalar).'</base64>';
|
||||
}
|
||||
if($v instanceof \DateTime)
|
||||
return '<dateTime.iso8601>'.self::escape($v->format(self::DATE_FORMAT), $escape).'</dateTime.iso8601>';
|
||||
return '<dateTime.iso8601>'.$v->format(self::DATE_FORMAT).'</dateTime.iso8601>';
|
||||
$v = get_object_vars($v);
|
||||
// fallthrough
|
||||
case 'array':
|
||||
$return = '';
|
||||
// empty array case
|
||||
if(!$v)
|
||||
return '<array><data/></array>';
|
||||
$return = '';
|
||||
// pure array case
|
||||
if(array_keys($v) === range(0, count($v) - 1))
|
||||
{
|
||||
@ -132,7 +132,7 @@ else
|
||||
private static function escape($str, $escape=true)
|
||||
{
|
||||
if($escape)
|
||||
return '<![CDATA['.$str.']]>';
|
||||
return '<![CDATA['.str_replace(']]>', ']]]]><![CDATA[>', $str).']]>';
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user