include(SERVER_ROOT.'/classes/class_text.php');
$Text=NEW TEXT;
include(SERVER_ROOT.'/classes/class_thread.php'); // Class that generates and stores threads and the quick reply box
$Thread = new THREAD;
$GroupID=ceil($_GET['id']);
if($_GET['revisionid'] && is_number($_GET['revisionid'])) {
$RevisionID = $_GET['revisionid'];
}
$TorrentCache=$Cache->get_value('detail_'.$GroupID.'_'.$RevisionID);
if(!is_array($TorrentCache)) {
// Fetch the group details
$SQL = "SELECT ";
if(!$RevisionID) {
$SQL.="
g.WikiBody,
g.WikiImage, ";
} else {
$SQL.="
w.Body,
w.Image, ";
}
$SQL .= "
g.ID,
g.Name,
g.Year,
g.CategoryID,
g.Time,
a.Name,
a.ID,
GROUP_CONCAT(DISTINCT tags.Name SEPARATOR '|'),
GROUP_CONCAT(DISTINCT tags.ID SEPARATOR '|'),
GROUP_CONCAT(tags.UserID SEPARATOR '|')
FROM torrents_group AS g
LEFT JOIN torrents_tags AS tt ON tt.GroupID=g.ID
LEFT JOIN tags ON tags.ID=tt.TagID
LEFT JOIN artists AS a ON a.ID=g.ArtistID ";
if($RevisionID) {
$SQL.="
LEFT JOIN wiki_torrents AS w ON w.PageID='".db_string($GroupID)."' AND w.RevisionID='".db_string($RevisionID)."' ";
}
$SQL .="
WHERE g.ID='".db_string($GroupID)."'
GROUP BY NULL";
$DB->query($SQL);
$TorrentDetails=$DB->to_array();
// Fetch the individual torrents
$DB->query("
SELECT
t.ID,
t.Media,
t.Format,
t.Encoding,
t.Year,
t.RemasterTitle,
t.Scene,
t.HasLog,
t.HasCue,
t.FileCount,
t.Size,
t.Seeders,
t.Leechers,
t.Snatched,
t.FreeTorrent,
t.Time,
t.Description,
t.FileList,
t.UserID,
um.Username,
t.last_action
FROM torrents AS t
LEFT JOIN users_main AS um ON um.ID=t.UserID
WHERE t.GroupID='".db_string($GroupID)."'
ORDER BY t.Format DESC, t.Encoding, t.ID");
$TorrentList = $DB->to_array();
if(in_array(0, $DB->collect('Seeders'))) {
$Time = 600;
} else {
$Time = 3600;
}
// Store it all in cache
$Cache->cache_value('detail_'.$GroupID.'_'.$RevisionID,array($TorrentDetails,$TorrentList),$Time);
} else { // If we're reading from cache
$TorrentDetails=$TorrentCache[0];
$TorrentList=$TorrentCache[1];
}
// Group details
list($WikiBody,$WikiImage,$GroupID,$GroupName,$GroupYear,$GroupCategoryID,$GroupTime,$ArtistName,$ArtistID,$TorrentTags,$TorrentTagIDs,$TorrentTagUserIDs)=array_shift($TorrentDetails);
$DisplayType='Torrent';
$DisplayName=$GroupName;
$AltName=$GroupName; // Goes in the alt text of the image
$Title=$GroupName; // goes in
$WikiBody = $Text->full_format($WikiBody);
if($ArtistID) {
$DisplayType="Album";
$DisplayName=''.$ArtistName.' - '.$DisplayName;
$AltName=$ArtistName." - ".$GroupName;
$Title=$ArtistName.' - '.$Title;
}
if($GroupYear>0) {
$DisplayName.=' ['.$GroupYear.']';
$AltName.=' ['.$GroupYear.']';
}
// Start output
show_header($Title,'browse,forums');
?>
=$DisplayName?>
| Torrents |
Size |
 |
 |
 |
function filelist($Str) {
return "".get_size($Str[1])." | ";
}
while(list($TorrentID, $Media, $Format, $Encoding, $Year, $RemasterTitle, $Scene, $HasLog, $HasCue, $FileCount, $Size, $Seeders, $Leechers, $Snatched, $FreeTorrent, $Time, $Description, $FileList, $UserID, $Username, $LastActive) = array_shift($TorrentList)) {
$temp_array = array('userid' => $UserID, 'username' => $Username, 'time' => $Time, 'torrentid' => $TorrentID);
$FileList=preg_replace("(_|-)", " ", $FileList);
$FileList=str_replace('|||','',display_str($FileList));
$FileList=preg_replace_callback('/\{\{\{([^\{]*)\}\}\}/i','filelist',$FileList);
$FileList='| File Name | Size | | '.$FileList." | ";
$ExtraInfo=''; // String that contains information on the torrent, eg. format and encoding
$AddExtra=''; // Separator between torrent properties
if ($Format) { $ExtraInfo.=display_str($Format); $AddExtra=' / '; }
if ($Encoding) { $ExtraInfo.=$AddExtra.display_str($Encoding); $AddExtra=' / '; }
if ($HasLog) { $ExtraInfo.=$AddExtra.'Log'; $AddExtra=' / '; }
if ($HasCue) { $ExtraInfo.=$AddExtra.'Cue'; $AddExtra=' / '; }
if ($Media) { $ExtraInfo.=$AddExtra.display_str($Media); $AddExtra=' / '; }
if ($Scene) { $ExtraInfo.=$AddExtra.'Scene'; $AddExtra=' / '; }
if ($RemasterTitle) { $ExtraInfo.=$AddExtra.display_str($RemasterTitle); $AddExtra=' - '; }
if ($Year) { $ExtraInfo.=$AddExtra.display_str($Year); $AddExtra=' / '; }
if ($FreeTorrent) { $ExtraInfo.=$AddExtra.'Freeleech!'; $AddExtra=' / '; }
if(!$ExtraInfo){
$ExtraInfo = $GroupName;
}
?>
|
|
[
DL
| RP
if(check_perms('torrents_edit') || $UserID == $LoggedUser['ID']) { ?>
| ED
} ?>
if(check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) { ?>
| RM
} ?>
]
» = $ExtraInfo; ?>
|
= get_size($Size); ?> |
= number_format($Snatched); ?> |
= number_format($Seeders); ?> |
= number_format($Leechers); ?> |
} ?>
Uploaded by = format_username($UserID, $Username)?> on = format_time($Time, true);?>
if($Seeders == 0){ ?>
Last active: = format_time($LastActive, true);?>
}?>
if($Description) {
echo ''.$Text->full_format($Description).' ';}
?>
= $FileList; ?>
if($_GET['peers'] !=$TorrentID || !is_number($_GET['peers'])) {?>
} else { ?>
| User |
Active |
Connectable |
Up |
% |
Client |
$DB->query("SELECT
xu.uid,
um.Username,
xu.active,
xu.connectable,
xu.uploaded,
xu.remaining,
xu.useragent
FROM xbt_files_users AS xu
LEFT JOIN users_main AS um ON um.ID=xu.uid
WHERE xu.fid='$TorrentID'
ORDER BY xu.uploaded DESC");
while(list($PeerUserID, $Username, $Active, $Connectable, $Uploaded, $Remaining, $UserAgent) = $DB->next_record()) {
?>
| = format_username($PeerUserID, $Username)?> |
= ($Active) ? 'Yes' : 'No' ?> |
= ($Connectable) ? 'Yes' : 'No [C]' ?> |
= get_size($Uploaded) ?> |
= number_format(($Size-$Remaining)/$Size*100, 2)?> |
= display_str($UserAgent)?> |
}
?>
} ?>
if(($_GET['snatches'] !=$TorrentID || !is_number($_GET['snatches'])) && check_perms('site_view_torrent_snatchlist')) { ?>
} elseif(check_perms('site_view_torrent_snatchlist')) { ?>
| User |
Time |
User |
Time |
$DB->query("SELECT
xs.uid,
um.Username,
um.Enabled,
ui.Donor,
ui.Warned,
xs.tstamp
FROM xbt_snatched AS xs
LEFT JOIN users_main AS um ON um.ID=xs.uid
LEFT JOIN users_info AS ui ON ui.UserID=xs.uid
WHERE xs.fid='$TorrentID'
ORDER BY xs.tstamp DESC");
$i = 0;
while(list($SnatcherID, $Username, $Enabled, $Donor, $Warned, $Timestamp) = $DB->next_record()) {
if($i % 2 == 0 && $i>0){ ?>
} ?>
| =format_username($SnatcherID, $Username, $Donor, $Warned, $Enabled)?> |
=time_diff($Timestamp, '', 2, true)?> |
$i++;
} ?>
} ?>
|
?>
= $DisplayType; ?> info
if ($WikiBody!="") { echo $WikiBody; } else { echo "There is no information on this torrent."; } ?>
|
if($Seeders==0) { ?>
} ?>
Uploaded by = format_username($temp_array['userid'], $temp_array['username'])?> on = format_time($temp_array['time'], true);?>
if($_GET['page']){
$Page = $_GET['page'];
$Limit=TORRENT_COMMENTS_PER_PAGE*$_GET['page']-TORRENT_COMMENTS_PER_PAGE . ", " . TORRENT_COMMENTS_PER_PAGE;
}else {
$Page = 1;
$Limit=TORRENT_COMMENTS_PER_PAGE;
}
$CommentCount=$Cache->get_value('torrentcomments_count_'.$GroupID);
if (!$CommentCount) {
$DB->query("SELECT COUNT(ID) FROM torrents_comments WHERE GroupID='".$GroupID."'");
list($CommentCount)=$DB->next_record();
$Cache->cache_value('torrentcomments_count_'.$GroupID,$CommentCount,21600);
}
$Pages=get_pages('torrents.php',$_GET['page'],$CommentCount,TORRENT_COMMENTS_PER_PAGE,'id='.$GroupID,true, 15);
?>
=$Pages?>
$Cache->new_page('torrentcomment_'.$GroupID.'_page_'.$Page);
$SQL = "SELECT
tc.ID,
tc.AuthorID,
tc.AddedTime,
tc.Body,
tc.EditedUserID,
tc.EditedTime,
ed.Username,
um.Username,
um.PermissionID,
um.Title,
ui.Avatar,
ui.Donor,
ui.Warned,
um.Enabled
FROM torrents_comments as tc
LEFT JOIN users_main AS um ON um.ID = tc.AuthorID
LEFT JOIN users_info AS ui ON ui.UserID = tc.AuthorID
LEFT JOIN users_main AS ed ON ed.ID = tc.EditedUserID
WHERE tc.GroupID = '".$GroupID."'
LIMIT ".$Limit;
$Thread->set_query($SQL);
$Thread->set_page_type('torrent');
$Thread->set_thread_id($GroupID);
$Thread->set_page($Page);
$Thread->set_highlight_unread(true);
//$Thread->set_show_avatars(($LoggedUser['ViewAvatars'])? true : false);
$Thread->write();
$Thread->show_reply_box('Quick Reply');
// Update last read posts (torrents_last_read_topics table)
// This is only done if the user hasn't read the last post on the page
$Thread->update_last_read('torrents_last_read_topics');
?>
=$Pages?>
show_footer();
?> |