本文整理汇总了PHP中php_xmlrpc_decode函数的典型用法代码示例。如果您正苦于以下问题:PHP php_xmlrpc_decode函数的具体用法?PHP php_xmlrpc_decode怎么用?PHP php_xmlrpc_decode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了php_xmlrpc_decode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callRemote
function callRemote($method)
{
// Curl is required so generate a fault if curl functions cannot be found.
if (!$this->curl) {
return array('faultCode' => -1, 'faultString' => 'Curl functions are unavailable.');
}
// The first argument will always be the method name while all remaining arguments need
// to be passed along with the call.
$args = func_get_args();
array_shift($args);
if ($this->xmlrpc) {
// If php has xmlrpc support use the built in functions.
$request = xmlrpc_encode_request($method, $args);
$result = $this->__xmlrpc_call($request);
$decodedResult = xmlrpc_decode($result);
} else {
// If no xmlrpc support is found, use the phpxmlrpc library. This involves containing
// all variables inside the xmlrpcval class.
$encapArgs = array();
foreach ($args as $arg) {
$encapArgs[] = $this->__phpxmlrpc_encapsulate($arg);
}
$msg = new xmlrpcmsg($method, $encapArgs);
$client = new xmlrpc_client($this->url);
$client->verifypeer = false;
$result = $client->send($msg);
if ($result->errno) {
$decodedResult = array('faultCode' => $result->errno, 'faultString' => $result->errstr);
} else {
$decodedResult = php_xmlrpc_decode($result->value());
}
}
return $decodedResult;
}
示例2: unsubscribe_topic_func
function unsubscribe_topic_func($xmlrpc_params)
{
global $db, $user;
$user->setup('viewtopic');
$params = php_xmlrpc_decode($xmlrpc_params);
// get topic id from parameters
$topic_id = intval($params[0]);
if (!$topic_id) {
trigger_error('NO_TOPIC');
}
$user_id = $user->data['user_id'];
$uns_result = false;
// Is user login?
if ($user_id != ANONYMOUS) {
$sql = 'SELECT notify_status
FROM ' . TOPICS_WATCH_TABLE . "\n WHERE topic_id = {$topic_id}\n AND user_id = {$user_id}";
$result = $db->sql_query($sql);
$notify_status = ($row = $db->sql_fetchrow($result)) ? $row['notify_status'] : NULL;
$db->sql_freeresult($result);
if (!is_null($notify_status) && $notify_status !== '') {
$sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . "\n WHERE topic_id = {$topic_id}\n AND user_id = {$user_id}";
$db->sql_query($sql);
$uns_result = true;
}
}
$response = new xmlrpcval(array('result' => new xmlrpcval($uns_result, 'boolean'), 'result_text' => new xmlrpcval($uns_result ? '' : 'Unsubscribe failed', 'base64')), 'struct');
return new xmlrpcresp($response);
}
示例3: delete_message_func
function delete_message_func($xmlrpc_params)
{
global $db, $user, $config, $phpbb_root_path, $phpEx;
$user->setup('ucp');
$params = php_xmlrpc_decode($xmlrpc_params);
// get folder id from parameters
$msg_id = intval($params[0]);
$user_id = $user->data['user_id'];
if (!$msg_id) {
trigger_error('NO_MESSAGE');
}
if (!$user->data['is_registered']) {
trigger_error('LOGIN_EXPLAIN_UCP');
}
// Is PM disabled?
if (!$config['allow_privmsg']) {
trigger_error('Module not accessible');
}
$sql = 'SELECT folder_id
FROM ' . PRIVMSGS_TO_TABLE . "\r\r\n WHERE user_id = {$user_id}\r\r\n AND msg_id = {$msg_id}";
$result = $db->sql_query_limit($sql, 1);
$folder_id = (int) $db->sql_fetchfield('folder_id');
$db->sql_freeresult($result);
include_once $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
$result = delete_pm($user_id, $msg_id, $folder_id);
$response = new xmlrpcval(array('result' => new xmlrpcval($result, 'boolean'), 'result_text' => new xmlrpcval($result ? '' : 'Delete message failed', 'base64')), 'struct');
return new xmlrpcresp($response);
}
示例4: init
/**
* Get request protocol based on Content-Type
*
* @return string default as xmlrpc
*/
protected function init()
{
$ver = phpversion();
if ($ver[0] >= 5) {
$data = file_get_contents('php://input');
} else {
$data = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
}
if (count($_SERVER) == 0) {
self::alert('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
}
if (isset($_SERVER['HTTP_CONTENT_ENCODING'])) {
$content_encoding = str_replace('x-', '', $_SERVER['HTTP_CONTENT_ENCODING']);
} else {
$content_encoding = '';
}
if ($content_encoding != '' && strlen($data)) {
if ($content_encoding == 'deflate' || $content_encoding == 'gzip') {
// if decoding works, use it. else assume data wasn't gzencoded
if (function_exists('gzinflate')) {
if ($content_encoding == 'deflate' && ($degzdata = @gzuncompress($data))) {
$data = $degzdata;
} elseif ($degzdata = @gzinflate(substr($data, 10))) {
$data = $degzdata;
}
} else {
self::alert('XML-RPC: ' . __METHOD__ . ': Received from client compressed HTTP request and cannot decompress');
}
}
}
$parsers = php_xmlrpc_decode_xml($data);
$this->cmd = $parsers->methodname;
$this->input = php_xmlrpc_decode(new xmlrpcval($parsers->params, 'array'));
}
示例5: _getExtensionData
/**
* Returns current version number, support link, and reviews for the passed in extension name. Input 1=cms name, input 2=extension name.
* @return string (or an xmlrpcresp obj instance if call fails)
*/
function _getExtensionData($cmsName, $extensionName)
{
#$client =& new xmlrpc_client('/cmsmarket/xmlrpc/index.php', 'localhost', 80);
$client =& new xmlrpc_client('/xmlrpc/index.php', 'www.cmsmarket.com', 80);
$client->return_type = 'xmlrpcvals';
$msg =& new xmlrpcmsg('CMSMarketItems.getExtensionDataBasic');
$p1 =& new xmlrpcval($cmsName, 'string');
$msg->addparam($p1);
$p2 =& new xmlrpcval($extensionName, 'string');
$msg->addparam($p2);
$res =& $client->send($msg, 0, '');
if ($res->faultcode()) {
return $res;
} else {
$data = php_xmlrpc_decode($res->value());
if (isset($data['url'])) {
$this->dataReturned = true;
$this->name = $data['name'];
$this->url = $data['url'];
$this->supportPage = $data['support_page'];
$this->currentVersion = $data['current_version'];
$this->rating = html_entity_decode($data['rating']);
} else {
$this->dataReturned = false;
}
}
}
示例6: get_forum_func
function get_forum_func($xmlrpc_params)
{
$params = php_xmlrpc_decode($xmlrpc_params);
$desc = isset($params[0]) ? true : false;
$parent_id = isset($params[1]) ? intval($params[1]) : 0;
global $db;
$cats = $db->sql_ufetchrowset('SELECT cat_id, cat_title FROM ' . CATEGORIES_TABLE . ' ORDER BY cat_order', SQL_ASSOC);
$forums = mobi_forums($parent_id);
for ($i = 0, $c = count($cats); $i < $c; ++$i) {
$cats[$i]['forum_id'] = $cats[$i]['cat_id'] + 99999;
$cats[$i]['forum_name'] = $cats[$i]['cat_title'];
$cats[$i]['parent_id'] = '-1';
$cats[$i]['sub_only'] = true;
$cats[$i]['child'] = array();
foreach ($forums as &$forum) {
if ($cats[$i]['cat_id'] != $forum['cat_id']) {
continue;
}
if (!$forum['parent_id']) {
$forum['parent_id'] = $forum['cat_id'] + 99999;
}
$cats[$i]['child'][] = assocToStruct($forum);
unset($forum);
}
if (empty($cats[$i]['child'])) {
unset($cats[$i]);
continue;
}
$cats[$i] = assocToStruct($cats[$i], $desc);
}
return new xmlrpcresp(new xmlrpcval($cats, 'array'));
}
示例7: mark_pm_unread_func
function mark_pm_unread_func($xmlrpc_params)
{
global $db, $auth, $user, $config;
$params = php_xmlrpc_decode($xmlrpc_params);
$msg_id = intval($params[0]);
$user->setup('ucp');
$message_row = array();
// Get Message user want to see
$sql = 'SELECT t.*, p.*, u.*
FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE t.user_id = ' . $user->data['user_id'] . "\r\r\n AND p.author_id = u.user_id\r\r\n AND t.msg_id = p.msg_id\r\r\n AND p.msg_id = {$msg_id}";
$result = $db->sql_query($sql);
$message_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$folder_id = $message_row['folder_id'];
$user_id = $user->data['user_id'];
if (!$message_row) {
trigger_error('NO_MESSAGE');
}
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . "\r\r\n\t\tSET pm_unread = 1\r\r\n\t\tWHERE msg_id = {$msg_id}\r\r\n\t\t\tAND user_id = {$user_id}\r\r\n\t\t\tAND folder_id = {$folder_id}";
$db->sql_query($sql);
$sql = 'UPDATE ' . USERS_TABLE . "\r\r\n\t\tSET user_unread_privmsg = user_unread_privmsg + 1\r\r\n\t\tWHERE user_id = {$user_id}";
$db->sql_query($sql);
if ($user->data['user_id'] == $user_id) {
$user->data['user_unread_privmsg']++;
// Try to cope with previous wrong conversions...
if ($user->data['user_unread_privmsg'] < 0) {
$sql = 'UPDATE ' . USERS_TABLE . "\r\r\n\t\t\t\tSET user_unread_privmsg = 0\r\r\n\t\t\t\tWHERE user_id = {$user_id}";
$db->sql_query($sql);
$user->data['user_unread_privmsg'] = 0;
}
}
return xmlresptrue();
}
示例8: addcomment
function addcomment($m)
{
global $xmlrpcerruser;
$err = "";
// get the first param
$msgID = php_xmlrpc_decode($m->getParam(0));
$name = php_xmlrpc_decode($m->getParam(1));
$comment = php_xmlrpc_decode($m->getParam(2));
$dbh = dba_open("/tmp/comments.db", "c", "db2");
if ($dbh) {
$countID = "{$msgID}_count";
if (dba_exists($countID, $dbh)) {
$count = dba_fetch($countID, $dbh);
} else {
$count = 0;
}
// add the new comment in
dba_insert($msgID . "_comment_{$count}", $comment, $dbh);
dba_insert($msgID . "_name_{$count}", $name, $dbh);
$count++;
dba_replace($countID, $count, $dbh);
dba_close($dbh);
} else {
$err = "Unable to open comments database.";
}
// if we generated an error, create an error return response
if ($err) {
return new xmlrpcresp(0, $xmlrpcerruser, $err);
} else {
// otherwise, we create the right response
// with the state name
return new xmlrpcresp(new xmlrpcval($count, "int"));
}
}
示例9: getcomments
function getcomments($m)
{
global $xmlrpcerruser;
$err = "";
$ra = array();
// get the first param
if (XMLRPC_EPI_ENABLED == '1') {
$msgID = xmlrpc_decode($m->getParam(0));
} else {
$msgID = php_xmlrpc_decode($m->getParam(0));
}
$dbh = dba_open("/tmp/comments.db", "r", "db2");
if ($dbh) {
$countID = "{$msgID}_count";
if (dba_exists($countID, $dbh)) {
$count = dba_fetch($countID, $dbh);
for ($i = 0; $i < $count; $i++) {
$name = dba_fetch("{$msgID}_name_{$i}", $dbh);
$comment = dba_fetch("{$msgID}_comment_{$i}", $dbh);
// push a new struct onto the return array
$ra[] = array("name" => $name, "comment" => $comment);
}
}
}
// if we generated an error, create an error return response
if ($err) {
return new xmlrpcresp(0, $xmlrpcerruser, $err);
} else {
// otherwise, we create the right response
// with the state name
return new xmlrpcresp(php_xmlrpc_encode($ra));
}
}
示例10: get_sysinfo
public function get_sysinfo()
{
$msgs = array();
$msgs[] = new xmlrpcmsg('system.client_version', array());
$msgs[] = new xmlrpcmsg('system.library_version', array());
$msgs[] = new xmlrpcmsg('get_down_rate', array());
$msgs[] = new xmlrpcmsg('get_up_rate', array());
$msgs[] = new xmlrpcmsg('get_directory', array());
$resps = $this->_rpc->multicall($msgs);
$values = array();
foreach ($resps as $r) {
$values[] = php_xmlrpc_decode($r->value());
}
$values = array_combine(array('version', 'lib_version', 'downrate', 'uprate', 'directory'), $values);
$values['downrate'] = round($values['downrate'] / 1024, 2) . 'K';
$values['uprate'] = round($values['uprate'] / 1024, 2) . 'K';
if (is_dir($values['directory'])) {
$values['have_disk_space'] = true;
$disk_total = disk_total_space($values['directory']);
$disk_free = disk_free_space($values['directory']);
$disk_used = round($disk_total - $disk_free);
$values['disk_total'] = $disk_total;
$values['disk_free'] = $disk_free;
$values['disk_used'] = $disk_used;
$values['disk_percent_used'] = round($disk_used / $disk_total * 100);
$values['disk_percent_free'] = round($disk_free / $disk_total * 100);
} else {
$values['have_disk_space'] = false;
}
return $values;
}
示例11: get_quote_pm_func
function get_quote_pm_func($xmlrpc_params)
{
global $db, $auth, $user;
$user->setup('ucp');
$params = php_xmlrpc_decode($xmlrpc_params);
// get msg id from parameters
$msg_id = intval($params[0]);
if (!$msg_id) {
trigger_error('NO_MESSAGE');
}
if (!$auth->acl_get('u_sendpm')) {
trigger_error('NO_AUTH_SEND_MESSAGE');
}
$sql = 'SELECT p.*, u.username as quote_username
FROM ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE p.author_id = u.user_id
AND p.msg_id = ' . $msg_id;
$result = $db->sql_query($sql);
$post = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$msg_id = (int) $post['msg_id'];
if (!$post) {
trigger_error('NO_MESSAGE');
}
if ((!$post['author_id'] || $post['author_id'] == ANONYMOUS && $action != 'delete') && $msg_id) {
trigger_error('NO_AUTHOR');
}
$message_subject = (!preg_match('/^Re:/', $post['message_subject']) ? 'Re: ' : '') . censor_text($post['message_subject']);
decode_message($post['message_text'], $post['bbcode_uid']);
$message = '[quote="' . $post['quote_username'] . '"]' . censor_text(trim($post['message_text'])) . "[/quote]\n";
return new xmlrpcresp(new xmlrpcval(array('msg_id' => new xmlrpcval($msg_id), 'msg_subject' => new xmlrpcval(html_entity_decode(strip_tags($message_subject)), 'base64'), 'text_body' => new xmlrpcval(html_entity_decode($message), 'base64')), 'struct'));
}
示例12: login_func
function login_func($xmlrpc_params)
{
global $auth, $user, $config, $db, $phpbb_root_path, $phpEx;
$params = php_xmlrpc_decode($xmlrpc_params);
$user->setup('ucp');
$username = $params[0];
$password = $params[1];
$viewonline = isset($params[2]) ? !$params[2] : 1;
set_var($username, $username, 'string', true);
set_var($password, $password, 'string', true);
header('Set-Cookie: mobiquo_a=0');
header('Set-Cookie: mobiquo_b=0');
header('Set-Cookie: mobiquo_c=0');
$login_result = $auth->login($username, $password, true, $viewonline);
$usergroup_id = array();
if ($login_result['status'] == LOGIN_SUCCESS) {
$auth->acl($user->data);
//add tapatalk_users here,for push service
if ($params[3] == '1' && push_table_exists()) {
global $table_prefix;
$sql = "SELECT * FROM " . $table_prefix . "tapatalk_users where userid = '" . $user->data['user_id'] . "'";
$result = $db->sql_query($sql);
$userInfo = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$time = time();
if (empty($userInfo)) {
$sql_data[$table_prefix . "tapatalk_users"]['sql'] = array('userid' => $user->data['user_id'], 'announcement' => 1, 'pm' => 1, 'subscribe' => 1, 'quote' => 1, 'tag' => 1, 'newtopic' => 1, 'updated' => time());
$sql = 'INSERT INTO ' . $table_prefix . "tapatalk_users" . ' ' . $db->sql_build_array('INSERT', $sql_data[$table_prefix . "tapatalk_users"]['sql']);
$db->sql_query($sql);
} else {
$sql = "UPDATE " . $table_prefix . "tapatalk_users \n\t \tSET updated= '" . time() . "' WHERE userid='" . $user->data['user_id'] . "'";
$db->sql_query($sql);
}
}
// Compatibility with mod NV who was here
if (file_exists($phpbb_root_path . 'includes/mods/who_was_here.' . $phpEx)) {
include_once $phpbb_root_path . 'includes/mods/who_was_here.' . $phpEx;
if (class_exists('phpbb_mods_who_was_here') && method_exists('phpbb_mods_who_was_here', 'update_session')) {
@phpbb_mods_who_was_here::update_session();
}
}
} else {
$error_msg = str_replace('%s', '', strip_tags($user->lang[$login_result['error_msg']]));
return new xmlrpcresp(new xmlrpcval(array('result' => new xmlrpcval(false, 'boolean'), 'result_text' => new xmlrpcval($error_msg, 'base64')), 'struct'));
}
if ($config['max_attachments'] == 0) {
$config['max_attachments'] = 100;
}
$usergroup_id[] = new xmlrpcval($user->data['group_id']);
$can_readpm = $config['allow_privmsg'] && $auth->acl_get('u_readpm') && ($user->data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'));
$can_sendpm = $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user->data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'));
$can_upload = $config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && (function_exists('phpbb_is_writable') ? phpbb_is_writable($phpbb_root_path . $config['avatar_path']) : 1) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
$can_search = $auth->acl_get('u_search') && $auth->acl_getf_global('f_search') && $config['load_search'];
$can_whosonline = $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel');
$max_filesize = $config['max_filesize'] === '0' || $config['max_filesize'] > 10485760 ? 10485760 : $config['max_filesize'];
$response = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'user_id' => new xmlrpcval($user->data['user_id'], 'string'), 'username' => new xmlrpcval($user->data['username'], 'base64'), 'usergroup_id' => new xmlrpcval($usergroup_id, 'array'), 'icon_url' => new xmlrpcval(get_user_avatar_url($user->data['user_avatar'], $user->data['user_avatar_type']), 'string'), 'post_count' => new xmlrpcval($user->data['user_posts'], 'int'), 'can_pm' => new xmlrpcval($can_readpm, 'boolean'), 'can_send_pm' => new xmlrpcval($can_sendpm, 'boolean'), 'can_moderate' => new xmlrpcval($auth->acl_get('m_') || $auth->acl_getf_global('m_'), 'boolean'), 'max_attachment' => new xmlrpcval($config['max_attachments'], 'int'), 'max_png_size' => new xmlrpcval($max_filesize, 'int'), 'max_jpg_size' => new xmlrpcval($max_filesize, 'int'), 'can_search' => new xmlrpcval($can_search, 'boolean'), 'can_whosonline' => new xmlrpcval($can_whosonline, 'boolean'), 'can_upload_avatar' => new xmlrpcval($can_upload, 'boolean')), 'struct');
return new xmlrpcresp($response);
}
示例13: get_id_by_url_func
function get_id_by_url_func($xmlrpc_params)
{
global $phpbb_home;
$params = php_xmlrpc_decode($xmlrpc_params);
$url = trim($params[0]);
if (strpos($url, $phpbb_home) === 0) {
$path = '/' . substr($url, strlen($phpbb_home));
$fid = $tid = $pid = "";
// get forum id
if (preg_match('/(\\?|&|;)(f|fid|board)=(\\d+)(\\W|$)/', $path, $match)) {
$fid = $match['3'];
} elseif (preg_match('/\\W(f|forum)-?(\\d+)(\\W|$)/', $path, $match)) {
$fid = $match['2'];
} elseif (preg_match('/\\/forum\\/(\\d+)-(\\w|-)+(\\W|$)/', $path, $match)) {
$fid = $match['1'];
$path = str_replace($match[0], $match[3], $path);
} elseif (preg_match('/forumdisplay\\.php(\\?|\\/)(\\d+)(\\W|$)/', $path, $match)) {
$fid = $match['2'];
$path = str_replace($match[0], $match[3], $path);
} elseif (preg_match('/(index\\.php\\?|\\/)forums\\/.+\\.(\\d+)/', $path, $match)) {
$fid = $match['2'];
}
// get topic id
if (preg_match('/(\\?|&|;)(t|tid|topic)=(\\d+)(\\W|$)/', $path, $match)) {
$tid = $match['3'];
} elseif (preg_match('/\\W(t|(\\w|-)+-t_|topic|article)-?(\\d+)(\\W|$)/', $path, $match)) {
$tid = $match['3'];
} elseif (preg_match('/showthread\\.php(\\?|\\/)(\\d+)(\\W|$)/', $path, $match)) {
$tid = $match['2'];
} elseif (preg_match('/(\\?|\\/)(\\d+)-(\\w|-)+(\\.|\\/|$)/', $path, $match)) {
$tid = $match['2'];
} elseif (preg_match('/(\\?|\\/)(\\w|-)+-(\\d+)(\\.|\\/|$)/', $path, $match)) {
$tid = $match['3'];
} elseif (preg_match('/(index\\.php\\?|\\/)threads\\/.+\\.(\\d+)/', $path, $match)) {
$tid = $match['2'];
}
// get post id
if (preg_match('/(\\?|&|;)(p|pid)=(\\d+)(\\W|$)/', $path, $match)) {
$pid = $match['3'];
} elseif (preg_match('/\\W(p|(\\w|-)+-p|post|msg)(-|_)?(\\d+)(\\W|$)/', $path, $match)) {
$pid = $match['4'];
} elseif (preg_match('/__p__(\\d+)(\\W|$)/', $path, $match)) {
$pid = $match['1'];
}
}
$result = array();
if ($fid) {
$result['forum_id'] = new xmlrpcval($fid, 'string');
}
if ($tid) {
$result['topic_id'] = new xmlrpcval($tid, 'string');
}
if ($pid) {
$result['post_id'] = new xmlrpcval($pid, 'string');
}
$response = new xmlrpcval($result, 'struct');
return new xmlrpcresp($response);
}
示例14: filterXmlInput
public static function filterXmlInput(array $filters, $xmlrpc_params)
{
global $db, $mybb;
require_once MYBB_ROOT . $mybb->settings['tapatalk_directory'] . '/emoji/emoji.class.php';
$params = php_xmlrpc_decode($xmlrpc_params);
// handle upload requests etc.
if (empty($params) && !empty($_POST['method_name'])) {
$params = array();
foreach ($filters as $name => $type) {
if (isset($_POST[$name])) {
$params[] = $_POST[$name];
}
}
}
$data = array();
$i = 0;
foreach ($filters as $name => $type) {
switch ($type) {
case self::INT:
if (isset($params[$i])) {
$data[$name] = intval($params[$i]);
} else {
$data[$name] = 0;
}
break;
case self::ALPHASTRING:
if (isset($params[$i])) {
$data[$name] = preg_replace("#[^a-z\\.\\-_]#i", "", $params[$i]);
} else {
$data[$name] = '';
}
$data[$name . '_esc'] = $db->escape_string($data[$name]);
break;
case self::STRING:
if (isset($params[$i])) {
if ($name == 'subject' || $name == 'post_title' || $name == 'title') {
$data[$name] = tapatalkEmoji::covertUnifiedToEmpty($params[$i]);
} else {
$data[$name] = tapatalkEmoji::covertEmojiToName($params[$i]);
}
} else {
$data[$name] = '';
}
$data[$name . '_esc'] = $db->escape_string($data[$name]);
break;
case self::RAW:
$data[$name] = $params[$i];
break;
}
$i++;
}
return $data;
}
示例15: mark_all_as_read_func
function mark_all_as_read_func($xmlrpc_params)
{
$params = php_xmlrpc_decode($xmlrpc_params);
if (!isset($params[0]) || $params[0] === 0) {
markread('all');
} else {
$forum_id = intval($params[0]);
markread('topics', $forum_id);
}
$response = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval('', 'base64')), 'struct');
return new xmlrpcresp($response);
}