<?php require_once nZEDb_LIBS . 'TMDb.php'; use nzedb\Movie; use nzedb\UserMovies; if (!$page->users->isLoggedIn()) { $page->show403(); } $um = new UserMovies(['Settings' => $page->settings]); if (isset($_REQUEST['del'])) { $usermovies = $um->delMovie($page->users->currentUserId(), $_REQUEST['del']); } else { if (isset($_REQUEST['add'])) { // Derive cats from user preferences. $cats = array(); $cats[] = '2030'; $cats[] = '2040'; $m = new Movie(['Settings' => $page->settings]); $mi = $m->getMovieInfo($_REQUEST['add']); if (!$mi) { $m->updateMovieInfo($_REQUEST['add']); } $usermovies = $um->addMovie($page->users->currentUserId(), $_REQUEST['add'], $cats); } else { if (!isset($_REQUEST['id'])) { $page->show404(); } $tmdb = new TMDb($page->settings->getSetting('tmdbkey'), $page->settings->getSetting('imdblanguage')); $m = new Movie(['Settings' => $page->settings, 'TMDb' => $tmdb]); if (is_numeric($_REQUEST['id'])) { $movie = $m->fetchTMDBProperties($_REQUEST['id']);
<?php use nzedb\Category; use nzedb\UserMovies; if (!$page->users->isLoggedIn()) { $page->show403(); } $um = new UserMovies(['Settings' => $page->settings]); if (isset($_REQUEST["del"])) { $um->delMovie($page->users->currentUserId(), $_REQUEST["del"]); } $cat = new Category(['Settings' => $page->settings]); $tmpcats = $cat->getChildren(Category::CAT_PARENT_MOVIE); $categories = array(); foreach ($tmpcats as $c) { $categories[$c['id']] = $c['title']; } $movies = $um->getMovies($page->users->currentUserId()); $results = array(); foreach ($movies as $mov => $m) { $movcats = explode('|', $m['categoryid']); if (is_array($movcats) && sizeof($movcats) > 0) { $catarr = array(); foreach ($movcats as $movcat) { if (!empty($movcat)) { $catarr[] = $categories[$movcat]; } } $m['categoryNames'] = implode(', ', $catarr); } else { $m['categoryNames'] = '';