t of all the blogs where the given member is on the team";
function f_nucleus_getUsersBlogs($m) {
$username = _getScalar($m,0);
$password = _getScalar($m,1);
return _getUsersBlogs($username, $password);
}
// nucleus.getRecentItems
$f_nucleus_getRecentItems_sig = array(array(
// return type
$xmlrpcArray, // array of strucs (representing items)
// params
$xmlrpcString, // blogid
$xmlrpcString, // username
$xmlrpcString, // pass
word $xmlrpcInt, // amount of items to return (max = 20)
));
$f_nucleus_getRecentItems_doc = "Returns a maximum of 20 recent items for a given
webblog";
function f_nucleus_getRecentItems($m) {
$blogid = _getScalar($m, 0);
$username = _getScalar($m, 1);
$password = _getScalar($m, 2);
$amount = _getScalar($m, 3);
return _getRecentItems($blogid, $username, $password, $amount);
}
// nucleus.getItem
$f_nucleus_getItem_sig = array(array(
// return type
$xmlrpcStruct, // A struct representing the item
// params
$xmlrpcString, // itemid
$xmlrpcString, // username
$xmlrpcString, // password
));
$f_nucleus_getItem_doc = "Returns an item";
function f_nucleus_getItem($m) {
$postid = _getScalar($m, 0);
$username = _getScalar($m, 1);
$password = _getScalar($m, 2);
return _getItem($postid, $username, $password);
}
// nucleus.deleteItem
$f_nucleus_deleteItem_sig = array(array(
// return type
$xmlrpcBoolean, // boolean (ok or not ok)
// params
$xmlrpcString, // itemid
$xmlrpcString, // username
$xmlrpcString, // password
));
$f_nucleus_deleteItem_doc = "Deletes an item";
function f_nucleus_deleteItem($m) {
$itemid = _getScalar($m,0);
$username = _getScalar($m, 1);
$password = _getScalar($m, 2);
return _deleteItem($itemid, $username, $password);
}
/**
* Returns a list of recent items (Nucleus Version)
* ($amount = max 20);
*/
function _getRecentItems($blogid, $username, $password, $amount) {
$blogid = intval($blogid);
$amount = intval($amount);
// 1. login
$mem = new MEMBER();
if (!$mem->login($username, $password))
return _error(1,"Could not log in");
// 2. check if allowed
if (!BLOG::existsID($blogid))
return _error(2,"No such blog ($blogid)");
if (!$mem->teamRights($blogid))
return _error(3,"Not a team member");
$amount = intval($amount);
if (($amount < 1) or ($amount > 20))
return _error(5,"Amount parameter must be in range 1..20");
// 3. create and return list of recent items
// Struct returned has dateCreated, userid, blogid and content
$structarray = array(); // the array in which the structs will be stored
$query = "SELECT ibody, iauthor, ibody, imore, ititle, iclosed, idraft, itime"
.' FROM '.sql_table('item')
." WHERE iblog=$blogid"
." ORDER BY itime DESC"
." LIMIT $amount";
$r =
sql_query($query);
while ($obj =
mysql_fetch_object($r)) {
$newstruct = new xmlrpcval(array(
"publishDate" => new xmlrpcval(iso8601_encode(strtotime($obj->itime)),"dateTime.iso8601"),
"userid" => new xmlrpcval($obj->iauthor,"string"),
"blogid" => new xmlrpcval($blogid,"string"),
"title" => new xmlrpcval($obj->ititle,"string"),
"body" => new xmlrpcval($obj->ibody,"string"),
"more" => new xmlrpcval($obj->imore,"string"),
"draft" => new xmlrpcval($obj->idraft,"boolean"),
"closed" => new xmlrpcval($obj->iclosed,"boolean"),
),'struct');
array_push($structarray, $newstruct);
}
return new xmlrpcresp(new xmlrpcval( $structarray , "array"));
}
/**
* Returns one item (Nucleus version)
*/
function _getItem($itemid, $username, $password) {
global $manage