function f_nucleus_addItem($m)
{
    $blogid = _getScalar($m, 0);
    $username = _getScalar($m, 1);
    $password = _getScalar($m, 2);
    $title = _getScalar($m, 3);
    $body = _getScalar($m, 4);
    $more = _getScalar($m, 5);
    $publish = _getScalar($m, 6);
    $closed = _getScalar($m, 7);
    return _addItem($blogid, $username, $password, $title, $body, $more, $publish, $closed);
}
function f_blogger_newPost($m)
{
    $blogid = _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);
    return _addItem($blogid, $username, $password, $title, $content, '', $publish, 0, $category);
}
function addItem()
{
    // Get information.
    $title = $_POST['title'];
    $description = $_POST['description'];
    $genre = $_POST['genre'];
    $publisher = $_POST['publisher'];
    $publish_month = $_POST['publish_month'];
    $publish_year = $_POST['publish_year'];
    $image_url = $_POST['image_url'];
    $price = $_POST['price'];
    echo $price;
    // If valid, continue.
    if (true) {
        $item_id = _addItem($title, $description, $genre, $publisher, $publish_month, $publish_year, $image_url, $price);
        if ($item_id > 0) {
            echo $item_id;
            http_response(200);
        } else {
            http_response(210);
        }
    }
}
function f_metaWeblog_newPost($m)
{
    global $manager;
    $blogid = _getScalar($m, 0);
    $username = _getScalar($m, 1);
    $password = _getScalar($m, 2);
    $struct = $m->getParam(3);
    $content = _getStructVal($struct, 'description');
    $more = _getStructVal($struct, 'mt_text_more');
    $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);
    }
    //		$comments = (int) _getStructVal($struct, 'mt_allow_comments') ? 0 : 1;
    $comments = $struct->structmem('mt_allow_comments');
    if ($comments) {
        $closed = intval(_getStructVal($struct, 'mt_allow_comments')) == 1 ? 0 : 1;
    } else {
        $closed = 0;
    }
    $publish = _getScalar($m, 4);
    // Add item
    //		$res = _addItem($blogid, $username, $password, $title, $content, $more, $publish, $comments, $category);
    $res = _addItem($blogid, $username, $password, $title, $content, $more, $publish, $closed, $category);
    // 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;
}