Esempio n. 1
0
    <article>

        <header>
            <h1>Atualizar Post:</h1>
        </header>

        <?php 
$post = filter_input_array(INPUT_POST, FILTER_DEFAULT);
$postid = filter_input(INPUT_GET, 'postId', FILTER_VALIDATE_INT);
if (isset($post) && $post['SendPostForm']) {
    $post['post_status'] = $post['SendPostForm'] == 'Atualizar' ? '0' : '1';
    $post['post_cover'] = $_FILES['post_cover']['tmp_name'] ? $_FILES['post_cover'] : 'null';
    unset($post['SendPostForm']);
    require_once '_models/AdminPost.class.php';
    $cadastra = new AdminPost();
    $cadastra->ExeUpdate($postid, $post);
    WSErro($cadastra->getError()[0], $cadastra->getError()[1]);
    if (!empty($_FILES['gallery_covers']['tmp_name'])) {
        $sendGallery = new AdminPost();
        $sendGallery->gbSend($_FILES['gallery_covers'], $postid);
    }
    if (!empty($_FILES['files']['tmp_name'])) {
        $sendFiles = new AdminPost();
        $sendFiles->flSend($_FILES['files'], $postid);
    }
} else {
    $WsPosts = new WsPosts();
    $WsPosts->setPost_id($postid);
    $WsPosts->Execute()->find();
    if (!$WsPosts->Execute()->getResult()) {
        header('Location: painel.php?exe=posts/index&empty=true');