Пример #1
0
 /**
  * Create a new XML-RPC Server. 
  *
  * The constructor receives a mandatory parameter: the Call Handler. The call handler executes the actual
  * method call. XML_RPC2 server acts as a protocol decoder/encoder between the call handler and the client
  *
  * @param object $callHandler
  * @param array $options associative array of options
  * @access public
  */
 function __construct($callHandler, $options = array())
 {
     parent::__construct($callHandler, $options);
     if (strtolower($this->encoding) != 'utf-8') {
         throw new XML_RPC2_Exception('XML_RPC2_Backend_Php does not support any encoding other than utf-8, due to a simplexml limitation');
     }
 }
 /**
  * Create a new XML-RPC Server. 
  *
  * The constructor receives a mandatory parameter: the Call Handler. The call handler executes the actual
  * method call. XML_RPC2 server acts as a protocol decoder/encoder between the call handler and the client
  *
  * @param object $callHandler
  * @param array $options associative array of options
  */
 function __construct($callHandler, $options = array())
 {
     parent::__construct($callHandler, $options);
     $this->_xmlrpcextServer = xmlrpc_server_create();
     foreach ($callHandler->getMethods() as $method) {
         if (xmlrpc_server_register_method($this->_xmlrpcextServer, $method->getName(), array($this, 'epiFunctionHandlerAdapter')) !== true) {
             throw new XML_RPC2_Exception('Unable to setup XMLRPCext server. xmlrpc_server_register_method returned non-true.');
         }
     }
 }
Пример #3
0
     * 
     * @param integer $int
     * @return integer
     */
    public static function factor($int)
    {
        $int = (int) $int;
        if ($int <= 1) {
            return 1;
        }
        return $int * static::factor($int - 1);
    }
}
class HiServer
{
    /**
     * Say hi
     * 
     * @param String $word
     * @return string Hi Name!
     */
    public static function hi($name)
    {
        return 'Hi! ' . (string) $name;
    }
}
$options = array('prefix' => 'time.');
$server = XML_RPC2_Server::create('ExampleServer', $options);
$server->handleCall();
//$hi = XML_RPC2_Server::create('HiServer',array('prefix'=>'hi.'));
//$hi->handleCall();
Пример #4
0
 /**
  * Do the real stuff if no cache available
  * 
  * @return string the response of the real XML/RPC2 server
  */
 private function _workWithoutCache()
 {
     require_once 'XML/RPC2/Server.php';
     $this->_serverObject = XML_RPC2_Server::create($this->_callTarget, $this->_options);
     return $this->_serverObject->getResponse();
 }
Пример #5
0
 /**
  * Create a new XML-RPC Server. 
  *
  * The constructor receives a mandatory parameter: the Call Handler. The call handler executes the actual
  * method call. XML_RPC2 server acts as a protocol decoder/encoder between the call handler and the client
  *
  * @param object $callHandler
  * @param array $options associative array of options
  * @access public
  */
 function __construct($callHandler, $options = array())
 {
     parent::__construct($callHandler, $options);
 }
Пример #6
0
    /**
     * 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);
Пример #7
0
        return number_format($x * $y, 2);
    }
    /**
     * Searches for a country based on name
     *
     * @param string $keyword the country name to look for.
     *
     * @return array an array of matching country names.
     */
    public static function search($keyword)
    {
        $keyword = strtolower($keyword);
        include_once 'countries.php';
        $return_array = array();
        if (strlen($keyword) > 0) {
            foreach ($countries as $country) {
                if (strpos(strtolower($country), $keyword) !== false) {
                    $return_array[] = $country;
                }
            }
        } else {
            $return_array[] = '[none]';
        }
        if (count($return_array) == 0) {
            $return_array[] = '[none]';
        }
        return $return_array;
    }
}
$server = XML_RPC2_Server::create('MyServer');
$server->handleCall();