function do_get_announcement()
{
    $cleaned = vB::getCleaner()->cleanArray($_REQUEST, array('forumid' => vB_Cleaner::TYPE_UINT));
    if (!isset($cleaned['forumid']) || $cleaned['forumid'] < 1) {
        return json_error(ERR_NO_PERMISSION);
    }
    $result = vB_Api::instance('announcement')->fetch($cleaned['forumid']);
    if ($result === null || isset($result['errors'])) {
        return json_error(ERR_NO_PERMISSION);
    }
    $posts = array();
    foreach ($result as $ann) {
        $posts[] = fr_parse_post($ann);
    }
    return array('posts' => $posts, 'total_posts' => count($posts));
}
function do_get_post()
{
    $cleaned = vB::getCleaner()->cleanArray($_REQUEST, array('postid' => vB_Cleaner::TYPE_INT, 'type' => vB_Cleaner::TYPE_STR, 'signature' => vB_Cleaner::TYPE_BOOL));
    if (empty($cleaned['postid'])) {
        return json_error(ERR_INVALID_TOP);
    }
    $html = true;
    $postinfo = vB_Api::instance('node')->getFullContentforNodes(array($cleaned['postid']));
    if (!$postinfo) {
        return json_error(ERR_INVALID_TOP);
    }
    $postinfo = $postinfo[0];
    if ($postinfo['content']['contenttypeclass'] != 'Text') {
        return json_error(ERR_INVALID_TOP);
    }
    $post = fr_parse_post($postinfo, $cleaned['signature'], $html);
    if ($html) {
        if ($cleaned['type'] === 'facebook') {
            $post['html'] = strip_tags($post['html']);
            if (!empty($post['fr_images'])) {
                $post['image'] = $post['fr_images'][0]['img'];
            }
        } else {
            $css = '
				<style>
				* {
					font-family: sans-serif;
		}
		.quotedRoot, .quoted1, .quoted2, .quoted3 {
			border-radius: 6px;
			background: #F4F5F6;
			border: 1px solid gray;
			padding: 5px 13px 5px 13px;
		}
		</style>
			';
            $post['html'] = $css . $post['html'];
        }
    }
    $post['canpost'] = $postinfo['content']['createpermissions']['vbforum_text'] ? 1 : 0;
    return $post;
}