Esempio n. 1
0
            $lastPage = ceil($postCount / 10);
            $idTopic = $topic->getId();
            $idPost = $back->getId();
            header('Location: index.php?page=topic&id=' . $idTopic . '&p=' . $lastPage . '#' . $idPost . '');
            exit;
        }
    }
}
// ________________
// ________ EDIT POST ________
if (isset($_GET['action']) && $_GET['action'] == 'edit') {
    if (isset($_POST['content'], $_GET['id'])) {
        $content = $_POST['content'];
        $idPost = $_GET['id'];
        $manager = new PostManager($db);
        $back = $manager->edit($idPost, $content);
        if (is_string($back)) {
            $errors[] = $back;
        } else {
            $back = $manager->getTopic($idPost);
            if (is_string($back)) {
                $errors[] = $back;
            } else {
                $idTopic = $back->getId();
                header('Location: index.php?page=topic&id=' . $idTopic . '');
                exit;
            }
        }
    }
}
// ________________