public function Step2() { if (!isset($_GET['q'])) { AddMovie::Step1('invalid-searchterm'); exit; } $search = new imdbsearch(); $search->setsearchname($_GET['q']); $results = $search->results(); $tpl = new Template(DOCUMENT_ROOT . '_templates/add-movie.tpl'); $content = new Template(DOCUMENT_ROOT . '_templates/step-2.tpl'); $content->set('results', $results); $tpl->set('content', $content); echo $tpl->fetch(); }
/** Initialize class (read config etc.) * @constructor imdbpsearch */ function __construct() { parent::__construct(); }
require_once "imdbsearch.class.php"; require_once "imdb_person.class.php"; $search = new imdbpsearch(); $headname = "Person"; break; default: switch ($engine) { case "pilot": require_once "pilotsearch.class.php"; require_once "pilot.class.php"; $search = new pilotsearch(); break; default: require_once "imdbsearch.class.php"; require_once "imdb.class.php"; $search = new imdbsearch(); break; } if ($_GET["searchtype"] == "episode") { $search->search_episodes(TRUE); } else { $search->search_episodes(FALSE); } $headname = "Movie"; break; } $search->setsearchname($_GET["name"]); echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n"; echo "<HTML><HEAD>\n"; echo " <TITLE>Performing search for '" . $_GET["name"] . "' [IMDBPHP2 v" . $search->version . "]</TITLE>\n"; echo " <STYLE TYPE='text/css'>body,td,th,h2 { font-size:12px; font-family:sans-serif; } th { background-color:#ffb000; } h2 { text-align:center; font-size:15px; margin-top: 20px; margin-bottom:0; }</STYLE>\n";
$movieformats = $moviedm->getFormats(); $Website->assign("movieformats", $movieformats); // Automatic update? $autoupdate = isset($_GET["autoupdate"]); $Website->assign("autoupdate", $autoupdate); // Find movies from IMDb if (isset($_GET["imdbsearch"])) { // What is the search term? $imdbsearch = trim($_GET["imdbsearch"]); $Website->assign("imdbsearch", $imdbsearch); if (strlen($imdbsearch) > 0) { // IMDB engine require_once $loc . "/lib/imdbphp/imdb.class.php"; require_once $loc . "/lib/imdbphp/imdbsearch.class.php"; // Search IMDb for the movie $imdb = new imdbsearch(); $imdb->setsearchname($imdbsearch); $imdbresults = $imdb->results(); // Check if any of these results are allready added to our database $temp = array(); foreach ($imdbresults as $result) { $result->known = false; $imdbmovie = $moviedm->getByImdb($result->imdbid()); if ($imdbmovie) { $result->known = true; } $temp[] = $result; } $imdbresults = $temp; $Website->assign("imdbresults", $imdbresults); }
# If we have no MID and no NAME, go back to search page if (empty($_GET["name"])) { header("Location: index.html"); return; } # Still here? Then we need to search for the movie: switch ($_GET["searchtype"]) { case "nm": require_once "imdb_person_search.class.php"; $search = new imdbpsearch(); $headname = "Person"; $results = $search->search($_GET["name"]); break; default: require_once "imdbsearch.class.php"; $search = new imdbsearch(); if ($_GET["searchtype"] == "episode") { $results = $search->search($_GET["name"], array(imdbsearch::TV_EPISODE)); } else { $results = $search->search($_GET["name"]); } $headname = "Movie"; break; } echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n"; echo "<HTML><HEAD>\n"; echo " <TITLE>Performing search for '" . $_GET["name"] . "' [IMDBPHP2 v" . $search->version . "]</TITLE>\n"; echo " <STYLE TYPE='text/css'>body,td,th,h2 { font-size:12px; font-family:sans-serif; } th { background-color:#ffb000; } h2 { text-align:center; font-size:15px; margin-top: 20px; margin-bottom:0; }</STYLE>\n"; echo "</HEAD><BODY>\n"; $sname = htmlspecialchars($_GET['name']); echo "<H2>[IMDBPHP2 v" . $search->version . " Demo] Search results for '{$sname}':</H2>\n";
public function executeImdb(sfWebRequest $request) { ini_set('display_errors', false); if ($request->getParameter("flag") == 'search') { $search = new imdbsearch(); $search->setsearchname($request->getPostParameter("title")); $this->results = $search->results(); $this->anime = Doctrine::getTable('Anime')->findOneByTitle($request->getPostParameter("title")); } else { if ($request->getParameter("flag") == 'get') { $util = new Util(); $result = new imdb($request->getPostParameter("imdbID")); $this->imdb = $util->getAnimeInfoFromImdb($result); $this->anime = Doctrine::getTable('Anime')->findOneByTitle($request->getPostParameter("title")); $this->setTemplate('edit'); } } }
$moviematchestag = generate_movies_tags($results, $searchResultsDocument, $limit); $resultsTag->appendChild($opensearchQueryTag); $resultsTag->appendChild($openSearchTotResultTag); $resultsTag->appendChild($moviematchestag); $searchResultsDocument->appendChild($resultsTag); return $searchResultsDocument->saveXML(); } /* generate an error xml */ function error_xml() { $errorDocument = createDocument(); $error = $errorDocument->CreateElement('error'); $content = $errorDocument->CreateTextNode(utf8_encode('You need to search for something first.')); $error->appendChild($content); $errorDocument->appendChild($error); return $errorDocument->saveXML(); } $matches = array(); if (preg_match("^title=(.+)\$^", $_SERVER['QUERY_STRING'], $matches) == 0) { echo error_xml(); } else { $keywords = $matches[1]; $search = new imdbsearch(); $search->setsearchname($keywords); $results = $search->results(); if (count($results) > 0) { echo generate_search_results($keywords, $results, 3); } else { echo generate_no_search_results($keywords); } }
function queryListing($page_no, $items_per_page, $offset, $s_item_type, $search_vars_r) { if (strlen($search_vars_r['imdb_id']) > 0) { $this->addListingRow(NULL, NULL, NULL, array('imdb_id' => $search_vars_r['imdb_id'])); return TRUE; } else { if ($this->_site_plugin_conf_r['title_search_faster_alternate'] != 'TRUE') { $imdbsearch = new imdbsearch(); $imdbsearch->setsearchname($search_vars_r['title']); $this->results = $imdbsearch->results(); if (is_array($this->results)) { foreach ($this->results as $res_id => $res) { if (starts_with($res->photo(), '/images/nopicture')) { $image = NULL; } else { $image = $res->photo(); } $this->addListingRow($res->title(), $image, $res->year(), array('imdb_id' => $res->imdbid(), 'res_id' => $res_id)); } return TRUE; } else { return FALSE; } } else { $pageBuffer = $this->fetchURI("http://www.imdb.com/find?q=" . rawurlencode(strtolower($search_vars_r['title'])) . ";more=tt"); if (strlen($pageBuffer) > 0) { if (preg_match("!http://us.imdb.com/title/tt([^/]+)/!", $this->getFetchedURILocation(), $regs)) { $this->addListingRow(NULL, NULL, NULL, array('imdb_id' => $regs[1])); return TRUE; } else { //<h1 class="findHeader">Results for <span class="findSearchTerm">"prometheus;more=tt"</span></h1> if (strpos($pageBuffer, "<h1 class=\"findHeader\">Results for <span class=\"findSearchTerm\">") !== FALSE) { //<tr class="findResult odd"> //<td class="primary_photo"> <a href="/title/tt1256632/?ref_=fn_al_tt_2" ><img src="http://ia.media-imdb.com/images/G/01/imdb/images/nopicture/32x44/film-3119741174._V397576370_.png" /></a> </td> //<td class="result_text"> <a href="/title/tt2411516/?ref_=fn_al_tt_6" >Prometheus Trap</a> (2012) </td> //</tr> if (($idx = strpos($pageBuffer, "<table class=\"findList\">")) !== FALSE) { $pageBuffer = substr($pageBuffer, $idx); $idx = strpos($pageBuffer, "</table>"); $pageBuffer = substr($pageBuffer, 0, $idx); if (preg_match_all("/<tr class=\"findResult[^\"]*\">.*?<\\/tr>/m", $pageBuffer, $matches)) { for ($i = 0; $i < count($matches[0]); $i++) { if (preg_match("/<td class=\"primary_photo\">[\\s]*<a href=\"[^\"]*\"[\\s]*>[\\s]*<img src=\"([^\"]*)\"[^>]*>[\\s]*<\\/a>[\\s]*<\\/td>/m", $matches[0][$i], $lmatches)) { $image = trim($lmatches[1]); } if (preg_match("/<td class=\"result_text\">[\\s]*<a href=\"\\/title\\/tt([0-9]+)[^\"]*\"[\\s]*>([^<]+)<\\/a>[\\s]*([^<]+)</m", $matches[0][$i], $lmatches)) { $imdb_id = trim($lmatches[1]); $title = trim($lmatches[2]) . " " . trim($lmatches[3]); } $this->addListingRow($title, $image, NULL, array('imdb_id' => $imdb_id)); } } } $pageBuffer = NULL; return TRUE; } } //else no results found return TRUE; } else { return FALSE; } } } }
$sql = "UPDATE songs SET winner=1 WHERE id={$ganador_id_cancion} AND picture_id='{$ganador_id_pelicula}'"; } } else { if ($accion == "nueva_pelicula") { $nuevo_titulo_ing = str_replace("'", "''", $nuevo_titulo_ing); $nuevo_titulo_esp = str_replace("'", "''", $nuevo_titulo_esp); $sql = "INSERT INTO pictures(aka,name,year,id) VALUES('" . $nuevo_titulo_esp . "','" . $nuevo_titulo_ing . "'," . $year . ",'" . $nuevo_id_imdb . "')"; } else { if ($accion == "insertar_rol") { $sql = "INSERT INTO person_picture(person_id,picture_id,role_id) VALUES(" . $id_persona . "," . $id_pelicula . "," . $id_rol . ")"; } else { if ($accion == "nueva_nominacion") { $sql = "INSERT INTO nominations(year,category_id,picture_id,nominee_id) VALUES(" . $year . "," . $nuevo_nom_categoria . ",'" . $nuevo_nom_pelicula . "','" . $nuevo_nom_profesional . "')"; } else { if ($accion == "buscar_pelicula") { $search = new imdbsearch(); //$search->setsearchname($HTTP_POST_VARS["name"]); $search->setsearchname($_POST["name"]); $results = $search->results(); foreach ($results as $res) { $pelicula_nombre_orig = "" . $res->title(); $pelicula_nombre_esp = ""; $pelicula_id = "" . $res->imdbid(); $movie = new imdb($res->imdbid()); $movie->setid($res->imdbid()); $aka = $movie->alsoknow(); if (!empty($aka)) { foreach ($aka as $ak) { if ($ak["country"] == "Spain") { $pelicula_nombre_esp = $ak["title"]; break;