public static function getAllPlatforms() { return PlatformQuery::create()->find(); }
exit; } else { $query = new GameQuery(); $game = $query->findOneByName($_GET["name"]); if ($game == null) { header("Location: /"); /* Redirect browser */ exit; } } if (!array_key_exists("platform", $_GET)) { $platform = "windows"; } else { $platform = $_GET["platform"]; } $query = new PlatformQuery(); $platform = $query->findOneByName($platform); if ($platform == null) { throw new Exception("Invalid platform specified"); } // Getting the rating queries the database each time, so we do it once here: $header = $game->getRatingHeaderForPlatform($platform); $rating = $game->getRatingForPlatform($platform); $user = Auth::getCurrentUser(); if (Auth::checkIfAuthenticated() && array_key_exists("submit_game_review", $_POST) && array_key_exists("submit_game_rating", $_POST)) { $new_review = $_POST["submit_game_review"]; $new_rating = $_POST["submit_game_rating"]; $review = UserReview::getUserReview($game, $platform, $user); if ($review == null) { $review = new UserReview(); $review->setGame($game);
if (!Auth::checkIfAuthenticated() || !Auth::checkIfAdmin()) { header("Location: /"); /* Redirect browser */ } $user = Auth::getCurrentUser(); $game = null; $platform = null; $con = \Propel\Runtime\Propel::getConnection(); if (!array_key_exists("game", $_GET) || !array_key_exists("platform", $_GET)) { header("Location: /"); /* Redirect browser */ exit; } else { $con->beginTransaction(); $game = GameQuery::create()->filterByName($_GET["game"])->findOne($con); $platform = PlatformQuery::create()->filterByName($_GET["platform"])->findOne($con); if ($game == null || $platform == null) { header("Location: /"); /* Redirect browser */ exit; } } $header = RatingHeaderQuery::create()->filterByGame($game)->filterByPlatform($platform)->findOne($con); $categories = CategoryQuery::create()->orderBySequence()->find($con); $options = CategoryOptionQuery::create()->orderBySequence()->find($con); if (array_key_exists("rating_submit", $_POST)) { try { if ($header == null) { $header = new RatingHeader(); $header->setGame($game); $header->setPlatform($platform);