View Single Post
  #1  
Old 7th October 2011, 22:17
boddi boddi is offline
Member
 
Join Date: Sep 2011
P2P
Posts: 1
Default 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:
<?php
/**
 *   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 = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

		if (isset($_GET["uploaded"])) {
			$HTMLOUT .= "<h2>{$lang['details_success']}</h2>\n";
			$HTMLOUT .= "<p>{$lang['details_start_seeding']}</p>\n";
		}
		elseif (isset($_GET["edited"])) {
			$HTMLOUT .= "<h2>{$lang['details_success_edit']}</h2>\n";
			if (isset($_GET["returnto"]))
				$HTMLOUT .= "<p><b>{$lang['details_go_back']}<a href='" . htmlspecialchars($_GET["returnto"]) . "'>{$lang['details_whence']}</a>.</b></p>\n";
		}

    elseif (isset($_GET["reseed"]))
    $HTMLOUT.="<h2>PM was sent! Now wait for a seeder !</h2>\n";
    
    elseif (isset($_GET["rated"]))
			$HTMLOUT .= "<h2>{$lang['details_rating_added']}</h2>\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 <a href={$INSTALLER09['baseurl']}/details.php?id=$id>($row[name])</a> 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 <a href={$INSTALLER09['baseurl']}/details.php?id=$id>($row[name])</a> 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 <a href={$INSTALLER09["baseurl"]}/details.php?id=$id>($row[name])</a> 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 .="<h2><a name='Success'>Successfully checked {$CURUSER['username']}!</a></h2>";
        if (isset($_GET["rechecked"]) &&  $_GET["rechecked"] == 'done')
            $HTMLOUT .="<h2><a name='Success'>Successfully re-checked {$CURUSER['username']}!</a></h2>";
        if (isset($_GET["clearchecked"]) &&  $_GET["clearchecked"] == 'done')
            $HTMLOUT .="<h2><a name='Success'>Successfully un-checked {$CURUSER['username']}!</a></h2>";
    }
    // end

    $s = htmlentities( $row["name"], ENT_QUOTES );
		$HTMLOUT .= "<h1>$s</h1>\n";
    /** free mod for TBDev 09 by pdq **/
    $clr = '#FF6600'; /// font color	
    $freeimg = '<img src="pic/freedownload.gif" border="0" alt="" />';
    $doubleimg = '<img src="pic/doubleseed.gif" border="0" alt="" />';	
	  $HTMLOUT .= '
    <div id="balloon1" class="balloonstyle">
    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.</div>
    <div id="balloon2" class="balloonstyle">
    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.</div>
    <script type="text/javascript" src="scripts/balloontip.js"></script>';
     /** end **/
    $HTMLOUT .= "<table align='center' width='750' border='1' cellspacing='0' cellpadding='5'>\n";
		$url = "edit.php?id=" . $row["id"];
		if (isset($_GET["returnto"])) {
			$addthis = "&amp;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 .= "<tr><td style='vertical-align:top'><b>{$lang['details_description']}</b></td><td><a href=\"javascript: klappe_news('a1')\"><img border=\"0\" src=\"pic/plus.gif\" id=\"pica1\" alt=\"[Hide/Show]\" /></a><div id=\"ka1\" style=\"display: none;\"><div style='background-color:#;width:100%;height:150px;overflow: auto'>". str_replace(array("\n", "  "), array("<br />\n", "&nbsp; "), format_comment( $row["descr"] ))."</div></div></td></tr>";
	//==09 Poster mod
  if (!empty($row["poster"]))
  $HTMLOUT .= tr("{$lang['details_poster']}", "<a href=\"javascript: klappe_news('a2')\"><img border=\"0\" src=\"pic/plus.gif\" id=\"pica2\" alt=\"[Hide/Show]\" /></a><div id=\"ka2\" style=\"display: none;\"><img src='".$row["poster"]."' alt='Poster' title='Poster' /></div>", 1);
  else
  $HTMLOUT .= tr("{$lang['details_poster']}", "<a href=\"javascript: klappe_news('a2')\"><img border=\"0\" src=\"pic/plus.gif\" id=\"pica2\" alt=\"[Hide/Show]\" /></a><div id=\"ka2\" style=\"display: none;\"><img src='{$INSTALLER09['pic_base_url']}noposter.png' alt='Poster' title='Poster' /></div>", 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<sizeof($match[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 = '<img src="'.$photo_url.'" alt="'.$movie->title().'" height="225" width="150"/>';
 } else {
$smallth = '<img src="imdb/images/noposter.jpg" alt="'.$movie->title().'" height="225" width="150"/>'; 
 }
 if (empty($row["poster"]))
{
                 $updateset[] = "poster = " . sqlesc($photo_url);
mysql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $id");
$row["poster"]=$photo_url;

        }
$imdb="<br /><div style='vertical-align:top;background:transparent;'>";
$imdb.="<div class='blockhead'><strong><font color=\"red\" size=\"3\"> Title: </font></strong><font size=\"3\">".$movie->title()." (".$movie->year().")</font></div><br />
<table cellpadding='6' cellspacing='1' border='0' width='100%' align='center'>
<tr>
<td class='bottom' style='vertical-align:top;background:transparent;' rowspan='6' width='10%' align='center' valign='top'>$smallth</td> 
</tr> 
<tr> 
<td class='bottom' style='vertical-align:top;background:transparent;'><strong><font color=\"red\">Year: </font></strong></td> <td class='bottom' style='vertical-align:top;background:transparent;'>".$movie->year()."</td> ";

if (!empty($mvrating)) {

$imdb.= "<td class='bottom' style='vertical-align:top;background:transparent;'><strong><font color=\"red\">Rating: </font></strong></td> <td class='bottom' style='vertical-align:top;background:transparent;'>" . "$mvrating (with $mvotes Votes)</td>\n";
}else{
$imdb.= "<td class='bottom' style='vertical-align:top;background:transparent;'><strong><font color=\"red\">Rating: </font></strong></td> <td class='bottom' style='vertical-align:top;background:transparent;'>N/A</td>\n";
}
$imdb.= "</tr><tr>";

if (!empty($gen)) {

$imdb.= "<td class='bottom' style='vertical-align:top;background:transparent;'><strong><font color=\"red\">Genre: </font></strong></td> <td class='bottom' style='vertical-align:top;background:transparent;'>";
for ($i = 0; $i + 1 < count($gen); $i++) {
$imdb.= "$gen[$i], ";
}
$imdb.= "$gen[$i]</td>\n";
}
if (!empty($runtime)) {
$imdb.= "<td class='bottom' style='vertical-align:top;background:transparent;'><strong><font color=\"red\">Runtime: </font></strong></td><td class='bottom' style='vertical-align:top;background:transparent;'>".$runtime." mins</td>"; 
}else{
$imdb.= "<td class='bottom' style='vertical-align:top;background:transparent;'><strong><font color=\"red\">Runtime: </font></strong></td> 
<td class='bottom' style='vertical-align:top;background:transparent;'>N/A</td>";

}
$imdb.="</tr><tr>";
if (!empty($country)) {

$imdb.= "<td class='bottom' style='vertical-align:top;background:transparent;'><strong><font color=\"red\">Country: </font></strong></td><td class='bottom' style='vertical-align:top;background:transparent;'>";
for ($i = 0; $i + 1 < count ($country); $i++) {
$imdb.="$country[$i], ";
}
$imdb.= "$country[$i]";
$imdb.= "</td>";
}
if (!empty($mvlang)) {
$imdb.= "<td class='bottom' style='vertical-align:top;background:transparent;'><strong><font color=\"red\">Language: </font></strong></td> <td class='bottom' style='vertical-align:top;background:transparent;'>" . "$mvlang</td>\n";
}
$imdb.= "</tr><tr>";

if (!empty($director)) {

$imdb.= "<td class='bottom' style='vertical-align:top;background:transparent;'><strong><font color=\"red\">Director: </font></strong></td><td class='bottom' style='vertical-align:top;background:transparent;'>";
for ($i = 0; $i < count ($director); $i++) {
$imdb.= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "".$director[$i]["imdb"]."" ."\">" . "".$director[$i]["name"]."" . "</a>, ";
}
$imdb.="</td>";
}
if (!empty($produce)) {
$imdb.= "<td class='bottom' style='vertical-align:top;background:transparent;'><strong><font color=\"red\">Producers: </font></strong></td><td class='bottom' style='vertical-align:top;background:transparent;'>";
for ($i = 0; $i < count ($produce); $i++) {
$imdb.= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "".$produce[$i]["imdb"]."" ." \">" . "".$produce[$i]["name"]."" . "</a>,";
}       
$imdb.="</td>";
}
$imdb.= "</tr> 
<tr>";

if (!empty($write)) {
$imdb.= "<td class='bottom' style='vertical-align:top;background:transparent;'><strong><font color=\"red\">Writters: </font></strong></td> <td class='bottom' style='vertical-align:top;background:transparent;'>";
for ($i = 0; $i < count ($write); $i++) {
$imdb.= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "".$write[$i]["imdb"]."" ."\">" . "".$write[$i]["name"]."" . "</a>, ";
}
$imdb.="</td> ";
}
if (!empty($compose)) {
$imdb.= "<td class='bottom' style='vertical-align:top;background:transparent;'><strong><font color=\"red\">Music: </font></strong></td><td class='bottom' style='vertical-align:top;background:transparent;'>"; 
for ($i = 0; $i < count($compose); $i++) {
$imdb.= "<a target=\"_blank\" href=\"http://www.imdb.com/name/nm" . "".$compose[$i]["imdb"]."" ." \">" . "".$compose[$i]["name"]."" . "</a>, "; 
}
}else{
$imdb.= "<td class='bottom' style='vertical-align:top;background:transparent;'><strong><font color=\"red\">Music: </font></strong></td><td class='bottom' style='vertical-align:top;background:transparent;'>N/A"; 
}
$imdb.="</td></tr>
</table>";
if (!empty($plotoutline)) { 
$imdb.="<div align='left'><strong><font color=\"red\">Plot:</font></strong></div>
<table cellpadding='6' cellspacing='1' border='0' width='100%' align='center'>
<tr><td class='bottom' style='vertical-align:top;background:transparent;'><div style='background-color:transparent;width:100%;overflow: auto'>".str_replace(array('<p>', '</p>','<a href="plotsummary">See full summary</a>'), array("",""), "$plotoutline")."</div></td></tr></table>";
}
if (!empty($plot)) {

$imdb.= "<div style=\"background-color:transparent; border: none; width:100%;\"><div style=\"text-transform: uppercase; border-bottom: 1px solid #CCCCCC; margin-bottom: 3px; font-size: 0.8em; color: red; font-weight: bold; display: block;\"><span onclick=\"if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerHTML = '<b>Summary: </b><a href=\'#\' onclick=\'return false;\'>hide</a>'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = '<b>Summary: </b><a href=\'#\' onclick=\'return false;\'>show</a>'; }\" ><font color='red'><b>Summary: </b></font><a href=\"#\" onclick=\"return false;\">show</a></span></div><div class=\"quotecontent\"><div style=\"display: none;\">
<table cellpadding='6' cellspacing='1' border='0' width='100%' align='center'>

<tr><td class='bottom' style='vertical-align:top;background:transparent;;border:none;'><div style='background-color:transparent;width:100%;overflow: auto'>";
for ($i = 0; $i < count ($plot); $i++) {
$imdb.=str_replace(array("&", "<p>", "</p>"), array("&amp;","",""), "$plot[$i]<br /><br />");
}
$imdb.="</div></td></tr></table></div></div></div>";
}
if (!empty($comment)) {
$imdb.= "<div style=\"background-color:transparent; border: none; width:100%;\"><div style=\"text-transform: uppercase; border-bottom: 1px solid #CCCCCC; margin-bottom: 3px; font-size: 0.8em; color: red; font-weight: bold; display: block;\"><span onclick=\"if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerHTML = '<b>Comments: </b><a href=\'#\' onclick=\'return false;\'>hide</a>'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = '<b>Comments: </b><a href=\'#\' onclick=\'return false;\'>show</a>'; }\" ><font color='red'><b>Comments: </b></font><a href=\"#\" onclick=\"return false;\">show</a></span></div><div class=\"quotecontent\"><div style=\"display: none;\">
<table cellpadding='6' cellspacing='1' width='100%' align='center'>
<tr><td class='bottom' style='vertical-align:top;background:transparent;'><div style='background-color:transparent;width:100%;overflow: auto'>".str_replace(array("<p>", "</p>", "<br>","<a></a>"), array("<br />", "<br />","<br />",""), "$comment")."</div></td></tr></table></div></div></div>";

}
$imdb.="<div style=\"background-color:transparent; border: none; width:100%;\"><div style=\"text-transform: uppercase; border-bottom: 1px solid #CCCCCC; margin-bottom: 3px; font-size: 0.8em; color: red; font-weight: bold; display: block;\"><span onclick=\"if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerHTML = '<b>Cast: </b><a href=\'#\' onclick=\'return false;\'>hide</a>'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = '<b>Cast: </b><a href=\'#\' onclick=\'return false;\'>show</a>'; }\" ><font color='red'><b>Cast: </b></font><a href=\"#\" onclick=\"return false;\">show</a></span></div><div class=\"quotecontent\"><div style=\"display: none;\"><div align='left'><strong>(<a href='http://www.imdb.com/title/tt".$movieid."/fullcredits#cast' target='_blank'>Full Cast</a>)</strong></div> 
<table cellpadding='6' cellspacing='1' width='100%' align='center'>
<tr>";
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<br /><strong><font color=\"red\">".$cast[$i]["role"]."</font></strong>";
}else{
$role='';
 }
if (($photo_url = $person->photo_localurl() ) != FALSE) {
$imdb.="<td class='bottom' style='vertical-align:top;background:transparent;'><img src='" . $photo_url . "' alt='".$cast[$i]["name"]."' height='140' width='95' title='' border='0'/><br /><a target=\"_blank\" href=\"http://www.imdb.com/name/nm".$cast[$i]["imdb"]."\">".$cast[$i]["name"]."</a><br />$role</td>"; 
 } else {
$imdb.="<td class='bottom' style='vertical-align:top;background:transparent;'><img src='imdb/images/nophoto.png' alt='".$cast[$i]["name"]."' height='140' width='95' title='' border='0'/><br /><a target=\"_blank\" href=\"http://www.imdb.com/name/nm".$cast[$i]["imdb"]."\">".$cast[$i]["name"]."" . "</a><br />$role</td>"; 
}
}
$imdb.="</tr></table></div></div></div>"; 


if (!empty($trailers)) {
$imdb.= "<div style=\"background-color:transparent; border: none; width:100%;\"><div style=\"text-transform: uppercase; border-bottom: 1px solid #CCCCCC; margin-bottom: 3px; font-size: 0.8em; color: red; font-weight: bold; display: block;\"><span onclick=\"if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerHTML = '<b>Trailers: </b><a href=\'#\' onclick=\'return false;\'>hide</a>'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = '<b>Trailers: </b><a href=\'#\' onclick=\'return false;\'>show</a>'; }\" ><font color='red'><b>Trailers: </b></font><a href=\"#\" onclick=\"return false;\">show</a></span></div><div class=\"quotecontent\"><div style=\"display: none;\">
<table cellpadding='6' cellspacing='1' border='0' width='100%' align='center'>
<tr><td class='bottom' style='vertical-align:top;background:transparent;'>";
$t_bIsChrome = strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome');
if ( $t_bIsChrome !== false)
{
for ($i=0;$i<count($trailers);++$i) {
if ($i > 14) {
break;
}
$imdb.= "<a target=\"_blank\" href='".$trailers[$i]."'>".$trailers[$i]."</a><br />\n";
}
$imdb.="</td></tr></table></div></div></div></div>";
}else{
for ($i=0;$i<count($trailers);++$i) {
if ($i > 14) {
break;
}

$imdb.= "".format_comment("[media=imdb]".$trailers[$i]."[/media]")."";
}
$imdb.="</td></tr></table></div></div></div>";
}
}
$imdb.="</div>";
}

