本文整理汇总了PHP中XML_RPC_Value类的典型用法代码示例。如果您正苦于以下问题:PHP XML_RPC_Value类的具体用法?PHP XML_RPC_Value怎么用?PHP XML_RPC_Value使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XML_RPC_Value类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: XML_RPC_Server_listMethods
/**
* Lists all the methods that the XML-RPC server knows how to dispatch
*
* @return object a new XML_RPC_Response object
*/
function XML_RPC_Server_listMethods($server, $m)
{
global $XML_RPC_err, $XML_RPC_str, $XML_RPC_Server_dmap;
$v = new XML_RPC_Value();
$outAr = array();
foreach ($server->dmap as $key => $val) {
$outAr[] = new XML_RPC_Value($key, 'string');
}
foreach ($XML_RPC_Server_dmap as $key => $val) {
$outAr[] = new XML_RPC_Value($key, 'string');
}
$v->addArray($outAr);
return new XML_RPC_Response($v);
}
开发者ID:altesien,项目名称:FinalProject,代码行数:19,代码来源:Server.php
示例2: xmlrpc_smtp2pne
function xmlrpc_smtp2pne($message)
{
// パラメータを取得
$param = $message->getParam(0);
if (!XML_RPC_Value::isValue($param)) {
return $param;
}
$params = XML_RPC_decode($param);
// 入力チェック とりあえず空かどうかのみ
if (empty($params['prefix']) and empty($params['domain'])) {
return xmlrpc_get_response_faultDefault('incorrect_params');
}
if (empty($params['to'])) {
return xmlrpc_get_response_faultDefault('incorrect_params');
}
if (empty($params['from'])) {
return xmlrpc_get_response_faultDefault('incorrect_params');
}
// デコーダオブジェクトを作成
$options['from_encoding'] = 'UTF-8';
$options['to_encoding'] = 'UTF-8';
$options['img_tmp_dir'] = OPENPNE_VAR_DIR . '/tmp';
$options['img_max_filesize'] = IMAGE_MAX_FILESIZE * 1024;
$options['trim_doublebyte_space'] = OPENPNE_TRIM_DOUBLEBYTE_SPACE;
$decoder =& new OpenPNE_KtaiMail_RPC($options);
$decoder->assign($params);
// メール受信処理オブジェクトを起動
$mail_sns =& new mail_sns($decoder);
if (!$mail_sns->main()) {
//エラーの場合はfaultCodeを返す
return xmlrpc_get_fault_response(56, 'Can\'t Receive Mail');
}
return xmlrpc_get_response(0);
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:34,代码来源:smtp2pne.php
示例3: XML_RPC_Server_listMethods
function XML_RPC_Server_listMethods($server, $m)
{
global $XML_RPC_err, $XML_RPC_str, $XML_RPC_Server_dmap;
$v = new XML_RPC_Value();
$dmap = $server->dmap;
$outAr = array();
for (reset($dmap); list($key, $val) = each($dmap);) {
$outAr[] = new XML_RPC_Value($key, "string");
}
$dmap = $XML_RPC_Server_dmap;
for (reset($dmap); list($key, $val) = each($dmap);) {
$outAr[] = new XML_RPC_Value($key, "string");
}
$v->addArray($outAr);
return new XML_RPC_Response($v);
}
开发者ID:ber5ien,项目名称:www.jade-palace.co.uk,代码行数:16,代码来源:Server.php
示例4: xmlrpc_000_auth
/**
* 認証API
*/
function xmlrpc_000_auth($message)
{
$param = $message->getParam(0);
if (!XML_RPC_Value::isValue($param)) {
return false;
}
$params = XML_RPC_decode($param);
if (empty($params['sid'])) {
return false;
}
if (empty($params['mid'])) {
return false;
}
if (empty($params['dt'])) {
return false;
}
$c_member_id = $params['mid'];
$datetime = $params['dt'];
if (!db_member_c_member4c_member_id_LIGHT($c_member_id)) {
return xmlrpc_get_fault_response(56);
}
if (!($member_token = db_api_get_member_token($c_member_id))) {
return xmlrpc_get_fault_response(52);
}
$session_id = api_get_sid($c_member_id, $member_token, $datetime);
if ($params['sid'] != $session_id) {
return xmlrpc_get_fault_response(52);
}
return xmlrpc_get_response($c_member_id);
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:33,代码来源:000_auth.php
示例5: getScalarValue
/**
* Aux functions
*
* @access public
* @param object $p
* @param string $i
* @return mixed
*/
function getScalarValue($p, $i)
{
$r = $p->getParam($i);
if (!XML_RPC_Value::isValue($r)) {
return false;
//return new XML_RPC_Response(0, $GLOBALS['XML_RPC_erruser']+3, 'fubar user param');
}
return $r->scalarval();
}
开发者ID:juniortux,项目名称:jaws,代码行数:17,代码来源:XmlRpc.php
示例6: xmlrpc_di_000_get_diary
function xmlrpc_di_000_get_diary($message)
{
$dummy = array();
$re_false = array('result' => 1, 'list' => $dummy);
$param = $message->getParam(0);
if (!XML_RPC_Value::isValue($param)) {
return xmlrpc_get_response($re_false);
}
$params = XML_RPC_decode($param);
if (empty($params['mid_to'])) {
//対象メンバID必須
return xmlrpc_get_response($re_false);
}
if (empty($params['count'])) {
//取得数必須
return xmlrpc_get_response($re_false);
}
if (!is_numeric($params['mid_to'])) {
//対象メンバIDは整数値
return xmlrpc_get_response($re_false);
}
if (!empty($params['mid_from'])) {
//アクセスメンバIDは(存在する場合は)整数値
if (!is_numeric($params['mid_from'])) {
return xmlrpc_get_response($re_false);
}
}
if (!is_numeric($params['count'])) {
//取得数は整数値
return xmlrpc_get_response($re_false);
}
if ($params['count'] < 0) {
//取得数は正
return xmlrpc_get_response($re_false);
}
$member_id_to = $params['mid_to'];
$member_id_from = $params['mid_from'];
$count = $params['count'];
if ($count > 100) {
//取得最大数は100
$count = 100;
}
if (!($arr = OP::op_diary_get_c_diary($member_id_to, $member_id_from, $count))) {
return xmlrpc_get_response($re_false);
} else {
foreach ($arr as $key => $value) {
$diary[$key]['id'] = $arr[$key]['c_diary_id'];
$diary[$key]['subject'] = $arr[$key]['subject'];
$diary[$key]['body'] = $arr[$key]['body'];
$diary[$key]['datetime'] = date('Y/m/d H:i:s', strtotime($arr[$key]['r_datetime']));
}
$re_true = array('result' => 0, 'list' => $diary);
return xmlrpc_get_response($re_true);
}
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:55,代码来源:di_000_get_diary.php
示例7: xmlrpc_002_get_member_point
/**
* @copyright 2005-2008 OpenPNE Project
* @license http://www.php.net/license/3_01.txt PHP License 3.01
*/
function xmlrpc_002_get_member_point($message)
{
$param = $message->getParam(0);
if (!XML_RPC_Value::isValue($param)) {
return false;
}
$params = XML_RPC_decode($param);
if (empty($params['c_member_id'])) {
return false;
}
$point = get_point($params['c_member_id']);
return xmlrpc_get_response($point);
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:17,代码来源:002_get_member_point.php
示例8: getDefinition
public function getDefinition($params)
{
// get word
$param = $params->getParam(0);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$word = $param->scalarval();
// get the definition by the word.
$message = $this->objMxitDictionary->getDefinition($word);
$val = $message['definition'];
// return the value as an XML-RPC value and response.
$val2send = new XML_RPC_Value($val, 'string');
return new XML_RPC_Response($val2send);
}
开发者ID:ookwudili,项目名称:chisimba,代码行数:15,代码来源:mxitdictionaryapi_class_inc.php
示例9: xmlrpc_as_001_set_ashiato
function xmlrpc_as_001_set_ashiato($message)
{
$dummy = array();
$re_false = array('result' => 1);
$re_true = array('result' => 0);
$param = $message->getParam(0);
if (!XML_RPC_Value::isValue($param)) {
return xmlrpc_get_response($re_false);
}
$params = XML_RPC_decode($param);
//「あしあと」を付けたメンバID必須
if (empty($params['mid_from'])) {
return xmlrpc_get_response($re_false);
}
//「あしあと」を付けられたメンバID必須
if (empty($params['mid_to'])) {
return xmlrpc_get_response($re_false);
}
$mid_from = $params['mid_from'];
$mid_to = $params['mid_to'];
//登録済みのメンバか
if (!OP::op_member_is_active_c_member_id($mid_from)) {
return xmlrpc_get_response($re_false);
}
//登録済みのメンバか
if (!OP::op_member_is_active_c_member_id($mid_to)) {
return xmlrpc_get_response($re_false);
}
//あしあとを付けたメンバIDと付けられたメンバIDは同一か
if ($mid_from == $mid_to) {
return xmlrpc_get_response($re_true);
}
//一定時間内の連続アクセスか?
if (!OP::op_ashiato_check_access_minute($mid_to, $mid_from)) {
return xmlrpc_get_response($re_true);
}
//忍び足状態か?
if (USE_SHINOBIASHI) {
if (OP::op_member_is_shinobiashi($mid_from)) {
return xmlrpc_get_response($re_true);
}
}
if (!OP::op_ashiato_insert_c_ashiato($mid_to, $mid_from)) {
return xmlrpc_get_response($re_false);
}
//正常終了
return xmlrpc_get_response($re_true);
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:48,代码来源:as_001_set_ashiato.php
示例10: xmlrpc_as_000_get_ashiato
function xmlrpc_as_000_get_ashiato($message)
{
$dummy = array();
$re_false = array('result' => 1, 'list' => $dummy);
$param = $message->getParam(0);
if (!XML_RPC_Value::isValue($param)) {
return xmlrpc_get_response($re_false);
}
$params = XML_RPC_decode($param);
//対象メンバID必須
if (empty($params['mid'])) {
return xmlrpc_get_response($re_false);
}
//取得数必須
if (empty($params['count'])) {
return xmlrpc_get_response($re_false);
}
//取得数は数値
if (!is_numeric($params['count'])) {
return xmlrpc_get_response($re_false);
}
$member_id = $params['mid'];
$count = intval($params['count']);
$profile = $params['profile'];
//取得数は正
if ($count <= 0) {
return xmlrpc_get_response($re_false);
}
//登録済みのメンバか
if (!OP::op_member_is_active_c_member_id($member_id)) {
return xmlrpc_get_response($re_false);
}
//あしあとのあるメンバか
if (!OP::op_is_ahiato_member($member_id)) {
return xmlrpc_get_response($re_false);
}
//取得最大数は100
if ($count > 100) {
$count = 100;
}
$list = OP::op_ashiato_list_c_member_profile($member_id, $count, $profile);
if (empty($list)) {
return xmlrpc_get_respose($re_false);
}
return xmlrpc_get_response(array('result' => 0, 'list' => $list));
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:46,代码来源:as_000_get_ashiato.php
示例11: grabXMLDoc
public function grabXMLDoc($params)
{
$param = $params->getParam(0);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$doc = $param->scalarval();
if (!file_exists($this->objConfig->getContentBasePath() . 'apitmp/')) {
@mkdir($this->objConfig->getContentBasePath() . 'apitmp/');
@chmod($this->objConfig->getContentBasePath() . 'apitmp/', 0777);
}
$localfile = $this->objConfig->getContentBasePath() . 'apitmp/annote' . rand(1, 999);
$ret = file_put_contents($doc, $localfile);
$val = new XML_RPC_Value($ret, 'boolean');
return new XML_RPC_Response($val);
// Ooops, couldn't open the file so return an error message.
return new XML_RPC_Response(0, $XML_RPC_erruser + 1, $this->objLanguage->languageText("mod_packages_fileerr", "packages"));
}
开发者ID:ookwudili,项目名称:chisimba,代码行数:18,代码来源:annoteapi_class_inc.php
示例12: xmlrpc_001_get_c_member
/**
* @copyright 2005-2008 OpenPNE Project
* @license http://www.php.net/license/3_01.txt PHP License 3.01
*/
function xmlrpc_001_get_c_member($message)
{
$param = $message->getParam(0);
if (!XML_RPC_Value::isValue($param)) {
return false;
}
$params = XML_RPC_decode($param);
if (empty($params['target_c_member_id'])) {
return false;
}
if (empty($params['my_c_member_id'])) {
return false;
}
$t_id = intval($params['target_c_member_id']);
$m_id = intval($params['my_c_member_id']);
// my_c_member_id が不正
if (!db_member_c_member4c_member_id_LIGHT($m_id)) {
return xmlrpc_get_fault_response(56);
}
if ($t_id == $m_id) {
// 自分
$public_flag = 'private';
} elseif (db_friend_is_friend($t_id, $m_id)) {
$public_flag = 'friend';
} else {
$public_flag = 'public';
}
// target_c_member_id が不正
if (!($c_member = db_member_c_member4c_member_id($t_id, false, true, $public_flag))) {
return xmlrpc_get_fault_response(56);
}
// アクセスブロック判定
if (db_member_is_access_block($m_id, $t_id)) {
$result = array('c_member_id' => $t_id, 'nickname' => $c_member['nickname'], 'image_url' => xmlrpc_get_image_url());
} else {
$result = array('c_member_id' => $t_id, 'nickname' => $c_member['nickname'], 'image_url' => xmlrpc_get_image_url($c_member['image_filename']), 'image_url_1' => xmlrpc_get_image_url($c_member['image_filename_1'], false), 'image_url_2' => xmlrpc_get_image_url($c_member['image_filename_2'], false), 'image_url_3' => xmlrpc_get_image_url($c_member['image_filename_3'], false), 'birth_year' => intval($c_member['birth_year']), 'birth_month' => intval($c_member['birth_month']), 'birth_day' => intval($c_member['birth_day']), 'access_date' => xmlrpc_get_date($c_member['access_date']), 'r_date' => xmlrpc_get_date($c_member['r_date']), 'profile' => array());
foreach ($c_member['profile'] as $key => $profile) {
$result['profile'][$key] = $profile['value'];
}
}
return xmlrpc_get_response($result);
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:46,代码来源:001_get_c_member.php
示例13: xmlrpc_901_o_search
/**
* @copyright 2005-2008 OpenPNE Project
* @license http://www.php.net/license/3_01.txt PHP License 3.01
*/
function xmlrpc_901_o_search($message)
{
$param = $message->getParam(0);
if (!XML_RPC_Value::isValue($param)) {
return false;
}
$params = XML_RPC_decode($param);
if (!array_key_exists('searchword', $params)) {
return false;
}
if (empty($params['type'])) {
return false;
}
$searchword = $params['searchword'];
if (empty($searchword)) {
$searchword = '';
}
$type = $params['type'];
$number = 0;
switch ($type) {
case 'DIARY':
$diary = p_h_diary_list_all_search_c_diary4c_diary($searchword, 0, 1);
$number += (int) $diary[3];
break;
case 'COMMUNITY':
$commu = db_commu_search_c_commu4c_commu_category($searchword, 0, 0, 1);
$number += (int) $commu[3];
break;
case 'ALL':
default:
$diary = p_h_diary_list_all_search_c_diary4c_diary($searchword, 0, 1);
$number += (int) $diary[3];
$commu = db_commu_search_c_commu4c_commu_category($searchword, 0, 0, 1);
$number += (int) $commu[3];
break;
}
$result = array('number' => intval($number), 'sns_name' => SNS_NAME);
return xmlrpc_get_response($result);
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:43,代码来源:901_o_search.php
示例14: xmlrpc_101_add_point
/**
* @copyright 2005-2008 OpenPNE Project
* @license http://www.php.net/license/3_01.txt PHP License 3.01
*/
function xmlrpc_101_add_point($message)
{
$param = $message->getParam(0);
if (!XML_RPC_Value::isValue($param)) {
return false;
}
$params = XML_RPC_decode($param);
if (empty($params['c_member_id'])) {
return false;
}
if (!isset($params['point'])) {
return false;
}
$c_member_id = intval($params['c_member_id']);
$point = intval($params['point']);
if (!db_member_c_member4c_member_id_LIGHT($c_member_id)) {
return xmlrpc_get_fault_response(56);
}
$c_point_log_id = db_point_insert_log($c_member_id, $point, $params['memo']);
db_point_insert_tags($c_point_log_id, $params['tags']);
$point = db_point_add_point($c_member_id, $point);
return xmlrpc_get_response($point);
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:27,代码来源:101_add_point.php
示例15: _encode
function _encode($php_val)
{
global $XML_RPC_Boolean, $XML_RPC_Int, $XML_RPC_Double;
global $XML_RPC_String, $XML_RPC_Array, $XML_RPC_Struct;
$type = gettype($php_val);
$xmlrpcval = new XML_RPC_Value();
switch ($type) {
case "array":
reset($php_val);
$firstkey = key($php_val);
end($php_val);
$lastkey = key($php_val);
reset($php_val);
if ($firstkey === 0 && is_int($lastkey) && $lastkey + 1 == count($php_val)) {
$is_continuous = true;
reset($php_val);
$size = count($php_val);
for ($expect = 0; $expect < $size; $expect++, next($php_val)) {
if (key($php_val) !== $expect) {
$is_continuous = false;
break;
}
}
if ($is_continuous) {
reset($php_val);
$arr = array();
while (list($k, $v) = each($php_val)) {
$arr[$k] = $this->_encode($v);
}
$xmlrpcval->addArray($arr);
break;
}
}
// fall though if not numerical and continuous
// fall though if not numerical and continuous
case "object":
$arr = array();
while (list($k, $v) = each($php_val)) {
$arr[$k] = $this->_encode($v);
}
$xmlrpcval->addStruct($arr);
break;
case "integer":
$xmlrpcval->addScalar($php_val, $XML_RPC_Int);
break;
case "double":
$xmlrpcval->addScalar($php_val, $XML_RPC_Double);
break;
case "string":
case "NULL":
$xmlrpcval->addScalar($php_val, $XML_RPC_String);
break;
case "boolean":
$xmlrpcval->addScalar($php_val, $XML_RPC_Boolean);
break;
case "unknown type":
default:
return null;
}
return $xmlrpcval;
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:61,代码来源:Remote.php
示例16:
/**
* Gets Structure Non Scalar field from XML RPC Value parameter
*
* @access private
*
* @param structure &$oStructure to return data
* @param XML_RPC_Value $oStructParam
* @param string $fieldName
* @param XML_RPC_Response &$responseWithError
*
* @return boolean shows true if method was executed successfully
*/
function _getStructureNonScalarField(&$oStructure, &$oStructParam, $fieldName, &$oResponseWithError)
{
$oParam = $oStructParam->structmem($fieldName);
if (isset($oParam)) {
if ($oParam->kindOf() != 'scalar') {
return XmlRpcUtils::_getNonScalarValue($oStructure->{$fieldName}, $oParam, $oResponseWithError);
} else {
$oResponseWithError = XmlRpcUtils::generateError('Structure field \'' . $fieldName . '\' should be non-scalar type ');
return false;
}
} else {
return true;
}
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:26,代码来源:XmlRpcUtils.php
示例17: XML_RPC_encode
/**
* Takes native php types and encodes them into XML_RPC PHP object format.
*
* Feature creep -- could support more types via optional type argument.
*
* @author Dan Libby <[email protected]>
**/
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":
$keys = array_keys($php_val);
$count = count($php_val);
$firstkey = $keys[0];
$lastkey = $keys[$count - 1];
if ($firstkey === 0 && is_int($lastkey) && $lastkey + 1 == $count) {
$is_continuous = true;
$expected = 0;
foreach ($keys as $actual) {
if ($actual != $expected) {
$is_continuous = false;
break;
}
$expected++;
}
if ($is_continuous) {
$arr = array();
foreach ($php_val as $k => $v) {
$arr[$k] = XML_RPC_encode($v);
}
$XML_RPC_val->addArray($arr);
break;
}
}
// fall though if not numerical and continuous
// fall though if not numerical and continuous
case "object":
$arr = array();
foreach ($php_val as $k => $v) {
$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:valentijnvenus,项目名称:geocloud,代码行数:77,代码来源:RPC.php
示例18: addCollRecord
public function addCollRecord($params)
{
$param = $params->getParam(0);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$coll = $param->scalarval();
$collid = $this->objDbColl->getCollByName($coll);
$param = $params->getParam(1);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$accno = $param->scalarval();
$param = $params->getParam(2);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$title = $param->scalarval();
$param = $params->getParam(3);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$description = $param->scalarval();
$param = $params->getParam(4);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$comment = $param->scalarval();
$param = $params->getParam(5);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$file = $param->scalarval();
$file = base64_decode($file);
$param = $params->getParam(6);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$fname = $param->scalarval();
$param = $params->getParam(7);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$username = $param->scalarval();
$userid = $this->objUser->getUserId($username);
// log_debug($userid);
if (!file_exists($this->objConfig->getContentBasePath() . 'users/' . $userid . "/")) {
@mkdir($this->objConfig->getContentBasePath() . 'users/' . $userid . "/");
@chmod($this->objConfig->getContentBasePath() . 'users/' . $userid . "/", 0777);
}
$objOverwriteIncrement = $this->getObject('overwriteincrement', 'filemanager');
$fname = $objOverwriteIncrement->checkfile($fname, 'users/' . $userid);
$localfile = $this->objConfig->getContentBasePath() . 'users/' . $userid . "/" . $fname;
file_put_contents($localfile, $file);
$fmname = basename($fname);
$fmpath = 'users/' . $userid . '/' . $fmname;
// Add to users fileset
$fileId = $this->objFileIndexer->processIndexedFile($fmpath, $userid);
// now add the record to the sahris collections database
$insarr = array('userid' => $userid, 'accno' => $accno, 'collection' => $collid, 'title' => $title, 'description' => $description, 'media' => $fileId, 'comment' => $comment);
$res = $this->objDbColl->insertRecord($insarr);
$val = new XML_RPC_Value($res, 'string');
return new XML_RPC_Response($val);
}
开发者ID:ookwudili,项目名称:chisimba,代码行数:64,代码来源:sahrisapi_class_inc.php
示例19: callMethod
/**
* XMLRPC methods wrapper
* Encode XMLRPC request message, send it, receive and decode response.
*
* @param method string, method name
* @param gettedPars array, returned by func_get_args() in called method
*
* @return array, PHP hash with response
*/
public function callMethod($method, $gettedPars)
{
$parr = array();
$XML_RPC_val = new XML_RPC_Value();
foreach ($this->mdefs[$method]['p'] as $i => $p) {
$parr[$p] = new XML_RPC_Value();
if ($this->mdefs[$method]['t'][$i] == 'array') {
$parr[$p] = XML_RPC_encode($gettedPars[$i]);
} else {
$parr[$p]->addScalar($gettedPars[$i], $this->mdefs[$method]['t'][$i]);
}
}
$XML_RPC_val->addStruct($parr);
$fullmethod = $this->mdefs[$method]['m'];
$msg = new XML_RPC_Message($fullmethod, array($XML_RPC_val));
if ($this->verbose) {
echo "parr:\n";
var_dump($parr);
echo "message:\n";
echo $msg->serialize() . "\n";
}
$this->client->setDebug($this->debug);
$res = $this->client->send($msg);
if (!$res) {
return $this->client->errstr;
}
if ($res->faultCode() > 0) {
return PEAR::raiseError("XR_CcClient::{$method}:" . $res->faultString() . " " . $res->faultCode() . "\n", $res->faultCode(), PEAR_ERROR_RETURN);
}
if ($this->verbose) {
echo "result:\n";
echo $res->serialize();
}
$val = $res->value();
$resp = XML_RPC_decode($res->value());
return $resp;
}
开发者ID:sourcefabric,项目名称:newscoop,代码行数:46,代码来源:XR_CcClient.php
示例20: convertDoc
/**
* Method to convert the document
*/
public function convertDoc($params, $type)
{
$this->objModules = $this->getObject('modules', 'modulecatalogue');
if ($type == 'swftools') {
$moduleRegistered = $this->objModules->checkIfRegistered('swftools');
} else {
$moduleRegistered = $this->objModules->checkIfRegistered('documentconverter');
}
// If module is not registered, return 0, can't do anything
if (!$moduleRegistered) {
$noResponse = new XML_RPC_Value('0', 'string');
return new XML_RPC_Response($noResponse);
}
// get password
$param = $params->getParam(0);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$password = $param->scalarval();
// get Required Password
$requiredPassword = $this->objSysconfig->getValue('REMOTEPASSWORD', 'documentconverter');
// Check if match
if ($password != $requiredPassword) {
$noResponse = new XML_RPC_Value('0', 'string');
return new XML_RPC_Response($noResponse);
}
// get current filename
$param = $params->getParam(1);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$filename = $param->scalarval();
// get contents of file
$param = $params->getParam(2);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$contents = $param->scalarval();
// get filename of converted file
$param = $params->getParam(3);
if (!XML_RPC_Value::isValue($param)) {
log_debug($param);
}
$this->convertFilename = $param->scalarval();
// Create Temp Directory
$dirName = md5($filename . $this->convertFilename . time());
// Full Path to Temp Directory
$dirToSave = $this->objConfig->getContentBasePath() . '/remoteconversion/' . $dirName;
// Load Classes
$objMkdir = $this->getObject('mkdir', 'files');
$objCleanUrl = $this->getObject('cleanurl', 'filemanager');
// Clean Paths
$dirToSave = $objCleanUrl->cleanUpUrl($dirToSave);
// Make Directory
$objMkdir->mkdirs($dirToSave);
// Store File Contents
file_put_contents($dirToSave . '/' . $filename, base64_decode($contents));
// Convert Files
if ($type == 'swftools') {
$objSWFTools = $this->getObject('pdf2flash', 'swftools');
$objSWFTools->convert2SWF($dirToSave . '/' . $filename, $dirToSave . '/' . $this->convertFilename);
} else {
$objDocumentConverter = $this->getObject('convertdoc', 'documentconverter');
$objDocumentConverter->convert($dirToSave . '/' . $filename, $dirToSave . '/' . $this->convertFilename);
}
// Delete Original File
@unlink($dirToSave . '/' . $filename);
$convertedFile = new XML_RPC_Value($this->returnFile($dirToSave), 'string');
return new XML_RPC_Response($convertedFile);
}
开发者ID:ookwudili,项目名称:chisimba,代码行数:73,代码来源:documentconversionapi_class_inc.php
注:本文中的XML_RPC_Value类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论