Bravo List
Register
Go Back   > Bravo List > Source Code > Active Trackers > Torrent Trader > Mods & Themes
Reply
  #1  
Old 15th December 2012, 21:05
Coraille Coraille is offline
Senior Member
 
Join Date: Feb 2009
Canada
Posts: 92
Default Align Center ?
you have mod ?
Auto-Align Description Torrent ?
Center ?

Thanks
Reply With Quote
  #2  
Old 15th December 2012, 23:15
mat22 mat22 is offline
Senior Member
 
Join Date: Jun 2009
Latvia
Posts: 119
Default
Can't you just use <center></center> on both sides where you have description in torrent details? Just add that in your php file and that should do it.
Reply With Quote
  #3  
Old 16th December 2012, 04:36
Coraille Coraille is offline
Senior Member
 
Join Date: Feb 2009
Canada
Posts: 92
Default
PHP Code:
<?php
//
//  TorrentTrader v2.x
//      $LastChangedDate: 2011-05-03 19:09:32 +0300 (Tue, 03 May 2011) $
//      $LastChangedBy: dj-howarth1 $
//
//      http://www.torrenttrader.org
//
//
require_once("backend/functions.php");
require_once(
"backend/BDecode.php") ;
require_once(
"backend/parse.php") ;//replace with parse later
dbconn();

$torrent_dir $site_config["torrent_dir"];    
$nfo_dir $site_config["nfo_dir"];    

//check permissions
if ($site_config["MEMBERSONLY"]){
    
loggedinonly();

    if(
$CURUSER["view_torrents"]=="no")
        
show_error_msg(T_("ERROR"), T_("NO_TORRENT_VIEW"), 1);
}

//************ DO SOME "GET" STUFF BEFORE PAGE LAYOUT ***************

$id = (int) $_GET["id"];
$scrape = (int)$_GET["scrape"];
if (!
is_valid_id($id))
    
show_error_msg("ERROR"T_("THATS_NOT_A_VALID_ID"), 1);

//GET ALL MYSQL VALUES FOR THIS TORRENT
    
$res mysql_query("SELECT torrents.anon, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.nfo, torrents.last_action, torrents.numratings, torrents.name, 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.external, torrents.image1, torrents.image2, torrents.announce, torrents.numfiles, torrents.freeleech, torrents.nuked, IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.numratings, categories.name AS cat_name, categories.image AS cat_pic, torrentlang.name AS lang_name, torrentlang.image AS lang_image, categories.parent_cat as cat_parent, users.username, users.privacy FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN torrentlang ON torrents.torrentlang = torrentlang.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id") or die(mysql_error());



$row mysql_fetch_array($res);

$moderator $CURUSER["edit_torrents"] == "yes";


//DECIDE IF TORRENT EXISTS
if (!$row || ($row["banned"] == "yes" && !$moderator))
    
show_error_msg(T_("ERROR"), T_("TORRENT_NOT_FOUND"), 1);

//torrent is availiable so do some stuff

if ($_GET["hit"]) {
    
mysql_query("UPDATE torrents SET views = views + 1 WHERE id = $id");
    
header("Location: torrents-details.php?id=$id");
    die;
    }

    
stdhead(T_("DETAILS_FOR_TORRENT")." \"" $row["name"] . "\"");

    if (
$CURUSER["id"] == $row["owner"])
        
$owned 1;
    else
        
$owned 0;

    if (
$CURUSER["edit_torrents"]=="yes")
        
$owned 1;

//take rating
if ($_GET["takerating"] == 'yes'){
    
$rating = (int)$_POST['rating'];

    if (
$rating <= || $rating 5)
        
show_error_msg(T_("RATING_ERROR"), T_("INVAILD_RATING"), 1);

    
$res mysql_query("INSERT INTO ratings (torrent, user, rating, added) VALUES ($id, " $CURUSER["id"] . ", $rating, '".get_date_time()."')");

    if (!
$res) {
        if (
mysql_errno() == 1062)
            
show_error_msg(T_("RATING_ERROR"), T_("YOU_ALREADY_RATED_TORRENT"), 1);
        else
            
show_error_msg(T_("RATING_ERROR"), T_("A_UNKNOWN_ERROR_CONTACT_STAFF"), 1);
    }

    
mysql_query("UPDATE torrents SET numratings = numratings + 1, ratingsum = ratingsum + $rating WHERE id = $id");
    
show_error_msg(T_("RATING_ERROR"), T_("RATING_THANK")."<BR><BR><a href=torrents-details.php?id=$id>" .T_("BACK_TO_TORRENT"). "</a>");
}

//take comment add
if ($_GET["takecomment"] == 'yes'){
    
loggedinonly();
    
$commentbody $_POST['body'];
    
    if (!
$commentbody)
        
show_error_msg(T_("RATING_ERROR"), T_("YOU_DID_NOT_ENTER_ANYTHING"), 1);

    
mysql_query("UPDATE torrents SET comments = comments + 1 WHERE id = $id") or die(mysql_error());

    
mysql_query("INSERT INTO comments (user, torrent, added, text) VALUES (".$CURUSER["id"].", ".$id.", '" .get_date_time(). "', " sqlesc($body).")") or die(mysql_error());

    if (
mysql_affected_rows() == 1)
            
show_error_msg(T_("COMPLETED"), T_("COMMENT_ADDED"), 0);
        else
            
show_error_msg(T_("ERROR"), T_("UNABLE_TO_ADD_COMMENT"), 0);
}
//end insert comment

//PM to uploader on comment add
                
