Beispiel #1
0
 /**
  * @todo document this
  */
 function action_itemedit()
 {
     global $member, $manager;
     $itemid = intRequestVar('itemid');
     // only allow if user is allowed to alter item
     $member->canAlterItem($itemid) or $this->disallow();
     $item =& $manager->getItem($itemid, 1, 1);
     $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
     $manager->notify('PrepareItemForEdit', array('item' => &$item));
     if ($blog->convertBreaks()) {
         $item['body'] = removeBreaks($item['body']);
         $item['more'] = removeBreaks($item['more']);
     }
     // form to edit blog items
     $this->pagehead();
     $formfactory =& new PAGEFACTORY($blog->getID());
     $formfactory->createEditForm('admin', $item);
     $this->pagefoot();
 }
/**
 * Returns one item (Nucleus version)
 */
function _getItem($itemid, $username, $password)
{
    global $manager;
    // 1. login
    $mem = new MEMBER();
    if (!$mem->login($username, $password)) {
        return _error(1, "Could not log in");
    }
    // 2. check if allowed
    if (!$manager->existsItem($itemid, 1, 1)) {
        return _error(6, "No such item ({$itemid})");
    }
    $blogid = getBlogIDFromItemID($itemid);
    if (!$mem->teamRights($blogid)) {
        return _error(3, "Not a team member");
    }
    // 3. return the item
    // Structure returned has dateCreated, userid, blogid and content
    $item =& $manager->getItem($itemid, 1, 1);
    // (also allow drafts and future items)
    $blog = new BLOG($blogid);
    if ($blog->convertBreaks()) {
        $item['body'] = removeBreaks($item['body']);
    }
    $newstruct = new xmlrpcval(array("publishDate" => new xmlrpcval(iso8601_encode($item['timestamp']), "dateTime.iso8601"), "userid" => new xmlrpcval($item['authorid'], "string"), "blogid" => new xmlrpcval($blogid, "string"), "title" => new xmlrpcval($item['title'], "string"), "body" => new xmlrpcval($item['body'], "string"), "more" => new xmlrpcval($item['more'], "string"), "draft" => new xmlrpcval($item['draft'], "boolean"), "closed" => new xmlrpcval($item['closed'], "boolean")), 'struct');
    return new xmlrpcresp($newstruct);
}
Beispiel #3
0
 private function _suspendConvertBreaks(&$data)
 {
     global $manager;
     $blogid = intval($data['blog']->blogid);
     $b =& $manager->getBlog($blogid);
     $this->memory_bconvertbreaks = false;
     if ($b->getSetting('bconvertbreaks') == true) {
         $this->memory_bconvertbreaks = true;
         $data['body'] = removeBreaks($data['body']);
         $data['more'] = removeBreaks($data['more']);
         $b->setConvertBreaks(false);
         $b->writeSettings();
     }
 }
/**
 * Returns one item (Blogger version)
 */
function _getItemBlogger($itemid, $username, $password)
{
    global $manager;
    // 1. login
    $mem = new MEMBER();
    if (!$mem->login($username, $password)) {
        return _error(1, "Could not log in");
    }
    // 2. check if allowed
    if (!$manager->existsItem($itemid, 1, 1)) {
        return _error(6, "No such item ({$itemid})");
    }
    $blogid = getBlogIDFromItemID($itemid);
    if (!$mem->teamRights($blogid)) {
        return _error(3, "Not a team member");
    }
    // 3. return the item
    // Structure returned has dateCreated, userid, blogid and content
    $item =& $manager->getItem($itemid, 1, 1);
    // (also allow drafts and future items)
    $blog = new BLOG($blogid);
    // get category
    $item['category'] = $blog->getCategoryName($item['catid']);
    // remove linebreaks if needed
    if ($blog->convertBreaks()) {
        $item['body'] = removeBreaks($item['body']);
    }
    $content = blogger_specialTags($item) . $item['body'];
    $newstruct = new xmlrpcval(array("dateCreated" => new xmlrpcval(iso8601_encode($item['timestamp']), "dateTime.iso8601"), "userid" => new xmlrpcval($item['authorid'], "string"), "blogid" => new xmlrpcval($blogid, "string"), "content" => new xmlrpcval($content, "string")), 'struct');
    return new xmlrpcresp($newstruct);
}
function shortcode_xml($attr, $content)
{
    return openCodeTag('xml') . removeBreaks($content) . closeCodeTag();
}
Beispiel #6
0
function bm_doEditForm()
{
    global $member, $manager;
    $itemid = intRequestVar('itemid');
    if (!$manager->existsItem($itemid, 0, 0)) {
        bm_doError(_ERROR_NOSUCHITEM);
    }
    if (!$member->canAlterItem($itemid)) {
        bm_doError(_ERROR_DISALLOWED);
    }
    $item =& $manager->getItem($itemid, 1, 1);
    $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
    $manager->notify('PrepareItemForEdit', array('item' => &$item));
    if ($blog->convertBreaks()) {
        $item['body'] = removeBreaks($item['body']);
        $item['more'] = removeBreaks($item['more']);
    }
    $formfactory = new PAGEFACTORY($blog->getID());
    $formfactory->createEditForm('bookmarklet', $item);
}
function _mw_getPost($itemid, $username, $password)
{
    global $manager;
    // 1. login
    $mem = new MEMBER();
    if (!$mem->login($username, $password)) {
        return _error(1, "Could not log in");
    }
    // 2. check if allowed
    if (!$manager->existsItem($itemid, 1, 1)) {
        return _error(6, "No such item ({$itemid})");
    }
    $blogid = getBlogIDFromItemID($itemid);
    if (!$mem->teamRights($blogid)) {
        return _error(3, "Not a team member");
    }
    // 3. return the item
    $item =& $manager->getItem($itemid, 1, 1);
    // (also allow drafts and future items)
    $b = new BLOG($blogid);
    if ($b->convertBreaks()) {
        $item['body'] = removeBreaks($item['body']);
        $item['more'] = removeBreaks($item['more']);
    }
    $categoryname = $b->getCategoryName($item['catid']);
    $newstruct = new xmlrpcval(array("dateCreated" => new xmlrpcval(iso8601_encode($item['timestamp']), "dateTime.iso8601"), "userid" => new xmlrpcval($item['authorid'], "string"), "blogid" => new xmlrpcval($blogid, "string"), "postid" => new xmlrpcval($itemid, "string"), "description" => new xmlrpcval($item['body'], "string"), "title" => new xmlrpcval($item['title'], "string"), "categories" => new xmlrpcval(array(new xmlrpcval($categoryname, "string")), "array"), "mt_text_more" => new xmlrpcval($item['more'], "string"), "mt_allow_comments" => new xmlrpcval($item['closed'] ? 0 : 1, "int"), "mt_allow_pings" => new xmlrpcval(1, "int")), 'struct');
    //TODO: add "String link" to struct?
    //TODO: add "String permaLink" to struct?
    return new xmlrpcresp($newstruct);
}