if (!empty($row["url"]))
$HTMLOUT .= tr("Imdb", "<a href=\"javascript: klappe_news('a3')\"><img border=\"0\" src=\"pic/plus.gif\" id=\"pica3\" alt=\"[Hide/Show]\" /></a><div id=\"ka3\" style=\"display: none;\">$imdb</div>", 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 .="<tr><td class='rowhead'>Subtitles</td><td align='left'>";
	$subs_array = explode(",",$row["subs"]);
  foreach ($subs_array as $k => $sid) {
	require_once(CACHE_DIR.'subs.php');
	foreach ($subs as $sub){
	if ($sub["id"] == $sid)
	$HTMLOUT .="<img border=\"0\" width=\"25px\" style=\"padding:3px;\"src=\"".$sub["pic"]."\" alt=\"".$sub["name"]."\" title=\"".$sub["name"]."\" />";
	}
	}
	$HTMLOUT .="</td></tr>\n";
  }
    if ($CURUSER["class"] >= UC_POWER_USER && $row["nfosz"] > 0)
    $HTMLOUT .= "<tr><td class='rowhead'>{$lang['details_nfo']}</td><td align='left'><a href='viewnfo.php?id=$row[id]'><b>{$lang['details_view_nfo']}</b></a> (" .mksize($row["nfosz"]) . ")</td></tr>\n";
      
		if ($row["visible"] == "no")
			$HTMLOUT .= tr("{$lang['details_visible']}", "<b>{$lang['details_no']}</b>{$lang['details_dead']}", 1);
		if ($moderator)
			$HTMLOUT .= tr("{$lang['details_banned']}", $row["banned"]);

    if ($row["nuked"] == "yes")
    $HTMLOUT .= "<tr><td class='rowhead'><b>Nuked</b></td><td align='left'><img src='{$INSTALLER09['pic_base_url']}nuked.gif' alt='Nuked' title='Nuked' /></td></tr>\n";
    if (!empty($row["nukereason"]))
    $HTMLOUT .= "<tr><td class='rowhead'><b>Nuke-Reason</b></td><td align='left'>".htmlspecialchars($row["nukereason"])."</td></tr>\n";

		if (isset($row["cat_name"]))
			$HTMLOUT .= tr("{$lang['details_type']}", $row["cat_name"]);
		else
			$HTMLOUT .= tr("{$lang['details_type']}", "{$lang['details_none']}");
		
		$s = "";
		$s .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\" class=\"embedded\">";
		if (!isset($row["rating"])) {
			if ($INSTALLER09['minvotes'] > 1) {
				$s .= "none yet (needs at least {$INSTALLER09['minvotes']} votes and has got ";
				if ($row["numratings"])
					$s .= "only " . $row["numratings"];
				else
					$s .= "none";
				$s .= ")";
			}
			else
				$s .= "No votes yet";
		}
		else {
			$rpic = ratingpic($row["rating"]);
			if (!isset($rpic))
				$s .= "invalid?";
			else
				$s .= "$rpic (" . $row["rating"] . " out of 5 with " . $row["numratings"] . " vote(s) total)";
		}
		$s .= "\n";
		$s .= "</td><td class=\"embedded\">$spacer</td><td valign=\"top\" class=\"embedded\">";

			$ratings = array(
					5 => "Kewl!",
					4 => "Pretty good",
					3 => "Decent",
					2 => "Pretty bad",
					1 => "Sucks!");
			if (!$owned || $moderator) {
			if (!empty($row['numratings'])){
      $xres = sql_query("SELECT rating, added FROM ratings WHERE torrent = $id AND user = " . $CURUSER["id"]);
      $xrow = mysql_fetch_assoc($xres);
      }
      if (!empty($xrow))
					$s .= "(you rated this torrent as \"" . $xrow["rating"] . " - " . $ratings[$xrow["rating"]] . "\")";
				  else {
					$s .= "<form method=\"post\" action=\"takerate.php\"><input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
					$s .= "<select name=\"rating\">\n";
					$s .= "<option value=\"0\">(add rating)</option>\n";
					foreach ($ratings as $k => $v) {
						$s .= "<option value=\"$k\">$k - $v</option>\n";
					}
					$s .= "</select>\n";
					$s .= "<input type=\"submit\" value=\"Vote!\" />";
					$s .= "</form>\n";
				}
			}
		
		$s .= "</td></tr></table>";
		$HTMLOUT .= tr("Rating", $s, 1);
		
  	$HTMLOUT .= tr("{$lang['details_last_seeder']}", "{$lang['details_last_activity']}" .get_date( $row['lastseed'],'',0,1));
		$HTMLOUT .= tr("{$lang['details_size']}",mksize($row["size"]) . " (" . number_format($row["size"]) . "{$lang['details_bytes']})");
		$HTMLOUT .= tr("{$lang['details_added']}", get_date( $row['added'],"{$lang['details_long']}"));
		$HTMLOUT .= tr("{$lang['details_views']}", $row["views"]);
		$HTMLOUT .= tr("{$lang['details_hits']}", $row["hits"]);
		$HTMLOUT .= tr("{$lang['details_snatched']}", ($row["times_completed"] > 0 ? "<a href='./snatches.php?id=$id'>$row[times_completed] {$lang['details_times']}</a>" : "0 {$lang['details_times']}"), 1);

		//==Anonymous
		if($row['anonymous'] == 'yes') {
    if ($CURUSER['class'] < UC_UPLOADER)
    $uprow = "<i>Anonymous</i>";
    else
    $uprow = "<i>Anonymous</i> (<a href='userdetails.php?id=$row[owner]'><b>$row[username]</b></a>)";
    }
    else {
		$uprow = (isset($row["username"]) ? ("<a href='./userdetails.php?id=" . $row["owner"] . "'><b>" . htmlspecialchars($row["username"]) . "</b></a>") : "<i>{$lang['details_unknown']}</i>");
		}
		if ($owned)
		$uprow .= " $spacer<$editlink><b>{$lang['details_edit']}</b></a>";
		$HTMLOUT .= tr("Upped by", $uprow, 1);
    //==pdq's Torrent Moderation
    if ($CURUSER['class'] >= UC_MODERATOR) {
       if (!empty($row['checked_by'])) {
           $checked_by = sql_query("SELECT id FROM users WHERE username='$row[checked_by]'");
           $checked = mysql_fetch_array($checked_by);
           $HTMLOUT .="<tr><td class='rowhead'>Checked by</td><td align='left'><a href='{$INSTALLER09["baseurl"]}/userdetails.php?id=".$checked['id']."'><strong>
           ".htmlspecialchars($row['checked_by'])."</strong></a> 
           <img src='{$INSTALLER09['pic_base_url']}mod.gif' width='15' border='0' alt='Checked' title='Checked - by ".htmlspecialchars($row['checked_by'])."' />
           <a href='{$INSTALLER09["baseurl"]}/details.php?id=".$row['id']."&amp;rechecked=1'><small><em><strong>[Re-Check this torrent]</strong></em></small></a> 
            <a href='{$INSTALLER09["baseurl"]}/details.php?id=".$row['id']."&amp;clearchecked=1'><small><em><strong>[Un-Check this torrent]</strong></em></small></a>  * STAFF Eyes Only *</td></tr>";
       }
       else {
       $HTMLOUT .="<tr><td class='rowhead'>Checked by</td><td align='left'><font color='#ff0000'><strong>NOT CHECKED!</strong></font> 
       <a href='{$INSTALLER09["baseurl"]}/details.php?id=".$row['id']."&amp;checked=1'>
       <small><em><strong>[Check this torrent]</strong></em></small></a>  * STAFF Eyes Only *</td></tr>";
       }
   }
   // end
		if ($row["type"] == "multi") {  
		if (!isset($_GET["filelist"]))
		$HTMLOUT .= tr("{$lang['details_num_files']}<br /><a href=\"./filelist.php?id=$id\" class=\"sublink\">{$lang['details_list']}</a>", $row["numfiles"] . " files", 1);
	  else {
	  $HTMLOUT .= tr("{$lang['details_num-files']}", $row["numfiles"] . "{$lang['details_files']}", 1);	
	  }
		}
		
		$HTMLOUT .= tr("{$lang['details_peers']}<br /><a href=\"peerlist.php?id=$id#seeders\" class=\"sublink\">{$lang['details_list']}</a>", $row["seeders"] . " seeder(s), " . $row["leechers"] . " leecher(s) = " . ($row["seeders"] + $row["leechers"]) . "{$lang['details_peer_total']}", 1);

		//==Report Torrent Link
		$HTMLOUT .= tr("Report Torrent", "<form action='report.php?type=Torrent&amp;id=$id' method='post'><input class='button' type='submit' name='submit' value='Report This Torrent' /> For breaking the <a href='rules.php'>rules</a></form>", 1);
		//==09 Reseed
		$next_reseed = 0; 
  	if ($row["last_reseed"] > 0)
	  $next_reseed = ($row["last_reseed"] + 172800 ); //add 2 days 
	  $reseed = "<form method=\"post\" action=\"./takereseed.php\">
	  <select name=\"pm_what\">
	  <option value=\"last10\">last10</option>
	  <option value=\"owner\">uploader</option>
	  </select>
	  <input type=\"submit\"  ".(($next_reseed > time()) ? "disabled='disabled'" : "" )." value=\"SendPM\" />
	  <input type=\"hidden\" name=\"uploader\" value=\"" . $row["owner"] . "\" />
	  <input type=\"hidden\" name=\"reseedid\" value=\"$id\" />
	  </form>";	
	  $HTMLOUT .= tr("Request reseed", $reseed,1);
		//==End
		$HTMLOUT .= "</table>";
		$HTMLOUT .= "<h1>{$lang['details_comments']}<a href='details.php?id=$id'>" . htmlentities( $row["name"], ENT_QUOTES ) . "</a></h1>\n";

    if ($row["allow_comments"] == "yes" || $CURUSER['class'] >= UC_MODERATOR && $CURUSER['class'] <= UC_SYSOP) {
    $HTMLOUT .= "<p><a name=\"startcomments\"></a></p>\n";
    } else {
    $HTMLOUT .="<table width='750' border=\"1\" cellspacing=\"0\" cellpadding=\"5\">
    <tr>
    <td class='colhead' align='left' colspan='2'><a name='startcomments'>&nbsp;</a><b>{$lang['details_com_disabled']}</b></td>
    </tr>
    </table>\n";
    print stdhead("{$lang['details_details']}\"" . htmlentities($row["name"], ENT_QUOTES) . "\"") . $HTMLOUT . stdfoot($stdfoot);
    die();
    }
    
    $commentbar = "<p align='center'><a class='index' href='comment.php?action=add&amp;tid=$id'>{$lang['details_add_comment']}</a></p>\n";

    $count = $row['comments'];

    if (!$count) 
    {
      $HTMLOUT .= "<h2>{$lang['details_no_comment']}</h2>\n";
    }
    else 
    {
		$pager = pager(20, $count, "details.php?id=$id&amp;", array('lastpagedefault' => 1));

		$subres = sql_query("SELECT comments.id, text, user, torrent, comments.added, comments.anonymous, editedby, editedat, avatar, av_w, av_h, offavatar, warned, reputation, username, title, class, donor FROM comments LEFT JOIN users ON comments.user = users.id WHERE torrent = $id ORDER BY comments.id ".$pager['limit']) or sqlerr(__FILE__, __LINE__);
		
		$allrows = array();
		while ($subrow = mysql_fetch_assoc($subres))
			$allrows[] = $subrow;

		$HTMLOUT .= $commentbar;
		$HTMLOUT .= $pager['pagertop'];

		$HTMLOUT .= commenttable($allrows);

		$HTMLOUT .= $pager['pagerbottom'];
	}

    $HTMLOUT .= $commentbar;

///////////////////////// HTML OUTPUT ////////////////////////////
    print stdhead("{$lang['details_details']}\"" . htmlentities($row["name"], ENT_QUOTES) . "\"") . $HTMLOUT . stdfoot($stdfoot);
?>
Reply With Quote