$msg "one of Your Torrents $torrent has recieved a Comment by $CURUSER[username]      Please check it  /torrents-details.php?id=$id]HERE";

          
mysql_query("INSERT INTO `messages` (`sender`, `receiver`, `added`, `subject`, `msg`, `unread`, `location`) VALUES
('
$CURUSER[username]', '".$row[owner]."', '".get_date_time()."', 'One of your torrents just recieved a comment. Please check !','$msg','yes','in')") or
die(
mysql_error());

//START OF PAGE LAYOUT HERE
$char1 50//cut length
$shortname CutName(htmlspecialchars($row["name"]), $char1);

begin_frame(T_("TORRENT_DETAILS_FOR"). " \"" $shortname "\"");

echo 
"<div align=right>[<a href=report.php?torrent=$id><B>" .T_("REPORT_TORRENT"). "</B></a>]&nbsp;";
if (
$owned)
    echo 
"[<a href=torrents-edit.php?id=$row[id]><B>".T_("EDIT_TORRENT")."</B></a>]";
echo 
"</div>";

$previd mysql_query("SELECT id, name FROM torrents WHERE id < $id ORDER BY id DESC LIMIT 1");
$prev mysql_fetch_row($previd);
$previd $prev[0];
$prevname htmlspecialchars($prev[1]);

$nextid mysql_query("SELECT id, name FROM torrents WHERE id > $id ORDER BY id ASC LIMIT 1");
$next mysql_fetch_row($nextid);
$nextid $next[0];
$nextname htmlspecialchars($next[1]);

echo 
"<table border=0 width=100%><tr>";
if (
$previd)
echo 
"<td align=center><a href='torrents-details.php?id=$previd'>[Previous Torrent]<BR>$prevname</a></td>";
if (
$nextid)
echo 
"<td align=center><a href='torrents-details.php?id=$nextid'>[Next Torrent]<BR>$nextname</a></td>";
echo 
"</tr></table>";

echo 
"<center><h1>" $shortname "</h1></center>";

// Calculate local torrent speed test
if ($row["leechers"] >= && $row["seeders"] >= && $row["external"]!='yes'){
    
$speedQ mysql_query("SELECT (SUM(p.downloaded)) / (UNIX_TIMESTAMP('".get_date_time()."') - UNIX_TIMESTAMP(added)) AS totalspeed FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' AND p.torrent = '$id' GROUP BY t.id ORDER BY added ASC LIMIT 15") or die(mysql_error());
    
$a mysql_fetch_assoc($speedQ);
    
$totalspeed mksize($a["totalspeed"]) . "/s";
}else{
    
$totalspeed "".T_("NO_ACTIVITY").""
}


//download box
echo "<CENTER><table border=0 width=98%><TR><TD><div id=downloadbox>";
if (
$row["banned"] == "yes"){
    print (
"<CENTER><B>" .T_("DOWNLOAD"). ": </B>BANNED!</CENTER>");
}else{
    print (
"<table border=0 cellpadding=0 width=95%><tr><td align=center valign=middle width=54><a href=\"download.php?id=$id&name=" rawurlencode($row["filename"]) . "\"><img src=\"".$site_config["SITEURL"]."/images/down.jpeg\" border=\"0\"></a></td>");
    print (
"<td valign=top><a href=\"download.php?id=$id&name=" rawurlencode($row["filename"]) . "\">".T_("DOWNLOAD_TORRENT")."</a><BR>");
    print (
"<B>" .T_("HEALTH"). ": </b><img src=".$site_config["SITEURL"]."/images/health_".health($row["leechers"], $row["seeders"]).".gif><BR>");
    print (
"<B>" .T_("SEEDS"). ": </b><font color=green>" $row["seeders"] . "</font><BR>");
    print (
"<B>".T_("LEECHERS").": </b><font color=red>" $row["leechers"] . "</font><BR>");

    if (
$row["external"]!='yes'){
        print (
"<B>".T_("SPEED").": </b>" $totalspeed "<BR>");
    }

    print (
"<b>".T_("COMPLETED").": </b>" $row["times_completed"] . "</B>&nbsp;"); 

    if (
$row["external"] != "yes" && $row["times_completed"] > 0) {
        echo(
"[<a href='torrents-completed.php?id=$id'>" .T_("WHOS_COMPLETED"). "</a>] ");
        if (
$row["seeders"] <= 1) {
            echo(
"[<a href='torrents-reseed.php?id=$id'>" .T_("REQUEST_A_RE_SEED"). "</a>]");
        }
    }
    echo 
"<br>";

    if (
$row["external"]!='yes' && $row["freeleech"]=='1'){
        print (
"<B>".T_("FREE_LEECH").": </b><font color=red>".T_("FREE_LEECH_MSG")."</font><BR>");
    }

        if (
$row["nuked"] == 'yes'){
        print (
"<B>Nuked: </B><font color=red><blink>Torrent NUKED!</blink></font><BR>");
        }

    print (
"<B>".T_("LAST_CHECKED").": </b>" date("d-m-Y H:i:s"utc_to_tz_time($row["last_action"])) . "<BR></td>");

    if (
$row["external"]=='yes'){

        if (
$scrape =='1'){
            print(
"<td valign=top align=right><b>Tracked: </b>EXTERNAL<BR><BR>");
            
$seeders1 $leechers1 $downloaded1 null;

            
$tres mysql_query("SELECT url FROM announce WHERE torrent=$id");
            while (
$trow mysql_fetch_array($tres)) {
                
$ann $trow["url"];
                
$tracker explode("/"$ann);
                
$path array_pop($tracker);
                
$oldpath $path;
                
$path preg_replace("/^announce/""scrape"$path);
                
$tracker implode("/"$tracker)."/".$path;

                if (
$oldpath == $path) {
                    continue; 
// Scrape not supported, ignored
                
}

                
// TPB's tracker is dead. Use openbittorrent instead
                
if (preg_match("/thepiratebay.org/i"$tracker) || preg_match("/prq.to/"$tracker)) {
                    
$tracker "http://tracker.openbittorrent.com/scrape";
                }

                
$stats torrent_scrape_url($tracker$row["info_hash"]);
                if (
$stats['seeds'] != -1) {
                    
$seeders1 += $stats['seeds'];
                    
$leechers1 += $stats['peers'];
                    
$downloaded1 += $stats['downloaded'];
                    
mysql_query("UPDATE `announce` SET `online` = 'yes', `seeders` = $stats[seeds], `leechers` = $stats[peers], `times_completed` = $stats[downloaded] WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");
                } else {
                    
mysql_query("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");

                }
            }

            if (
$seeders1 !== null){ //only update stats if data is received
                
print ("<B>".T_("LIVE_STATS").": </b><BR>");
                print (
"Seeders: ".$seeders1."<BR>");
                print (
"Leechers: ".$leechers1."<BR>");
                print (
"".T_("COMPLETED").": ".$downloaded1."<BR>");

                
mysql_query("UPDATE torrents SET leechers='".$leechers1."', seeders='".$seeders1."',times_completed='".$downloaded1."',last_action= '".get_date_time()."',visible='yes' WHERE id='".$row['id']."'"); 
            }else{
                print (
"<B>".T_("LIVE_STATS").": </b><BR>");
                print (
"<font color=red>Tracker Timeout<BR>Please retry later</font><BR>");
            }

            print (
"<form action=torrents-details.php?id=$id&scrape=1 method=post><input type=\"submit\" name=\"submit\" value=\"Update Stats\"></td></form>");
        }else{
            print (
"<td valign=top align=right><b>Tracked: </b>EXTERNAL<BR><BR><form action=torrents-details.php?id=$id&scrape=1 method=post><input type=\"submit\" name=\"submit\" value=\"Update Stats\"></td></form>");
        }
    }

    echo 
"</tr></table>";
}
echo 
"</div></td></tr></table></CENTER><BR><BR>";
//end download box

// Thanx mod
$torrentid $_GET["id"];
                
$thanks_sql mysql_query("SELECT * FROM thanks where torrentid=$torrentid");
  
$thanks_all mysql_numrows($thanks_sql);
  if (
$thanks_all) {
  while(
$rows_t mysql_fetch_array($thanks_sql)) {
  
$thanks_userid $rows_t["userid"];
  
$user_sql mysql_query("SELECT * FROM users where id=$thanks_userid");
  
$rows_a mysql_fetch_array($user_sql);
  
$username_t $rows_a["username"];
  
$thanksby =  $thanksby."<a href='userdetails.php?id=$thanks_userid'>$username_t</a>, ";
  }
  
$t_userid $CURUSER["id"];             
  
$tsql mysql_query("SELECT COUNT(*) FROM thanks where torrentid=$torrentid and userid=$t_userid");
  
$trows mysql_fetch_array($tsql);
  
$t_ab $trows[0];
if (
$t_ab == "0" && $CURUSER["id"] != $row["owner"]) {
 
$thanksby $thanksby." <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Say Thanks!\">
<input type=\"hidden\" name=\"torrentid\" value=\"
$torrentid\">
</form>"
;
 }
 else {
 
$thanksby $thanksby." <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Say Thanks!\" disabled>
<input type=\"hidden\" name=\"torrentid\" value=\"
$torrentid\">
</form>"
;
 }
 }
 else {
 if (
$CURUSER["id"] == $row["owner"]){
 
$thanksby $thanksby." <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Say Thanks!\" disabled>
<input type=\"hidden\" name=\"torrentid\" value=\"
$torrentid\">
</form>"
;
 }
 else
 
$thanksby "No Thanks Yet
 <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Say Thanks!\">
<input type=\"hidden\" name=\"torrentid\" value=\"
$torrentid\">
</form>
 "
;
 }  print(
"<br><table><tr>
<td valign=top><table border=0 width=100 cellspacing=0 cellpadding=0><tr><td class=alt5 align=center><b>Thanks by</b></td>
</tr></table></td><td width=100%>" 
$thanksby "</td></tr></table>");

//Thanx mod end


echo "<FIELDSET class=search><LEGEND></a><b>Details</B></LEGEND>";
echo 
"<table cellpadding=3 border=0 width=95%>";
print(
"<tr><td align=left><b>".T_("NAME").":</b></td><td>" $shortname "</td></tr>\n");
print(
"<tr><td align=left colspan=2><b>" .T_("DESCRIPTION"). ":</b><br>" .  format_comment($row['descr']) . "</td></tr>\n");
print(
"<tr><td align=left><b>" TTYPE ":</b></td><td><a href=\"torrents.php?cat=" $row["category"] . "\"><img border=\"0\"src=\"" $site_config['SITEURL'] . "/images/categories/" $row["cat_pic"] . "\" alt=\"" $row["cat_name"] . "\" /></td></tr>\n");

if (empty(
$row["lang_name"])) $row["lang_name"] = "Unknown/NA";
print(
"<tr><td align=left><b>" .T_("LANG"). ":</b></td><td>" $row["lang_name"] . "\n");

if (isset(
$row["lang_image"]) && $row["lang_image"] != "")
            print(
"&nbsp;<img border=\"0\"src=\"" $site_config['SITEURL'] . "/images/languages/" $row["lang_image"] . "\" alt=\"" $row["lang_name"] . "\" />");

print(
"</td></tr>");

print(
"<tr><td align=left><b>" .T_("TOTAL_SIZE"). ":</b></td><td>" mksize($row["size"]) . " </td></tr>\n");
print(
"<tr><td align=left><b>" .T_("INFO_HASH"). ":</b></td><td>" $row["info_hash"] . "</td></tr>\n");
print(
"");
if (
$row["anon"] == "yes" && !$owned)
    print(
"<tr><td align=left><b>" .T_("ADDED_BY"). ":</b></td><td>Anonymous</td></tr>");
elseif (
$row["username"])
    print(
"<tr><td align=left><b>" .T_("ADDED_BY"). ":</b></td><td><a href=account-details.php?id=" $row["owner"] . ">" $row["username"] . "</a></td></tr>");
else
    print(
"<tr><td align=left><b>" .T_("ADDED_BY"). ":</b></td><td>Unknown</td></tr>");

print(
"<tr><td align=left><b>" .T_("DATE_ADDED"). ":</b></td><td>" date("d-m-Y H:i:s"utc_to_tz_time($row["added"])) . "</td></tr>\n");
print(
"<tr><td align=left><b>" .T_("VIEWS"). ":</b></td><td>" $row["views"] . "</td></tr>\n");
print(
"<tr><td align=left><b>".T_("HITS").":</b></td><td>" $row["hits"] . "</td></tr>\n");
echo 
"</table></FIELDSET><BR><BR>";


// $srating IS RATING VARIABLE
        
$srating "";
        
$srating .= "<table border=\"0\" cellspacing=\"1\" cellpadding=\"4\" width='95%' style=\"border: 2px solid #f8de8f;\"><tr><td style=\"background:#f8edcc;\" width=60><b>".T_("RATINGS").":</b></td><td style=\"background:#f8f1dd;\" valign=middle><NOBR>";
        if (!isset(
$row["rating"])) {
                
$srating .= "Not Yet Rated";
        }else{
            
$rpic ratingpic($row["rating"]);
            if (!isset(
$rpic))
                
$srating .= "invalid?";
            else
                
$srating .= "$rpic (" $row["rating"] . " ".T_("OUT_OF")." 5) " $row["numratings"] . " ".T_("USERS_HAVE_RATED")."";
        }
        
$srating .= "\n";
        if (!isset(
$CURUSER))
            
$srating .= "(<a href=\"account-login.php?returnto=" urlencode($_SERVER["REQUEST_URI"]) . "&amp;nowarn=1\">Log in</a> to rate it)";
        else {
            
$ratings = array(
                    
=> "".T_("COOL")."",
                    
=> "".T_("PRETTY_GOOD")."",
                    
=> "".T_("DECENT")."",
                    
=> "".T_("PRETTY_BAD")."",
                    
=> "".T_("SUCKS")."",
            );
            
//if (!$owned || $moderator) {
                
$xres mysql_query("SELECT rating, added FROM ratings WHERE torrent = $id AND user = " $CURUSER["id"]);
                
$xrow mysql_fetch_array($xres);
                if (
$xrow)
                    
$srating .= "<BR><i>(".T_("YOU_RATED")." \"" $xrow["rating"] . " - " $ratings[$xrow["rating"]] . "\")</i>";
                else {
                    
$srating .= "<form style=display:inline; method=\"post\" action=\"torrents-details.php?id=$id&takerating=yes\"><input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
                    
$srating .= "<select name=\"rating\">\n";
                    
$srating .= "<option value=\"0\">(".T_("ADD_RATING").")</option>\n";
                    foreach (
$ratings as $k => $v) {
                        
$srating .= "<option value=\"$k\">$k - $v</option>\n";
                    }
                    
$srating .= "</select>\n";
                    
$srating .= "<input type=\"submit\" value=\"".T_("VOTE")."\" />";
                    
$srating .= "</form>\n";
                }
            
//}
        
}
        
$srating .= "</NOBR></td></tr></table>";

print(
"<CENTER>"$srating "</CENTER>");// rating

//END DEFINE RATING VARIABLE

echo "<BR>";

if (
$row["image1"] != "" OR $row["image2"] != "") {
  if (
$row["image1"] != "")
    
$img1 "<IMG src=".$site_config["SITEURL"]."/uploads/images/$row[image1] width=150 border=0>";
  if (
$row["image2"] != "")
    
$img2 "<IMG src=".$site_config["SITEURL"]."/uploads/images/$row[image2] width=150 border=0>";
  print(
"<CENTER>"$img1 "&nbsp&nbsp" $img2."</CENTER><BR>");
}



if (
$row["external"]=='yes'){
    print (
"<br><b>Tracker:</B><BR> ".$row['announce']."<br>");
}


$tres mysql_query("SELECT * FROM `announce` WHERE `torrent` = $id");
if (
mysql_num_rows($tres) > 1){
    echo 
"<br><B>".T_("THIS_TORRENT_HAS_BACKUP_TRACKERS")."</B><br>";
    echo 
'<table cellpadding="1" cellspacing="2" class="ttable_headinner"><tr>';
    echo 
'<td class="ttable_head">URL</td><td class="ttable_head">'.T_("SEEDERS").'</td><td class="ttable_head">'.T_("LEECHERS").'</td><td class="ttable_head">'.T_("COMPLETED").'</td></tr>';
    
$x 1;
    while (
$trow mysql_fetch_array($tres)) {
        
$colour $trow["online"] == "yes" "green" "red";
        echo 
"<tr class=\"ttable_col$x\"><td><font color=\"$colour\"><b>".htmlspecialchars($trow['url'])."</b></font></td><td align=\"center\">".number_format($trow["seeders"])."</td><td align=\"center\">".number_format($trow["leechers"])."</td><td align=\"center\">".number_format($trow["times_completed"])."</td></tr>";
        
$x $x == 1;
    }
    echo 
'</table>';
}

echo 
"<BR><BR><b>".T_("FILE_LIST").":</B>&nbsp;<img src='images/plus.gif' id='pic1' onclick='klappe_torrent(1)'><div id='k1' style='display: none;'><table align=center cellpadding=0 cellspacing=0 class=table_table border=1 width=95%><TR><TD class=table_head align=left>&nbsp;".T_("FILE")."</TD><TD width=50 class=table_head>&nbsp;".T_("SIZE")."</td></tr>";
$fres mysql_query("SELECT * FROM `files` WHERE `torrent` = $id");
if (
mysql_num_rows($fres)) {
    while (
$frow mysql_fetch_array($fres)) {
        echo 
"<TR><td class=table_col1>".htmlspecialchars($frow['path'])."</td><TD class=table_col2>".mksize($frow['filesize'])."</td></tr>";
    }
}else{
    echo 
"<TR><td class=table_col1>".htmlspecialchars($row["name"])."</td><TD class=table_col2>".mksize($row["size"])."</td></tr>";
}
echo 
"</table></div>";

if (
$row["external"]!='yes'){
    echo 
"<BR><BR><B>".T_("PEERS_LIST").":</B><BR>";
    
$query mysql_query("SELECT * FROM peers WHERE torrent = $id ORDER BY seeder DESC");

    
$result mysql_num_rows($query);
        if(
$result == 0) {
            echo 
T_("NO_ACTIVE_PEERS")."\n";
        }else{
            
?>
            <table align=center cellpadding="3" cellspacing="0" class="table_table" width="95%" border="1">
            <tr>
            <td class="table_head"><?php print(T_("PORT")); ?></td>
            <td class="table_head"><?php print(T_("UPLOADED")); ?></td>
            <td class="table_head"><?php print(T_("DOWNLOADED")); ?></td>
            <td class="table_head"><?php print(T_("RATIO")); ?></td>
            <td class="table_head"><?php print(T_("LEFT")); ?></td>
            <td class="table_head"><?php print(T_("FINISHED_SHORT"). "%"); ?></td>
            <td class="table_head"><?php print(T_("SEED")); ?></td>
            <td class="table_head"><?php print(T_("CONNECTED_SHORT")); ?></td>
            <td class="table_head"><?php print(T_("CLIENT")); ?></td>
            <td class="table_head"><?php print(T_("USER_SHORT")); ?></td>
            </tr>

            <?php
            
while($row1 MYSQL_FETCH_ARRAY($query))    {
                
                if (
$row1["downloaded"] > 0){
                    
$ratio $row1["uploaded"] / $row1["downloaded"];
                    
$ratio number_format($ratio3);
                }else{
                    
$ratio "---";
                }

                
$percentcomp sprintf("%.2f"100 * (- ($row1["to_go"] / $row["size"])));    

                if (
$site_config["MEMBERSONLY"]) {
                    
$res mysql_query("SELECT id, username, privacy FROM users WHERE id=".$row1["userid"]."");
                    
$arr MYSQL_FETCH_ARRAY($res);
                }
                
$arr["username"];
                if (
$arr["privacy"] != "strong" || ($CURUSER["control_panel"] == "yes")) {
                    print(
"<tr><td class=table_col2>".$row1["port"]."</td><td class=table_col1>".mksize($row1["uploaded"])."</td><td class=table_col2>".mksize($row1["downloaded"])."</td><td class=table_col1>".$ratio."</td><td class=table_col2>".mksize($row1["to_go"])."</td><td class=table_col1>".$percentcomp."%</td><td class=table_col2>$row1[seeder]</td><td class=table_col1>$row1[connectable]</td><td class=table_col2>".htmlspecialchars($row1[client])."</td><td class=table_col1><a href=account-details.php?id=$arr[id]>$arr[username]</a></td></tr>");
                }else{
                    print(
"<tr><td class=table_col2>".$row1["port"]."</td><td class=table_col1>".mksize($row1["uploaded"])."</td><td class=table_col2>".mksize($row1["downloaded"])."</td><td class=table_col1>".$ratio."</td><td class=table_col2>".mksize($row1["to_go"])."</td><td class=table_col1>".$percentcomp."%</td><td class=table_col2>$row1[seeder]</td><td class=table_col1>$row1[connectable]</td><td class=table_col2>".htmlspecialchars($row1[client])."</td><td class=table_col1>Private</td></tr>");
                }

            }
            echo 
"</table>";
    }
}


echo 
"<BR><BR>";

//DISPLAY NFO BLOCK
function my_nfo_translate($nfo){
        
$trans = array(
        
"\x80" => "Ç""\x81" => "ü""\x82" => "é""\x83" => "â""\x84" => "ä""\x85" => "à""\x86" => "å""\x87" => "ç""\x88" => "ê""\x89" => "ë""\x8a" => "è""\x8b" => "ï""\x8c" => "î""\x8d" => "ì""\x8e" => "Ä""\x8f" => "Å""\x90" => "É",
        
"\x91" => "æ""\x92" => "Æ""\x93" => "ô""\x94" => "ö""\x95" => "ò""\x96" => "û""\x97" => "ù""\x98" => "ÿ""\x99" => "Ö""\x9a" => "Ü""\x9b" => "¢""\x9c" => "£""\x9d" => "¥""\x9e" => "₧""\x9f" => "ƒ""\xa0" => "á""\xa1" => "í",
        
"\xa2" => "ó""\xa3" => "ú""\xa4" => "ñ""\xa5" => "Ñ""\xa6" => "ª""\xa7" => "º""\xa8" => "¿""\xa9" => "⌐""\xaa" => "¬""\xab" => "½""\xac" => "¼""\xad" => "¡""\xae" => "«""\xaf" => "»""\xb0" => "░""\xb1" => "▒""\xb2" => "▓",
        
"\xb3" => "│""\xb4" => "┤""\xb5" => "╡""\xb6" => "╢""\xb7" => "╖""\xb8" => "╕""\xb9" => "╣""\xba" => "║""\xbb" => "╗""\xbc" => "╝""\xbd" => "╜""\xbe" => "╛""\xbf" => "┐""\xc0" => "└""\xc1" => "┴""\xc2" => "┬""\xc3" => "├",
        
"\xc4" => "─""\xc5" => "┼""\xc6" => "╞""\xc7" => "╟""\xc8" => "╚""\xc9" => "╔""\xca" => "╩""\xcb" => "╦""\xcc" => "╠""\xcd" => "═""\xce" => "╬""\xcf" => "╧""\xd0" => "╨""\xd1" => "╤""\xd2" => "╥""\xd3" => "╙""\xd4" => "╘",
        
"\xd5" => "╒""\xd6" => "╓""\xd7" => "╫""\xd8" => "╪""\xd9" => "┘""\xda" => "┌""\xdb" => "█""\xdc" => "▄""\xdd" => "▌""\xde" => "▐""\xdf" => "▀""\xe0" => "α""\xe1" => "ß""\xe2" => "Γ""\xe3" => "π""\xe4" => "Σ""\xe5" => "σ",
        
"\xe6" => "µ""\xe7" => "τ""\xe8" => "Φ""\xe9" => "Θ""\xea" => "Ω""\xeb" => "δ""\xec" => "∞""\xed" => "φ""\xee" => "ε""\xef" => "∩""\xf0" => "≡""\xf1" => "±""\xf2" => "≥""\xf3" => "≤""\xf4" => "⌠""\xf5" => "⌡""\xf6" => "÷",
        
"\xf7" => "≈""\xf8" => "°""\xf9" => "∙""\xfa" => "·""\xfb" => "√""\xfc" => "ⁿ""\xfd" => "²""\xfe" => "■""\xff" => " ",
        );
        
$trans2 = array("\xe4" => "&auml;",        "\xF6" => "&ouml;",        "\xFC" => "&uuml;",        "\xC4" => "&Auml;",        "\xD6" => "&Ouml;",        "\xDC" => "&Uuml;",        "\xDF" => "&szlig;");
        
$all_chars "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        
$last_was_ascii False;
        
$tmp "";
        
$nfo $nfo "\00";
        for (
$i 0$i < (strlen($nfo) - 1); $i++)
        {
                
$char $nfo[$i];
                if (isset(
$trans2[$char]) and ($last_was_ascii or strpos($all_chars, ($nfo[$i 1]))))
                {
                        
$tmp $tmp $trans2[$char];
                        
$last_was_ascii True;
                }
                else
                {
                        if (isset(
$trans[$char]))
                        {
                                
$tmp $tmp $trans[$char];
                        }
                        else
                        {
                            
$tmp $tmp $char;
                        }
                        
$last_was_ascii strpos($all_chars$char);
                }
        }
        return 
$tmp;
}
//-----------------------------------------------

//DISPLAY NFO BLOCK
if($row["nfo"]== "yes"){
    
$nfofilelocation "$nfo_dir/$row[id].nfo";
    
$filegetcontents file_get_contents($nfofilelocation);
    
$nfo htmlspecialchars($filegetcontents);
        if (
$nfo) {    
            
$nfo my_nfo_translate($nfo);
            echo 
"<BR><BR><b>NFO:</B><BR>";
            
begin_table();
            print(
"<tr><td>\n");

            print(
"<textarea style=\"font-size:8pt;width:100%;height:100%;\" wrap=\"off\" rows=20 and cols=20 READONLY>".stripslashes($nfo)."</textarea>");
            
end_table();
        }else{
            print(
T_("ERROR")." reading .nfo file!");
        }
}
end_frame();

begin_frame(T_("COMMENTS"));
    
//echo "<p align=center><a class=index href=torrents-comment.php?id=$id>" .T_("ADDCOMMENT"). "</a></p>\n";

    
$subres mysql_query("SELECT COUNT(*) FROM comments WHERE torrent = $id") or die(mysql_error());
    
$subrow mysql_fetch_array($subres);
    
$commcount $subrow[0];

    if (
$commcount) {
        list(
$pagertop$pagerbottom$limit) = pager(10$commcount"torrents-details.php?id=$id&");
        
$commquery "SELECT comments.id, text, user, comments.added, avatar, signature, username, title, class, uploaded, downloaded, privacy, donated FROM comments LEFT JOIN users ON comments.user = users.id WHERE torrent = $id ORDER BY comments.id $limit";
        
$commres mysql_query($commquery) or die(mysql_error());
    }else{
        unset(
$commres);
    }

    if (
$commcount) {
        print(
$pagertop);
        
commenttable($commres);
        print(
$pagerbottom);
    }else {
        print(
"<BR><b><CENTER>" .T_("NOCOMMENTS"). "</CENTER></b><BR>\n");
    }

    require_once(
"backend/bbcode.php");

    if (
$CURUSER) {
        echo 
"<CENTER>";
        echo 
"<form name=\"comment\" method=\"post\" action=\"torrents-details.php?id=$row[id]&takecomment=yes\">";
        echo 
"".textbbcode("comment","body")."<br>";
        echo 
"<input type=\"submit\" class=btn value=\"".T_("ADDCOMMENT")."\" />";
        echo 
"</form></CENTER>";
    }

    
end_frame();

stdfoot();
?>

Last edited by Krypto; 16th December 2012 at 11:21. Reason: php Code Tags Added
Reply With Quote
  #4  
Old 16th December 2012, 11:15
firefly's Avatar
firefly firefly is offline
Senior Member
 
Join Date: Dec 2009
P2P
Posts: 74
Default
Could you kindly wrap your last post with the php bb code. That much code is a mess hehehe.
__________________
Can install Gazelle
Reply With Quote
  #5  
Old 16th December 2012, 22:50
Grogz Grogz is offline
Senior Member
 
Join Date: Jun 2010
P2P
Posts: 15
Default
Test this

PHP Code:
<?php
//
//  TorrentTrader v2.x
//      $LastChangedDate: 2011-05-03 19:09:32 +0300 (Tue, 03 May 2011) $
//      $LastChangedBy: dj-howarth1 $
//
//      http://www.torrenttrader.org
//
//
require_once("backend/functions.php");
require_once(
"backend/BDecode.php") ;
require_once(
"backend/parse.php") ;//replace with parse later
dbconn();

$torrent_dir $site_config["torrent_dir"];    
$nfo_dir $site_config["nfo_dir"];    

//check permissions
if ($site_config["MEMBERSONLY"]){
    
loggedinonly();

    if(
$CURUSER["view_torrents"]=="no")
        
show_error_msg(T_("ERROR"), T_("NO_TORRENT_VIEW"), 1);
}

//************ DO SOME "GET" STUFF BEFORE PAGE LAYOUT ***************

$id = (int) $_GET["id"];
$scrape = (int)$_GET["scrape"];
if (!
is_valid_id($id))
    
show_error_msg("ERROR"T_("THATS_NOT_A_VALID_ID"), 1);

//GET ALL MYSQL VALUES FOR THIS TORRENT
    
$res mysql_query("SELECT torrents.anon, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.nfo, torrents.last_action, torrents.numratings, torrents.name, 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.external, torrents.image1, torrents.image2, torrents.announce, torrents.numfiles, torrents.freeleech, torrents.nuked, IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.numratings, categories.name AS cat_name, categories.image AS cat_pic, torrentlang.name AS lang_name, torrentlang.image AS lang_image, categories.parent_cat as cat_parent, users.username, users.privacy FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN torrentlang ON torrents.torrentlang = torrentlang.id LEFT JOIN users ON torrents.owner = users.id WHERE torrents.id = $id") or die(mysql_error());



$row mysql_fetch_array($res);

$moderator $CURUSER["edit_torrents"] == "yes";


//DECIDE IF TORRENT EXISTS
if (!$row || ($row["banned"] == "yes" && !$moderator))
    
show_error_msg(T_("ERROR"), T_("TORRENT_NOT_FOUND"), 1);

//torrent is availiable so do some stuff

if ($_GET["hit"]) {
    
mysql_query("UPDATE torrents SET views = views + 1 WHERE id = $id");
    
header("Location: torrents-details.php?id=$id");
    die;
    }

    
stdhead(T_("DETAILS_FOR_TORRENT")." \"" $row["name"] . "\"");

    if (
$CURUSER["id"] == $row["owner"])
        
$owned 1;
    else
        
$owned 0;

    if (
$CURUSER["edit_torrents"]=="yes")
        
$owned 1;

//take rating
if ($_GET["takerating"] == 'yes'){
    
$rating = (int)$_POST['rating'];

    if (
$rating <= || $rating 5)
        
show_error_msg(T_("RATING_ERROR"), T_("INVAILD_RATING"), 1);

    
$res mysql_query("INSERT INTO ratings (torrent, user, rating, added) VALUES ($id, " $CURUSER["id"] . ", $rating, '".get_date_time()."')");

    if (!
$res) {
        if (
mysql_errno() == 1062)
            
show_error_msg(T_("RATING_ERROR"), T_("YOU_ALREADY_RATED_TORRENT"), 1);
        else
            
show_error_msg(T_("RATING_ERROR"), T_("A_UNKNOWN_ERROR_CONTACT_STAFF"), 1);
    }

    
mysql_query("UPDATE torrents SET numratings = numratings + 1, ratingsum = ratingsum + $rating WHERE id = $id");
    
show_error_msg(T_("RATING_ERROR"), T_("RATING_THANK")."<BR><BR><a href=torrents-details.php?id=$id>" .T_("BACK_TO_TORRENT"). "</a>");
}

//take comment add
if ($_GET["takecomment"] == 'yes'){
    
loggedinonly();
    
$commentbody $_POST['body'];
    
    if (!
$commentbody)
        
show_error_msg(T_("RATING_ERROR"), T_("YOU_DID_NOT_ENTER_ANYTHING"), 1);

    
mysql_query("UPDATE torrents SET comments = comments + 1 WHERE id = $id") or die(mysql_error());

    
mysql_query("INSERT INTO comments (user, torrent, added, text) VALUES (".$CURUSER["id"].", ".$id.", '" .get_date_time(). "', " sqlesc($body).")") or die(mysql_error());

    if (
mysql_affected_rows() == 1)
            
show_error_msg(T_("COMPLETED"), T_("COMMENT_ADDED"), 0);
        else
            
show_error_msg(T_("ERROR"), T_("UNABLE_TO_ADD_COMMENT"), 0);
}
//end insert comment

//PM to uploader on comment add
                
$msg "one of Your Torrents $torrent has recieved a Comment by $CURUSER[username]      Please check it  /torrents-details.php?id=$id]HERE";

          
mysql_query("INSERT INTO `messages` (`sender`, `receiver`, `added`, `subject`, `msg`, `unread`, `location`) VALUES
('
$CURUSER[username]', '".$row[owner]."', '".get_date_time()."', 'One of your torrents just recieved a comment. Please check !','$msg','yes','in')") or
die(
mysql_error());

//START OF PAGE LAYOUT HERE
$char1 50//cut length
$shortname CutName(htmlspecialchars($row["name"]), $char1);

begin_frame(T_("TORRENT_DETAILS_FOR"). " \"" $shortname "\"");

echo 
"<div align=right>[<a href=report.php?torrent=$id><B>" .T_("REPORT_TORRENT"). "</B></a>]&nbsp;";
if (
$owned)
    echo 
"[<a href=torrents-edit.php?id=$row[id]><B>".T_("EDIT_TORRENT")."</B></a>]";
echo 
"</div>";

$previd mysql_query("SELECT id, name FROM torrents WHERE id < $id ORDER BY id DESC LIMIT 1");
$prev mysql_fetch_row($previd);
$previd $prev[0];
$prevname htmlspecialchars($prev[1]);

$nextid mysql_query("SELECT id, name FROM torrents WHERE id > $id ORDER BY id ASC LIMIT 1");
$next mysql_fetch_row($nextid);
$nextid $next[0];
$nextname htmlspecialchars($next[1]);

echo 
"<table border=0 width=100%><tr>";
if (
$previd)
echo 
"<td align=center><a href='torrents-details.php?id=$previd'>[Previous Torrent]<BR>$prevname</a></td>";
if (
$nextid)
echo 
"<td align=center><a href='torrents-details.php?id=$nextid'>[Next Torrent]<BR>$nextname</a></td>";
echo 
"</tr></table>";

echo 
"<center><h1>" $shortname "</h1></center>";

// Calculate local torrent speed test
if ($row["leechers"] >= && $row["seeders"] >= && $row["external"]!='yes'){
    
$speedQ mysql_query("SELECT (SUM(p.downloaded)) / (UNIX_TIMESTAMP('".get_date_time()."') - UNIX_TIMESTAMP(added)) AS totalspeed FROM torrents AS t LEFT JOIN peers AS p ON t.id = p.torrent WHERE p.seeder = 'no' AND p.torrent = '$id' GROUP BY t.id ORDER BY added ASC LIMIT 15") or die(mysql_error());
    
$a mysql_fetch_assoc($speedQ);
    
$totalspeed mksize($a["totalspeed"]) . "/s";
}else{
    
$totalspeed "".T_("NO_ACTIVITY").""
}


//download box
echo "<CENTER><table border=0 width=98%><TR><TD><div id=downloadbox>";
if (
$row["banned"] == "yes"){
    print (
"<CENTER><B>" .T_("DOWNLOAD"). ": </B>BANNED!</CENTER>");
}else{
    print (
"<table border=0 cellpadding=0 width=95%><tr><td align=center valign=middle width=54><a href=\"download.php?id=$id&name=" rawurlencode($row["filename"]) . "\"><img src=\"".$site_config["SITEURL"]."/images/down.jpeg\" border=\"0\"></a></td>");
    print (
"<td valign=top><a href=\"download.php?id=$id&name=" rawurlencode($row["filename"]) . "\">".T_("DOWNLOAD_TORRENT")."</a><BR>");
    print (
"<B>" .T_("HEALTH"). ": </b><img src=".$site_config["SITEURL"]."/images/health_".health($row["leechers"], $row["seeders"]).".gif><BR>");
    print (
"<B>" .T_("SEEDS"). ": </b><font color=green>" $row["seeders"] . "</font><BR>");
    print (
"<B>".T_("LEECHERS").": </b><font color=red>" $row["leechers"] . "</font><BR>");

    if (
$row["external"]!='yes'){
        print (
"<B>".T_("SPEED").": </b>" $totalspeed "<BR>");
    }

    print (
"<b>".T_("COMPLETED").": </b>" $row["times_completed"] . "</B>&nbsp;"); 

    if (
$row["external"] != "yes" && $row["times_completed"] > 0) {
        echo(
"[<a href='torrents-completed.php?id=$id'>" .T_("WHOS_COMPLETED"). "</a>] ");
        if (
$row["seeders"] <= 1) {
            echo(
"[<a href='torrents-reseed.php?id=$id'>" .T_("REQUEST_A_RE_SEED"). "</a>]");
        }
    }
    echo 
"<br>";

    if (
$row["external"]!='yes' && $row["freeleech"]=='1'){
        print (
"<B>".T_("FREE_LEECH").": </b><font color=red>".T_("FREE_LEECH_MSG")."</font><BR>");
    }

        if (
$row["nuked"] == 'yes'){
        print (
"<B>Nuked: </B><font color=red><blink>Torrent NUKED!</blink></font><BR>");
        }

    print (
"<B>".T_("LAST_CHECKED").": </b>" date("d-m-Y H:i:s"utc_to_tz_time($row["last_action"])) . "<BR></td>");

    if (
$row["external"]=='yes'){

        if (
$scrape =='1'){
            print(
"<td valign=top align=right><b>Tracked: </b>EXTERNAL<BR><BR>");
            
$seeders1 $leechers1 $downloaded1 null;

            
$tres mysql_query("SELECT url FROM announce WHERE torrent=$id");
            while (
$trow mysql_fetch_array($tres)) {
                
$ann $trow["url"];
                
$tracker explode("/"$ann);
                
$path array_pop($tracker);
                
$oldpath $path;
                
$path preg_replace("/^announce/""scrape"$path);
                
$tracker implode("/"$tracker)."/".$path;

                if (
$oldpath == $path) {
                    continue; 
// Scrape not supported, ignored
                
}

                
// TPB's tracker is dead. Use openbittorrent instead
                
if (preg_match("/thepiratebay.org/i"$tracker) || preg_match("/prq.to/"$tracker)) {
                    
$tracker "http://tracker.openbittorrent.com/scrape";
                }

                
$stats torrent_scrape_url($tracker$row["info_hash"]);
                if (
$stats['seeds'] != -1) {
                    
$seeders1 += $stats['seeds'];
                    
$leechers1 += $stats['peers'];
                    
$downloaded1 += $stats['downloaded'];
                    
mysql_query("UPDATE `announce` SET `online` = 'yes', `seeders` = $stats[seeds], `leechers` = $stats[peers], `times_completed` = $stats[downloaded] WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");
                } else {
                    
mysql_query("UPDATE `announce` SET `online` = 'no' WHERE `url` = ".sqlesc($ann)." AND `torrent` = $id");

                }
            }

            if (
$seeders1 !== null){ //only update stats if data is received
                
print ("<B>".T_("LIVE_STATS").": </b><BR>");
                print (
"Seeders: ".$seeders1."<BR>");
                print (
"Leechers: ".$leechers1."<BR>");
                print (
"".T_("COMPLETED").": ".$downloaded1."<BR>");

                
mysql_query("UPDATE torrents SET leechers='".$leechers1."', seeders='".$seeders1."',times_completed='".$downloaded1."',last_action= '".get_date_time()."',visible='yes' WHERE id='".$row['id']."'"); 
            }else{
                print (
"<B>".T_("LIVE_STATS").": </b><BR>");
                print (
"<font color=red>Tracker Timeout<BR>Please retry later</font><BR>");
            }

            print (
"<form action=torrents-details.php?id=$id&scrape=1 method=post><input type=\"submit\" name=\"submit\" value=\"Update Stats\"></td></form>");
        }else{
            print (
"<td valign=top align=right><b>Tracked: </b>EXTERNAL<BR><BR><form action=torrents-details.php?id=$id&scrape=1 method=post><input type=\"submit\" name=\"submit\" value=\"Update Stats\"></td></form>");
        }
    }

    echo 
"</tr></table>";
}
echo 
"</div></td></tr></table></CENTER><BR><BR>";
//end download box

// Thanx mod
$torrentid $_GET["id"];
                
$thanks_sql mysql_query("SELECT * FROM thanks where torrentid=$torrentid");
  
$thanks_all mysql_numrows($thanks_sql);
  if (
$thanks_all) {
  while(
$rows_t mysql_fetch_array($thanks_sql)) {
  
$thanks_userid $rows_t["userid"];
  
$user_sql mysql_query("SELECT * FROM users where id=$thanks_userid");
  
$rows_a mysql_fetch_array($user_sql);
  
$username_t $rows_a["username"];
  
$thanksby =  $thanksby."<a href='userdetails.php?id=$thanks_userid'>$username_t</a>, ";
  }
  
$t_userid $CURUSER["id"];             
  
$tsql mysql_query("SELECT COUNT(*) FROM thanks where torrentid=$torrentid and userid=$t_userid");
  
$trows mysql_fetch_array($tsql);
  
$t_ab $trows[0];
if (
$t_ab == "0" && $CURUSER["id"] != $row["owner"]) {
 
$thanksby $thanksby." <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Say Thanks!\">
<input type=\"hidden\" name=\"torrentid\" value=\"
$torrentid\">
</form>"
;
 }
 else {
 
$thanksby $thanksby." <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Say Thanks!\" disabled>
<input type=\"hidden\" name=\"torrentid\" value=\"
$torrentid\">
</form>"
;
 }
 }
 else {
 if (
$CURUSER["id"] == $row["owner"]){
 
$thanksby $thanksby." <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Say Thanks!\" disabled>
<input type=\"hidden\" name=\"torrentid\" value=\"
$torrentid\">
</form>"
;
 }
 else
 
$thanksby "No Thanks Yet
 <form action=\"thanks.php\" method=\"post\">
<input type=\"submit\" name=\"submit\" value=\"Say Thanks!\">
<input type=\"hidden\" name=\"torrentid\" value=\"
$torrentid\">
</form>
 "
;
 }  print(
"<br><table><tr>
<td valign=top><table border=0 width=100 cellspacing=0 cellpadding=0><tr><td class=alt5 align=center><b>Thanks by</b></td>
</tr></table></td><td width=100%>" 
$thanksby "</td></tr></table>");

//Thanx mod end


echo "<FIELDSET class=search><LEGEND></a><b>Details</B></LEGEND>";
echo 
"<table cellpadding=3 border=0 width=95%>";
print(
"<tr><td align=left><b>".T_("NAME").":</b></td><td>" $shortname "</td></tr>\n");
print(
"<tr><td align=center colspan=2><b>" .T_("DESCRIPTION"). ":</b><br>" .  format_comment($row['descr']) . "</td></tr>\n");
print(
"<tr><td align=left><b>" TTYPE ":</b></td><td><a href=\"torrents.php?cat=" $row["category"] . "\"><img border=\"0\"src=\"" $site_config['SITEURL'] . "/images/categories/" $row["cat_pic"] . "\" alt=\"" $row["cat_name"] . "\" /></td></tr>\n");

if (empty(
$row["lang_name"])) $row["lang_name"] = "Unknown/NA";
print(
"<tr><td align=left><b>" .T_("LANG"). ":</b></td><td>" $row["lang_name"] . "\n");

if (isset(
$row["lang_image"]) && $row["lang_image"] != "")
            print(
"&nbsp;<img border=\"0\"src=\"" $site_config['SITEURL'] . "/images/languages/" $row["lang_image"] . "\" alt=\"" $row["lang_name"] . "\" />");

print(
"</td></tr>");

print(
"<tr><td align=left><b>" .T_("TOTAL_SIZE"). ":</b></td><td>" mksize($row["size"]) . " </td></tr>\n");
print(
"<tr><td align=left><b>" .T_("INFO_HASH"). ":</b></td><td>" $row["info_hash"] . "</td></tr>\n");
print(
"");
if (
$row["anon"] == "yes" && !$owned)
    print(
"<tr><td align=left><b>" .T_("ADDED_BY"). ":</b></td><td>Anonymous</td></tr>");
elseif (
$row["username"])
    print(
"<tr><td align=left><b>" .T_("ADDED_BY"). ":</b></td><td><a href=account-details.php?id=" $row["owner"] . ">" $row["username"] . "</a></td></tr>");
else
    print(
"<tr><td align=left><b>" .T_("ADDED_BY"). ":</b></td><td>Unknown</td></tr>");

print(
"<tr><td align=left><b>" .T_("DATE_ADDED"). ":</b></td><td>" date("d-m-Y H:i:s"utc_to_tz_time($row["added"])) . "</td></tr>\n");
print(
"<tr><td align=left><b>" .T_("VIEWS"). ":</b></td><td>" $row["views"] . "</td></tr>\n");
print(
"<tr><td align=left><b>".T_("HITS").":</b></td><td>" $row["hits"] . "</td></tr>\n");
echo 
"</table></FIELDSET><BR><BR>";


// $srating IS RATING VARIABLE
        
$srating "";
        
$srating .= "<table border=\"0\" cellspacing=\"1\" cellpadding=\"4\" width='95%' style=\"border: 2px solid #f8de8f;\"><tr><td style=\"background:#f8edcc;\" width=60><b>".T_("RATINGS").":</b></td><td style=\"background:#f8f1dd;\" valign=middle><NOBR>";
        if (!isset(
$row["rating"])) {
                
$srating .= "Not Yet Rated";
        }else{
            
$rpic ratingpic($row["rating"]);
            if (!isset(
$rpic))
                
$srating .= "invalid?";
            else
                
$srating .= "$rpic (" $row["rating"] . " ".T_("OUT_OF")." 5) " $row["numratings"] . " ".T_("USERS_HAVE_RATED")."";
        }
        
$srating .= "\n";
        if (!isset(
$CURUSER))
            
$srating .= "(<a href=\"account-login.php?returnto=" urlencode($_SERVER["REQUEST_URI"]) . "&amp;nowarn=1\">Log in</a> to rate it)";
        else {
            
$ratings = array(
                    
=> "".T_("COOL")."",
                    
=> "".T_("PRETTY_GOOD")."",
                    
=> "".T_("DECENT")."",
                    
=> "".T_("PRETTY_BAD")."",
                    
=> "".T_("SUCKS")."",
            );
            
//if (!$owned || $moderator) {
                
$xres mysql_query("SELECT rating, added FROM ratings WHERE torrent = $id AND user = " $CURUSER["id"]);
                
$xrow mysql_fetch_array($xres);
                if (
$xrow)
                    
$srating .= "<BR><i>(".T_("YOU_RATED")." \"" $xrow["rating"] . " - " $ratings[$xrow["rating"]] . "\")</i>";
                else {
                    
$srating .= "<form style=display:inline; method=\"post\" action=\"torrents-details.php?id=$id&takerating=yes\"><input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
                    
$srating .= "<select name=\"rating\">\n";
                    
$srating .= "<option value=\"0\">(".T_("ADD_RATING").")</option>\n";
                    foreach (
$ratings as $k => $v) {
                        
$srating .= "<option value=\"$k\">$k - $v</option>\n";
                    }
                    
$srating .= "</select>\n";
                    
$srating .= "<input type=\"submit\" value=\"".T_("VOTE")."\" />";
                    
$srating .= "</form>\n";
                }
            
//}
        
}
        
$srating .= "</NOBR></td></tr></table>";

print(
"<CENTER>"$srating "</CENTER>");// rating

//END DEFINE RATING VARIABLE

echo "<BR>";

if (
$row["image1"] != "" OR $row["image2"] != "") {
  if (
$row["image1"] != "")
    
$img1 "<IMG src=".$site_config["SITEURL"]."/uploads/images/$row[image1] width=150 border=0>";
  if (
$row["image2"] != "")
    
$img2 "<IMG src=".$site_config["SITEURL"]."/uploads/images/$row[image2] width=150 border=0>";
  print(
"<CENTER>"$img1 "&nbsp&nbsp" $img2."</CENTER><BR>");
}



if (
$row["external"]=='yes'){
    print (
"<br><b>Tracker:</B><BR> ".$row['announce']."<br>");
}


$tres mysql_query("SELECT * FROM `announce` WHERE `torrent` = $id");
if (
mysql_num_rows($tres) > 1){
    echo 
"<br><B>".T_("THIS_TORRENT_HAS_BACKUP_TRACKERS")."</B><br>";
    echo 
'<table cellpadding="1" cellspacing="2" class="ttable_headinner"><tr>';
    echo 
'<td class="ttable_head">URL</td><td class="ttable_head">'.T_("SEEDERS").'</td><td class="ttable_head">'.T_("LEECHERS").'</td><td class="ttable_head">'.T_("COMPLETED").'</td></tr>';
    
$x 1;
    while (
$trow mysql_fetch_array($tres)) {
        
$colour $trow["online"] == "yes" "green" "red";
        echo 
"<tr class=\"ttable_col$x\"><td><font color=\"$colour\"><b>".htmlspecialchars($trow['url'])."</b></font></td><td align=\"center\">".number_format($trow["seeders"])."</td><td align=\"center\">".number_format($trow["leechers"])."</td><td align=\"center\">".number_format($trow["times_completed"])."</td></tr>";
        
$x $x == 1;
    }
    echo 
'</table>';
}

echo 
"<BR><BR><b>".T_("FILE_LIST").":</B>&nbsp;<img src='images/plus.gif' id='pic1' onclick='klappe_torrent(1)'><div id='k1' style='display: none;'><table align=center cellpadding=0 cellspacing=0 class=table_table border=1 width=95%><TR><TD class=table_head align=left>&nbsp;".T_("FILE")."</TD><TD width=50 class=table_head>&nbsp;".T_("SIZE")."</td></tr>";
$fres mysql_query("SELECT * FROM `files` WHERE `torrent` = $id");
if (
mysql_num_rows($fres)) {
    while (
$frow mysql_fetch_array($fres)) {
        echo 
"<TR><td class=table_col1>".htmlspecialchars($frow['path'])."</td><TD class=table_col2>".mksize($frow['filesize'])."</td></tr>";
    }
}else{
    echo 
"<TR><td class=table_col1>".htmlspecialchars($row["name"])."</td><TD class=table_col2>".mksize($row["size"])."</td></tr>";
}
echo 
"</table></div>";

if (
$row["external"]!='yes'){
    echo 
"<BR><BR><B>".T_("PEERS_LIST").":</B><BR>";
    
$query mysql_query("SELECT * FROM peers WHERE torrent = $id ORDER BY seeder DESC");

    
$result mysql_num_rows($query);
        if(
$result == 0) {
            echo 
T_("NO_ACTIVE_PEERS")."\n";
        }else{
            
?>
            <table align=center cellpadding="3" cellspacing="0" class="table_table" width="95%" border="1">
            <tr>
            <td class="table_head"><?php print(T_("PORT")); ?></td>
            <td class="table_head"><?php print(T_("UPLOADED")); ?></td>
            <td class="table_head"><?php print(T_("DOWNLOADED")); ?></td>
            <td class="table_head"><?php print(T_("RATIO")); ?></td>
            <td class="table_head"><?php print(T_("LEFT")); ?></td>
            <td class="table_head"><?php print(T_("FINISHED_SHORT"). "%"); ?></td>
            <td class="table_head"><?php print(T_("SEED")); ?></td>
            <td class="table_head"><?php print(T_("CONNECTED_SHORT")); ?></td>
            <td class="table_head"><?php print(T_("CLIENT")); ?></td>
            <td class="table_head"><?php print(T_("USER_SHORT")); ?></td>
            </tr>

            <?php
            
while($row1 MYSQL_FETCH_ARRAY($query))    {
                
                if (
$row1["downloaded"] > 0){
                    
$ratio $row1["uploaded"] / $row1["downloaded"];
                    
$ratio number_format($ratio3);
                }else{
                    
$ratio "---";
                }

                
$percentcomp sprintf("%.2f"100 * (- ($row1["to_go"] / $row["size"])));    

                if (
$site_config["MEMBERSONLY"]) {
                    
$res mysql_query("SELECT id, username, privacy FROM users WHERE id=".$row1["userid"]."");
                    
$arr MYSQL_FETCH_ARRAY($res);
                }
                
$arr["username"];
                if (
$arr["privacy"] != "strong" || ($CURUSER["control_panel"] == "yes")) {
                    print(
"<tr><td class=table_col2>".$row1["port"]."</td><td class=table_col1>".mksize($row1["uploaded"])."</td><td class=table_col2>".mksize($row1["downloaded"])."</td><td class=table_col1>".$ratio."</td><td class=table_col2>".mksize($row1["to_go"])."</td><td class=table_col1>".$percentcomp."%</td><td class=table_col2>$row1[seeder]</td><td class=table_col1>$row1[connectable]</td><td class=table_col2>".htmlspecialchars($row1[client])."</td><td class=table_col1><a href=account-details.php?id=$arr[id]>$arr[username]</a></td></tr>");
                }else{
                    print(
"<tr><td class=table_col2>".$row1["port"]."</td><td class=table_col1>".mksize($row1["uploaded"])."</td><td class=table_col2>".mksize($row1["downloaded"])."</td><td class=table_col1>".$ratio."</td><td class=table_col2>".mksize($row1["to_go"])."</td><td class=table_col1>".$percentcomp."%</td><td class=table_col2>$row1[seeder]</td><td class=table_col1>$row1[connectable]</td><td class=table_col2>".htmlspecialchars($row1[client])."</td><td class=table_col1>Private</td></tr>");
                }

            }
            echo 
"</table>";
    }
}


echo 
"<BR><BR>";

//DISPLAY NFO BLOCK
function my_nfo_translate($nfo){
        
$trans = array(
        
"\x80" => "Ç""\x81" => "ü""\x82" => "é""\x83" => "â""\x84" => "ä""\x85" => "à""\x86" => "å""\x87" => "ç""\x88" => "ê""\x89" => "ë""\x8a" => "è""\x8b" => "ï""\x8c" => "î""\x8d" => "ì""\x8e" => "Ä""\x8f" => "Å""\x90" => "É",
        
"\x91" => "æ""\x92" => "Æ""\x93" => "ô""\x94" => "ö""\x95" => "ò""\x96" => "û""\x97" => "ù""\x98" => "ÿ""\x99" => "Ö""\x9a" => "Ü""\x9b" => "¢""\x9c" => "£""\x9d" => "¥""\x9e" => "₧""\x9f" => "ƒ""\xa0" => "á""\xa1" => "í",
        
"\xa2" => "ó""\xa3" => "ú""\xa4" => "ñ""\xa5" => "Ñ""\xa6" => "ª""\xa7" => "º""\xa8" => "¿""\xa9" => "⌐""\xaa" => "¬""\xab" => "½""\xac" => "¼""\xad" => "¡""\xae" => "«""\xaf" => "»""\xb0" => "░""\xb1" => "▒""\xb2" => "▓",
        
"\xb3" => "│""\xb4" => "┤""\xb5" => "╡""\xb6" => "╢""\xb7" => "╖""\xb8" => "╕""\xb9" => "╣""\xba" => "║""\xbb" => "╗""\xbc" => "╝""\xbd" => "╜""\xbe" => "╛""\xbf" => "┐""\xc0" => "└""\xc1" => "┴""\xc2" => "┬""\xc3" => "├",
        
"\xc4" => "─""\xc5" => "┼""\xc6" => "╞""\xc7" => "╟""\xc8" => "╚""\xc9" => "╔""\xca" => "╩""\xcb" => "╦""\xcc" => "╠""\xcd" => "═""\xce" => "╬""\xcf" => "╧""\xd0" => "╨""\xd1" => "╤""\xd2" => "╥""\xd3" => "╙""\xd4" => "╘",
        
"\xd5" => "╒""\xd6" => "╓""\xd7" => "╫""\xd8" => "╪""\xd9" => "┘""\xda" => "┌""\xdb" => "█""\xdc" => "▄""\xdd" => "▌""\xde" => "▐""\xdf" => "▀""\xe0" => "α""\xe1" => "ß""\xe2" => "Γ""\xe3" => "π""\xe4" => "Σ""\xe5" => "σ",
        
"\xe6" => "µ""\xe7" => "τ""\xe8" => "Φ""\xe9" => "Θ""\xea" => "Ω""\xeb" => "δ""\xec" => "∞""\xed" => "φ""\xee" => "ε""\xef" => "∩""\xf0" => "≡""\xf1" => "±""\xf2" => "≥""\xf3" => "≤""\xf4" => "⌠""\xf5" => "⌡""\xf6" => "÷",
        
"\xf7" => "≈""\xf8" => "°""\xf9" => "∙""\xfa" => "·""\xfb" => "√""\xfc" => "ⁿ""\xfd" => "²""\xfe" => "■""\xff" => " ",
        );
        
$trans2 = array("\xe4" => "&auml;",        "\xF6" => "&ouml;",        "\xFC" => "&uuml;",        "\xC4" => "&Auml;",        "\xD6" => "&Ouml;",        "\xDC" => "&Uuml;",        "\xDF" => "&szlig;");
        
$all_chars "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        
$last_was_ascii False;
        
$tmp "";
        
$nfo $nfo "\00";
        for (
$i 0$i < (strlen($nfo) - 1); $i++)
        {
                
$char $nfo[$i];
                if (isset(
$trans2[$char]) and ($last_was_ascii or strpos($all_chars, ($nfo[$i 1]))))
                {
                        
$tmp $tmp $trans2[$char];
                        
$last_was_ascii True;
                }
                else
                {
                        if (isset(
$trans[$char]))
                        {
                                
$tmp $tmp $trans[$char];
                        }
                        else
                        {
                            
$tmp $tmp $char;
                        }
                        
$last_was_ascii strpos($all_chars$char);
                }
        }
        return 
$tmp;
}
//-----------------------------------------------

//DISPLAY NFO BLOCK
if($row["nfo"]== "yes"){
    
$nfofilelocation "$nfo_dir/$row[id].nfo";
    
$filegetcontents file_get_contents($nfofilelocation);
    
$nfo htmlspecialchars($filegetcontents);
        if (
$nfo) {    
            
$nfo my_nfo_translate($nfo);
            echo 
"<BR><BR><b>NFO:</B><BR>";
            
begin_table();
            print(
"<tr><td>\n");

            print(
"<textarea style=\"font-size:8pt;width:100%;height:100%;\" wrap=\"off\" rows=20 and cols=20 READONLY>".stripslashes($nfo)."</textarea>");
            
end_table();
        }else{
            print(
T_("ERROR")." reading .nfo file!");
        }
}
end_frame();

begin_frame(T_("COMMENTS"));
    
//echo "<p align=center><a class=index href=torrents-comment.php?id=$id>" .T_("ADDCOMMENT"). "</a></p>\n";

    
$subres mysql_query("SELECT COUNT(*) FROM comments WHERE torrent = $id") or die(mysql_error());
    
$subrow mysql_fetch_array($subres);
    
$commcount $subrow[0];

    if (
$commcount) {
        list(
$pagertop$pagerbottom$limit) = pager(10$commcount"torrents-details.php?id=$id&");
        
$commquery "SELECT comments.id, text, user, comments.added, avatar, signature, username, title, class, uploaded, downloaded, privacy, donated FROM comments LEFT JOIN users ON comments.user = users.id WHERE torrent = $id ORDER BY comments.id $limit";
        
$commres mysql_query($commquery) or die(mysql_error());
    }else{
        unset(
$commres);
    }

    if (
$commcount) {
        print(
$pagertop);
        
commenttable($commres);
        print(
$pagerbottom);
    }else {
        print(
"<BR><b><CENTER>" .T_("NOCOMMENTS"). "</CENTER></b><BR>\n");
    }

    require_once(
"backend/bbcode.php");

    if (
$CURUSER) {
        echo 
"<CENTER>";
        echo 
"<form name=\"comment\" method=\"post\" action=\"torrents-details.php?id=$row[id]&takecomment=yes\">";
        echo 
"".textbbcode("comment","body")."<br>";
        echo 
"<input type=\"submit\" class=btn value=\"".T_("ADDCOMMENT")."\" />";
        echo 
"</form></CENTER>";
    }

    
end_frame();

stdfoot();
?>
Reply With Quote
The Following User Says Thank You to Grogz For This Useful Post:
romano1 (6th January 2013)
Reply

Tags
align , center

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 10:22. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.