public static function getInstance() { if (!function_exists('xmlrpc_server_create')) { echo '<?xml version="1.0"?> <methodResponse> <fault> <value> <struct> <member> <name>faultCode</name> <value><int>999</int></value> </member> <member> <name>faultString</name> <value><string>XML-RPC is not available</string></value> </member> </struct> </value> </fault> </methodResponse>'; die; } if (!self::$instance) { self::$instance = new EpicRPCServer(); } return self::$instance; }
/** * Handles an XML-RPC requests by creating an instance of the server and * registering all the methods. */ public function respond() { if (!$this->post) { throw new Error403(); } $server = EpicRPCServer::getInstance(); // All available methods need to be registered below. $server->register('login', array(&$this, 'login')); $server->register('test', array(&$this, 'test')); // SSO $server->register('authenticate', array(&$this, 'authenticate')); $server->register('getUser', array(&$this, 'getUser')); $server->register('updateUser', array(&$this, 'updateUser')); $server->register('changePassword', array(&$this, 'changePassword')); $server->register('changeEmail', array(&$this, 'changeEmail')); $server->register('xlogin', array(&$this, 'xlogin')); // RPC $server->register('classMethod', array(&$this, 'classMethod')); $server->register('objectMethod', array(&$this, 'objectMethod')); $server->register('objectProperty', array(&$this, 'objectProperty')); $server->register('saveObject', array(&$this, 'saveObject')); $server->register('validateObject', array(&$this, 'validateObject')); $server->register('getLastError', array(&$this, 'getLastError')); // Response to the current request $server->respond(); }