} }); ////////////////////// // // // MOVIES // // // ////////////////////// $app->get('/actors/movie/{movieId}/{movieName}/{movieReleaseDate}/{movieDescription}', function ($request, $response, $args) { if (addMovie($args['movieId'], $args['movieName'], $args['movieReleaseDate'], $args['movieDescription'])) { createResponse(array('succes' => 'Succesfully created movie.')); } else { createResponse(array('error' => 'Could not create movie.')); } }); $app->get('/movie/{movieId}', function ($request, $response, $args) { if ($movieData = getMovie($args['movieId'])) { $movie = mysqli_fetch_array($movieData); createResponse($movie); } else { createResponse(array('error' => 'Could not load movie.')); } }); $app->get('/movie/search/{movieName}', function ($request, $response, $args) { if ($movieData = getmovieNameLike($args['movieName'])) { $movies = array(); while ($movie = mysqli_fetch_array($movieData)) { array_push($movies, $movie); } createResponse($movies); } else { createResponse(array('error' => 'No movies found for the ' . $args['movieName'] . ' search term.'));
} $stat['max'] = $max; $stat['export_url'] = 'ajax_request.php?mod=media&file=stat.export&downloadid=' . $downloadid . '&month=' . $month . '&year=' . $year; $smarty->assign('dl_stat', $stat); } } if ($rights->isAllowed($mod, 'manage')) { $menu->addSubElement($mod, $lang->get('download_stat'), '', array('categoryid' => $categoryid, 'downloadid' => $downloadid, 'statistic' => '')); } } else { $notify->add($lang->get('media'), $lang->get('access_denied')); } $showcategories = false; } if ($movieid > 0) { $mv = getMovie($movieid); if (isVisible($mv['categoryid'])) { $breadcrumbs->addElement($mv['name'], makeURL($mod, array('categoryid' => $categoryid, 'movieid' => $movieid))); $smarty->assign('movie', $mv); $smarty->assign('path', $template_dir . "/movie.tpl"); if ($login->currentUser() !== false) { $smarty->assign('loggedin', true); if (isset($_POST['add'])) { $comments->add($mod . '-movie', $login->currentUserID(), $_POST['comment'], $movieid); } } $smarty->assign('comments', $comments->get($mod . '-movie', $movieid)); } else { $notify->add($lang->get('media'), $lang->get('access_denied')); } $showcategories = false;
function processAddMovie() { $id = $_POST['id']; $obj = getMovie($id); $title = $obj['original_title']; $description = $obj['overview']; $poster_path = 'http://image.tmdb.org/t/p/w500' . $obj['poster_path']; $poster_destination = '/img/movie/poster' . $obj['poster_path']; //returns false if function fails $falseOnFailure = copy($poster_path, __DIR__ . '/../' . $poster_destination); if ($falseOnFailure == false) { $poster_destination = null; } $tagline = $obj['tagline']; $date = $obj['release_date']; $backdrop_path = 'http://image.tmdb.org/t/p/w1920' . $obj['backdrop_path']; $backdrop_destination = '/img/movie/backdrop' . $obj['backdrop_path']; //no poster_destination $falseOnFailure = copy($backdrop_path, __DIR__ . '/../' . $backdrop_destination); if ($falseOnFailure == false) { $backdrop_destination = null; } $movieID = addMovie($id, $title, $description, $poster_destination, $tagline, $date, $backdrop_destination); if (is_numeric($movieID)) { header("Location:../movies/{$movieID}"); } else { $errorMsg = $movieID; include '../view/errorPage.php'; } }
<div id="nav"> <h3>Members Area</h3> <a href="movieSearch.php">Home</a><br> <a href="editDatabase.php">Add to Database</a><br> <a href="deleteStuff.php">Delete from Database</a><br> <a href="changePassword.php">Change Password</a><br> <a href="logout.php">Logout</a> </div> <table id="inDepth"> <tr><td id="space" colspan="2"></td></tr> <tr> <td>Title:</td> <td> <?php $results = getMovie($request); foreach ($results as $resultDisplay) { echo $resultDisplay['title'] . "</td></tr>"; echo "<tr><td>Director:</td>"; echo "<td>" . $resultDisplay['director'] . "</td></tr>"; echo "<tr><td>Featured Star:</td>"; echo "<td>" . $resultDisplay['star'] . "</td></tr>"; echo "<tr><td>Genre:</td>"; echo "<td>" . $resultDisplay['genre'] . "</td></tr>"; echo "<tr><td>Rating:</td>"; echo "<td>" . $resultDisplay['rating'] . "</td></tr>"; echo "<tr><td>Length:</td>"; echo "<td>" . $resultDisplay['length'] . " minutes</td></tr>"; echo "<tr><td>Year:</td>"; echo "<td>" . $resultDisplay['year'] . "</td></tr>"; }
<li class='navbarItem'><a href="newReview.php?movie=<?php echo $_GET['movieTitle']; ?> ">Add Review For This Movie!</a></li> <?php } else { ?> <li class='navbarItem'><a href="login.php">Login or register</a></li> <?php } ?> </ul> <?php require './controller.php'; $movie = $_GET["movieTitle"]; $movieInfo = getMovie($movie); $movieInfo = $movieInfo[0]; $movieReviews = getReviewsForMovie($movie); $ratings_array = ['G', 'PG', 'PG-13', 'R']; ?> <h1 class="text_heading"><?php echo $movieInfo['movieTitle'] . " " . $movieInfo['yearReleased']; ?> </h1> <div class="content_area"> <div class="reviews_heading"> <?php echo freshOrNot($movieReviews); ?> </div>
<?php require __DIR__ . '/includes/config.php'; require __DIR__ . '/includes/functions.php'; $id = (int) $_GET['id']; $movie = getMovie($id); if (count($movie) < 1) { require __DIR__ . '/404.php'; } $stream = generateSecureStream($movie['filename']); $description = htmlentities($movie['plot'], ENT_QUOTES); $og_title = htmlentities($movie['title'] . ' (' . $movie['year'] . ')', ENT_QUOTES); $og_description = $description; $og_url = $www . 'movie.php?id=' . $movie['id']; $og_image = $movie['poster']; $twitter_url = $og_url; $twitter_title = $og_title; $twitter_description = $description; $twitter_image = $og_image; $no_warning = true; $no_description_intro = true; include __DIR__ . '/includes/header.php'; ?> <div class="home movie section"> <div class="container"> <div class="content"> <div class="player"> <div class="player-object"> <div id="playerXJXweHTdLqjJ"></div> <script> jwplayer('playerXJXweHTdLqjJ').setup({
//tmdb api key define('TMDB_URI', 'https://api.themoviedb.org/3/'); define('API_KEY', '166547236c6c7c2a230787e413461366'); //gets the function call from func and the rest of the query string are dependent on //the api request if (isset($_POST['func'])) { $func = $_POST['func']; //all the functions switch ($func) { case 'SearchMovie': searchMovie(); break; case 'GetMovie': $id = $_POST['id']; getMovie($id); break; } } //when adding a movie it searches and returns the list function searchMovie() { //multiple words $query = urlencode($_POST['query']); //the json link $jsonMovieList = TMDB_URI . 'search/movie?query=' . $query . '&api_key=' . API_KEY; $json = file_get_contents($jsonMovieList); //the movie list object $movieList = json_decode($json, true, 512, JSON_BIGINT_AS_STRING); //bring the json object back to page echo json_encode($movieList['results']);