Пример #1
0
    print "<script> window.location = 'index.php?menu=plugin&plugin=blogger&plugin_menu=blogger_config'; </script>";
    exit;
}
if (isset($_POST['add_post'])) {
    $params = $_POST;
    $errors = $blogger->validatePost($params);
    if (!count($errors)) {
        $post_id = $blogger->addPost($params);
        $add_success = true;
    }
}
if (isset($_POST['update_post']) && isset($_POST['post_id'])) {
    $params = $_POST;
    $errors = $blogger->validatePost($params);
    if (!count($errors)) {
        $blogger->updatePost($_POST['post_id'], $params);
        $upd_success = true;
    }
}
if (isset($_REQUEST['post_id'])) {
    $post_id = $_REQUEST['post_id'];
    if (!isset($_POST['update_post'])) {
        $params = $blogger->getPost($post_id);
        if (!$params) {
            unset($post_id);
        } else {
            if (count($params['tags'])) {
                $tags = array();
                foreach ($params['tags'] as $key => $val) {
                    $tags[] = $val['tag'];
                }