<?php
/*
* Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2009 The Nucleus Group
+ * Copyright (C) 2002-2012 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
* mt.supportedMethods
*
* @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @copyright Copyright (C) 2002-2012 The Nucleus Group
* @version $Id: server.php 1622 2012-01-09 03:18:59Z sakamocchi $
*/
$CONF = array();
* Adds an item to the given blog. Username and password are required to login
*/
function _addItem($blogid, $username, $password, $title, $body, $more, $publish, $closed, $catname = "") {
- $blog = new BLOG($blogid);
+ global $manager;
+ $blog =& $manager->getBlog($blogid);
$timestamp = $blog->getCorrectTime();
return _addDatedItem($blogid, $username, $password, $title, $body, $more, $publish, $closed, $timestamp, 0, $catname);
}
* Adds item to blog, with time of item given
*/
function _addDatedItem($blogid, $username, $password, $title, $body, $more, $publish, $closed = '0', $timestamp, $future, $catname = "") {
+ global $manager;
+
// 1. login
- $mem = new MEMBER();
+ $mem = new Member();
if (!$mem->login($username, $password))
return _error(1,"Could not log in");
// 2. check if allowed to add to blog
- 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");
return _error(4,"Cannot add empty items!");
// 3. calculate missing vars
- $blog = new BLOG($blogid);
+ $blog =& $manager->getBlog($blogid);
// get category id (or id for default category when false category)
$catid = $blog->getCategoryIdFromName($catname);
global $manager;
// 1. login
- $mem = new MEMBER();
+ $mem = new Member();
if (!$mem->login($username, $password))
return _error(1,"Could not log in");
return _error(7,"Not allowed to alter item");
// 3. update item
- ITEM::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, 0);
+ Item::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, 0);
return new xmlrpcresp(new xmlrpcval(1,"boolean"));
}
*/
function _getUsersBlogs($username, $password) {
// 1. Try to login
- $mem = new MEMBER();
+ $mem = new Member();
if (!$mem->login($username, $password))
return _error(1,"Could not log in");
. ' FROM '.sql_table('blog').', '.sql_table('team')
. " WHERE tblog=bnumber and tmember=" . $mem->getID()
. " ORDER BY bname";
- $r = sql_query($query);
-
- while ($obj = sql_fetch_object($r)) {
- if ($obj->burl)
+ $r = DB::getResult($query);
+
+ foreach ( $r as $row )
+ {
+ if ( $row['burl'] )
+ {
+ $blogurl = $row['burl'];
+ }
+ if ( $obj->burl )
+ {
$blogurl = $obj->burl;
+ }
else
+ {
$blogurl = 'http://';
-
+ }
+
$newstruct = new xmlrpcval(array(
- "url" => new xmlrpcval($blogurl,"string"),
- "blogid" => new xmlrpcval($obj->bnumber,"string"),
- "blogName" => new xmlrpcval($obj->bname,"string")
+ "url" => new xmlrpcval($blogurl, "string"),
+ "blogid" => new xmlrpcval($row['bnumber'], "string"),
+ "blogName" => new xmlrpcval($row['bname'], "string")
),'struct');
array_push($structarray, $newstruct);
}
-
+
return new xmlrpcresp(new xmlrpcval( $structarray , "array"));
}
function _getUserInfo($username, $password) {
// 1. login
- $mem = new MEMBER();
+ $mem = new Member();
if (!$mem->login($username, $password))
return _error(1,"Could not log in");
global $manager;
// 1. login
- $mem = new MEMBER();
+ $mem = new Member();
if (!$mem->login($username, $password))
return _error(1,"Could not log in");
return _error(3,"Not a team member");
// delete the item
- ITEM::delete($itemid);
+ Item::delete($itemid);
return new xmlrpcresp(new xmlrpcval(1,"boolean"));
}
* Returns a template
*/
function _getSkinPart($blogid, $username, $password, $type) {
+ global $manager;
+
// 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");
// 3. return skin part
- $blog = new BLOG($blogid);
- $skin = new SKIN($blog->getDefaultSkin());
- return new xmlrpcresp(new xmlrpcval($skin->getContent($type),"string"));
+ $blog =& $manager->getBlog($blogid);
+ $skin =& $manager->getSkin($blog->getDefaultSkin());
+ return new xmlrpcresp(new xmlrpcval($skin->getContentFromDB($type),"string"));
}
function _setSkinPart($blogid, $username, $password, $content, $type) {
+ global $manager;
+
// 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");
// 3. update skin part
- $blog = new BLOG($blogid);
- $skin = new SKIN($blog->getDefaultSkin());
+ $blog =& $manager->getBlog($blogid);
+ $skin =& $manager->getSkin($blog->getDefaultSkin());
$skin->update($type, $content);
return new xmlrpcresp(new xmlrpcval(1,'boolean'));