Пример #1
0
function f_blogger_editPost($m)
{
    global $manager;
    $itemid = intval(_getScalar($m, 1));
    $username = _getScalar($m, 2);
    $password = _getScalar($m, 3);
    $content = _getScalar($m, 4);
    $publish = _getScalar($m, 5);
    $title = blogger_extractTitle($content);
    $category = blogger_extractCategory($content);
    $content = blogger_removeSpecialTags($content);
    // get old title and extended part
    if (!$manager->existsItem($itemid, 1, 1)) {
        return _error(6, "No such item ({$itemid})");
    }
    $old =& $manager->getItem($itemid, 1, 1);
    $blogid = getBlogIDFromItemID($itemid);
    $blog = new BLOG($blogid);
    $catid = $blog->getCategoryIdFromName($category);
    if ($old['draft'] && $publish) {
        $wasdraft = 1;
        $publish = 1;
    } else {
        $wasdraft = 0;
    }
    return _edititem($itemid, $username, $password, $catid, $title, $content, $old['more'], $wasdraft, $publish, $old['closed']);
}
Пример #2
0
function f_nucleus_editItem($m)
{
    global $manager;
    $itemid = intval(_getScalar($m, 0));
    $username = _getScalar($m, 1);
    $password = _getScalar($m, 2);
    $title = _getScalar($m, 3);
    $content = _getScalar($m, 4);
    $more = _getScalar($m, 5);
    $publish = _getScalar($m, 6);
    $closed = _getScalar($m, 7);
    // get old title and extended part
    if (!$manager->existsItem($itemid, 1, 1)) {
        return _error(6, "No such item ({$itemid})");
    }
    $old =& $manager->getItem($itemid, 1, 1);
    $wasdraft = $old['draft'] ? 1 : 0;
    return _edititem($itemid, $username, $password, $old['catid'], $title, $content, $more, $wasdraft, $publish, $closed);
}
Пример #3
0
function _mt_publishPost($itemid, $username, $password)
{
    global $manager;
    if (!$manager->existsItem($itemid, 1, 1)) {
        return _error(6, "No such item ({$itemid})");
    }
    // get item data
    $blogid = getBlogIDFromItemID($itemid);
    $blog = new BLOG($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']);
}
Пример #4
0
function f_metaWeblog_editPost($m)
{
    global $manager;
    $itemid = _getScalar($m, 0);
    $username = _getScalar($m, 1);
    $password = _getScalar($m, 2);
    $category = '';
    $struct = $m->getParam(3);
    $content = _getStructVal($struct, 'description');
    $title = _getStructVal($struct, 'title');
    // category is optional (thus: be careful)!
    $catlist = $struct->structmem('categories');
    if ($catlist && $catlist->kindOf() == "array" && $catlist->arraysize() > 0) {
        $category = _getArrayVal($catlist, 0);
    }
    $publish = _getScalar($m, 4);
    // get old title and extended part
    if (!$manager->existsItem($itemid, 1, 1)) {
        return _error(6, "No such item ({$itemid})");
    }
    $blogid = getBlogIDFromItemID($itemid);
    $old =& $manager->getItem($itemid, 1, 1);
    if ($category == '') {
        // leave category unchanged when not present
        $catid = $old['catid'];
    } else {
        $blog = new BLOG($blogid);
        $catid = $blog->getCategoryIdFromName($category);
    }
    if ($old['draft'] && $publish) {
        $wasdraft = 1;
        $publish = 1;
    } else {
        $wasdraft = 0;
    }
    $more = $struct->structmem('mt_text_more');
    if ($more) {
        $more = _getStructVal($struct, 'mt_text_more');
    } else {
        $more = $old['more'];
    }
    $comments = $struct->structmem('mt_allow_comments');
    if ($comments) {
        //			$comments = (int) _getStructVal($struct, 'mt_allow_comments') ? 0 : 1;
        $closed = intval(_getStructVal($struct, 'mt_allow_comments')) == 1 ? 0 : 1;
    } else {
        //			$comments = $old['closed'];
        $closed = $old['closed'];
    }
    //		$res = _edititem($itemid, $username, $password, $catid, $title, $content, $more, $wasdraft, $publish, $comments);
    $res = _edititem($itemid, $username, $password, $catid, $title, $content, $more, $wasdraft, $publish, $closed);
    // Handle trackbacks
    $trackbacks = array();
    $tblist = $struct->structmem('mt_tb_ping_urls');
    if ($tblist && $tblist->kindOf() == "array" && $tblist->arraysize() > 0) {
        for ($i = 0; $i < $tblist->arraysize(); $i++) {
            $trackbacks[] = _getArrayVal($tblist, $i);
        }
        $manager->notify('SendTrackback', array('tb_id' => $itemid, 'urls' => &$trackbacks));
    }
    return $res;
}