public function create() { $newcomment = new Comment($_POST); // $newcomment['user_id'] = static::$auth->user()->id; if (!$newcomment->isValid()) { $_SESSION['comment.form'] = $newcomment; header("Location:.\\?page=recipe&id=" . $newcomment->id); exit; } $newcomment->save(); echo 'here'; header("Location:.\\?page=recipe&id=" . $newcomment->id . "#comment-" . $newcomment->id); }
public function create() { $input = $_POST; $input['user_id'] = static::$auth->user()->id; $newcomment = new Comment($input); if (!$newcomment->isValid()) { // echo "here"; $_SESSION['comment.form'] = $newcomment; header("Location:.\\?page=movie&id=" . $newcomment->movie_id); exit; } $newcomment->save(); header("Location: ./?page=movie&id=" . $newcomment->movie_id . "#comment-" . $newcomment->id); }
public function update() { static::$auth->mustBeAdmin(); $comment = new Comment($_POST['id']); $comment->processArray($_POST); if (!$comment->isValid()) { $_SESSION['comment.form'] = $comment; header("Location: ./?page=comment.edit&id=" . $_POST['id']); exit; } if ($_FILES['poster']['error'] === UPLOAD_ERR_OK) { $comment->savePoster($_FILES['poster']['tmp_name']); } else { if (isset($_POST['remove-image']) && $_POST['remove-image'] === "TRUE") { $comment->poster = null; } } $comment->save(); header("Location: ./?page=thread&id=" . $comment->thread_id); }