Beispiel #1
0
    $insert2->bindParam(':time', $time, PDO::PARAM_STR);
    $insert2->bindParam(':author', $CURUSER->get('id'), PDO::PARAM_INT);
    $insert2->bindParam(':flags', $postFlags, PDO::PARAM_INT);
    $insert2->execute();
    if ($insert2->rowCount() > 0) {
        $postId = $DB->lastInsertId();
        //Update the topic with the post id
        $update = $DB->prepare("UPDATE `wcf_topics` SET `posts` = `posts` + 1, `lastpost_id` = :post, `lastpost_time` = :time WHERE `id` = :topic LIMIT 1;");
        $update->bindParam(':topic', $topicId, PDO::PARAM_INT);
        $update->bindParam(':post', $postId, PDO::PARAM_INT);
        $update->bindParam(':time', $time, PDO::PARAM_STR);
        $update->execute();
        //Update the forum
        $update = $DB->prepare("UPDATE `wcf_forums` SET `posts` = `posts` + 1 WHERE `id` = :forum LIMIT 1;");
        $update->bindParam(':forum', $forumId, PDO::PARAM_INT);
        $update->execute();
        ######################################
        ########## Redirect ##################
        $PostPage = WCF::calculatePostPage($postId);
        //bind the onsuccess message
        $ERRORS->onSuccess('Success.', '/forums.php?page=topic&id=' . $topicId . '&p=' . $PostPage . '#post-' . $postId);
        //Trigger it
        $ERRORS->triggerSuccess();
    } else {
        $ERRORS->Add('The topic you are replying on might have been removed. Cannot continue.');
    }
} else {
    $ERRORS->Add('The website failed to insert your post. Please contact the administration.');
}
$ERRORS->Check('/forums.php?page=post_reply');
exit;