Exemplo n.º 1
0
function newThreadPost()
{
    $subcategory = $_GET["subcategory"];
    $title = trim($_POST["title"]);
    $content = trim($_POST["content"]);
    if (empty($title) or empty($content)) {
        checkEmptyValues($title, $content);
    } else {
        $postId = ModelFacade::insertThread($title, $content, $subcategory, ModelFacade::getLoggedInUser()->id);
        header("location:Thread.php?id=" . $postId);
    }
}
function newMessagePost()
{
    // sanitises data input from form.
    $receiver = htmlspecialchars(trim($_POST["receiver"]));
    $subject = htmlspecialchars(trim($_POST["subject"]));
    $message = htmlspecialchars(trim($_POST["message"]));
    //if successful redirect to sentbox with confirmation message
    if (empty($receiver) or empty($subject) or empty($message)) {
        checkEmptyValues($receiver, $subject, $message);
    } else {
        if (ModelFacade::createMsg($receiver, $subject, $message)) {
            header("location:DirectMsgSent.php?newMsgSent=true");
        } else {
            header("location:DirectMsgSent.php?newMsgSent=false");
        }
    }
}