Пример #1
0
    $shortdesc = $_POST['shortdesc'];
    $category = $_POST['category'];
    $tags = $_POST['tags'];
    $status = $_POST['status'];
    //Adding General information
    $form_data = array('name' => mysql_real_escape_string($name), 'parmalink' => mysql_real_escape_string($parmalink), 'description' => mysql_real_escape_string($desc), 'short_description' => mysql_real_escape_string($shortdesc), 'tags' => mysql_real_escape_string($tags), 'last_update' => date("Y-m-d H:i:s"), 'status' => $status);
    UpdateData(POST, $form_data, "WHERE slno = " . $id . "");
    //Adding Featured Image
    if ($_FILES["postimage"]["name"] != "") {
        $newname = image_upload($_FILES["postimage"]["tmp_name"], $_FILES["postimage"]["name"], uniqid(), "../images/featured_image/");
        $form_data = array('image' => $newname);
        UpdateData(POST, $form_data, "WHERE slno = " . $id . "");
    }
    //Adding Category
    $array1 = $category;
    $array2 = get_cat_arr_id($id);
    $result = array_intersect($array1, $array2);
    if (count($array1) == count($array2) && count($array1) == count($result)) {
        $flag = FALSE;
    } else {
        $flag = TRUE;
    }
    if ($flag) {
        mysql_query("DELETE FROM `" . POST_CATEGORY . "` WHERE `post_id`='{$id}'");
        foreach ($category as $cat) {
            mysql_query("INSERT INTO `" . POST_CATEGORY . "`(`post_id`, `category_id`) VALUES ('{$id}','{$cat}')");
        }
    }
    header("location:edit-post.php?id={$id}&editsuccess#tab_general");
}
?>
Пример #2
0
													<!-- TASK DESC -->
													
                                                                                                        <div class="form-group">
                                                                                                            <div class="col-md-12">
                                                                                                                    <textarea name="shortdesc"  maxlength="500" rows="5" class="maxlength form-control todo-taskbody-tasktitle" placeholder="Excerpt.."><?php 
    if ($fedit) {
        echo $editpostarr["short_description"];
    }
    ?>
</textarea>
                                                                                                                    <span class="help-block"><i class="fa fa-info-circle"></i> Small description of your article within 500 letter.</span>
                                                                                                            </div>
                                                                                                        </div>
                                                                                                        <?php 
    if ($fedit) {
        $categories = get_cat_arr_id($editpostarr["slno"]);
    }
    ?>
                                                                                                        <div class="form-group">
                                                                                                                    <label class="control-label col-md-2"><b>Category</b> <i class="fa fa-folder-open"></i></label>
                                                                                                                    <div class="col-md-10">
                                                                                                                        <div class="row">
                                                                                                                            <?php 
    $res1 = mysql_query("SELECT * FROM `" . CATEGORY . "` WHERE `status`='active' ORDER BY `sort_order` ASC");
    while ($datacat = mysql_fetch_array($res1)) {
        ?>
                                                                                                                            <div class="col-md-4 radio-list">
                                                                                                                                <label class="radio-inline">
                                                                                                                                    <input 
                                                                                                                                        type="checkbox" 
                                                                                                                                        name="category[]"