当前位置: 首页>>代码示例>>PHP>>正文


PHP XML_RPC_encode函数代码示例

本文整理汇总了PHP中XML_RPC_encode函数的典型用法代码示例。如果您正苦于以下问题:PHP XML_RPC_encode函数的具体用法?PHP XML_RPC_encode怎么用?PHP XML_RPC_encode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了XML_RPC_encode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: call

 /**
  * Call a method
  * @param string Method name, automatically gets "grav." prepended to it
  * @param Array List of named arguments
  */
 protected function call($method, $params = array())
 {
     #$params = array_map('XML_RPC_encode', $params);
     $params = array_merge($params, array('apikey' => $this->apikey));
     $msg = new XML_RPC_Message("grav.{$method}", array(XML_RPC_encode($params)));
     $response = $this->client()->send($msg);
     if (!$response->faultCode()) {
         $value = $response->value();
         $value = XML_RPC_decode($value);
         return $value;
     } else {
         throw new GravatarException($response->faultString(), $response->faultCode());
     }
 }
开发者ID:khanhnnvn,项目名称:OKMS,代码行数:19,代码来源:GravatarRPC.class.php

示例2: UPMS_registerVersion

function UPMS_registerVersion($aServer, $id = 0, $name = 'unknown', $comments = '')
{
    // Prepare variables
    $aParams = array('user_name' => $name, 'changeset_id' => $id, 'comments' => $comments);
    // Create the XML-RPC message
    $message = new XML_RPC_Message('OXUPMS.registerID', array(XML_RPC_encode($aParams)));
    // Create an XML-RPC client to talk to the XML-RPC server
    $client = new XML_RPC_Client($aServer['path'], $aServer['host'], $aServer['port']);
    $client->debug = 0;
    // Send the XML-RPC message to the server
    $response = $client->send($message, 60, 'http');
    // Was the response OK?
    if ($response && $response->faultCode() == 0) {
        $response = XML_RPC_decode($response->value());
        return $response;
    }
    return array('id' => 'unregistered', 'user' => 'unregistered', 'comments' => 'unregistered');
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:18,代码来源:upms.inc.php

示例3: sxr_call

function sxr_call($host, $port, $path, $func, $params)
{
    debug(XMLRPC, "SXR calling {$func} via http://{$host}:{$port}/{$path}");
    global $sxr_clients;
    $key = "{$host}:{$port}/{$path}";
    if (!array_key_exists($key, $sxr_clients)) {
        $sxr_clients[$key] = new XML_RPC_Client($path, $host, $port);
    }
    $p = array();
    if (is_array($params)) {
        foreach ($params as $i) {
            array_push($p, XML_RPC_encode($i));
        }
    } else {
        $p[0] = $params;
    }
    $req = new XML_RPC_Message($func, $p);
    $resp = $sxr_clients[$key]->send($req);
    if ($resp->faultCode()) {
        return FALSE;
    } else {
        return XML_RPC_decode($resp->value());
    }
}
开发者ID:palfrey,项目名称:phplib,代码行数:24,代码来源:simplexmlrpc.php

示例4: checkForUpdates

 function checkForUpdates($aParams)
 {
     require_once 'XML/RPC.php';
     $message = new XML_RPC_Message('OXPS.checkForUpdate', array(XML_RPC_encode($aParams)));
     $aConf = $GLOBALS['_MAX']['CONF']['pluginUpdatesServer'];
     $client = new XML_RPC_Client($aConf['path'] . '/xmlrpc.php', $aConf['host'], $aConf['httpPort']);
     $client->debug = 0;
     // Send the XML-RPC message to the server
     $response = $client->send($message, 60, 'http');
     // Assign the response code strings
     if ($response && $response->faultCode() == 0) {
         $response = XML_RPC_decode($response->value());
         switch ($response['status']) {
             case 0:
                 if (substr($response['downloadurl'], 0, 7) == '{local}') {
                     $response['downloadurl'] = str_replace('{local}', $aConf['host'], $response['downloadurl']);
                 }
                 $aResult[] = '<a href="http://' . $response['downloadurl'] . '" target="_blank">Download Now</a>';
                 break;
         }
         return $response;
     } else {
         $this->_logError($response->fs);
         return false;
     }
 }
开发者ID:villos,项目名称:tree_admin,代码行数:26,代码来源:PluginManager.php

示例5: xmlrpc_get_response

/**
 * @copyright 2005-2008 OpenPNE Project
 * @license   http://www.php.net/license/3_01.txt PHP License 3.01
 */
function xmlrpc_get_response($params)
{
    return new XML_RPC_Response(XML_RPC_encode($params));
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:8,代码来源:xmlrpc.php

示例6: XML_RPC_encode

function XML_RPC_encode($php_val)
{
    global $XML_RPC_Boolean;
    global $XML_RPC_Int;
    global $XML_RPC_Double;
    global $XML_RPC_String;
    global $XML_RPC_Array;
    global $XML_RPC_Struct;
    $type = gettype($php_val);
    $XML_RPC_val = new XML_RPC_value();
    switch ($type) {
        case "array":
        case "object":
            $arr = array();
            while (list($k, $v) = each($php_val)) {
                $arr[$k] = XML_RPC_encode($v);
            }
            $XML_RPC_val->addStruct($arr);
            break;
        case "integer":
            $XML_RPC_val->addScalar($php_val, $XML_RPC_Int);
            break;
        case "double":
            $XML_RPC_val->addScalar($php_val, $XML_RPC_Double);
            break;
        case "string":
        case "NULL":
            $XML_RPC_val->addScalar($php_val, $XML_RPC_String);
            break;
            // <G_Giunta_2001-02-29>
            // Add support for encoding/decoding of booleans, since they are supported in PHP
        // <G_Giunta_2001-02-29>
        // Add support for encoding/decoding of booleans, since they are supported in PHP
        case "boolean":
            $XML_RPC_val->addScalar($php_val, $XML_RPC_Boolean);
            break;
            // </G_Giunta_2001-02-29>
        // </G_Giunta_2001-02-29>
        case "unknown type":
        default:
            $XML_RPC_val = false;
            break;
    }
    return $XML_RPC_val;
}
开发者ID:verdurin,项目名称:mrbs-mcr,代码行数:45,代码来源:RPC.php

示例7: _send

 /**
  * This function sends a method call to a specified service.
  *
  * @param string $method  The name of the remote method to call.
  * @param mixed  $data    The data to send to the web service.
  * @return mixed The response from the server or false in the event of failure.
  */
 function _send($method, $data)
 {
     $dataMessage = array();
     foreach ($data as $element) {
         if (is_object($element) && is_subclass_of($element, 'OA_Info')) {
             $dataMessage[] = XmlRpcUtils::getEntityWithNotNullFields($element);
         } else {
             $dataMessage[] = XML_RPC_encode($element);
         }
     }
     $message = new XML_RPC_Message($method, $dataMessage);
     $client =& $this->_getClient();
     // Send the XML-RPC message to the server.
     $response = $client->send($message, $this->timeout, $this->ssl ? 'https' : 'http');
     // Check for an error response.
     if ($response && $response->faultCode() == 0) {
         $result = XML_RPC_decode($response->value());
     } else {
         trigger_error('XML-RPC Error (' . $response->faultCode() . '): ' . $response->faultString() . ' in method ' . $method . '()', E_USER_ERROR);
     }
     return $result;
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:29,代码来源:openx-api-v2-xmlrpc.inc.php

示例8: getRecentPosts

 function getRecentPosts($message)
 {
     $args = $this->_params_to_args($message);
     if (count($args) != 4) {
         return new XML_RPC_Response(0, midcom_connection::get_error(), 'Invalid arguments.');
     }
     if ($args[0] != $this->_content_topic->guid) {
         return new XML_RPC_Response(0, midcom_connection::get_error(), 'Blog ID does not match this folder.');
     }
     if (!midcom::get('auth')->login($args[1], $args[2])) {
         return new XML_RPC_Response(0, midcom_connection::get_error(), 'Authentication failed.');
     }
     midcom::get('auth')->initialize();
     $response = array();
     $qb = midcom_db_article::new_query_builder();
     $qb->set_limit($args[3]);
     $qb->add_constraint('topic', '=', $this->_content_topic->id);
     $qb->add_order('metadata.published', 'DESC');
     $articles = $qb->execute();
     foreach ($articles as $article) {
         if (!$this->_datamanager->autoset_storage($article)) {
             // This article has something wrong, skip it
             continue;
         }
         $arg = $article->name ? $article->name : $article->guid;
         if ($this->_config->get('view_in_url')) {
             $link = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) . "view/{$arg}/";
         } else {
             $link = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX) . "{$arg}/";
         }
         if (array_key_exists('categories', $this->_datamanager->types)) {
             $categories = $this->_datamanager->types['categories']->selection;
         } else {
             $categories = array();
         }
         $response_array = array('postid' => new XML_RPC_Value($article->guid, 'string'), 'title' => new XML_RPC_Value($article->title, 'string'), 'permaLink' => new XML_RPC_Value(midcom::get('permalinks')->create_permalink($article->guid), 'string'), 'link' => new XML_RPC_Value($link, 'string'), 'description' => new XML_RPC_Value($article->content, 'string'), 'mt_excerpt' => new XML_RPC_Value($article->abstract, 'string'), 'dateCreated' => new XML_RPC_Value(gmdate("Ymd\\TH:i:s\\Z", $article->metadata->published), 'dateTime.iso8601'), 'categories' => XML_RPC_encode($categories));
         if ($this->_positioning) {
             $object_position = new org_routamc_positioning_object($article);
             $coordinates = $object_position->get_coordinates();
             $response_array['georss:point'] = new XML_RPC_Value("{$coordinates['latitude']} {$coordinates['longitude']}", 'string');
         }
         $response[] = new XML_RPC_Value($response_array, 'struct');
     }
     return new XML_RPC_Response(new XML_RPC_Value($response, 'array'));
 }
开发者ID:nemein,项目名称:openpsa,代码行数:45,代码来源:metaweblog.php

示例9: get_notices_xmlrpc

function get_notices_xmlrpc($raw_params)
{
    global $g, $xmlrpc_g;
    $params = xmlrpc_params_to_php($raw_params);
    if (!xmlrpc_auth($params)) {
        xmlrpc_authfail();
        return $xmlrpc_g['return']['authfail'];
    }
    if (!function_exists("get_notices")) {
        require "notices.inc";
    }
    if (!$params) {
        $toreturn = get_notices();
    } else {
        $toreturn = get_notices($params);
    }
    $response = new XML_RPC_Response(XML_RPC_encode($toreturn));
    return $response;
}
开发者ID:michaeleino,项目名称:pfsense,代码行数:19,代码来源:xmlrpc.php

示例10: setCampaignsProperties

 /**
  * Call XMLRPC method from central
  *  for set campaign data from oap
  * Input - array data and ids campains from oap
  *
  * The $aCampaigns array format
  *
  * Array
  * (
  *      [21]   => Array
  *               (
  *                  [id]             => 2
  *                  [invocationCode] => ''
  *                  [deliveredCount] => 50
  *               )
  *      [45]   => Array
  *               (
  *                  [id]             => 5
  *                  [invocationCode] => ''
  *                  [deliveredCount] => 0
  *               )
  * )
  *
  * @param array $aCampaigns
  */
 function setCampaignsProperties($aCampaigns)
 {
     return $this->oRpc->callNoAuth('setCampaignsProperties', array(XML_RPC_encode($aCampaigns)));
 }
开发者ID:villos,项目名称:tree_admin,代码行数:29,代码来源:RpcMapper.php

示例11: checkForUpdates

 /**
  * Connect to OpenX Sync to check for updates
  *
  * @param float $already_seen Only check for updates newer than this value.
  * @return array An array of two items:
  *
  *               Item 0 is the XML-RPC error code. Meanings:
  *                      -2  => The admin user has disabled update checking
  *                      -1  => No response from the server
  *                  0 - 799 => XML-RPC library error codes
  *                       0  => No error
  *                     800  => No updates
  *                     801+ => Error codes from the remote XML-RPC server
  *
  *               Item 1 is either the error message (item 1 != 0), or an array containing update info
  */
 function checkForUpdates($already_seen = 0)
 {
     global $XML_RPC_erruser;
     if (!$this->aConf['sync']['checkForUpdates']) {
         // Checking for updates has been disabled by the admin user,
         // so do not communicate with the OpenX server that provides
         // the details of what upgrades are available - just return
         // an 800 "error"
         $aReturn = array(-2, 'Check for updates has been disabled by the OpenX administrator.');
         return $aReturn;
     }
     // Should this server's technology stack be shared with OpenX?
     $shareTechStack = false;
     if ($this->aConf['sync']['shareStack']) {
         $shareTechStack = true;
     }
     // Should this server's aggregate impression and click statistcs
     // be shared with OpenX?
     $shareStats = false;
     if ($this->aConf['sync']['shareData']) {
         $shareStats = true;
     }
     // Create the XML-RPC client object
     $client = OA_Central::getXmlRpcClient($this->_conf);
     // Prepare the parameters required for the XML-RPC call to
     // obtain if an update is available for this OpenX installation
     $params = array(new XML_RPC_Value(MAX_PRODUCT_NAME, 'string'), new XML_RPC_Value($this->getConfigVersion(OA_Dal_ApplicationVariables::get('oa_version')), 'string'), new XML_RPC_Value($already_seen, 'string'), new XML_RPC_Value('', 'string'), new XML_RPC_Value(OA_Dal_ApplicationVariables::get('platform_hash'), 'string'));
     // Has the OpenX admin user kindly agreed to share the technology
     // stack that OpenX is running on, so that OpenX can monitor what
     // technology stacks the community users, to help with supporting
     // OpenX?
     $aTechStack = array('data' => false);
     if ($shareTechStack) {
         // Thanks, OpenX admin user! You're a star! Prepare the
         // technology stack data and add it to the XML-RPC call
         if ($this->oDbh->dbsyntax == 'mysql') {
             $dbms = 'MySQL';
         } else {
             if ($this->oDbh->dbsyntax == 'pgsql') {
                 $dbms = 'PostgreSQL';
             } else {
                 $dbms = 'UnknownSQL';
             }
         }
         $aTechStack = array('os_type' => php_uname('s'), 'os_version' => php_uname('r'), 'webserver_type' => isset($_SERVER['SERVER_SOFTWARE']) ? preg_replace('#^(.*?)/.*$#', '$1', $_SERVER['SERVER_SOFTWARE']) : '', 'webserver_version' => isset($_SERVER['SERVER_SOFTWARE']) ? preg_replace('#^.*?/(.*?)(?: .*)?$#', '$1', $_SERVER['SERVER_SOFTWARE']) : '', 'db_type' => $dbms, 'db_version' => $this->oDbh->queryOne("SELECT VERSION()"), 'php_version' => phpversion(), 'php_sapi' => ucfirst(php_sapi_name()), 'php_extensions' => get_loaded_extensions(), 'php_register_globals' => (bool) ini_get('register_globals'), 'php_magic_quotes_gpc' => (bool) ini_get('magic_quotes_gpc'), 'php_safe_mode' => (bool) ini_get('safe_mode'), 'php_open_basedir' => (bool) strlen(ini_get('open_basedir')), 'php_upload_tmp_readable' => (bool) is_readable(ini_get('upload_tmp_dir') . DIRECTORY_SEPARATOR));
     }
     $params[] = XML_RPC_Encode($aTechStack);
     // Has the OpenX admin user kindly agreed to share their
     // aggregate impression and click statistics to help
     // OpenX monitor what sizes of OpenX installations exist
     // (to ensure OpenX scales to appropriate sizes), and also
     // so that the total community size can be shown in the
     // Dashboard?
     $aStats = array();
     if ($shareStats) {
         // Thanks, OpenX admin user! You're a star! Prepare the
         // aggregate impression and click statistics data and
         // add it to the XML-RPC call
         foreach ($this->buildStats() as $k => $v) {
             $aStats[$k] = XML_RPC_encode($v);
         }
     }
     $params[] = new XML_RPC_Value($aStats, 'struct');
     // Add the OpenX package Origin ID, if appropriate
     $originID = '';
     $originFile = MAX_PATH . '/etc/origin.txt';
     if (file_exists($originFile) && is_readable($originFile)) {
         $rOriginFile = @fopen($originFile, 'r');
         if ($rOriginFile !== false) {
             $originID = fread($rOriginFile, 32);
             fclose($rOriginFile);
         }
         if ($originID === false) {
             $originID = '';
         }
     }
     $params[] = new XML_RPC_Value($originID, 'string');
     // Add the registered email address
     $params[] = new XML_RPC_Value(OA_Dal_ApplicationVariables::get('sync_registered_email'), 'string');
     // Create the XML-RPC request message
     $msg = new XML_RPC_Message("OpenX.Sync", $params);
     // Send the XML-RPC request message
     if ($response = $client->send($msg, 10)) {
         // XML-RPC server found, now checking for errors
//.........这里部分代码省略.........
开发者ID:villos,项目名称:tree_admin,代码行数:101,代码来源:Sync.php

示例12: get_remote_log

function get_remote_log()
{
    global $config, $g, $postfix_dir;
    $curr_time = time();
    $log_time = date('YmdHis', $curr_time);
    #get protocol
    if ($config['system']['webgui']['protocol'] != "") {
        $synchronizetoip = $config['system']['webgui']['protocol'] . "://";
    }
    #get port
    $port = $config['system']['webgui']['port'];
    #if port is empty lets rely on the protocol selection
    if ($port == "") {
        $port = $config['system']['webgui']['protocol'] == "http" ? "80" : "443";
    }
    $synchronizetoip .= $sync_to_ip;
    if (is_array($config['installedpackages']['postfixsync'])) {
        foreach ($config['installedpackages']['postfixsync']['config'][0]['row'] as $sh) {
            $sync_to_ip = $sh['ipaddress'];
            $sync_type = $sh['sync_type'];
            $password = $sh['password'];
            $file = '/var/db/postfix/' . $server . '.sql';
            #get remote data
            if ($sync_type == 'fetch') {
                $url = $synchronizetoip . $sync_to_ip;
                print "{$sync_to_ip} {$url}, {$port}\n";
                $method = 'pfsense.exec_php';
                $execcmd = "require_once('/usr/local/www/postfix.php');\n";
                $execcmd .= '$toreturn=get_sql(' . $log_time . ');';
                /* assemble xmlrpc payload */
                $params = array(XML_RPC_encode($password), XML_RPC_encode($execcmd));
                log_error("postfix get sql data from {$sync_to_ip}.");
                $msg = new XML_RPC_Message($method, $params);
                $cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
                $cli->setCredentials('admin', $password);
                #$cli->setDebug(1);
                $resp = $cli->send($msg, "250");
                $a = $resp->value();
                $errors = 0;
                #var_dump($sql);
                foreach ($a as $b) {
                    foreach ($b as $c) {
                        foreach ($c as $d) {
                            foreach ($d as $e) {
                                $update = unserialize($e['string']);
                                print $update['day'] . "\n";
                                if ($update['day'] != "") {
                                    create_db($update['day'] . ".db");
                                    if ($debug = true) {
                                        print $update['day'] . " writing from remote system to db...";
                                    }
                                    $dbhandle = sqlite_open($postfix_dir . '/' . $update['day'] . ".db", 0666, $error);
                                    #file_put_contents("/tmp/".$key.'-'.$update['day'].".sql",gzuncompress(base64_decode($update['sql'])), LOCK_EX);
                                    $ok = sqlite_exec($dbhandle, gzuncompress(base64_decode($update['sql'])), $error);
                                    if (!$ok) {
                                        $errors++;
                                        die("Cannot execute query. {$error}\n" . $update['sql'] . "\n");
                                    } else {
                                        if ($debug = true) {
                                            print "ok\n";
                                        }
                                    }
                                    sqlite_close($dbhandle);
                                }
                            }
                        }
                    }
                }
                if ($errors == 0) {
                    $method = 'pfsense.exec_php';
                    $execcmd = "require_once('/usr/local/www/postfix.php');\n";
                    $execcmd .= 'flush_sql(' . $log_time . ');';
                    /* assemble xmlrpc payload */
                    $params = array(XML_RPC_encode($password), XML_RPC_encode($execcmd));
                    log_error("postfix flush sql buffer file from {$sync_to_ip}.");
                    $msg = new XML_RPC_Message($method, $params);
                    $cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
                    $cli->setCredentials('admin', $password);
                    #$cli->setDebug(1);
                    $resp = $cli->send($msg, "250");
                }
            }
        }
    }
}
开发者ID:randyqx,项目名称:pfsense-packages,代码行数:85,代码来源:postfix.php

示例13: _setRPCTypeWithDefaultValues

 /**
  * Set RPC type for variable with default values.
  *
  * @access private
  *
  * @param string $type
  * @param mixed $variable
  *
  * @return XML_RPC_Value or false
  */
 function _setRPCTypeWithDefaultValues($type, $variable)
 {
     switch ($type) {
         case 'struct':
             if (is_null($variable)) {
                 $variable = array();
             }
             return XML_RPC_encode($variable);
         case 'array':
             if (is_null($variable)) {
                 $variable = array();
             }
             return XML_RPC_encode($variable);
         case 'string':
             if (is_null($variable)) {
                 $variable = '';
             }
             return new XML_RPC_Value($variable, $GLOBALS['XML_RPC_String']);
         case 'integer':
             if (is_null($variable)) {
                 $variable = 0;
             }
             return new XML_RPC_Value($variable, $GLOBALS['XML_RPC_Int']);
         case 'float':
         case 'double':
             if (is_null($variable)) {
                 $variable = 0.0;
             }
             return new XML_RPC_Value($variable, $GLOBALS['XML_RPC_Double']);
         case 'date':
             $dateVariable = null;
             if (isset($variable)) {
                 if (!is_string($variable)) {
                     Max::raiseError('Date for statistics should be represented as string');
                     exit;
                 }
                 if (!empty($variable)) {
                     $dateVariable = date('Ymd\\TH:i:s', strtotime($variable));
                 }
             }
             return new XML_RPC_Value($dateVariable, $GLOBALS['XML_RPC_DateTime']);
     }
     Max::raiseError('Unsupported Xml Rpc type \'' . $type . '\'');
     exit;
 }
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:55,代码来源:XmlRpcUtils.php

示例14: register_user

/**
 * @param $params
 * @return XML_RPC_Response
 */
function register_user($params)
{
    global $tikilib, $prefs, $registrationlib, $logslib;
    $key = $params->getParam(0);
    $key = $key->scalarval();
    if (!isset($prefs['known_hosts'][$key]) or $prefs['known_hosts'][$key]['ip'] != $tikilib->get_ip_address()) {
        $msg = tra('Invalid server key');
        if ($prefs['intertiki_errfile']) {
            logit($prefs['intertiki_errfile'], $msg, $key, INTERTIKI_BADKEY, $prefs['known_hosts'][$key]['name']);
        }
        $logslib->add_log('intertiki', $msg . ' from ' . $prefs['known_hosts'][$key]['name'], $login);
        return new XML_RPC_Response(0, 101, $msg);
    }
    if (!isset($prefs['known_hosts'][$key]['allowusersregister']) || $prefs['known_hosts'][$key]['allowusersregister'] != 'y') {
        return new XML_RPC_Response(0, 101, 'Users are not allowed to register via intertiki on this master.');
    }
    require_once 'lib/registration/registrationlib.php';
    $result = $registrationlib->register_new_user_from_intertiki(XML_RPC_decode($params->getParam(1)));
    return new XML_RPC_Response(XML_RPC_encode($result));
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:24,代码来源:remote.php

示例15: call

 /**
  * A method to perform a call to the OAC XML-RPC server
  *
  * @param string $methodName The RPC method name
  * @param int    $authType   Type of required authentication, see constants
  * @param array  $aParams    Array of XML_RPC_Values
  * @return mixed The returned value or PEAR_Error on error
  */
 function call($methodName, $authType, $aParams = null, $recursionLevel = 0)
 {
     $aPref = $GLOBALS['_MAX']['PREF'];
     $oMsg = new XML_RPC_Message('oac.' . $methodName);
     $oMsg->remove_extra_lines = $this->remove_extra_lines;
     $aHeader = array('protocolVersion' => OA_DAL_CENTRAL_PROTOCOL_VERSION, 'ph' => OA_Dal_ApplicationVariables::get('platform_hash'));
     if ($authType & OA_DAL_CENTRAL_AUTH_M2M) {
         if (empty($this->oCentral)) {
             MAX::raiseError('M2M authentication used with a non M2M-enabled OA_Central object');
         }
         $aHeader['accountId'] = (int) $this->oCentral->accountId;
         $aHeader['m2mPassword'] = OA_Dal_Central_M2M::getM2MPassword($this->oCentral->accountId);
         if (empty($aHeader['m2mPassword']) || isset($GLOBALS['OX_CLEAR_M2M_PASSWORD'][$this->oCentral->accountId]) && $GLOBALS['OX_CLEAR_M2M_PASSWORD'][$this->oCentral->accountId] == true) {
             // No password stored, connect!
             $result = $this->oCentral->connectM2M();
             if (PEAR::isError($result)) {
                 return $result;
             }
             $aHeader['m2mPassword'] = $result;
         }
     }
     if ($authType & OA_DAL_CENTRAL_AUTH_SSO) {
         $aHeader['ssoUsername'] = $this->ssoUsername;
         $aHeader['ssoPassword'] = $this->ssoPassword;
     }
     if ($authType & OA_DAL_CENTRAL_AUTH_CAPTCHA) {
         $aHeader['ssoCaptcha'] = isset($_REQUEST['captcha-value']) ? $_REQUEST['captcha-value'] : '';
         $aHeader['ssoCaptchaRandom'] = isset($_REQUEST['captcha-random']) ? $_REQUEST['captcha-random'] : '';
     }
     $oMsg->addParam(XML_RPC_encode($aHeader));
     if (is_array($aParams)) {
         foreach ($aParams as $oParam) {
             $oMsg->addParam($oParam);
         }
     }
     OA::disableErrorHandling();
     $oResponse = $this->oXml->send($oMsg, OAC_RPC_TIMEOUT);
     OA::enableErrorHandling();
     if (!$oResponse) {
         return new PEAR_Error('XML-RPC connection error', OA_CENTRAL_ERROR_XML_RPC_CONNECTION_ERROR);
     }
     if ($oResponse->faultCode() || $oResponse->faultString()) {
         // Deal with particular response codes at Rpc level, avoiding endless recursion
         if (!$recursionLevel) {
             switch ($oResponse->faultCode()) {
                 case OA_CENTRAL_ERROR_PLATFORM_DOES_NOT_EXIST:
                     OA::disableErrorHandling();
                     $oSync = new OA_Sync();
                     $oSync->checkForUpdates();
                     OA::enableErrorHandling();
                     return $this->call($methodName, $authType, $aParams, ++$recursionLevel);
                 case OA_CENTRAL_ERROR_ERROR_NOT_AUTHORIZED:
                     if (!($authType & OA_DAL_CENTRAL_AUTH_M2M)) {
                         break;
                     } else {
                         // Go with OA_CENTRAL_ERROR_M2M_PASSWORD_INVALID
                     }
                 case OA_CENTRAL_ERROR_M2M_PASSWORD_INVALID:
                     // OAP was asked to connect the account to get a password
                     // Set clear the password and retry (old password is in DB in case of problems with receiving new one)
                     $GLOBALS['OX_CLEAR_M2M_PASSWORD'][$this->oCentral->accountId] = true;
                     return $this->call($methodName, $authType, $aParams, ++$recursionLevel, true);
                 case OA_CENTRAL_ERROR_M2M_PASSWORD_EXPIRED:
                     $result = $this->_reconnectM2M();
                     if (PEAR::isError($result)) {
                         return $result;
                     }
                     return $this->call($methodName, $authType, $aParams, ++$recursionLevel);
             }
         }
         return new PEAR_Error($oResponse->faultString(), $oResponse->faultCode());
     }
     $ret = XML_RPC_decode($oResponse->value());
     // handling unknown server errors
     // this may happen due to difference in Java/PHP XML-RPC handling errors
     if (is_array($ret) && (isset($ret['faultCode']) || isset($ret['faultCode']))) {
         return new PEAR_Error('Unknown server error', OA_CENTRAL_ERROR_SERVER_ERROR);
     }
     return $ret;
 }
开发者ID:villos,项目名称:tree_admin,代码行数:88,代码来源:Rpc.php


注:本文中的XML_RPC_encode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。