public static function run() { if ($_SERVER["REQUEST_METHOD"] == "POST") { $movieData = new MovieData($_POST); if ($movieData->getErrorCount() == 0) { $dbMovieData = MoviesDB::addMovie($movieData); HomeView::show(); } else { AddMovieView::show($movieData); } } else { AddMovieView::show(null); } }
public static function run() { if ($_SERVER["REQUEST_METHOD"] == "POST") { $movieData = new MovieData($_POST); print_r($movieData->getErrors()); if ($movieData->getErrorCount() == 0) { HomeView::show(); } else { RequestMovieView::show($movieData); } } else { RequestMovieView::show(null); } }
break; case validateRoute('GET', 'moviedata/search'): $movieData = new MovieData($db); httpResponse($movieData->search($_GET["search"])); break; case validateRoute('GET', 'moviedata/imdb/\\w+'): $movieData = new MovieData($db); $arr = $movieData->getDataByImdbId($params[2]); httpResponse($arr); break; case validateRoute('GET', 'moviedata/toplist'): $cacheId = 'toplists-toplist'; if ($memcache && ($cached = $memcache->get($cacheId))) { httpResponse($cached); } else { $movieData = new MovieData($db); $torrent = new Torrent($db); $data = $movieData->getToplist(); $result = array(); foreach ($data as $movie) { $movie["torrents"] = $torrent->getByMovieId($movie["id"]); $result[] = $movie; } $memcache && $memcache->set($cacheId, $result, MEMCACHE_COMPRESSED, 60 * 60 * 6); httpResponse($result); } break; case validateRoute('GET', 'start-torrents'): $torrent = new Torrent($db); $index = explode(',', $user->getIndexList()); if (!$index[0]) {
public static function getMoviesArray($rowSets) { // Return an array of Review objects extracted from $rowSets $movies = array(); foreach ($rowSets as $moviesRow) { $movie = new MovieData($moviesRow); $movie->setMovieId($moviesRow['movieId']); array_push($movies, $movie); } return $movies; }