home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / CMS / xoops-2.0.18.1.exe / xoops-2.0.18.1 / htdocs / xmlrpc.php < prev    next >
Encoding:
PHP Script  |  2006-05-27  |  3.7 KB  |  82 lines

  1. <?php
  2. //  ------------------------------------------------------------------------ //
  3. //                XOOPS - PHP Content Management System                      //
  4. //                    Copyright (c) 2000 XOOPS.org                           //
  5. //                       <http://www.xoops.org/>                             //
  6. //  ------------------------------------------------------------------------ //
  7. //  This program is free software; you can redistribute it and/or modify     //
  8. //  it under the terms of the GNU General Public License as published by     //
  9. //  the Free Software Foundation; either version 2 of the License, or        //
  10. //  (at your option) any later version.                                      //
  11. //                                                                           //
  12. //  You may not change or alter any portion of this comment or credits       //
  13. //  of supporting developers from this source code or any supporting         //
  14. //  source code which is considered copyrighted (c) material of the          //
  15. //  original comment or credit authors.                                      //
  16. //                                                                           //
  17. //  This program is distributed in the hope that it will be useful,          //
  18. //  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
  19. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
  20. //  GNU General Public License for more details.                             //
  21. //                                                                           //
  22. //  You should have received a copy of the GNU General Public License        //
  23. //  along with this program; if not, write to the Free Software              //
  24. //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
  25. //  ------------------------------------------------------------------------ //
  26.  
  27. define('XOOPS_XMLRPC', 1);
  28. include './mainfile.php';
  29. error_reporting(0);
  30. include_once XOOPS_ROOT_PATH.'/class/xml/rpc/xmlrpctag.php';
  31. include_once XOOPS_ROOT_PATH.'/class/xml/rpc/xmlrpcparser.php';
  32.  
  33. global $xoopsErrorHandler;
  34. $xoopsErrorHandler->activate( false );
  35.  
  36. $response = new XoopsXmlRpcResponse();
  37. $parser = new XoopsXmlRpcParser( rawurlencode( $GLOBALS['HTTP_RAW_POST_DATA'] ) );
  38. if (!$parser->parse()) {
  39.     $response->add(new XoopsXmlRpcFault(102));
  40. } else {
  41.     $module_handler =& xoops_gethandler('module');
  42.     $module =& $module_handler->getByDirname('news');
  43.     if (!is_object($module)) {
  44.         $response->add(new XoopsXmlRpcFault(110));
  45.     } else {
  46.         $methods = explode('.', $parser->getMethodName());
  47.         switch ($methods[0]) {
  48.         case 'blogger':
  49.             include_once XOOPS_ROOT_PATH.'/class/xml/rpc/bloggerapi.php';
  50.             $rpc_api = new BloggerApi($parser->getParam(), $response, $module);
  51.             break;
  52.         case 'metaWeblog':
  53.             include_once XOOPS_ROOT_PATH.'/class/xml/rpc/metaweblogapi.php';
  54.             $rpc_api = new MetaWeblogApi($parser->getParam(), $response, $module);
  55.             break;
  56.         case 'mt':
  57.             include_once XOOPS_ROOT_PATH.'/class/xml/rpc/movabletypeapi.php';
  58.             $rpc_api = new MovableTypeApi($parser->getParam(), $response, $module);
  59.             break;
  60.         case 'xoops':
  61.         default:
  62.             include_once XOOPS_ROOT_PATH.'/class/xml/rpc/xoopsapi.php';
  63.             $rpc_api = new XoopsApi($parser->getParam(), $response, $module);
  64.             break;
  65.         }
  66.         $method = $methods[1];
  67.         if (!method_exists($rpc_api, $method)) {
  68.             $response->add(new XoopsXmlRpcFault(107));
  69.         } else {
  70.             $rpc_api->$method();
  71.         }
  72.     }
  73. }
  74. $payload =& $response->render();
  75. //$fp = fopen(XOOPS_CACHE_PATH.'/xmllog.txt', 'w');
  76. //fwrite($fp, $payload);
  77. //fclose($fp);
  78. header('Server: XOOPS XML-RPC Server');
  79. header('Content-type: text/xml');
  80. header('Content-Length: '.strlen($payload));
  81. echo $payload;
  82. ?>