forked from jegelstaff/formulize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmlrpc.php
71 lines (68 loc) · 2.34 KB
/
xmlrpc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/**
* @copyright http://www.xoops.org/ The XOOPS Project
* @copyright XOOPS_copyrights.txt
* @copyright http://www.impresscms.org/ The ImpressCMS Project
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @package core
* @since XOOPS
* @author http://www.xoops.org The XOOPS Project
* @author Sina Asghari (aka stranger) <[email protected]>
* @version $Id: xmlrpc.php 20423 2010-11-20 17:09:38Z phoenyx $
*/
define('XOOPS_XMLRPC', 1);
include './mainfile.php';
include_once ICMS_LIBRARIES_PATH . '/xml/rpc/xmlrpctag.php';
include_once ICMS_LIBRARIES_PATH . '/xml/rpc/xmlrpcparser.php';
icms::$logger->disableLogger();
$response = new XoopsXmlRpcResponse();
$parser = new XoopsXmlRpcParser(rawurlencode($GLOBALS['HTTP_RAW_POST_DATA']));
if (!$parser->parse())
{
$response->add(new XoopsXmlRpcFault(102));
} else {
$module_handler = icms::handler('icms_module');
$module =& $module_handler->getByDirname('news');
if (!is_object($module))
{
$response->add(new XoopsXmlRpcFault(110));
} else {
$methods = explode('.', $parser->getMethodName());
switch($methods[0])
{
case 'blogger':
include_once ICMS_LIBRARIES_PATH. ' /xml/rpc/bloggerapi.php';
$rpc_api = new BloggerApi($parser->getParam(), $response, $module);
break;
case 'metaWeblog':
include_once ICMS_LIBRARIES_PATH . '/xml/rpc/metaweblogapi.php';
$rpc_api = new MetaWeblogApi($parser->getParam(), $response, $module);
break;
case 'mt':
include_once ICMS_LIBRARIES_PATH . '/xml/rpc/movabletypeapi.php';
$rpc_api = new MovableTypeApi($parser->getParam(), $response, $module);
break;
case 'xoops':
default:
include_once ICMS_LIBRARIES_PATH . '/xml/rpc/xoopsapi.php';
$rpc_api = new XoopsApi($parser->getParam(), $response, $module);
break;
}
$method = $methods[1];
if (!method_exists($rpc_api, $method))
{
$response->add(new XoopsXmlRpcFault(107));
} else {
$rpc_api->$method();
}
}
}
$payload =& $response->render();
//$fp = fopen(ICMS_CACHE_PATH.'/xmllog.txt', 'w');
//fwrite($fp, $payload);
//fclose($fp);
header('Server: XOOPS XML-RPC Server');
header('Content-type: text/xml');
header('Content-Length: '.strlen($payload));
echo $payload;
?>