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); }