boddi |
7th October 2011 22:17 |
IMDB auto on Details.php
Havin trouble with showing the cast images as well the imdb poster.
http://imageshack.us/photo/my-images/42/detailsq.jpg/
Code:
/**
* https://09source.kicks-ass.net:8443/svn/installer09/
* Licence Info: GPL
* Copyright (C) 2010 Installer09 v.2
* A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
* Project Leaders: Mindless,putyn,kidvision.
**/
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'bittorrent.php');
require_once(INCL_DIR.'user_functions.php');
require_once(INCL_DIR.'bbcode_functions.php');
require_once(INCL_DIR.'pager_functions.php');
require_once(INCL_DIR.'torrenttable_functions.php');
require_once(INCL_DIR.'html_functions.php');
require_once(IMDB_DIR.'imdb.class.php');
require_once(IMDB_DIR.'imdb_person.class.php');
dbconn(false);
loggedinorreturn();
$lang = array_merge( load_language('global'), load_language('details') );
parked();
$stdfoot = array(/** include js **/'js' => array('popup','jquery.thanks','wz_tooltip','java_klappe'));
$HTMLOUT = '';
if (!isset($_GET['id']) || !is_valid_id($_GET['id']))
stderr("{$lang['details_user_error']}", "{$lang['details_bad_id']}");
$id = (int)$_GET["id"];
if (isset($_GET["hit"]))
{
sql_query("UPDATE torrents SET views = views + 1 WHERE id = $id");
header("Location: {$INSTALLER09['baseurl']}/details.php?id=$id");
exit();
}
$res = sql_query("SELECT torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.checked_by, torrents.filename, torrents.points, LENGTH(torrents.nfo) AS nfosz, torrents.last_action AS lastseed, torrents.numratings, torrents.name, IF(torrents.numratings < {$INSTALLER09['minvotes']}, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.comments, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.poster, torrents.url, torrents.numfiles, torrents.anonymous, torrents.free, torrents.allow_comments, torrents.nuked, torrents.nukereason, torrents.last_reseed, torrents.vip, torrents.category, torrents.subs, categories.name AS cat_name, users.username, users.reputation, freeslots.free AS freeslot, freeslots.double AS doubleslot, freeslots.tid AS slotid, freeslots.uid AS slotuid FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN users ON torrents.owner = users.id LEFT JOIN freeslots ON (torrents.id=freeslots.tid AND freeslots.uid = {$CURUSER['id']}) WHERE torrents.id = $id")
or sqlerr();
$row = mysql_fetch_assoc($res);
$owned = $moderator = 0;
if ($CURUSER["class"] >= UC_MODERATOR)
$owned = $moderator = 1;
elseif ($CURUSER["id"] == $row["owner"])
$owned = 1;
if ($row["vip"] == "1" && $CURUSER["class"] < UC_VIP)
stderr("VIP Access Required", "You must be a VIP In order to view details or download this torrent! You may become a Vip By Donating to our site. Donating ensures we stay online to provide you more Vip-Only Torrents!");
if (!$row || ($row["banned"] == "yes" && !$moderator))
stderr("{$lang['details_error']}", "{$lang['details_torrent_id']}");
if ($CURUSER["id"] == $row["owner"] ||$CURUSER["class"] >= UC_MODERATOR)
$owned = 1;
else
$owned = 0;
$spacer = " ";
if (isset($_GET["uploaded"])) {
$HTMLOUT .= "{$lang['details_success']}\n";
$HTMLOUT .= "{$lang['details_start_seeding']} \n";
}
elseif (isset($_GET["edited"])) {
$HTMLOUT .= "{$lang['details_success_edit']}\n";
if (isset($_GET["returnto"]))
$HTMLOUT .= "{$lang['details_go_back']}{$lang['details_whence']}. \n";
}
elseif (isset($_GET["reseed"]))
$HTMLOUT.="PM was sent! Now wait for a seeder !\n";
elseif (isset($_GET["rated"]))
$HTMLOUT .= "{$lang['details_rating_added']}\n";
//==pdq's Torrent Moderation
if ($CURUSER['class'] >= UC_MODERATOR) {
if (isset($_GET["checked"]) && $_GET["checked"] == 1) {
sql_query("UPDATE torrents SET checked_by = ".sqlesc($CURUSER['username'])." WHERE id =$id LIMIT 1");
write_log("Torrent ($row[name]) was checked by $CURUSER[username]");
header("Location: {$INSTALLER09["baseurl"]}/details.php?id=$id&checked=done#Success");
}
elseif (isset($_GET["rechecked"]) && $_GET["rechecked"] == 1) {
sql_query("UPDATE torrents SET checked_by = ".sqlesc($CURUSER['username'])." WHERE id =$id LIMIT 1");
write_log("Torrent ($row[name]) was re-checked by $CURUSER[username]");
header("Location: {$INSTALLER09["baseurl"]}/details.php?id=$id&rechecked=done#Success");
}
elseif (isset($_GET["clearchecked"]) && $_GET["clearchecked"] == 1) {
sql_query("UPDATE torrents SET checked_by = '' WHERE id =$id LIMIT 1");
write_log("Torrent ($row[name]) was un-checked by $CURUSER[username]");
header("Location: {$INSTALLER09["baseurl"]}/details.php?id=$id&clearchecked=done#Success");
}
if (isset($_GET["checked"]) && $_GET["checked"] == 'done')
$HTMLOUT .="";
if (isset($_GET["rechecked"]) && $_GET["rechecked"] == 'done')
$HTMLOUT .="";
if (isset($_GET["clearchecked"]) && $_GET["clearchecked"] == 'done')
$HTMLOUT .="";
}
// end
$s = htmlentities( $row["name"], ENT_QUOTES );
$HTMLOUT .= "$s\n";
/** free mod for TBDev 09 by pdq **/
$clr = '#FF6600'; /// font color
$freeimg = '';
$doubleimg = '';
$HTMLOUT .= '
Once chosen this torrent will be Freeleech '.$freeimg.' until '.get_date($row['freeslot'], 'DATE').' and can be resumed or started over using the regular download link. Doing so will result in one Freeleech Slot being taken away from your total.
Once chosen this torrent will be Doubleseed '.$doubleimg.' until '.get_date($row['doubleslot'], 'DATE').' and can be resumed or started over using the regular download link. Doing so will result in one Freeleech Slot being taken away from your total.
';
/** end **/
$HTMLOUT .= "\n";
$url = "edit.php?id=" . $row["id"];
if (isset($_GET["returnto"])) {
$addthis = "&returnto=" . urlencode($_GET["returnto"]);
$url .= $addthis;
$keepget = $addthis;
}
$editlink = "a href=\"$url\" class=\"sublink\"";
if (!($CURUSER["downloadpos"] == 0 && $CURUSER["id"] != $row["owner"] OR $CURUSER["downloadpos"] > 1)) {
/** free mod for TBDev 09 by pdq **/
require ROOT_DIR.'/mods/free_details.php';
/** end **/
$HTMLOUT .= tr("{$lang['details_info_hash']}", $row["info_hash"]);
}
else {
$HTMLOUT .= tr("{$lang['details_download']}", "{$lang['details_dloadpos']}");
}
if (!empty($row["descr"]))
$HTMLOUT .= "{$lang['details_description']} | : klappe_news('a1')\">". str_replace(array("\n", " "), array("\n", " "), format_comment( $row["descr"] ))." | ";
//==09 Poster mod
if (!empty($row["poster"]))
$HTMLOUT .= tr("{$lang['details_poster']}", ": klappe_news('a2')\">", 1);
else
$HTMLOUT .= tr("{$lang['details_poster']}", ": klappe_news('a2')\">", 1);
$imdb = '';
//auto imdb mod
if (empty($row["url"]))
{
$text = $row["descr"];
preg_match_all( '/((http|https|ftp):\/\/|www)([a-z0-9\-\._]+)\/?[a-z0-9_\.\-\?\+\/~=&;,]*/si', $text, $match );
for( $i=0; $i
{
$requestnftest = $match[0][$i];
$testurl="http://www.imdb.com/title/tt";
$testurl1="http://uk.imdb.com/title/tt";
$testurl2="http://imdb.com/title/tt";
$testurl3="http://us.imdb.com/title/tt";
$testurl4="http://us.imdb.com/Title?";
$test1=(substr($testurl, 0, 28));
$test2=(substr($testurl1, 0, 27));
$test3=(substr($testurl2, 0, 24));
$test4=(substr($testurl3, 0, 27));
$test5=(substr($testurl4, 0, 25));
If (substr($requestnftest, 0, 25) == $test5)
{$requestnftest= str_replace("http://us.imdb.com/Title?", 'http://us.imdb.com/title/tt', $requestnftest);}
if(substr($requestnftest, 0, 28) == $test1 or substr($requestnftest, 0, 27) == $test2 or substr($requestnftest, 0, 24) == $test3 or substr($requestnftest, 0, 27) == $test4)
{
$updateset[] = "url = " . sqlesc($requestnftest);
mysql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $id");
$row["url"]=$requestnftest;
}}}
$smallth = '';
if (($row["url"] != "")AND(strpos($row["url"], 'imdb'))AND(strpos($row["url"], 'title')))
{
$rurl = trim($row["url"]);
$thenumbers = ltrim(strrchr($rurl,'tt'),'tt');
$thenumbers = ($thenumbers[strlen($thenumbers)-1] == "/" ? substr($thenumbers,0,strlen($thenumbers)-1) : $thenumbers);
$thenumbers = preg_replace("[^A-Za-z0-9]", "", $thenumbers);
$movie = new imdb ($thenumbers);
$movieid = $thenumbers;
$movie->setid ($movieid);
$country = $movie->country ();
$director = $movie->director();
$write = $movie->writing();
$produce = $movie->producer();
$cast = $movie->cast();
$plot = $movie->plot ();
$compose = $movie->composer();
$gen = $movie->genres();
$plotoutline = $movie->plotoutline();
$trailers = $movie->trailers();
$mvrating = $movie->rating();
$mvotes = $movie->votes();
$runtime = $movie->runtime();
$mvlang = $movie->language();
$comment = $movie->comment();
if (($photo_url = $movie->photo_localurl() ) != FALSE) {
$smallth = '';
} else {
$smallth = '';
}
if (empty($row["poster"]))
{
$updateset[] = "poster = " . sqlesc($photo_url);
mysql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $id");
$row["poster"]=$photo_url;
}
$imdb="";
$imdb.=" Title: ".$movie->title()." (".$movie->year().")
$smallth |
Year: | ".$movie->year()." | ";
if (!empty($mvrating)) {
$imdb.= "Rating: | " . "$mvrating (with $mvotes Votes) | \n";
}else{
$imdb.= "Rating: | N/A | \n";
}
$imdb.= " ";
if (!empty($gen)) {
$imdb.= "Genre: | ";
for ($i = 0; $i + 1 < count($gen); $i++) {
$imdb.= "$gen[$i], ";
}
$imdb.= "$gen[$i] | \n";
}
if (!empty($runtime)) {
$imdb.= "Runtime: | ".$runtime." mins | ";
}else{
$imdb.= "Runtime: |
N/A | ";
}
$imdb.=" ";
if (!empty($country)) {
$imdb.= "Country: | ";
for ($i = 0; $i + 1 < count ($country); $i++) {
$imdb.="$country[$i], ";
}
$imdb.= "$country[$i]";
$imdb.= " | ";
}
if (!empty($mvlang)) {
$imdb.= "Language: | " . "$mvlang | \n";
}
$imdb.= " ";
if (!empty($director)) {
$imdb.= "Director: | ";
for ($i = 0; $i < count ($director); $i++) {
$imdb.= "" . "".$director[$i]["name"]."" . ", ";
}
$imdb.=" | ";
}
if (!empty($produce)) {
$imdb.= "Producers: | ";
for ($i = 0; $i < count ($produce); $i++) {
$imdb.= "" . "".$produce[$i]["name"]."" . ",";
}
$imdb.=" | ";
}
$imdb.= "
";
if (!empty($write)) {
$imdb.= "Writters: | ";
for ($i = 0; $i < count ($write); $i++) {
$imdb.= "" . "".$write[$i]["name"]."" . ", ";
}
$imdb.=" | ";
}
if (!empty($compose)) {
$imdb.= "Music: | ";
for ($i = 0; $i < count($compose); $i++) {
$imdb.= "" . "".$compose[$i]["name"]."" . ", ";
}
}else{
$imdb.= " | Music: | N/A";
}
$imdb.=" |
";
if (!empty($plotoutline)) {
$imdb.=" Plot:
";
}
if (!empty($plot)) {
$imdb.= " hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = 'Summary: show'; }\" >Summary: show
";
for ($i = 0; $i < count ($plot); $i++) {
$imdb.=str_replace(array("&", " ", " "), array("&","",""), "$plot[$i]");
}
$imdb.=" |
";
}
if (!empty($comment)) {
$imdb.= " hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = 'Comments: show'; }\" >Comments: show
".str_replace(array(" ", " ", ""," "), array("", "","",""), "$comment")." |
";
}
$imdb.=" hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = 'Cast: show'; }\" >Cast: show
";
for ($i = 0; $i < count ($cast); $i++) {
if ($i >= 6) {
break;
}
$person = new imdb_person ($cast[$i]["imdb"]);
if (!empty($cast[$i]["role"])) {
$role= "As".$cast[$i]["role"]."";
}else{
$role='';
}
if (($photo_url = $person->photo_localurl() ) != FALSE) {
$imdb.="".$cast[$i]["name"]."$role | ";
} else {
$imdb.="".$cast[$i]["name"]."" . "$role | ";
}
}
$imdb.="
";
if (!empty($trailers)) {
$imdb.= " hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = 'Trailers: show'; }\" >Trailers: show
";
$t_bIsChrome = strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome');
if ( $t_bIsChrome !== false)
{
for ($i=0;$i
if ($i > 14) {
break;
}
$imdb.= "".$trailers[$i]."\n";
}
$imdb.=" |
";
}else{
for ($i=0;$i
if ($i > 14) {
break;
}
$imdb.= "".format_comment("[media=imdb]".$trailers[$i]."[/media]")."";
}
$imdb.=" ";
}
}
$imdb.="";
}
if (!empty($row["url"]))
$HTMLOUT .= tr("Imdb", ": klappe_news('a3')\">$imdb ", 1);
$movie_cat = array("3","5","6","10","11"); //add here your movie category
if (in_array($row["category"], $movie_cat) && !empty($row["subs"]) )
{
$HTMLOUT .=" |