* You should have received a copy of the GNU Affero General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
***** END LICENSE BLOCK *****/
if (isset($_POST['action'])) {
    switch (trim($_POST['action'])) {
        case 'page':
            $page = $_POST['page'];
            print render_page($page);
            break;
        case 'post':
            $post_id = $_POST['post_id'];
            $search_value = trim($POST['search_value']);
            $sql = generate_SQL(0, 10, array(), array(), '', null, false, $post_id, 1);
            $rs = $core->con->select($sql);
            $tpl = showSinglePost($rs, $core->tpl, $search_value, true, true);
            print $tpl->render('post.block');
            break;
            ##########################################################
            # DEFAULT RETURN
            ##########################################################
        ##########################################################
        # DEFAULT RETURN
        ##########################################################
        default:
            print '<div class="flash_error">' . T_('User bad call') . '</div>';
            break;
    }
} else {
    print 'forbidden';
}
function showPosts($rs, $tpl, $search_value = "", $multiview = true, $strip_tags = false)
{
    global $blog_settings, $core, $user_settings;
    $avatar = $blog_settings->get('planet_avatar');
    while ($rs->fetch()) {
        $tpl = showSinglePost($rs, $tpl, $search_value, $multiview, $strip_tags);
        $tpl->render('post.block');
    }
    if ($rs->count() > 1) {
        $tpl->render('post.morebutton');
    }
    return $tpl;
}