Ejemplo n.º 1
0
 public static function respond()
 {
     $server = new IXR_IntrospectionServer();
     foreach (PicoraXMLRPC::getMethods() as $name => $info) {
         $server->addCallback($name, create_function('$args', 'return call_user_func_array(array(\'' . $info[0][0] . '\',\'' . $info[0][1] . '\'),$args);'), $info[1], isset($info[2]) ? $info[2] : '');
     }
     $server->serve(file_get_contents("php://input"));
     exit;
 }
Ejemplo n.º 2
0
 /**
  * Execute a call, extends parent method
  *
  * Checks for authentication first
  */
 function call($methodname, $args)
 {
     if (!in_array($methodname, $this->public_methods) && !$this->checkAuth()) {
         return new IXR_Error(-32603, 'server error. not authorized to call method "' . $methodname . '".');
     }
     return parent::call($methodname, $args);
 }
Ejemplo n.º 3
0
 /**
  * Execute a call, extends parent method
  *
  * Checks for authentication first
  */
 function call($methodname, $args)
 {
     if (!in_array($methodname, $this->public_methods) && !$this->checkAuth()) {
         if (!isset($_SERVER['REMOTE_USER'])) {
             header('HTTP/1.1 401 Unauthorized');
         } else {
             header('HTTP/1.1 403 Forbidden');
         }
         return new IXR_Error(-32603, 'server error. not authorized to call method "' . $methodname . '".');
     }
     return parent::call($methodname, $args);
 }
Ejemplo n.º 4
0
 function __construct()
 {
     global $enable_xmlrpc_server, $HTTP_RAW_POST_DATA;
     if (!$HTTP_RAW_POST_DATA) {
         $HTTP_RAW_POST_DATA = file_get_contents('php://input');
     }
     parent::__construct();
     // Add API Methods as callbacks.
     if ($enable_xmlrpc_server) {
         // Blogger API [http://www.blogger.com/developers/api/] - add as
         // server capability.
         $this->capabilities['bloggerAPI'] = array('specUrl' => 'http://www.blogger.com/developers/api/', 'specVersion' => 2);
         $this->addCallback('blogger.newPost', 'this:blogger_newPost', array('int', 'string', 'string', 'string', 'string', 'string', 'boolean'), 'makes a new post to a designated blog');
         $this->addCallback('blogger.editPost', 'this:blogger_editPost', array('boolean', 'string', 'string', 'string', 'string', 'string', 'boolean'), 'changes the contents of a given post');
         $this->addCallback('blogger.getUsersBlogs', 'this:blogger_getUsersBlogs', array('struct', 'string', 'string', 'string'), 'return information about all the blogs a given user is member of');
         $this->addCallback('blogger.getUserInfo', 'this:blogger_getUserInfo', array('struct', 'string', 'string', 'string'), 'return information about the current user');
         $this->addCallback('blogger.getTemplate', 'this:blogger_getTemplate', array('string', 'string', 'string', 'string', 'string', 'string'), 'return section template - main will return default template, archiveIndex will return section template');
         $this->addCallback('blogger.setTemplate', 'this:blogger_setTemplate', array('boolean', 'string', 'string', 'string', 'string', 'string', 'string'), 'updates section template - main=default template, archiveIndex=section template');
         // Non-official Blogger API methods - supported by XML-RPC clients
         // as BloggerAPI2. Place all this info on a public URI.
         $this->addCallback('blogger.getPost', 'this:blogger_getPost', array('struct', 'string', 'string', 'string', 'string'), 'retrieves contents for the given postid');
         $this->addCallback('blogger.deletePost', 'this:blogger_deletePost', array('boolean', 'string', 'string', 'string', 'string', 'boolean'), 'deletes a given post');
         $this->addCallback('blogger.getRecentPosts', 'this:blogger_getRecentPosts', array('array', 'string', 'string', 'string', 'string', 'int'), 'retrieves a list of posts (default 10)');
         // metaWeblog API[http://www.xmlrpc.com/metaWeblogApi] - add as
         // server capability.
         $this->capabilities['metaWeblog API'] = array('specUrl' => 'http://www.xmlrpc.com/metaWeblogApi', 'specVersion' => 1);
         // Implements also MovableType extension of the API methods.
         $this->addCallback('metaWeblog.getPost', 'this:metaWeblog_getPost', array('struct', 'string', 'string', 'string'), 'retrieves contents for the given postid');
         $this->addCallback('metaWeblog.newPost', 'this:metaWeblog_newPost', array('string', 'string', 'string', 'string', 'struct', 'boolean'), 'creates a new post');
         $this->addCallback('metaWeblog.editPost', 'this:metaWeblog_editPost', array('boolean', 'string', 'string', 'string', 'struct', 'boolean'), 'creates a new post');
         $this->addCallback('metaWeblog.getCategories', 'this:metaWeblog_getCategories', array('struct', 'string', 'string', 'string'), 'retrieves a list of categories for the current blog');
         $this->addCallback('metaWeblog.getRecentPosts', 'this:metaWeblog_getRecentPosts', array('array', 'string', 'string', 'string', 'int'), 'retrieves a given number of recent posts');
         // TODO: metaWeblog.newMediaObject (blogid, username, password, struct) returns struct
         // MovableType API[] - add as server capability.
         $this->capabilities['MovableType API'] = array('specUrl' => 'http://www.sixapart.com/movabletype/docs/mtmanual_programmatic.html#xmlrpc%20api', 'specVersion' => 1);
         // Not completely implemented.
         $this->addCallback('mt.getRecentPostTitles', 'this:mt_getRecentPostTitles', array('array', 'string', 'string', 'string', 'id'), 'returns a bandwidth-friendly list of the most recent posts in the system');
         $this->addCallback('mt.getCategoryList', 'this:mt_getCategoryList', array('array', 'string', 'string', 'string'), 'returns a list of all categories defined in the weblog');
         $this->addCallback('mt.supportedMethods', 'this:listMethods', array('array'), 'return the XML-RPC Methods supported by the server(Redundant).');
         $this->addCallback('mt.supportedTextFilters', 'this:mt_supportedTextFilters', array('array'), 'return the format filters suported by the server.');
         $this->addCallback('mt.getPostCategories', 'this:mt_getPostCategories', array('array', 'string', 'string', 'string'), 'returns a list of all categories for the given article');
         $this->addCallback('mt.setPostCategories', 'this:mt_setPostCategories', array('boolean', 'string', 'string', 'string', 'array'), 'sets categories for the given article');
         $this->addCallback('mt.publishPost', 'this:mt_publishPost', array('boolean', 'string', 'string', 'string'), 'changes the status of the current article to published');
     }
 }
