session_start(); if (!isset($_SESSION['user'])) { session_start(); $_SESSION['notLoggedInError'] = 'Only logged-in users can add new movies.'; header("Location: addNewMovie.php"); } elseif ($modelMethods->titleExists($title)) { session_start(); $_SESSION['addNewMovieError'] = 'The movie already exists in our database'; header("Location: addNewMovie.php"); } else { $modelMethods->addNewMovie($title, $imageFileName, $director, $mpaa, $year, $runtime, $boxOffice); session_start(); $_SESSION["title"] = $title; header("Location: review.php"); } } elseif (isset($_POST['reviewTitle'])) { $title = htmlspecialchars(trim($_POST['reviewTitle'])); $review = htmlspecialchars(trim($_POST['reviewReview'])); $rating = htmlspecialchars(trim($_POST['rating'])); session_start(); if (!isset($_SESSION['user'])) { session_start(); $_SESSION['notLoggedInError'] = 'Only logged-in users can add reviews.'; header("Location: addReview.php"); } else { $modelMethods->addReview($title, $_SESSION["user"], $review, $rating); session_start(); $_SESSION["title"] = $title; header("Location: review.php"); } }
/** * Declares an association between this object and a Model object. * * @param Model $v * @return Review The current object (for fluent API support) * @throws PropelException */ public function setModel(Model $v = null) { if ($v === null) { $this->setModelId(NULL); } else { $this->setModelId($v->getId()); } $this->aModel = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Model object, it will not be re-added. if ($v !== null) { $v->addReview($this); } return $this; }