X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=nucleus%2Fxmlrpc%2Fapi_mt.inc.php;h=81cfdf0b16ece5eb6c83bc96029091f7466eda08;hb=c90b0980cfa3e79cd4bc7eed551a64a5e2b02a5c;hp=73c59974a7a43b82cdd5aef88745d03ca4f24b68;hpb=0926bc19967e1b472c9aeb40eb47234a601a68f8;p=nucleus-jp%2Fnucleus-next.git diff --git a/nucleus/xmlrpc/api_mt.inc.php b/nucleus/xmlrpc/api_mt.inc.php index 73c5997..81cfdf0 100644 --- a/nucleus/xmlrpc/api_mt.inc.php +++ b/nucleus/xmlrpc/api_mt.inc.php @@ -17,7 +17,7 @@ * * @license http://nucleuscms.org/license.txt GNU General Public License * @copyright Copyright (C) 2002-2009 The Nucleus Group - * @version $Id: api_mt.inc.php 1388 2009-07-18 06:31:28Z shizuki $ + * @version $Id: api_mt.inc.php 1860 2012-05-19 03:47:59Z sakamocchi $ */ // mt.supportedMethods @@ -188,8 +188,9 @@ $trackbacks = array (); $tbstruct = array (); - - $manager->notify('RetrieveTrackback', array ('tb_id' => $itemid, 'trackbacks' => & $trackbacks)); + + $data = array('tb_id' => $itemid, 'trackbacks' => &$trackbacks); + $manager->notify('RetrieveTrackback', $data); while (list(,$v) = each ($trackbacks)) { $tbstruct[] = new xmlrpcval( @@ -253,7 +254,7 @@ global $manager; // login - $mem = new MEMBER(); + $mem = new Member(); if (!$mem->login($username, $password)) return _error(1,"Could not log in"); @@ -262,7 +263,7 @@ return _error(6,"No such item ($itemid)"); $blogid = getBlogIDFromItemID($itemid); - $blog = new BLOG($blogid); + $blog =& $manager->getBlog($blogid); if (!$mem->canAlterItem($itemid)) return _error(7,"Not allowed to alter item"); @@ -287,7 +288,7 @@ global $manager; // login - $mem = new MEMBER(); + $mem = new Member(); if (!$mem->login($username, $password)) return _error(1,"Could not log in"); @@ -296,7 +297,7 @@ return _error(6,"No such item ($itemid)"); $blogid = getBlogIDFromItemID($itemid); - $blog = new BLOG($blogid); + $blog =& $manager->getBlog($blogid); if (!$mem->canAlterItem($itemid)) return _error(7, 'You are not allowed to request this information'); @@ -324,7 +325,7 @@ // get item data $blogid = getBlogIDFromItemID($itemid); - $blog = new BLOG($blogid); + $blog =& $manager->getBlog($blogid); $old =& $manager->getItem($itemid,1,1); return _edititem($itemid, $username, $password, $old['catid'], $old['title'], $old['body'], $old['more'], $old['draft'], 1, $old['closed']); @@ -332,18 +333,19 @@ function _mt_categoryList($blogid, $username, $password) { + global $manager; // 1. login - $mem = new MEMBER(); + $mem = new Member(); if (!$mem->login($username, $password)) return _error(1,"Could not log in"); // check if on team and blog exists - if (!BLOG::existsID($blogid)) + if (!Blog::existsID($blogid)) return _error(2,"No such blog ($blogid)"); if (!$mem->teamRights($blogid)) return _error(3,"Not a team member"); - $b = new BLOG($blogid); + $b =& $manager->getBlog($blogid); $categorystruct = array(); @@ -351,14 +353,14 @@ . ' FROM '.sql_table('category') . " WHERE cblog=" . intval($blogid) . " ORDER BY cname"; - $r = sql_query($query); + $r = DB::getResult($query); - while ($obj = sql_fetch_object($r)) { + foreach ( $r as $row ) { $categorystruct[] = new xmlrpcval( array( - "categoryName" => new xmlrpcval($obj->cname,"string"), - "categoryId" => new xmlrpcval($obj->cname,"string") + "categoryName" => new xmlrpcval($row['cname'],"string"), + "categoryId" => new xmlrpcval($row['cname'],"string") ) ,'struct'); @@ -371,16 +373,18 @@ function _mt_getRecentPostTitles($blogid, $username, $password, $iAmount) { + global $manager; + $blogid = intval($blogid); $iAmount = intval($iAmount); // 1. login - $mem = new MEMBER(); + $mem = new Member(); if (!$mem->login($username, $password)) return _error(1,"Could not log in"); // 2. check if allowed - if (!BLOG::existsID($blogid)) + if (!Blog::existsID($blogid)) return _error(2,"No such blog ($blogid)"); if (!$mem->teamRights($blogid)) return _error(3,"Not a team member"); @@ -391,7 +395,7 @@ // 3. create and return list of recent items // Struct returned has dateCreated, userid, postid and title - $blog = new BLOG($blogid); + $blog =& $manager->getBlog($blogid); $structarray = array(); // the array in which the structs will be stored @@ -400,9 +404,9 @@ ." WHERE iblog=$blogid" ." ORDER BY itime DESC" ." LIMIT $iAmount"; - $r = sql_query($query); + $r = DB::getResult($query); - while ($row = sql_fetch_assoc($r)) { + foreach ( $r as $row ) { $newstruct = new xmlrpcval(array( "dateCreated" => new xmlrpcval(iso8601_encode(strtotime($row['itime'])),"dateTime.iso8601"), @@ -420,4 +424,4 @@ -?> \ No newline at end of file +?>