the array
// will be assigned the primary category for the post." (MT doc)
if ($bPrimary) {
$category = $struct->structmem('categoryId');
$category = $category->scalarval();
}
}
return _mt_setPostCategories($itemid, $username, $password, $category);
}
// mt.getRecentPostTitles
$f_mt_getRecentPostTitles_sig = array(array(
// return
$xmlrpcArray, // array of structs
// params
$xmlrpcString, // blogid
$xmlrpcString, // userid
$xmlrpcString, // password,
$xmlrpcInt // number of posts
));
$f_mt_getRecentPostTitles_doc = 'Returns a bandwidth-friendly list of the most recent posts in the system.';
function f_mt_getRecentPostTitles($m) {
$blogid = intval(_getScalar($m, 0));
$username = _getScalar($m, 1);
$password = _getScalar($m, 2);
$iAmount = intval(_getScalar($m, 3));
return _mt_getRecentPostTitles($blogid, $username, $password, $iAmount);
}
// mt.getTrackbackPings
$f_mt_getTrackbackPings_sig = array(array(
// return
$xmlrpcArray, // array of structs
// params
$xmlrpcString // postid
));
$f_mt_getTrackbackPings_doc = '(this is currently just a placeholder. It returns an empty array.)';
function f_mt_getTrackbackPings($m) {
global $manager;
$itemid = intval(_getScalar($m, 0));
$trackbacks = array ();
$tbstruct = array ();
$manager->notify('RetrieveTrackback', array ('tb_id' => $itemid, 'trackbacks' => & $trackbacks));
while (list(,$v) = each ($trackbacks)) {
$tbstruct[] = new xmlrpcval(
array(
"pingTitle" => new xmlrpcval($v['title'], "string"),
"pingURL" => new xmlrpcval($v['url'], "string"),
"pingIP" => new xmlrpcval($v['ip'], "string")
)
,'struct');
}
return new xmlrpcresp(new xmlrpcval( $tbstruct , "array"));
}
$functionDefs = array_merge($functionDefs,
array(
"mt.supportedMethods" =>
array( "function" => "f_mt_supportedMethods",
"signature" => $f_mt_supportedMethods_sig,
"docstring" => $f_mt_supportedMethods_doc),
"mt.supportedTextFilters" =>
array( "function" => "f_mt_supportedTextFilters",
"signature" => $f_mt_supportedTextFilters_sig,
"docstring" => $f_mt_supportedTextFilters_doc),
"mt.getCategoryList" =>
array( "function" => "f_mt_getCategoryList",
"signature" => $f_mt_getCategoryList_sig,
"docstring" => $f_mt_getCategoryList_doc),
"mt.publishPost" =>
array( "function" => "f_mt_publishPost",
"signature" => $f_mt_publishPost_sig,
"docstring" => $f_mt_publishPost_doc),
"mt.getPostCategories" =>
array( "function" => "f_mt_getPostCategories",
"signature" => $f_mt_getPostCategories_sig,
"docstring" => $f_mt_getPostCategories_doc),
"mt.setPostCategories" =>
array( "function" => "f_mt_setPostCategories",
"signature" => $f_mt_setPostCategories_sig,
"docstring" => $f_mt_setPostCategories_doc),
"mt.getRecentPostTitles" =>
array( "function" => "f_mt_getRecentPostTitles",
"signature" => $f_mt_getRecentPostTitles_sig,
"docstring" => $f_mt_getRecentPostTitles_doc),
"mt.getTrackbackPings" =>
array( "function" => "f_mt_getTrackbackPings",
"signature" => $f_mt_getTrackbackPings_sig,
"docstring" => $f_mt_getTrackbackPings_doc)
)
);
function _mt_setPostCategories($itemid, $username, $password, $category) {
global $manager;
// login
$mem = new MEMBER();
if (!$mem->login($username, $password))
return _error(1,"Could not log in");
// check if item exists
if (!$manager->existsItem($itemid,1,1))
return _error(6,"No such item ($itemid)");
$blog