toolmanwill |
10-20-2006 10:44 AM |
actually that will be included in next release of both PHP and XBT.
to fix it now before new release edit VBTT Showthread Stuff plugin
This is ONLY for PHP version, XBT plugin/code for this is totally different
replace entire plugin code with :
Code:
$s="";
if ($attachment['info_hash'] != '')
{
$myid = $attachment['attachmentid'];
// now we display the files inside the torrent
$subres = $db->query("SELECT * FROM " . TABLE_PREFIX . "files WHERE info_hash ='".$attachment['info_hash']."' ORDER BY fileid ASC");
$s.="<table id='torrent$myid' class=\"tborder\" cellpadding=\"6\" cellspacing=\"1\" width=\"100%\" border=\"0\">\n";
$s.="<thead><tr><td class=\"tcat\" colspan=\"7\"><a href=\"#top\" style=\"float:right\" ";
$s .= " onclick=\"return toggle_collapse('torrent".$myid."')\">";
$coll = "collapseimg_torrent".$myid ;
$s.= "<img id=\"collapseimg_torrent$myid\" src='".$stylevar[imgdir_button]."/collapse_alt".str_replace('_collapsed','',$vbcollapse[$coll]).".gif' alt=\"\" border=\"0\">";
$s.="</a><strong><a href=\"#top\" onclick=\"return toggle_collapse('torrent".$myid."')\">Files</a></strong></td></tr></thead>\n";
$s.="<tbody id=\"collapseobj_torrent".$myid."\" style=\"\">" ;
$s.=" <tr><td class=\"alt1\" width=\"15%\"><div align=\"center\"><strong>Size</strong></div></td>
<td class=\"alt1\" width=\"70%\"><div align=\"center\"><strong>Filename</strong></div></td>
<td class=\"alt1\" width=\"15%\"><div align=\"center\"><strong>MD5</strong></div></td></tr>\n" ;
$i=0;
while ($subrow = $db->fetch_array($subres))
{
$i++;
if ($i % 2 == 0 )
$s.= "<tr><td class=\"alt1\" width=\"15%\"><div align=\"center\">" . vb_number_format($subrow["size"], 1, true) . "</div></td>
<td class=\"alt1\" width=\"85%\"><div align=\"center\">" . $subrow["filename"] ."</div></td>
<td class=\"alt1\" width=\"15%\"><div align=\"center\">" . $subrow["md5sum"] . "</div></td></tr>\n";
else $s.= "<tr><td class=\"alt2\" width=\"15%\"><div align=\"center\">" . vb_number_format($subrow["size"], 1, true) . "</div></td>
<td class=\"alt2\" width=\"85%\"><div align=\"center\">" . $subrow["filename"] ."</div></td>
<td class=\"alt2\" width=\"15%\"><div align=\"center\">" .$subrow["md5sum"] . "</div></td></tr>\n";
}
$s.= "</tbody>\n</table>\n";
$s.="<script type='text/javascript'> toggle_collapse('torrent$myid');</script>";
//now we display seeds/peers on this torrent
$downloaders = array();
$seeders = array();
$subres = $db->query("SELECT agent, ulspeed, dlspeed, seeder, ip, port, uploaded, downloaded, to_go, UNIX_TIMESTAMP(started) AS st, connectable, UNIX_TIMESTAMP(last_action) AS la FROM peers WHERE info_hash = '".$attachment[info_hash]."' ") ;
while ($subrow = $db->fetch_array($subres))
{
if ($subrow["seeder"] == "yes")
$seeders[] = $subrow;
else
$downloaders[] = $subrow;
}
usort($seeders, "seed_sort");
usort($downloaders, "leech_sort");
$s.="<table class=\"tborder\" cellpadding=\"6\" cellspacing=\"1\" width=\"100%\" border=\"0\">\n";
$s.="<thead>\n";
$s.="<tr><td class=\"tcat\" colspan=\"9\">\n";
$s.="<a href=\"#top\" style=\"float:right\" onclick=\"return toggle_collapse('tpeers$myid')\">";
$coll = "collapseimg_tpeers".$myid ;
$s.="<img id=\"collapseimg_tpeers$myid\" src='".$stylevar[imgdir_button]."/collapse_alt".str_replace('_collapsed','',$vbcollapse[$coll]).".gif' alt=\"\" border=\"0\"></a> ";
$s.="<strong><a href=\"#top\" onclick=\"return toggle_collapse('tpeers$myid')\">Statistics</a></strong>";
$s.="</td></tr>";
$s.="</thead>";
$s.="<tbody id=\"collapseobj_tpeers$myid\" style=\"\">" ;
$s.="<tr><td class=\"alt1\" width=\"10%\"><div align=\"center\"><strong>User</strong></div></td><td class=\"alt1\" width=\"10%\"><div align=\"center\"><strong>Connected</strong></div></td><td class=\"alt1\" width=\"10%\"><div align=\"center\"><strong>Downloaded</strong></div></td><td class=\"alt1\" width=\"10%\"><div align=\"center\"><strong>Uploaded</strong></div></td><td class=\"alt1\" width=\"10%\"><div align=\"center\"><strong>Ratio<strong></div></td><td class=\"alt1\" width=\"10%\"><div align=\"center\"><strong>Progress<strong></div></td><td class=\"alt1\" width=\"10%\"><div align=\"center\"><strong>UL Speed<strong></div></td><td class=\"alt1\" width=\"10%\"><div align=\"center\"><strong>DL Speed<strong></div></td><td class=\"alt1\" width=\"10%\"><div align=\"center\"><strong>Agent<strong></div></td></tr>";
$s.=dltable("Seeder(s)", $seeders,$attachment[size]) ;
$s.=dltable("Leecher(s)", $downloaders,$attachment[size]) ;
$s.="</tbody></table>";
$s.="<script type='text/javascript'> toggle_collapse('tpeers$myid'); </script>";
// advanced stats
$s.="<table id='detail$myid' class=\"tborder\" cellpadding=\"6\" cellspacing=\"1\" width=\"100%\" border=\"0\">\n";
$s.="<thead><tr><td class=\"tcat\" colspan=\"5\"><a href=\"#top\" style=\"float:right\" ";
$s .= " onclick=\"return toggle_collapse('detail".$myid."')\">";
$coll = "collapseimg_detail".$myid ;
$s.= "<img id=\"collapseimg_detail$myid\" src='".$stylevar[imgdir_button]."/collapse_alt".str_replace('_collapsed','',$vbcollapse[$coll]).".gif' alt=\"\" border=\"0\">";
$s.="</a><strong><a href=\"#top\" onclick=\"return toggle_collapse('detail".$myid."')\">More details on torrent</a></strong></td></tr></thead>\n";
$s.="<tbody id=\"collapseobj_detail".$myid."\" style=\"\">" ;
$s.=" <tr><td class=\"alt1\" width=\"75%\">";
$s .= "<strong><u>Created By:</u></strong><br>";
$s .= $attachment[created_by];
$s .= "<br><br><strong><u>Comment:</u></strong><br>";
if ($attachment[comment] != "")
$s .= $attachment[comment];
else $s .= "No comment for this torrent";
$s .= "<br><br><strong><u>Announce List:</u></strong><br>";
$s .= $attachment[announce_list];
$s .= "<br><br><strong><u>Completed by:</u></strong><br>";
if ($attachment[completed_by] = '".$passkey."')
{
if ($attachment[completed_by]{0} == ";")
$attachment[completed_by] = substr($attachment[completed_by],1);
$query_user = $db->query("SELECT userid,username FROM " . TABLE_PREFIX . "user WHERE userid IN (" .str_replace(";",", ",$attachment[completed_by]). ")");
while ($result_user = $db->fetch_array($query_user) )
{
$s .= '<a href="member.php?u='.$result_user['userid'].'">'.$result_user['username'].'</a>, ';
}
$s = substr($s,0,-2)."</td>";
}
else
{
$s .= "Nobody has completed this torrent yet !</td>";
}
$s.="<td width=\"25%\" align=\"right\">";
require_once("charts.php");
//insert the charts.swf flash file into the web page
//tell charts.swf to get the chart's data from sample.php created in the first step
$s.= InsertChart ( "charts.swf", "torrent.php?id=".$attachment['attachmentid'],200,200,"f5f5ff");
$s .= "</td></tr>\n" ;
$i=0;
$s.= "</tbody>\n</table>\n";
$s.="<script type='text/javascript'> toggle_collapse('detail$myid');</script>";
$attachment[tstats] = "<b>Full Size:</b> ".mksize($attachment[size], 1, true).", <b>Seeders:</b> ".$attachment[seeders].", <b>Leechers:</b> ".$attachment[leechers].", <b>Completed:</b> ".$attachment[completed].", <b>UL Speed:</b> ".mksize($attachment[ulspeed], 1, true)."/s" .", <b>DL Speed:</b> ".mksize($attachment[dlspeed], 1, true)."/s" ." ";
$attachment[torrentinfo] = $s;
}
|