public function service() { $app = JFactory::getApplication(); $params = JComponentHelper::getParams('com_xmlrpc'); $plugin = $params->get('plugin', 'joomla'); JPluginHelper::importPlugin('xmlrpc', strtolower($plugin)); $allCalls = $app->triggerEvent('onGetWebServices'); if(count($allCalls) < 1){ JError::raiseError(404, JText::_('COM_XMLRPC_SERVICE_WAS_NOT_FOUND')); } $methodsArray = array(); foreach ($allCalls as $calls) { $methodsArray = array_merge($methodsArray, $calls); } @mb_regex_encoding('UTF-8'); @mb_internal_encoding('UTF-8'); require_once dirname(__FILE__).'/libraries/phpxmlrpc/xmlrpc.php'; require_once dirname(__FILE__).'/libraries/phpxmlrpc/xmlrpcs.php'; require_once (JPATH_SITE.'/components/com_content/helpers/route.php'); JTable::addIncludePath(JPATH_ADMINISTRATOR.'/components/com_content/tables'); $xmlrpc = new xmlrpc_server($methodsArray, false); $xmlrpc->functions_parameters_type = 'phpvals'; $encoding = 'UTF-8'; $xmlrpc->xml_header($encoding); $GLOBALS['xmlrpc_internalencoding'] = $encoding; $xmlrpc->setDebug($params->get('debug', JDEBUG)); @ini_set( 'display_errors', $params->get('display_errors', 0)); $data = file_get_contents('php://input'); if(empty($data)){ JError::raiseError(403, JText::_('COM_XMLRPC_INVALID_REQUEST')); } $xmlrpc->service($data); jexit(); }
public function display($cachable = false, $urlparams = array()) { $mainframe = JFactory::getApplication(); $methodsArray = $this->_getServices(); $xmlrpcServer = new xmlrpc_server($methodsArray, false); // allow casting to be defined by that actual values passed $xmlrpcServer->functions_parameters_type = 'phpvals'; // define UTF-8 as the internal encoding for the XML-RPC server $defaultEncoding = 'UTF-8'; $xmlrpcServer->xml_header($defaultEncoding); $xmlrpc_internalencoding = $defaultEncoding; // debug level $xmlrpcServer->setDebug(0); // start the service $xmlrpcServer->service(); exit; }
public function import() { global $xmlrpcString, $xmlrpcBase64, $xmlrpc_internalencoding; /* $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select($db->quoteName('element')); $query->from($db->quoteName('#__extensions')); $query->where($db->quoteName('type') . ' = ' . $db->quote('library')); $query->where($db->quoteName('element') . ' = ' . $db->quote('xmlrpc')); $query->where($db->quoteName('enabled') . ' = 1'); $db->setQuery($query); if ($db->loadResult() == null) { echo '<?xml version="1.0"?> <methodResponse><params><param><value><array><data><value><struct> <member><name>code</name><value><int>15</int></value></member> <member><name>string</name><value><string>XMLRC not supported</string></value></member> </struct></value></data></array></value></param></params></methodResponse>'; return; } */ $app = JFactory::getApplication(); $params = JComponentHelper::getParams('com_j2xml'); $xmlrpcServer = new xmlrpc_server(array('j2xml.import' => array('function' => 'plgXMLRPCJ2XMLServices::import', 'docstring' => 'Import articles from xml file', 'signature' => array(array($xmlrpcString, $xmlrpcBase64, $xmlrpcString, $xmlrpcString)))), false); // allow casting to be defined by that actual values passed $xmlrpcServer->functions_parameters_type = 'phpvals'; // define UTF-8 as the internal encoding for the XML-RPC server $xmlrpcServer->xml_header('UTF-8'); $xmlrpc_internalencoding = 'UTF-8'; // debug level $xmlrpcServer->setDebug($params->get('debug')); // start the service $xmlrpcServer->service(); }
require_once './Mobiquo-Functions.php'; require_once './Mobiquo-Templates.php'; require_once './lib/xmlrpc.inc'; require_once './lib/xmlrpcs.inc'; require_once './method_define.php'; require_once './api/forum.php'; require_once './api/topic.php'; require_once './api/subscription.php'; require_once './api/search.php'; require_once './api/user.php'; require_once './api/post.php'; require_once './api/moderation.php'; header('Mobiquo_is_login: '******'is_guest'] ? 'false' : 'true')); header('Content-type: text/xml'); $rpcServer = new xmlrpc_server($methods, false); $rpcServer->setDebug(1); $rpcServer->compress_response = true; $rpcServer->response_charset_encoding = 'UTF-8'; $pass = $rpcServer->service(); if ($pass !== false) { exit; } // Load settings and the database loadMobiquoSettings(); // Parse the request parseMobRequest(); // Are we closed? if (!empty($context['in_maintenance']) && !$user_info['is_admin'] && !in_array($context['mob_request']['method'], array('get_config', 'login'))) { createErrorResponse(5, ' due to maintenance'); } // Invalid method?
$permNames = array_flip($groupPowers); return array('error' => 'Agent does not have group power to ' . $Permission . '(' . $permNames[$Permission] . ')', 'PermMasked' => $PermMasked, 'params' => var_export($params, TRUE), 'permBitMaskSql' => $sql, 'Permission' => $Permission); } /* return array('error' => 'Reached end' , 'reqAgentMembership' => var_export($reqAgentMembership, TRUE) , 'GroupID' => $GroupID , 'Permission' => $Permission , 'PermMasked' => $PermMasked ); */ return TRUE; } $s = new xmlrpc_server(array("test" => array("function" => "test"), "groups.createGroup" => array("function" => "createGroup", "signature" => $common_sig), "groups.updateGroup" => array("function" => "updateGroup", "signature" => $common_sig), "groups.getGroup" => array("function" => "getGroup", "signature" => $common_sig), "groups.findGroups" => array("function" => "findGroups", "signature" => $common_sig), "groups.getGroupRoles" => array("function" => "getGroupRoles", "signature" => $common_sig), "groups.addRoleToGroup" => array("function" => "addRoleToGroup", "signature" => $common_sig), "groups.removeRoleFromGroup" => array("function" => "removeRoleFromGroup", "signature" => $common_sig), "groups.updateGroupRole" => array("function" => "updateGroupRole", "signature" => $common_sig), "groups.getGroupRoleMembers" => array("function" => "getGroupRoleMembers", "signature" => $common_sig), "groups.setAgentGroupSelectedRole" => array("function" => "setAgentGroupSelectedRole", "signature" => $common_sig), "groups.addAgentToGroupRole" => array("function" => "addAgentToGroupRole", "signature" => $common_sig), "groups.removeAgentFromGroupRole" => array("function" => "removeAgentFromGroupRole", "signature" => $common_sig), "groups.getGroupMembers" => array("function" => "getGroupMembers", "signature" => $common_sig), "groups.addAgentToGroup" => array("function" => "addAgentToGroup", "signature" => $common_sig), "groups.removeAgentFromGroup" => array("function" => "removeAgentFromGroup", "signature" => $common_sig), "groups.setAgentGroupInfo" => array("function" => "setAgentGroupInfo", "signature" => $common_sig), "groups.addAgentToGroupInvite" => array("function" => "addAgentToGroupInvite", "signature" => $common_sig), "groups.getAgentToGroupInvite" => array("function" => "getAgentToGroupInvite", "signature" => $common_sig), "groups.removeAgentToGroupInvite" => array("function" => "removeAgentToGroupInvite", "signature" => $common_sig), "groups.setAgentActiveGroup" => array("function" => "setAgentActiveGroup", "signature" => $common_sig), "groups.getAgentGroupMembership" => array("function" => "getAgentGroupMembership", "signature" => $common_sig), "groups.getAgentGroupMemberships" => array("function" => "getAgentGroupMemberships", "signature" => $common_sig), "groups.getAgentActiveMembership" => array("function" => "getAgentActiveMembership", "signature" => $common_sig), "groups.getAgentRoles" => array("function" => "getAgentRoles", "signature" => $common_sig), "groups.getGroupNotices" => array("function" => "getGroupNotices", "signature" => $common_sig), "groups.getGroupNotice" => array("function" => "getGroupNotice", "signature" => $common_sig), "groups.addGroupNotice" => array("function" => "addGroupNotice", "signature" => $common_sig)), false); $s->functions_parameters_type = 'phpvals'; if (isset($debugXMLRPC) && $debugXMLRPC > 0 && isset($debugXMLRPCFile) && $debugXMLRPCFile != "") { $s->setDebug($debugXMLRPC); } $s->service(); if (isset($debugXMLRPC) && $debugXMLRPC > 0 && isset($debugXMLRPCFile) && $debugXMLRPCFile != "") { $f = fopen($debugXMLRPCFile, "a"); fwrite($f, "\n----- " . date("Y-m-d H:i:s") . " -----\n"); $debugInfo = $s->serializeDebug(); $debugInfo = split("\n", $debugInfo); unset($debugInfo[0]); unset($debugInfo[count($debugInfo) - 1]); $debugInfo = join("\n", $debugInfo); fwrite($f, base64_decode($debugInfo)); fclose($f); } mysql_close($groupDBCon);
require_once JPATH_BASE . DS . 'includes' . DS . 'framework.php'; // We want to echo the errors so that the xmlrpc client has a chance to capture them in the payload JError::setErrorHandling(E_ERROR, 'die'); JError::setErrorHandling(E_WARNING, 'echo'); JError::setErrorHandling(E_NOTICE, 'echo'); // create the mainframe object $mainframe =& JFactory::getApplication('xmlrpc'); // Ensure that this application is enabled if (!$mainframe->getCfg('xmlrpc_server')) { JError::raiseError(403, 'XML-RPC Server not enabled.'); } // Includes the required class file for the XML-RPC Server jimport('phpxmlrpc.xmlrpc'); jimport('phpxmlrpc.xmlrpcs'); // load all available remote calls JPluginHelper::importPlugin('xmlrpc'); $allCalls = $mainframe->triggerEvent('onGetWebServices'); $methodsArray = array(); foreach ($allCalls as $calls) { $methodsArray = array_merge($methodsArray, $calls); } $xmlrpcServer = new xmlrpc_server($methodsArray, false); // allow casting to be defined by that actual values passed $xmlrpcServer->functions_parameters_type = 'phpvals'; // define UTF-8 as the internal encoding for the XML-RPC server $xmlrpcServer->xml_header($mainframe->getEncoding()); $xmlrpc_internalencoding = $mainframe->getEncoding(); // debug level $xmlrpcServer->setDebug(0); // start the service $xmlrpcServer->service();
include BASEDIR . 'modules/Forums/nukebb.php'; // Initialise tapatalk include MOBIDIR . 'include/xmlrpc.inc'; include MOBIDIR . 'include/xmlrpcs.inc'; require MOBIDIR . 'error_code.php'; require MOBIDIR . 'config/config.php'; $mobiquo_config = get_mobiquo_config(); if (empty($mobiquo_config['is_open'])) { header("{$_SERVER['SERVER_PROTOCOL']} 503 Service Unavailable"); exit; } require MOBIDIR . 'mobiquo_common.php'; require MOBIDIR . 'server_define.php'; $phpEx = $mobiquo_config['php_extension']; $xmlrpc_internalencoding = 'UTF-8'; $xmlrpcName = 'DragonflyCMS/' . CPG_NUKE . ' (PHP ' . PHP_MAJOR_VERSION . '; ' . PHP_SAPI . '; ' . PHP_OS . ') XML-RPC Tapatalk/3'; $xmlrpcVersion = 'v' . $mobiquo_config['sys_version']; header('Mobiquo_is_login:'******'true' : 'false')); // Get requested function and load file $request_method_name = get_method_name(); if ($request_method_name && isset($server_param[$request_method_name])) { require MOBIDIR . 'function/' . $request_method_name . '.php'; } $rpcServer = new xmlrpc_server($server_param, false); $rpcServer->setDebug(2); $rpcServer->allow_system_funcs = false; $rpcServer->compress_response = 'false'; $rpcServer->response_charset_encoding = 'UTF-8'; $response = $rpcServer->service(); ini_restore('log_errors'); exit;
/** * Handles incoming requests to the kapost service */ public function index() { //If the request is not a post request 404 if (!$this->request->isPOST()) { return ErrorPage::response_for(404); } //If the request is not the kapost user agent 404 if (self::config()->check_user_agent == true && $this->request->getHeader('User-Agent') != 'Kapost XMLRPC::Client') { return ErrorPage::response_for(404); } $methods = array_fill_keys($this->exposed_methods, array('function' => array($this, 'handleRPCMethod'))); //Disable Content Negotiator and send the text/xml header (which kapost expects) ContentNegotiator::config()->enabled = false; $this->response->addHeader('Content-Type', 'text/xml'); $server = new xmlrpc_server($methods, false); $server->compress_response = true; if (Director::isDev()) { $server->setDebug(3); //Base 64 encoded debug information is included in the response } //Tell XML-RPC to re-throw the exception rather than trap it so we can allow the SilverStripe's normal error handling along side sending the xmlrpc response $server->exception_handling = 2; //Force the internal encoding of the XMLRPC library to utf-8 $GLOBALS['xmlrpc_internalencoding'] = self::config()->database_charset; try { return $server->service($this->request->getBody(), true); } catch (Exception $e) { //Call on SS_Log to log the error SS_Log::log($e, SS_Log::ERR); //Allow exceptions to handle the response $results = $this->extend('onException', $e); if ($results && is_array($results)) { $results = array_filter($results, function ($v) { return !is_null($v) && $v instanceof xmlrpcresp; }); if (count($results) > 0) { $this->generateErrorResponse($server, array_shift($results)); } } //If we're in dev mode relay the actual message to the client if (Director::isDev()) { $response = new xmlrpcresp(0, $e->getCode() + 100, _t('KapostService.ERROR_MESSAGE', '_{message} in {file} line {line_number}', array('message' => $e->getMessage(), 'file' => $e->getFile(), 'line_number' => $e->getLine()))); } else { $response = new xmlrpcresp(0, 17, _t('KapostService.SERVER_ERROR', '_Internal server error')); } return $this->generateErrorResponse($server, $response); } }
/** * Handles incoming requests to the kapost service */ public function index() { //If the request is not a post request 404 if (!$this->request->isPOST()) { return ErrorPage::response_for(404); } //If the request is not the kapost user agent 404 if (self::config()->check_user_agent == true && $this->request->getHeader('User-Agent') != 'Kapost XMLRPC::Client') { return ErrorPage::response_for(404); } $methods = array_fill_keys($this->exposed_methods, array('function' => array($this, 'handleRPCMethod'))); //Disable Content Negotiator and send the text/xml header (which kapost expects) ContentNegotiator::config()->enabled = false; $this->response->addHeader('Content-Type', 'text/xml'); $server = new xmlrpc_server($methods, false); $server->compress_response = true; if (Director::isDev()) { $server->setDebug(3); //Base 64 encoded debug information is included in the response $server->exception_handling = 2; //Exception's sent to the client } //Force the internal encoding of the XMLRPC library to utf-8 $GLOBALS['xmlrpc_internalencoding'] = self::config()->database_charset; return $server->service($this->request->getBody(), true); }