本文整理汇总了PHP中xmlrpc_debugmsg函数的典型用法代码示例。如果您正苦于以下问题:PHP xmlrpc_debugmsg函数的具体用法?PHP xmlrpc_debugmsg怎么用?PHP xmlrpc_debugmsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlrpc_debugmsg函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: forward_request
/**
* Forward an xmlrpc request to another server, and return to client the response received.
* @param xmlrpcmsg $m (see method docs below for a description of the expected parameters)
* @return xmlrpcresp
*/
function forward_request($m)
{
// create client
$timeout = 0;
$url = php_xmlrpc_decode($m->getParam(0));
$c = new xmlrpc_client($url);
if ($m->getNumParams() > 3) {
// we have to set some options onto the client.
// Note that if we do not untaint the received values, warnings might be generated...
$options = php_xmlrpc_decode($m->getParam(3));
foreach ($options as $key => $val) {
switch ($key) {
case 'Cookie':
break;
case 'Credentials':
break;
case 'RequestCompression':
$c->setRequestCompression($val);
break;
case 'SSLVerifyHost':
$c->setSSLVerifyHost($val);
break;
case 'SSLVerifyPeer':
$c->setSSLVerifyPeer($val);
break;
case 'Timeout':
$timeout = (int) $val;
break;
}
// switch
}
}
// build call for remote server
/// @todo find a weay to forward client info (such as IP) to server, either
/// - as xml comments in the payload, or
/// - using std http header conventions, such as X-forwarded-for...
$method = php_xmlrpc_decode($m->getParam(1));
$pars = $m->getParam(2);
$m = new xmlrpcmsg($method);
for ($i = 0; $i < $pars->arraySize(); $i++) {
$m->addParam($pars->arraymem($i));
}
// add debug info into response we give back to caller
xmlrpc_debugmsg("Sending to server {$url} the payload: " . $m->serialize());
return $c->send($m, $timeout);
}
开发者ID:5haman,项目名称:knowledgetree,代码行数:51,代码来源:proxy.php
示例2: agesorter
function agesorter($m)
{
global $agesorter_arr, $xmlrpcerruser, $s;
xmlrpc_debugmsg("Entering 'agesorter'");
// get the parameter
$sno = $m->getParam(0);
// error string for [if|when] things go wrong
$err = "";
// create the output value
$v = new xmlrpcval();
$agar = array();
if (isset($sno) && $sno->kindOf() == "array") {
$max = $sno->arraysize();
// TODO: create debug method to print can work once more
// print "<!-- found $max array elements -->\n";
for ($i = 0; $i < $max; $i++) {
$rec = $sno->arraymem($i);
if ($rec->kindOf() != "struct") {
$err = "Found non-struct in array at element {$i}";
break;
}
// extract name and age from struct
$n = $rec->structmem("name");
$a = $rec->structmem("age");
// $n and $a are xmlrpcvals,
// so get the scalarval from them
$agar[$n->scalarval()] = $a->scalarval();
}
$agesorter_arr = $agar;
// hack, must make global as uksort() won't
// allow us to pass any other auxilliary information
uksort($agesorter_arr, agesorter_compare);
$outAr = array();
while (list($key, $val) = each($agesorter_arr)) {
// recreate each struct element
$outAr[] = new xmlrpcval(array("name" => new xmlrpcval($key), "age" => new xmlrpcval($val, "int")), "struct");
}
// add this array to the output value
$v->addArray($outAr);
} else {
$err = "Must be one parameter, an array of structs";
}
if ($err) {
return new xmlrpcresp(0, $xmlrpcerruser, $err);
} else {
return new xmlrpcresp($v);
}
}
开发者ID:rahulsiwal,项目名称:younity,代码行数:48,代码来源:server.php
示例3: _b2_or_mt_get_categories
/**
* Helper for {@link b2_getcategories()} and {@link mt_getPostCategories()}, because they differ
* only in the "categoryId" case ("categoryId" (b2) vs "categoryID" (MT))
*
* @param string Type, either "b2" or "mt"
* @param xmlrpcmsg XML-RPC Message
* 0 blogid (string): Unique identifier of the blog to query
* 1 username (string): Login for a Blogger user who is member of the blog.
* 2 password (string): Password for said username.
* @return xmlrpcresp XML-RPC Response
*/
function _b2_or_mt_get_categories($type, $m)
{
global $xmlrpcerruser, $DB;
// CHECK LOGIN:
/**
* @var User
*/
if (!($current_User =& xmlrpcs_login($m, 1, 2))) {
// Login failed, return (last) error:
return xmlrpcs_resperror();
}
// GET BLOG:
/**
* @var Blog
*/
if (!($Blog =& xmlrpcs_get_Blog($m, 0))) {
// Login failed, return (last) error:
return xmlrpcs_resperror();
}
// CHECK PERMISSION: (we need at least one post/edit status)
if (!$current_User->check_perm('blog_post_statuses', 1, false, $Blog->ID)) {
// Permission denied
return xmlrpcs_resperror(3);
// User error 3
}
logIO('Permission granted.');
$sql = 'SELECT *
FROM T_categories ';
$BlogCache =& get_Cache('BlogCache');
$current_Blog = $BlogCache->get_by_ID($Blog->ID);
$aggregate_coll_IDs = $current_Blog->get_setting('aggregate_coll_IDs');
if (empty($aggregate_coll_IDs)) {
// We only want posts from the current blog:
$sql .= 'WHERE cat_blog_ID =' . $current_Blog->ID;
} else {
// We are aggregating posts from several blogs:
$sql .= 'WHERE cat_blog_ID IN (' . $aggregate_coll_IDs . ')';
}
$sql .= " ORDER BY cat_name ASC";
$rows = $DB->get_results($sql);
if ($DB->error) {
// DB error
return new xmlrpcresp(0, $xmlrpcerruser + 9, 'DB error: ' . $DB->last_error);
// user error 9
}
xmlrpc_debugmsg('Categories:' . count($rows));
$categoryIdName = $type == 'b2' ? 'categoryID' : 'categoryId';
$data = array();
foreach ($rows as $row) {
$data[] = new xmlrpcval(array($categoryIdName => new xmlrpcval($row->cat_ID), 'categoryName' => new xmlrpcval($row->cat_name)), 'struct');
}
logIO('OK.');
return new xmlrpcresp(new xmlrpcval($data, "array"));
}
开发者ID:LFSF,项目名称:oras,代码行数:65,代码来源:_xmlrpcs.funcs.php
示例4: mw_getrecentposts
/**
* metaWeblog.getRecentPosts
*
* @see http://www.xmlrpc.com/metaWeblogApi#metawebloggetrecentposts
*
* @param xmlrpcmsg XML-RPC Message
* 0 blogid (string): Unique identifier of the blog the post will be added to.
* Currently ignored in b2evo, in favor of the category.
* 1 username (string): Login for a Blogger user who has permission to edit the given
* post (either the user who originally created it or an admin of the blog).
* 2 password (string): Password for said username.
*/
function mw_getrecentposts($m)
{
global $xmlrpcerruser, $DB;
// CHECK LOGIN:
/**
* @var User
*/
if (!($current_User =& xmlrpcs_login($m, 1, 2))) {
// Login failed, return (last) error:
return xmlrpcs_resperror();
}
// GET BLOG:
/**
* @var Blog
*/
if (!($Blog =& xmlrpcs_get_Blog($m, 0))) {
// Login failed, return (last) error:
return xmlrpcs_resperror();
}
// CHECK PERMISSION: (we need at least one post/edit status)
if (!$current_User->check_perm('blog_post_statuses', 1, false, $Blog->ID)) {
// Permission denied
return xmlrpcs_resperror(3);
// User error 3
}
logIO('Permission granted.');
$numposts = $m->getParam(3);
$numposts = $numposts->scalarval();
logIO("In mw_getrecentposts, current numposts is ..." . $numposts);
// Get the posts to display:
load_class('items/model/_itemlist.class.php');
$MainList =& new ItemList2($Blog, NULL, NULL, $numposts);
$MainList->set_filters(array('visibility_array' => array('published', 'protected', 'private', 'draft', 'deprecated', 'redirected'), 'order' => 'DESC', 'unit' => 'posts'));
// Run the query:
$MainList->query();
xmlrpc_debugmsg('Items:' . $MainList->result_num_rows);
$data = array();
/**
* @var Item
*/
while ($Item =& $MainList->get_item()) {
xmlrpc_debugmsg('Item:' . $Item->title . ' - Issued: ' . $Item->issue_date . ' - Modified: ' . $Item->mod_date);
$post_date = mysql2date("U", $Item->issue_date);
$post_date = gmdate("Ymd", $post_date) . "T" . gmdate("H:i:s", $post_date);
$content = $Item->content;
$content = str_replace("\n", '', $content);
// Tor - kludge to fix bug in xmlrpc libraries
// Load Item's creator User:
$Item->get_creator_User();
$authorname = $Item->creator_User->get('preferredname');
// need a loop here to extract all categoy names
// $extra_cat_IDs is the variable for the rest of the IDs
$hope_cat_name = get_the_category_by_ID($Item->main_cat_ID);
$test = $Item->extra_cat_IDs[0];
xmlrpc_debugmsg('postcats:' . $hope_cat_name["cat_name"]);
xmlrpc_debugmsg('test:' . $test);
$data[] = new xmlrpcval(array("dateCreated" => new xmlrpcval($post_date, "dateTime.iso8601"), "userid" => new xmlrpcval($Item->creator_user_ID), "postid" => new xmlrpcval($Item->ID), "categories" => new xmlrpcval(array(new xmlrpcval($hope_cat_name["cat_name"])), 'array'), "title" => new xmlrpcval($Item->title), "description" => new xmlrpcval($content), "link" => new xmlrpcval($Item->url), 'publish' => new xmlrpcval($Item->status == 'published', 'boolean')), "struct");
}
$resp = new xmlrpcval($data, "array");
logIO('OK.');
return new xmlrpcresp($resp);
}
开发者ID:LFSF,项目名称:oras,代码行数:74,代码来源:_metaweblog.api.php
示例5: _errorHandler
function _errorHandler($e)
{
$msg = htmlspecialchars($e->asString());
// '--' not allowed within xml comment
$msg = str_replace('--', '--', $msg);
if (function_exists('xmlrpc_debugmsg')) {
xmlrpc_debugmsg($msg);
}
return true;
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:10,代码来源:XmlRpcServer.php
示例6: blogger_getrecentposts
/**
* blogger.getRecentPosts retieves X most recent posts.
*
* This API call is not documented on
* {@link http://www.blogger.com/developers/api/1_docs/}
* @see http://www.sixapart.com/developers/xmlrpc/blogger_api/bloggergetrecentposts.html
*
* @param xmlrpcmsg XML-RPC Message
* 0 appkey (string): Unique identifier/passcode of the application sending the post.
* (See access info {@link http://www.blogger.com/developers/api/1_docs/#access} .)
* 1 blogid (string): Unique identifier of the blog the post will be added to.
* Currently ignored in b2evo, in favor of the category.
* 2 username (string): Login for a Blogger user who has permission to edit the given
* post (either the user who originally created it or an admin of the blog).
* 3 password (string): Password for said username.
* 4 numposts (integer): number of posts to retrieve.
* @return xmlrpcresp XML-RPC Response
*/
function blogger_getrecentposts($m)
{
global $xmlrpcerruser, $DB;
// CHECK LOGIN:
/**
* @var User
*/
if (!($current_User =& xmlrpcs_login($m, 2, 3))) {
// Login failed, return (last) error:
return xmlrpcs_resperror();
}
// GET BLOG:
/**
* @var Blog
*/
if (!($Blog =& xmlrpcs_get_Blog($m, 1))) {
// Login failed, return (last) error:
return xmlrpcs_resperror();
}
// CHECK PERMISSION: (we need at least one post/edit status)
// (we should be able to see all even if we cannot edit the particular status of a post)
if (!$current_User->check_perm('blog_post_statuses', 1, false, $Blog->ID)) {
// Permission denied
return xmlrpcs_resperror(3);
// User error 3
}
logIO('Permission granted.');
$numposts = $m->getParam(4);
$numposts = $numposts->scalarval();
// Get the posts to display:
load_class('items/model/_itemlist.class.php');
$MainList =& new ItemList2($Blog, NULL, NULL, $numposts);
$MainList->set_filters(array('visibility_array' => array('published', 'protected', 'private', 'draft', 'deprecated', 'redirected'), 'order' => 'DESC', 'unit' => 'posts'));
// Run the query:
$MainList->query();
xmlrpc_debugmsg('Items:' . $MainList->result_num_rows);
$data = array();
while ($Item =& $MainList->get_item()) {
xmlrpc_debugmsg('Item:' . $Item->title . ' - Issued: ' . $Item->issue_date . ' - Modified: ' . $Item->mod_date);
$post_date = mysql2date("U", $Item->issue_date);
$post_date = gmdate("Ymd", $post_date) . "T" . gmdate("H:i:s", $post_date);
$content = '<title>' . $Item->title . '</title>';
$content .= '<category>' . $Item->main_cat_ID . '</category>';
$content .= $Item->content;
// Load Item's creator User:
$Item->get_creator_User();
$authorname = $Item->creator_User->get('preferredname');
$data[] = new xmlrpcval(array("authorName" => new xmlrpcval($authorname), "userid" => new xmlrpcval($Item->creator_user_ID), "dateCreated" => new xmlrpcval($post_date, "dateTime.iso8601"), "content" => new xmlrpcval($content), "postid" => new xmlrpcval($Item->ID)), "struct");
}
$resp = new xmlrpcval($data, "array");
logIO('OK.');
return new xmlrpcresp($resp);
}
开发者ID:LFSF,项目名称:oras,代码行数:71,代码来源:_blogger.api.php
示例7: agesorter
function agesorter($m)
{
global $s;
xmlrpc_debugmsg("Entering 'agesorter'");
// get the parameter
$sno = $m->getParam(0);
// error string for [if|when] things go wrong
$err = '';
// create the output value
$v = CreateObject('phpgwapi.xmlrpcval');
$agar = array();
if (isset($sno) && $sno->kindOf() == 'array') {
$max = $sno->arraysize();
// TODO: create debug method to print can work once more
// print "<!-- found $max array elements -->\n";
for ($i = 0; $i < $max; $i++) {
$rec = $sno->arraymem($i);
if ($rec->kindOf() != 'struct') {
$err = 'Found non-struct in array at element ' . $i;
break;
}
// extract name and age from struct
$n = $rec->structmem('name');
$a = $rec->structmem('age');
// $n and $a are xmlrpcvals,
// so get the scalarval from them
$agar[$n->scalarval()] = $a->scalarval();
}
$GLOBALS['agesorter_arr'] = $agar;
// hack, must make global as uksort() won't
// allow us to pass any other auxilliary information
uksort($GLOBALS['agesorter_arr'], agesorter_compare);
$outAr = array();
while (list($key, $val) = each($GLOBALS['agesorter_arr'])) {
// recreate each struct element
$outAr[] = CreateObject('phpgwapi.xmlrpcval', array('name' => CreateObject('phpgwapi.xmlrpcval', $key), 'age' => CreateObject('phpgwapi.xmlrpcval', $val, 'int')), 'struct');
}
// add this array to the output value
$v->addArray($outAr);
} else {
$err = 'Must be one parameter, an array of structs';
}
if ($err) {
return CreateObject('phpgwapi.xmlrpcresp', CreateObject('phpgwapi.xmlrpcval'), $GLOBALS['xmlrpcerruser'], $err);
} else {
return CreateObject('phpgwapi.xmlrpcresp', $v);
}
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:48,代码来源:xmlrpc.interop.php
注:本文中的xmlrpc_debugmsg函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论