Ejemplo n.º 5
0
 /**
  *	This is the class constructor of the YDXmlRpcServer class.
  */
 function YDXmlRpcServer()
 {
     // Initialize YDRequest
     $this->YDRequest();
     // Aggregate the functions from the IXR_IntrospectionServer class
     aggregate($this, 'IXR_IntrospectionServer');
     IXR_IntrospectionServer::IXR_IntrospectionServer();
 }
Ejemplo n.º 6
0
 * @param  array  $args (in appkey string, in blogid string, in username string,
 *                       in password string, in template string,
 *                       in templateType string)
 * @return string Upon success this will return the bollean true value. Upon
 *                failure, the fault will be returned.
 * @link   http://docs.openlinksw.com/virtuoso/fn_blogger.setTemplate.html
 * @deprecated    I do not support Blogger-type templates.
 */
function setTemplate($args)
{
    global $server;
    $server->error(8001, 'Unsupported method.');
}
// setTemplate()
/* SERVER CODE */
// create server
$server = new IXR_IntrospectionServer();
global $server;
// Now add the callbacks along with their introspection details
$server->addCallback('blogger.newPost', 'newPost', array('string', 'string', 'string', 'string', 'string', 'string', 'boolean'), 'This function creates a new post and optionally publishes it.');
$server->addCallback('blogger.editPost', 'editPost', array('string', 'string', 'string', 'string', 'string', 'string', 'boolean'), 'This function edits an existing post and optionally publishes it.');
$server->addCallback('blogger.deletePost', 'deletePost', array('string', 'string', 'string', 'string', 'string', 'boolean'), 'This function deletes a post from the server.');
$server->addCallback('blogger.getRecentPosts', 'getRecentPosts', array('string', 'string', 'string', 'string', 'string', 'int'), 'This function retrieves a list of the most recent posts on the server.');
$server->addCallback('blogger.getPost', 'getPost', array('string', 'string', 'string', 'string', 'string'), 'This function retrieves an existing post from the server.');
$server->addCallback('blogger.getUsersBlogs', 'getUsersBlogs', array('struct', 'string', 'string', 'string'), 'This function retrieves a list of weblogs for which a user has posting ' . 'privileges.');
$server->addCallback('blogger.getUserInfo', 'getUserInfo', array('struct', 'string', 'string', 'string'), 'This function retrieves information about a blog author.');
$server->addCallback('blogger.getTemplate', 'getTemplate', array('string', 'string', 'string', 'string', 'string', 'string'), '(UNSUPPORTED) This function retrieves the content of the requested ' . 'template.');
$server->addCallback('blogger.setTemplate', 'setTemplate', array('string', 'string', 'string', 'string', 'string', 'string', 'string'), '(UNSUPPORTED) This function sets the content of the specfied template.');
// And serve the request
$server->serve();
/* Simba says Roar! */