Esempio n. 1
0
function threadPost()
{
    ModelFacade::kickIfBannedOrDeleted();
    $thread = ModelFacade::getThread($_GET["id"]);
    //get Post Comments
    //check if comment has text
    $emptyComment = false;
    if (trim($_POST["newComment"]) == "") {
        $emptyComment = true;
    } elseif (ModelFacade::checkThreadClosed($_GET["id"])) {
        header("location:Thread.php?id=" . $_GET["id"]);
    } else {
        //add comment
        ModelFacade::addComment($_GET["id"], htmlspecialchars($_POST["newComment"]), ModelFacade::getLoggedInUser()->id);
    }
    unset($_POST);
    $comments = ModelFacade::getThreadComments($_GET["id"]);
    //include_once('/Views/Thread.html');
    header("location:Thread.php?id=" . $_GET["id"]);
}