public function update() { static::$auth->mustBeAdmin(); $movie = new Movies($_POST['id']); $movie->processArray($_POST); if (is_array($movie->tags)) { $movie->tags = implode(",", $movie->tags); // var_dump($movie->tags); } // var_dump($movie); if (!$movie->isValid()) { $_SESSION['movie.create'] = $movie; header("Location: .\\?page=movie.edit&id=" . $_POST['id']); exit; } if ($_FILES['poster']['error'] === UPLOAD_ERR_OK) { $movie->savePoster($_FILES['poster']['tmp_name']); } elseif (isset($_POST['removeImage']) && $_POST['removeImage'] === "true") { $movie->poster = null; } $movie->savePoster($_FILES['poster']['tmp_name']); $movie->save(); $movie->saveTags(); header("Location: .\\?page=movie&id=" . $movie->id); }