} $id = $result[0]['id']; if (!adultcheck($id)) { $id = 0; } //adult movie? -> try again } // id still empty? go back to index. if (empty($id)) { redirect('index.php'); } } // get data (id may be empty on a empty database) if (!empty($id)) { // no adult permissions? -> back to index if (!adultcheck($id) || !check_videopermission(PERM_READ, $id)) { redirect('index.php'); } // XML / RSS / PDF export if ($export && $config[$export]) { // either (xml|rss|pdf)export $func = $export . 'export'; if ($export == 'rss') { $export = 'xml'; } require_once './core/' . $export . '.php'; if (function_exists($func)) { $func('WHERE ' . TBL_DATA . '.id = ' . $id); } exit; }
/** * Check if this item is already in the database */ function is_known_item($id, &$sp_id, &$sp_diskid) { $SQL = "SELECT imdbID, id, diskid\n FROM " . TBL_DATA . "\n WHERE imdbID = '" . addslashes($id) . "'\n ORDER BY diskid DESC"; $result = runSQL($SQL); // do we know this movie? if (count($result) && isset($result[0]['imdbID']) && adultcheck($result[0]['id']) && check_videopermission(PERM_READ, $result[0]['id'])) { $sp_id = $result[0]['id']; $sp_diskid = $result[0]['diskid']; if (!$sp_diskid) { $sp_diskid = 'no_diskid'; } return true; } return false; }
// limit random to not unseen movies only if ($config['showrandomunseen']) { // WARNING: this may make the SQL query expensive for large databases $WHERES .= ' AND (' . TBL_DATA . '.id NOT IN (SELECT video_id FROM ' . TBL_USERSEEN . '))'; } // find a random id $SELECT = 'SELECT id, REVERSE(RAND(NOW())) AS rnd FROM ' . TBL_DATA . "\n {$JOINS}\n WHERE mediatype != " . MEDIA_WISHLIST . " {$WHERES}\n ORDER BY rnd\n LIMIT 1"; while (!$id) { $result = runSQL($SELECT); // prevent endless loop if (!count($result) || $count++ > 50) { break; } $id = $result[0]['id']; if (!adultcheck($id)) { $id = 0; } //adult movie? -> try again } // id still empty? go back to index. if (empty($id)) { redirect('index.php'); } } // get data (id may be empty on a empty database) if (!empty($id)) { // XML / RSS / PDF export if ($export && $config[$export]) { // either (xml|rss|pdf)export $func = $export . 'export';