Torrents
Size
function filelist($Str) {
return "".Format::get_size($Str[1])." ";
}
foreach ($TorrentList as $Torrent) {
list($TorrentID, $Media, $Container, $Codec, $Resolution, $AudioFormat, $Subbing,
$Subber, $Language, $Censored, $Archive, $FileCount, $Size, $Seeders, $Leechers,
$Snatched, $FreeTorrent, $FreeLeechType, $TorrentTime, $Description, $MediaInfo, $FileList,
$FilePath, $UserID, $LastActive, $InfoHash, $BadTags, $BadFolders, $BadFiles,
$LastReseedRequest, $LogInDB, $HasFile, $PersonalFL, $IsSnatched, $IsSeeding, $IsLeeching
) = array_values($Torrent);
$Reported = false;
$Reports = Torrents::get_reports($TorrentID);
$NumReports = count($Reports);
if ($NumReports > 0) {
$Reported = true;
include(SERVER_ROOT.'/sections/reportsv2/array.php');
$ReportInfo = '
This torrent has '.$NumReports.' active '.($NumReports === 1 ? 'report' : 'reports').":
";
foreach ($Reports as $Report) {
if (check_perms('admin_reports')) {
$ReporterID = $Report['ReporterID'];
$Reporter = Users::user_info($ReporterID);
$ReporterName = $Reporter['Username'];
$ReportLinks = "$ReporterName reported it ";
} else {
$ReportLinks = 'Someone reported it';
}
if (isset($Types[$GroupCategoryID][$Report['Type']])) {
$ReportType = $Types[$GroupCategoryID][$Report['Type']];
} elseif (isset($Types['master'][$Report['Type']])) {
$ReportType = $Types['master'][$Report['Type']];
} else {
//There was a type but it wasn't an option!
$ReportType = $Types['master']['other'];
}
$ReportInfo .= "
$ReportLinks ".time_diff($Report['ReportedTime'], 2, true, true).' for the reason "'.$ReportType['title'].'":
'.Text::full_format($Report['UserComment']).'
';
}
$ReportInfo .= "\n\t\t
";
}
$CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear)));
$RegenLink = check_perms('users_mod') ? ' Regenerate ' : '';
$FileTable = '
File Names' . $RegenLink . '
' . ($FilePath ? "/$FilePath/" : '') . '
Size
';
if (substr($FileList, -3) == '}}}') { // Old style
$FileListSplit = explode('|||', $FileList);
foreach ($FileListSplit as $File) {
$NameEnd = strrpos($File, '{{{');
$Name = substr($File, 0, $NameEnd);
if ($Spaces = strspn($Name, ' ')) {
$Name = str_replace(' ', ' ', substr($Name, 0, $Spaces)) . substr($Name, $Spaces);
}
$FileSize = substr($File, $NameEnd + 3, -3);
$FileTable .= sprintf("\n%s %s ", $Name, Format::get_size($FileSize));
}
} else {
$FileListSplit = explode("\n", $FileList);
foreach ($FileListSplit as $File) {
$FileInfo = Torrents::filelist_get_file($File);
$FileTable .= sprintf("\n%s %s ", $FileInfo['name'], Format::get_size($FileInfo['size']));
}
}
$FileTable .= '
';
$ExtraInfo = ''; // String that contains information on the torrent (e.g. format and encoding)
$AddExtra = ''; // Separator between torrent properties
// similar to Torrents::torrent_info()
if ($Media && $GroupCategoryID != 5) { $ExtraInfo.=display_str($Media); $AddExtra=" / "; }
if ($Container) { $ExtraInfo.=$AddExtra.display_str($Container); $AddExtra=' / '; }
if ($Codec) { $ExtraInfo.=$AddExtra.display_str($Codec); $AddExtra=' / '; }
if ($Resolution) { $ExtraInfo.=$AddExtra.display_str($Resolution); $AddExtra=' / '; }
if ($AudioFormat) { $ExtraInfo.=$AddExtra.display_str($AudioFormat); $AddExtra=' / '; }
if ($Language) {
if ($Subber && ($GroupCategoryID == 3 || $GroupCategoryID == 4)) {
$ExtraInfo.=$AddExtra.display_str($Language.' ('.$Subber.')'); $AddExtra=' / ';
} else {
$ExtraInfo.=$AddExtra.display_str($Language); $AddExtra=' / ';
}
}
if ($Subbing) {
if ($Subber) {
if (($GroupCategoryID == 2 || $GroupCategoryID == 1) && $Subbing != "RAW") {
$ExtraInfo.=$AddExtra.display_str($Subbing)." (".display_str($Subber).")"; $AddExtra=' / ';
}
} else {
$ExtraInfo.=$AddExtra.display_str($Subbing); $AddExtra=' / ';
}
}
if ($Archive) {
$ExtraInfo .= $AddExtra.display_str('Archived ('.$Archive.')'); $AddExtra=' / ';
}
if (!$ExtraInfo) {
$ExtraInfo = $GroupName ; $AddExtra=' / ';
}
if ($IsLeeching) { $ExtraInfo.=$AddExtra. Format::torrent_label('Leeching'); $AddExtra=' / '; }
else if ($IsSeeding) { $ExtraInfo.=$AddExtra . Format::torrent_label('Seeding'); $AddExtra=' / '; }
else if ($IsSnatched) { $ExtraInfo.=$AddExtra. Format::torrent_label('Snatched!'); $AddExtra=' / '; }
if ($FreeTorrent == '1') { $ExtraInfo.=$AddExtra. Format::torrent_label('Freeleech!'); $AddExtra=' / '; }
if ($FreeTorrent == '2') { $ExtraInfo.=$AddExtra. Format::torrent_label('Neutral Leech!'); $AddExtra=' / '; }
// Freleechizer
if ($FreeLeechType == '3') {
$DB->query("
SELECT GREATEST(NOW(), ExpiryTime)
FROM shop_freeleeches
WHERE TorrentID = $TorrentID");
if ($DB->has_results()) {
$ExpiryTime = $DB->next_record(MYSQLI_NUM, false)[0];
$ExtraInfo .= " (" . str_replace(['week','day','hour','min','Just now','s',' '],['w','d','h','m','0m'],time_diff($ExpiryTime, 1, false)) . ") ";
}
}
if ($PersonalFL) { $ExtraInfo.=$AddExtra. Format::torrent_label('Personal Freeleech!'); $AddExtra=' / '; }
if ($Reported) { $ExtraInfo.=$AddExtra. Format::torrent_label('Reported'); $AddExtra=' / '; }
if (!$Censored) { $ExtraInfo .= $AddExtra.Format::torrent_label('Uncensored'); $AddExtra=' / '; }
if (!empty($BadTags)) { $ExtraInfo.=$AddExtra. Format::torrent_label('Bad Tags'); $AddExtra=' / '; }
if (!empty($BadFolders)) { $ExtraInfo.=$AddExtra. Format::torrent_label('Bad Folders'); $AddExtra=' / '; }
if (!empty($BadFiles)) { $ExtraInfo.=$AddExtra. Format::torrent_label('Bad File Names'); $AddExtra=' / '; }
$TorrentDL = "torrents.php?action=download&id=".$TorrentID."&authkey=".$LoggedUser['AuthKey']."&torrent_pass=".$LoggedUser['torrent_pass'];
if (!($TorrentFileName = $Cache->get_value('torrent_file_name_'.$TorrentID))) {
$TorrentFile = file_get_contents(TORRENT_STORE.$TorrentID.'.torrent');
$Tor = new BencodeTorrent($TorrentFile);
$TorrentFileName = $Tor->Dec['info']['name'];
$Cache->cache_value('torrent_file_name_'.$TorrentID, $TorrentFileName);
}
$TorrentMG = "magnet:?dn=".rawurlencode($TorrentFileName)."&xt=urn:btih:".$InfoHash."&as=https://".SITE_DOMAIN."/".str_replace('&','%26',$TorrentDL)."&tr=".implode("/".$LoggedUser['torrent_pass']."/announce&tr=",ANNOUNCE_URLS[0])."/".$LoggedUser['torrent_pass']."/announce&xl=".$Size;
?>
[ =($HasFile ? 'DL' : 'Missing')?>
| MG
if (Torrents::can_use_token($Torrent)) { ?>
| FL
} ?>
| RP
if ($CanEdit) { ?>
| ED
}
if (check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) { ?>
| RM
}?>
| PL
]
» =$ExtraInfo; ?>
=Format::get_size($Size)?>
=number_format($Snatched)?>
=number_format($Seeders)?>
=number_format($Leechers)?>
Uploaded by =Users::format_username($UserID, false, false, false)?> =time_diff($TorrentTime);?>
if ($Seeders == 0) {
if ($LastActive != NULL && time() - strtotime($LastActive) >= 1209600) { ?>
Last active: =time_diff($LastActive); ?>
} else { ?>
Last active: =time_diff($LastActive); ?>
}
}
if (($Seeders == 0 && $LastActive != NULL && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) || check_perms('users_mod')) { ?>
Request re-seed
}
?>
if (check_perms('site_moderate_requests')) { ?>
} ?>
=$FileTable?>
if ($Reported) { ?>
=$ReportInfo?>
}
if (!empty($Description)) {
echo "\n".Text::full_format($Description).' ';
}
if (!empty($MediaInfo)) {
$parsed = MediaInfo::parse($MediaInfo);
echo "\n";
if (!empty($parsed)) {
echo $parsed;
} else {
?>
}
echo " ";
}
?>
} ?>
$Requests = get_group_requests($GroupID);
if (empty($LoggedUser['DisableRequests']) && count($Requests) > 0) {
?>
Requests (=number_format(count($Requests))?>)
Show
Description
Votes
Bounty
foreach ($Requests as $Request) {
$RequestVotes = Requests::get_votes_array($Request['ID']);
$RequestDesc = substr(explode('\n', Text::strip_bbcode($Request['Description']), 2)[0], 0, 70);
if (strlen(explode('\n', Text::strip_bbcode($Request['Description']), 2)[0]) > 70) {
$RequestDesc = substr($RequestDesc, 0, 67) . '...';
}
?>
=$RequestDesc?>
=count($RequestVotes['Voters'])?>
if (check_perms('site_vote')) { ?>
+
} ?>
=Format::get_size($RequestVotes['TotalBounty'])?>
} ?>
}
$Collages = $Cache->get_value("torrent_collages_$GroupID");
if (!is_array($Collages)) {
$DB->query("
SELECT c.Name, c.NumTorrents, c.ID
FROM collages AS c
JOIN collages_torrents AS ct ON ct.CollageID = c.ID
WHERE ct.GroupID = '$GroupID'
AND Deleted = '0'
AND CategoryID != '0'");
$Collages = $DB->to_array();
$Cache->cache_value("torrent_collages_$GroupID", $Collages, 3600 * 6);
}
if (count($Collages) > 0) {
if (count($Collages) > MAX_COLLAGES) {
// Pick some at random
$Range = range(0, count($Collages) - 1);
shuffle($Range);
$Indices = array_slice($Range, 0, MAX_COLLAGES);
$SeeAll = '
(See all) ';
} else {
$Indices = range(0, count($Collages) - 1);
$SeeAll = '';
}
?>
↑ This album is in =number_format(count($Collages))?> collage=((count($Collages) > 1) ? 's' : '')?>=$SeeAll?>
# torrents
foreach ($Indices as $i) {
list($CollageName, $CollageTorrents, $CollageID) = $Collages[$i];
unset($Collages[$i]);
?>
=$CollageName?>
=number_format($CollageTorrents)?>
}
foreach ($Collages as $Collage) {
list($CollageName, $CollageTorrents, $CollageID) = $Collage;
?>
=$CollageName?>
=number_format($CollageTorrents)?>
} ?>
}
$PersonalCollages = $Cache->get_value("torrent_collages_personal_$GroupID");
if (!is_array($PersonalCollages)) {
$DB->query("
SELECT c.Name, c.NumTorrents, c.ID
FROM collages AS c
JOIN collages_torrents AS ct ON ct.CollageID = c.ID
WHERE ct.GroupID = '$GroupID'
AND Deleted = '0'
AND CategoryID = '0'");
$PersonalCollages = $DB->to_array(false, MYSQLI_NUM);
$Cache->cache_value("torrent_collages_personal_$GroupID", $PersonalCollages, 3600 * 6);
}
if (count($PersonalCollages) > 0) {
if (count($PersonalCollages) > MAX_PERS_COLLAGES) {
// Pick some at random
$Range = range(0,count($PersonalCollages) - 1);
shuffle($Range);
$Indices = array_slice($Range, 0, MAX_PERS_COLLAGES);
$SeeAll = '
(See all) ';
} else {
$Indices = range(0, count($PersonalCollages) - 1);
$SeeAll = '';
}
?>
↑ This album is in =number_format(count($PersonalCollages))?> personal collage=((count($PersonalCollages) > 1) ? 's' : '')?>=$SeeAll?>
# torrents
foreach ($Indices as $i) {
list($CollageName, $CollageTorrents, $CollageID) = $PersonalCollages[$i];
unset($PersonalCollages[$i]);
?>
=$CollageName?>
=number_format($CollageTorrents)?>
}
foreach ($PersonalCollages as $Collage) {
list($CollageName, $CollageTorrents, $CollageID) = $Collage;
?>
=$CollageName?>
=number_format($CollageTorrents)?>
} ?>
}
// Matched Votes
include(SERVER_ROOT.'/sections/torrents/voter_picks.php');
?>
↑ =(!empty($ReleaseType) ? $ReleaseTypes[$ReleaseType].' info' : 'Info' )?>
if ($WikiBody != '') { echo $WikiBody; } else { echo 'There is no information on this torrent.'; } ?>
↑
=($GroupCategoryID == 3)?'Samples':'Screenshots'?> (=count($Screenshots)?>)
if (count($Screenshots) > 0) {
?>
Show
}
$DB->query("
SELECT UserID
FROM torrents
WHERE GroupID = $GroupID");
if (in_array($LoggedUser['ID'], $DB->collect('UserID')) || check_perms('torrents_edit') || check_perms('screenshots_add') || check_perms('screenshots_delete')) {
?>
Add/Remove
}
?>
foreach($Screenshots as $Screenshot) {
$SSURL = ImageTools::process($Screenshot['Image'], false)
?>
- =time_diff($Screenshot['Time'])?>' src="=$SSURL?>" />
}
?>
// --- Comments ---
$Pages = Format::get_pages($Page, $NumComments, TORRENT_COMMENTS_PER_PAGE, 9, '#comments');
?>