Пример #1
0
 function processRequest($xml)
 {
     $this->Request =& XMLRPC_parse($xml);
     $this->Parameters = XMLRPC_getParams($this->Request);
     $method = XMLRPC_getMethodName($this->Request);
     if (count($this->Parameters) < 3) {
         return $this->_returnError("Malformed request: invalid number of parameters");
     }
     $this->ParentDocumentID = array_shift($this->Parameters);
     // We consider the "BlogID" the ID of the parent document
     $this->Username = array_shift($this->Parameters);
     $this->Password = array_shift($this->Parameters);
     if (IMP_DEBUG) {
         error_log("{$method} request for blog id {$this->ParentDocumentID} username={$this->Username} password={$this->Password}");
     }
     $this->CMS->enableAdminAccess($this->Username, $this->Password) or $this->_ReturnError("Login failed for {$this->Username} - please check your password");
     $this->ParentDocument = $this->CMS->getDocument($this->ParentDocumentID);
     if (empty($this->ParentDocument)) {
         return $this->_ReturnError("Unable to load document!", E_USER_ERROR);
     }
     if (!empty($this->ValidMethods[$method]) and method_exists($this, $this->ValidMethods[$method])) {
         // Since XML-RPC is brain-dead and uses position instead of keys, there's no reason
         // for us not to treat its parameters like normal PHP parameters:
         return call_user_func_array(array(&$this, $this->ValidMethods[$method]), $this->Parameters);
     } else {
         return $this->_methodNotFound($method);
     }
 }
Пример #2
0
 protected function init()
 {
     $requestString = file_get_contents('php://input');
     if (StringUtils::isEmpty($requestString)) {
         return;
     }
     $requestData = XMLRPC_parse($requestString);
     $methodStrings = explode('.', XMLRPC_getMethodName($requestData));
     $this->methodOwner = $methodStrings[0];
     $this->methodName = $methodStrings[1];
     $this->methodParams = XMLRPC_getParams($requestData);
     // TODO: Where to call session_start?
     session_start();
     $this->session = new PhpHttpSession();
 }
Пример #3
0
$xmlrpc_methods['blogger.getPost'] = 'blogger_getPost';
//$xmlrpc_methods['blogger.getTemplate']		= 'blogger_getTemplate';
//$xmlrpc_methods['blogger.setTemplate']		= 'blogger_setTemplate';
$xmlrpc_methods['metaWeblog.newPost'] = 'metaWeblog_newPost';
$xmlrpc_methods['metaWeblog.getPost'] = 'metaWeblog_getPost';
$xmlrpc_methods['metaWeblog.getCategories'] = 'metaWeblog_getCategories';
$xmlrpc_methods['metaWeblog.getRecentPosts'] = 'metaWeblog_getRecentPosts';
$xmlrpc_methods['metaWeblog.editPost'] = 'metaWeblog_editPost';
$xmlrpc_methods['method_not_found'] = 'XMLRPC_method_not_found';
$xmlrpc_methods['mt.getCategoryList'] = 'mt_getCategoryList';
$xmlrpc_methods['mt.getPostCategories'] = 'mt_getPostCategories';
$xmlrpc_methods['mt.setPostCategories'] = 'mt_setPostCategories';
$xmlrpc_methods['mt.publishPost'] = 'mt_publishPost';
$xmlrpc_request = XMLRPC_parse($HTTP_RAW_POST_DATA);
$methodName = XMLRPC_getMethodName($xmlrpc_request);
$params = XMLRPC_getParams($xmlrpc_request);
define('WEBLOG_XMLPRPC_USERAGENT', 'Loquacity ' . BBLOG_VERSION);
if (!isset($xmlrpc_methods[$methodName])) {
    $xmlrpc_methods['method_not_found']($methodName);
} else {
    //call the method
    $xmlrpc_methods[$methodName]($params);
}
////
// !blogger.getUsersBlogs  	= blogger_getUsersBlogs
// gets a list of the users blogs.
// but at the moment Loquacity is a single-blog thing
// so we just return the config details
function blogger_getUsersBlogs($params)
{
    global $loq;