XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
xmlrpc.php
Go to the documentation of this file.
1 <?php
19 define('XOOPS_XMLRPC', 1);
20 
21 include dirname(__FILE__). DIRECTORY_SEPARATOR . 'mainfile.php';
22 
23 error_reporting(0);
24 
25 include_once $GLOBALS['xoops']->path('class/xml/rpc/xmlrpctag.php');
26 include_once $GLOBALS['xoops']->path('class/xml/rpc/xmlrpcparser.php');
27 
28 $GLOBALS['xoopsLogger']->activate(false);
29 
31 $parser = new XoopsXmlRpcParser(rawurlencode($GLOBALS['HTTP_RAW_POST_DATA']));
32 if (!$parser->parse()) {
33  $response->add(new XoopsXmlRpcFault(102));
34 } else {
35  $module_handler =& xoops_gethandler('module');
36  $module =& $module_handler->getByDirname('news');
37  if (!is_object($module)) {
38  $response->add(new XoopsXmlRpcFault(110));
39  } else {
40  $methods = explode('.', $parser->getMethodName());
41  switch ($methods[0]) {
42  case 'blogger':
43  include_once $GLOBALS['xoops']->path('class/xml/rpc/bloggerapi.php');
44  break;
45  case 'metaWeblog':
46  include_once $GLOBALS['xoops']->path('class/xml/rpc/metaweblogapi.php');
47  $rpc_api = new MetaWeblogApi($parser->getParam(), $response, $module);
48  break;
49  case 'mt':
50  include_once $GLOBALS['xoops']->path('class/xml/rpc/movabletypeapi.php');
51  $rpc_api = new MovableTypeApi($parser->getParam(), $response, $module);
52  break;
53  case 'xoops':
54  default:
55  include_once $GLOBALS['xoops']->path('class/xml/rpc/xoopsapi.php');
56  $rpc_api = new XoopsApi($parser->getParam(), $response, $module);
57  break;
58  }
59  $method = $methods[1];
60  if (!method_exists($rpc_api, $method)) {
61  $response->add(new XoopsXmlRpcFault(107));
62  } else {
63  $rpc_api->$method();
64  }
65  }
66 }
67 $payload =& $response->render();
68 header('Server: XOOPS XML-RPC Server');
69 header('Content-type: text/xml');
70 header('Content-Length: ' . strlen($payload));
71 echo $payload;
72 ?>