Пример #1
0
/**
 * Returns a list of recent items
 */
function _getRecentItemsBlogger($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
    $blog = new BLOG($blogid);
    $structarray = array();
    // the array in which the structs will be stored
    $query = "SELECT mname, ibody, iauthor, ibody, inumber, ititle as title, itime, cname as category" . ' FROM ' . sql_table('item') . ', ' . sql_table('category') . ', ' . sql_table('member') . " WHERE iblog={$blogid} and icat=catid and iauthor=mnumber" . " ORDER BY itime DESC" . " LIMIT {$amount}";
    $r = sql_query($query);
    while ($row = sql_fetch_assoc($r)) {
        // remove linebreaks if needed
        if ($blog->convertBreaks()) {
            $row['ibody'] = removeBreaks($row['ibody']);
        }
        $content = blogger_specialTags($row) . $row['ibody'];
        $newstruct = new xmlrpcval(array("userid" => new xmlrpcval($row['iauthor'], "string"), "dateCreated" => new xmlrpcval(iso8601_encode(strtotime($row['itime'])), "dateTime.iso8601"), "blogid" => new xmlrpcval($blogid, "string"), "content" => new xmlrpcval($content, "string"), "postid" => new xmlrpcval($row['inumber'], "string"), "authorName" => new xmlrpcval($row['mname'], 'string'), "title" => new xmlrpcval($row['title'], 'string')), 'struct');
        array_push($structarray, $newstruct);
    }
    return new xmlrpcresp(new xmlrpcval($structarray, "array"));
}
Пример #2
0
/**
 * 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 = sql_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"));
}
Пример #3
0
function _setSkinPart($blogid, $username, $password, $content, $type)
{
    // 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");
    }
    // 3. update skin part
    $blog = new BLOG($blogid);
    $skin = new SKIN($blog->getDefaultSkin());
    $skin->update($type, $content);
    return new xmlrpcresp(new xmlrpcval(1, 'boolean'));
}
Пример #4
0
function _mt_getRecentPostTitles($blogid, $username, $password, $iAmount)
{
    $blogid = intval($blogid);
    $iAmount = intval($iAmount);
    // 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");
    }
    $iAmount = intval($iAmount);
    if ($iAmount < 1) {
        return _error(5, "Amount parameter must be positive");
    }
    // 3. create and return list of recent items
    // Struct returned has dateCreated, userid, postid and title
    $blog = new BLOG($blogid);
    $structarray = array();
    // the array in which the structs will be stored
    $query = "SELECT inumber, ititle as title, itime, iauthor" . ' FROM ' . sql_table('item') . " WHERE iblog={$blogid}" . " ORDER BY itime DESC" . " LIMIT {$iAmount}";
    $r = sql_query($query);
    while ($row = sql_fetch_assoc($r)) {
        $newstruct = new xmlrpcval(array("dateCreated" => new xmlrpcval(iso8601_encode(strtotime($row['itime'])), "dateTime.iso8601"), "postid" => new xmlrpcval($row['inumber'], "string"), "title" => new xmlrpcval($row['title'], "string"), "userid" => new xmlrpcval($row['iauthor'], "string")), 'struct');
        array_push($structarray, $newstruct);
    }
    return new xmlrpcresp(new xmlrpcval($structarray, "array"));
}
Пример #5
0
function bm_doShowForm()
{
    global $member;
    $blogid = intRequestVar('blogid');
    $log_text = trim(requestVar('logtext'));
    $log_link = requestVar('loglink');
    $log_linktitle = requestVar('loglinktitle');
    $log_text = uniDecode($log_text, _CHARSET);
    $log_linktitle = uniDecode($log_linktitle, _CHARSET);
    if (!BLOG::existsID($blogid)) {
        bm_doError(_ERROR_NOSUCHBLOG);
    }
    if (!$member->isTeamMember($blogid)) {
        bm_doError(_ERROR_NOTONTEAM);
    }
    $logje = '';
    if ($log_text) {
        $logje .= '<blockquote><div>"' . htmlspecialchars($log_text) . '"</div></blockquote>' . "\n";
    }
    if (!$log_linktitle) {
        $log_linktitle = $log_link;
    }
    if ($log_link) {
        $logje .= '<a href="' . htmlspecialchars($log_link) . '">' . htmlspecialchars($log_linktitle) . '</a>';
    }
    $item['body'] = $logje;
    $item['title'] = htmlspecialchars($log_linktitle);
    $factory = new PAGEFACTORY($blogid);
    $factory->createAddForm('bookmarklet', $item);
}
Пример #6
0
function _categoryList($blogid, $username, $password)
{
    // 1. login
    $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)) {
        return _error(2, "No such blog ({$blogid})");
    }
    if (!$mem->teamRights($blogid)) {
        return _error(3, "Not a team member");
    }
    $b = new BLOG($blogid);
    $categorystruct = array();
    $query = "SELECT cname, cdesc, catid" . ' FROM ' . sql_table('category') . " WHERE cblog=" . intval($blogid) . " ORDER BY cname";
    $r = sql_query($query);
    while ($obj = sql_fetch_object($r)) {
        $categorystruct[$obj->cname] = new xmlrpcval(array("description" => new xmlrpcval($obj->cdesc, "string"), "htmlUrl" => new xmlrpcval($b->getURL() . "?catid=" . $obj->catid, "string"), "rssUrl" => new xmlrpcval("", "string")), 'struct');
    }
    return new xmlrpcresp(new xmlrpcval($categorystruct, "struct"));
}
Пример #7
0
 /**
  * Checks if a blog id exists
  */
 function existsBlogID($id)
 {
     $this->_loadClass('BLOG', 'BLOG.php');
     return BLOG::existsID($id);
 }