[ Index ]

PHP Cross Reference of Xoops v2.4.5 code documentation

title

Body

[close]

/ -> xmlrpc.php (source)

   1  <?php
   2  /**
   3   * XOOPS XMLRPC
   4   *
   5   * You may not change or alter any portion of this comment or credits
   6   * of supporting developers from this source code or any supporting source code
   7   * which is considered copyrighted (c) material of the original comment or credit authors.
   8   * This program is distributed in the hope that it will be useful,
   9   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11   *
  12   * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
  13   * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
  14   * @package         core
  15   * @since           2.0.0
  16   * @version         $Id: xmlrpc.php 4897 2010-06-19 02:55:48Z phppp $
  17   */
  18  
  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  
  30  $response = new XoopsXmlRpcResponse();
  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  ?>


Generated: Sun Aug 1 01:39:09 2010
Open Source related documentation for developers.