function new_Intraface_Contact_XMLRPC_Client($c) { XML_RPC2_Backend::setBackend('php'); $credentials = array('private_key' => $GLOBALS['elevforeningen_intraface_private_key'], 'session_id' => session_id()); $debug = false; return $contact_client = new IntrafacePublic_Contact_XMLRPC_Client($credentials, $debug); }
/** * Factory method that constructs the appropriate XML-RPC encoded type value * * @param mixed Value to be encode * @param string (optional) Explicit XML-RPC type as enumerated in the XML-RPC spec (defaults to automatically selected type) * @return mixed The encoded value */ public static function createFromNative($value, $explicitType = null) { $xmlrpcTypes = array('int', 'boolean', 'string', 'double', 'datetime', 'base64', 'struct', 'array'); if (in_array($explicitType, $xmlrpcTypes)) { return @call_user_func(array(XML_RPC2_Backend::getValueClassname(), 'createFromNative'), $value, $explicitType); } return $value; }
/** * Factory method to select, create and return a XML_RPC2_Client backend * * To create a new XML_RPC2_Client, a URI must be provided (e.g. http://xmlrpc.example.com/1.0/). * * Optionally, some options may be set. * * @param string URI for the XML-RPC server * @param array (optional) associative array of options (see constructor) */ public static function create($uri, $options = array()) { if (isset($options['backend'])) { XML_RPC2_Backend::setBackend($options['backend']); } $backend = XML_RPC2_Backend::getClientClassname(); return new $backend($uri, $options); }
/** * Backend setter. * * Currently, two backends exist: 'php' and 'XMLRPCext'. * The PHP backend has no external dependencies, while the xmlrpcext * requires the xmlrpc extension. * * The XMLRPCext backend is quite faster, and will be automatically * selected when no explicit backend has been set and the extension * is available. * * @param string The backend to select. Either 'php' or 'XMLRPCext'. */ public static function setBackend($backend) { $backend = ucfirst(strtolower($backend)); if ($backend != 'Php' && $backend != 'Xmlrpcext') { throw new XML_RPC2_Exception(sprintf('Backend %s does not exist', $backend)); } if ($backend == 'Xmlrpcext' && !function_exists('xmlrpc_server_create') && !(@dl('php_xmlrpc' . PHP_SHLIB_SUFFIX) || @dl('xmlrpc' . PHP_SHLIB_SUFFIX))) { throw new XML_RPC2_Exception('Unable to load xmlrpc extension.'); } self::$currentBackend = $backend; }
/** * Factory method to select a backend and return a new XML_RPC2_Server based on the backend * * @param mixed $callTarget either a class name or an object instance. * @param array associative array of options * @return object a server class instance */ public static function create($callTarget, $options = array()) { if (isset($options['backend'])) { XML_RPC2_Backend::setBackend($options['backend']); } if (isset($options['prefix'])) { $prefix = $options['prefix']; } else { $prefix = ''; } $backend = XML_RPC2_Backend::getServerClassname(); // Find callHandler class if (!isset($options['callHandler'])) { if (is_object($callTarget)) { // Delegate calls to instance methods require_once 'XML/RPC2/Server/CallHandler/Instance.php'; $callHandler = new XML_RPC2_Server_CallHandler_Instance($callTarget, $prefix); } else { // Delegate calls to static class methods require_once 'XML/RPC2/Server/CallHandler/Class.php'; $callHandler = new XML_RPC2_Server_CallHandler_Class($callTarget, $prefix); } } else { $callHandler = $options['callHandler']; } return new $backend($callHandler, $options); }
/** * Wrapper for get_notices() * * @param string $username * @param string $password * @param string $category * * @return bool */ public function get_notices($username, $password, $category = 'all') { $this->auth($username, $password); global $g; if (!function_exists("get_notices")) { require_once "notices.inc"; } if (!$params) { $toreturn = get_notices(); } else { $toreturn = get_notices($params); } return $toreturn; } } $xmlrpclockkey = lock('xmlrpc', LOCK_EX); XML_RPC2_Backend::setBackend('php'); $HTTP_RAW_POST_DATA = file_get_contents('php://input'); $options = array('prefix' => 'pfsense.', 'encoding' => 'utf-8', 'autoDocument' => false); $server = XML_RPC2_Server::create(new pfsense_xmlrpc_server(), $options); $server->handleCall(); unlock($xmlrpclockkey);
/** * Factory method to select, create and return a XML_RPC2_Client backend * * To create a new XML_RPC2_Client, a URI must be provided (e.g. http://xmlrpc.example.com/1.0/). * * Optionally, some options may be set. * * @param string URI for the XML-RPC server * @param array (optional) associative array of options (see constructor) */ public static function create($uri, $options = array()) { if (isset($this)) { // Method called non-statically forward to remote call() as RPC $this->__call('create', func_get_args()); } if (isset($options['backend'])) { XML_RPC2_Backend::setBackend($options['backend']); } $backend = XML_RPC2_Backend::getClientClassname(); return new $backend($uri, $options); }
function new_IntrafacePublic_Newsletter_XMLRPC_Client() { $credentials = array("private_key" => INTRAFACE_PRIVATE_KEY, "session_id" => uniqid()); XML_RPC2_Backend::setBackend("php"); return new IntrafacePublic_Newsletter_XMLRPC_Client($credentials); }