". $SearchString . " ... "; require_once("imdbphp2/imdbsearch.class.php"); require_once("imdbphp2/imdb.class.php"); $search = new imdbsearch(); $search->setsearchname($SearchString); $results = $search->results (); if($results == 0) { $out .= $GLOBALS['strErrNothingFoundEnterNewString']; return(PML_FETCH_SEARCHDONE); } //print out all the movies found: $out .= $GLOBALS['strFoundMore']; $out .= ""; $Page = basename(__FILE__); $Page = substr($Page, 6); $Page = substr($Page, 0, -4); $out .= "\n"; $j=1; foreach($results as $res) { if(trim($res->title()) == trim($SearchString)) { $this->FetchID = $res->imdbid(); return(PML_FETCH_EXACTMATCH); } $out .= "\n"; } $out .= "
Possible Matches
 "; $out .= "".$res->title().""; $out .= " - [imdbsite."/title/tt".$res->imdbid()."\" target=_blank>$GLOBALS[strInfo]]\n"; if(strlen($res->year())>2) $out .= "". $res->year() .""; $out .= "
"; return(PML_FETCH_SEARCHDONE); } /** * DoFetch - perform the search on the page to fetch from * * IMPORTANT if you want to add some feilds: * if you add new fields, add them to var $FieldNames on top of this file * * @param string the fetched value (return-string) * @param string the FieldName * @access public * @return const PML_FETCH_ERROR, PML_FETCH_OK or PML_FETCH_ITEMNOTFOUND **/ function DoFetch(&$ret, $FieldName) { global $CFG; require_once("imdbphp2/imdb.class.php"); $movie = new imdb($this->FetchID); switch($FieldName) { case "Title": //fetch Title $ret = addslashes($movie->title()); break; case "Year": $ret = addslashes($movie->year()); if($ret=="") $ret=0; break; case "Poster": if (($photo_url = $movie->photo() ) != FALSE) { $ret = addslashes($photo_url); } else { return(PML_FETCH_ERROR); } break; case "Director": $director = $movie->director(); if (!empty($director)) { $ret = addslashes($director[0]["name"]); } else { return(PML_FETCH_ERROR); } break; case "Genre": $genre = $movie->genre(); if (!empty($genre)) { $ret = array(); $gen = $movie->genres(); if (!empty($gen)) { for ($i = 0; $i < count($gen); $i++) { $ret[] = addslashes($gen[$i]); } } else { $ret[0] = addslashes($genre); } } else { return(PML_FETCH_ERROR); } break; case "Rating": $ratv = $movie->rating(); if (!empty($ratv)) { $ret = addslashes($ratv); } else { return(PML_FETCH_ERROR); } break; case "Starring": $cast = $movie->cast(); if (!empty($cast)) { $ret = array(); for ($i = 0; ($i < count($cast)) && ($i < $this->actorLimit); $i++) { $ret[] = addslashes($cast[$i]["name"]); } } else { return(PML_FETCH_ERROR); } break; case "Plot": $plot = $movie->plot(); if (!empty($plot)) { $plot = preg_replace("/<.*/", "", $plot); $ret = trim(addslashes($plot[0])); break; } return(PML_FETCH_ERROR); case "Release": $release = $movie->releaseInfo(); if (!empty($release)) { $ret = $release[0]["year"]."-".$release[0]["mon"]."-".$release[0]["day"]; } else { return(PML_FETCH_ERROR); } break; case "imdbid": $ret = $this->FetchID; break; case "Runtime": //TODO Implement return(PML_FETCH_ERROR); case "MPAA": //TODO Implement return(PML_FETCH_ERROR); case "Akas": $ret = array(); //TODO Implement return(PML_FETCH_ERROR); case "Country": $release = $movie->releaseInfo(); if (!empty($release)) { $ret = array(); $ret[] = addslashes($release[0]["country"]); } else { return(PML_FETCH_ERROR); } break; default: return(PML_FETCH_ITEMNOTFOUND); }//end switch $FieldName if(is_array($ret)) { foreach($ret as $k=>$i) { $ret[$k] = $this->ReplaceUnicodeChars($i); } } else { $ret = $this->ReplaceUnicodeChars($ret); } return(PML_FETCH_OK); }//end function DoFetch /** * getUseSettings * * returns if this field has additional settings * * @access public * @param string the field * @return boolean **/ function getUseSettings($field) { switch($field) { case "Starring": return(true); case "Akas": return(true); default: return(false); } } /** * printSettings * * print out here the HTML-code for your custom settings * * @access public * @param string the field * @param string the current setting from the database * @return the HTML-code **/ function printSettings($field, $set) { switch($field) { case "Starring": if($set=="") $set="3"; $out = " Actors to fetch\n"; return($out); case "Akas": if($set=="") $set="USA"; $out = " Aka(s) to fetch\n"; return($out); } } /** * saveSettings * * processes the $_GET-stuff and validates it and then moves it into * one string that will be saved in the database (only one field is * avaliable for saving the data! * * @access public * @param string the field * @return string the string that will be saved in the db **/ function saveSettings($field) { switch($field) { case "Starring": return($_POST['set'.$field]); case "Akas": return($_POST['set'.$field]); default: return(""); } } /** * setSetting * * will be called from editentry.php bevore calling DoFetch * (only if $set is not empty) * There shoud the setting be processed and saved into some * class-vars... * * @access public * @param string * @param string the field **/ function setSettings($field, $set) { switch($field) { case "Starring": if($set=="" || $set==0) $set="3"; $this->actorLimit = $set; break; case "Akas": if($set=="") $set="USA"; $this->akaCountry = $set; break; } } } ?>