OSDN Git Service

MERGE: リビジョン1894〜1990
[nucleus-jp/nucleus-next.git] / nucleus / xmlrpc / api_metaweblog.inc.php
index 42129ee..ee580cb 100644 (file)
@@ -2,7 +2,7 @@
 
 /*
  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2012 The Nucleus Group
+ * Copyright (C) 2002-2009 The Nucleus Group
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -15,8 +15,8 @@
  *     This file contains definitions for the methods of the metaWeblog API
  *
  * @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2012 The Nucleus Group
- * @version $Id: api_metaweblog.inc.php 1534 2011-06-22 06:13:23Z sakamocchi $
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @version $Id: api_metaweblog.inc.php 1860 2012-05-19 03:47:59Z sakamocchi $
  */
 
 
@@ -75,7 +75,8 @@
                                $trackbacks[] = _getArrayVal($tblist, $i);
                        }
                        
-                       $manager->notify('SendTrackback', array ('tb_id' => $itemid, 'urls' => & $trackbacks));
+                       $data = array('tb_id' => $itemid, 'urls' => &$trackbacks);
+                       $manager->notify('SendTrackback', $data);
                }
 
                return $res;
                }
                else
                {
-                       $blog = new Blog($blogid);
+                       $blog =& $manager->getBlog($blogid);
                        $catid = $blog->getCategoryIdFromName($category);
                }
 
                                $trackbacks[] = _getArrayVal($tblist, $i);
                        }
                        
-                       $manager->notify('SendTrackback', array ('tb_id' => $itemid, 'urls' => & $trackbacks));
+                       $data = array('tb_id' => $itemid, 'urls' => &$trackbacks);
+                       $manager->notify('SendTrackback', $data);
                }
 
                return $res;
        }
 
        function _getRecentItemsMetaWeblog($blogid, $username, $password, $amount) {
-
+               global $manager;
+               
                $blogid = intval($blogid);
                $amount = intval($amount);
 
                // 3. create and return list of recent items
                // Struct returned has dateCreated, userid, blogid and content
 
-               $blog = new Blog($blogid);
+               $blog =& $manager->getBlog($blogid);
 
                $structarray = array();         // the array in which the structs will be stored
 
                           ." WHERE iblog=$blogid and icat=catid and iauthor=mnumber"
                           ." ORDER BY itime DESC"
                           ." LIMIT $amount";
-               $r = sql_query($query);
+               $r = DB::getResult($query);
 
-               while ($row = sql_fetch_assoc($r)) {
+               foreach ( $r as $row ) {
 
                        // remove linebreaks if needed
                        if ($blog->convertBreaks()) {
        }
 
        function _newMediaObject($blogid, $username, $password, $info) {
-               global $CONF, $DIR_MEDIA, $DIR_LIBS;
+               global $CONF, $DIR_MEDIA, $DIR_LIBS, $manager;
 
                // - login
                $mem = new Member();
                if (!$mem->teamRights($blogid))
                        return _error(3,'Not a team member');
 
-               $b = new Blog($blogid);
+               $b =& $manager->getBlog($blogid);
 
                // - decode data
                $data = $info['bits']; // decoding was done transparantly by xmlrpclib
        }
 
        function _categoryList($blogid, $username, $password) {
+               global $manager;
+               
                // 1. login
                $mem = new Member();
                if (!$mem->login($username, $password))
                if (!$mem->teamRights($blogid))
                        return _error(3,"Not a team member");
 
-               $b = new Blog($blogid);
+               $b =& $manager->getBlog($blogid);
 
                $categorystruct = array();
 
                                . ' 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[$obj->cname] = new xmlrpcval(
+                       $categorystruct[$row['cname']] = new xmlrpcval(
                                array(
-                                       "description" => new xmlrpcval($obj->cdesc,"string"),
-                                       "htmlUrl" => new xmlrpcval($b->getURL() . "?catid=" . $obj->catid ,"string"),
+                                       "description" => new xmlrpcval($row['cdesc'],"string"),
+                                       "htmlUrl" => new xmlrpcval($b->getURL() . "?catid=" . $row['catid'] ,"string"),
                                        "rssUrl" => new xmlrpcval("","string")
                                )
                        ,'struct');
                // 3. return the item
                $item =& $manager->getItem($itemid,1,1); // (also allow drafts and future items)
 
-               $b = new Blog($blogid);
+               $b =& $manager->getBlog($blogid);
                if ($b->convertBreaks()) {
                        $item['body'] = removeBreaks($item['body']);
                        $item['more'] = removeBreaks($item['more']);
 
                )
        );
-?>
\ No newline at end of file
+?>