Gazelle/sections/torrents/functions.php

527 lines
18 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
2013-04-24 08:00:23 +00:00
function get_group_info($GroupID, $Return = true, $RevisionID = 0, $PersonalProperties = true, $ApiCall = false) {
2011-03-28 14:21:28 +00:00
global $Cache, $DB;
2012-10-16 08:00:18 +00:00
if (!$RevisionID) {
2013-07-17 08:00:52 +00:00
$TorrentCache = $Cache->get_value("torrents_details_$GroupID");
2012-12-07 08:00:19 +00:00
}
2013-09-13 08:00:53 +00:00
if ($RevisionID || !is_array($TorrentCache)) {
2011-03-28 14:21:28 +00:00
// Fetch the group details
2013-07-04 08:00:56 +00:00
$SQL = 'SELECT ';
2011-03-28 14:21:28 +00:00
2012-10-16 08:00:18 +00:00
if (!$RevisionID) {
2013-07-04 08:00:56 +00:00
$SQL .= '
2011-03-28 14:21:28 +00:00
g.WikiBody,
2013-07-04 08:00:56 +00:00
g.WikiImage, ';
2011-03-28 14:21:28 +00:00
} else {
2013-07-04 08:00:56 +00:00
$SQL .= '
2011-03-28 14:21:28 +00:00
w.Body,
2013-07-04 08:00:56 +00:00
w.Image, ';
2011-03-28 14:21:28 +00:00
}
$SQL .= "
2013-04-20 08:01:01 +00:00
g.ID,
g.Name,
g.Year,
g.RecordLabel,
g.CatalogueNumber,
g.ReleaseType,
g.CategoryID,
g.Time,
g.VanityHouse,
GROUP_CONCAT(DISTINCT tags.Name SEPARATOR '|'),
GROUP_CONCAT(DISTINCT tags.ID SEPARATOR '|'),
GROUP_CONCAT(tt.UserID SEPARATOR '|'),
GROUP_CONCAT(tt.PositiveVotes SEPARATOR '|'),
GROUP_CONCAT(tt.NegativeVotes SEPARATOR '|')
2011-03-28 14:21:28 +00:00
FROM torrents_group AS g
2013-07-04 08:00:56 +00:00
LEFT JOIN torrents_tags AS tt ON tt.GroupID = g.ID
LEFT JOIN tags ON tags.ID = tt.TagID";
2011-03-28 14:21:28 +00:00
2012-10-16 08:00:18 +00:00
if ($RevisionID) {
$SQL .= "
2013-07-04 08:00:56 +00:00
LEFT JOIN wiki_torrents AS w ON w.PageID = '".db_string($GroupID)."'
AND w.RevisionID = '".db_string($RevisionID)."' ";
2011-03-28 14:21:28 +00:00
}
2012-10-16 08:00:18 +00:00
$SQL .= "
2013-07-04 08:00:56 +00:00
WHERE g.ID = '".db_string($GroupID)."'
2011-03-28 14:21:28 +00:00
GROUP BY NULL";
$DB->query($SQL);
2012-10-16 08:00:18 +00:00
$TorrentDetails = $DB->next_record(MYSQLI_ASSOC);
2011-03-28 14:21:28 +00:00
// Fetch the individual torrents
$DB->query("
SELECT
2013-04-20 08:01:01 +00:00
t.ID,
t.Media,
t.Format,
t.Encoding,
t.Remastered,
t.RemasterYear,
t.RemasterTitle,
t.RemasterRecordLabel,
t.RemasterCatalogueNumber,
t.Scene,
t.HasLog,
t.HasCue,
t.LogScore,
t.FileCount,
t.Size,
t.Seeders,
t.Leechers,
t.Snatched,
t.FreeTorrent,
t.Time,
t.Description,
t.FileList,
t.FilePath,
t.UserID,
t.last_action,
HEX(t.info_hash) AS InfoHash,
tbt.TorrentID AS BadTags,
tbf.TorrentID AS BadFolders,
tfi.TorrentID AS BadFiles,
ca.TorrentID AS CassetteApproved,
lma.TorrentID AS LossymasterApproved,
lwa.TorrentID AS LossywebApproved,
t.LastReseedRequest,
tln.TorrentID AS LogInDB,
t.ID AS HasFile
2011-03-28 14:21:28 +00:00
FROM torrents AS t
2013-07-04 08:00:56 +00:00
LEFT JOIN torrents_bad_tags AS tbt ON tbt.TorrentID = t.ID
2013-11-17 08:00:47 +00:00
LEFT JOIN torrents_bad_folders AS tbf ON tbf.TorrentID = t.ID
LEFT JOIN torrents_bad_files AS tfi ON tfi.TorrentID = t.ID
LEFT JOIN torrents_cassette_approved AS ca ON ca.TorrentID = t.ID
LEFT JOIN torrents_lossymaster_approved AS lma ON lma.TorrentID = t.ID
LEFT JOIN torrents_lossyweb_approved AS lwa ON lwa.TorrentID = t.ID
2013-07-04 08:00:56 +00:00
LEFT JOIN torrents_logs_new AS tln ON tln.TorrentID = t.ID
WHERE t.GroupID = '".db_string($GroupID)."'
2011-03-28 14:21:28 +00:00
GROUP BY t.ID
2013-04-20 08:01:01 +00:00
ORDER BY t.Remastered ASC,
2013-05-27 08:00:58 +00:00
(t.RemasterYear != 0) DESC,
2013-04-20 08:01:01 +00:00
t.RemasterYear ASC,
t.RemasterTitle ASC,
t.RemasterRecordLabel ASC,
t.RemasterCatalogueNumber ASC,
t.Media ASC,
t.Format,
t.Encoding,
t.ID");
2011-03-28 14:21:28 +00:00
2012-10-16 08:00:18 +00:00
$TorrentList = $DB->to_array('ID', MYSQLI_ASSOC);
2013-07-17 08:00:52 +00:00
if (count($TorrentList) === 0 && $ApiCall == false) {
2013-07-04 08:00:56 +00:00
header('Location: log.php?search='.(empty($_GET['torrentid']) ? "Group+$GroupID" : "Torrent+$_GET[torrentid]"));
2012-09-27 08:00:20 +00:00
die();
2013-09-15 08:00:53 +00:00
} elseif (count($TorrentList) === 0 && $ApiCall == true) {
2013-10-15 08:01:05 +00:00
return null;
2011-03-28 14:21:28 +00:00
}
2012-10-16 08:00:18 +00:00
if (in_array(0, $DB->collect('Seeders'))) {
2011-03-28 14:21:28 +00:00
$CacheTime = 600;
} else {
$CacheTime = 3600;
}
// Store it all in cache
2012-10-16 08:00:18 +00:00
if (!$RevisionID) {
2013-07-04 08:00:56 +00:00
$Cache->cache_value("torrents_details_$GroupID", array($TorrentDetails, $TorrentList), $CacheTime);
2011-03-28 14:21:28 +00:00
}
} else { // If we're reading from cache
2012-10-16 08:00:18 +00:00
$TorrentDetails = $TorrentCache[0];
$TorrentList = $TorrentCache[1];
2011-03-28 14:21:28 +00:00
}
2013-02-04 08:00:13 +00:00
if ($PersonalProperties) {
// Fetch all user specific torrent and group properties
$TorrentDetails['Flags'] = array('IsSnatched' => false);
foreach ($TorrentList as &$Torrent) {
Torrents::torrent_properties($Torrent, $TorrentDetails['Flags']);
}
2012-12-06 08:00:17 +00:00
}
2012-10-16 08:00:18 +00:00
if ($Return) {
return array($TorrentDetails, $TorrentList);
2011-03-28 14:21:28 +00:00
}
}
2013-04-24 08:00:23 +00:00
function get_torrent_info($TorrentID, $Return = true, $RevisionID = 0, $PersonalProperties = true, $ApiCall = false) {
global $Cache, $DB;
$GroupID = (int)torrentid_to_groupid($TorrentID);
$GroupInfo = get_group_info($GroupID, $Return, $RevisionID, $PersonalProperties, $ApiCall);
if ($GroupInfo) {
foreach ($GroupInfo[1] as &$Torrent) {
//Remove unneeded entries
if ($Torrent['ID'] != $TorrentID) {
unset($GroupInfo[1][$Torrent['ID']]);
}
if ($Return) {
return $GroupInfo;
}
}
} else {
if ($Return) {
2013-10-15 08:01:05 +00:00
return null;
2013-04-24 08:00:23 +00:00
}
}
}
2011-03-28 14:21:28 +00:00
//Check if a givin string can be validated as a torrenthash
function is_valid_torrenthash($Str) {
//6C19FF4C 6C1DD265 3B25832C 0F6228B2 52D743D5
$Str = str_replace(' ', '', $Str);
2013-04-13 08:00:19 +00:00
if (preg_match('/^[0-9a-fA-F]{40}$/', $Str))
2011-03-28 14:21:28 +00:00
return $Str;
return false;
}
2013-04-24 08:00:23 +00:00
//Functionality for the API to resolve input into other data.
function torrenthash_to_torrentid($Str) {
global $Cache, $DB;
2013-07-04 08:00:56 +00:00
$DB->query("
2013-11-17 08:00:47 +00:00
SELECT ID
FROM torrents
WHERE HEX(info_hash) = '".db_string($Str)."'");
2013-04-24 08:00:23 +00:00
$TorrentID = (int)array_pop($DB->next_record(MYSQLI_ASSOC));
if ($TorrentID) {
return $TorrentID;
}
2013-10-15 08:01:05 +00:00
return null;
2013-04-24 08:00:23 +00:00
}
function torrenthash_to_groupid($Str) {
global $Cache, $DB;
2013-07-04 08:00:56 +00:00
$DB->query("
2013-11-17 08:00:47 +00:00
SELECT GroupID
FROM torrents
WHERE HEX(info_hash) = '".db_string($Str)."'");
2013-04-24 08:00:23 +00:00
$GroupID = (int)array_pop($DB->next_record(MYSQLI_ASSOC));
if ($GroupID) {
return $GroupID;
}
2013-10-15 08:01:05 +00:00
return null;
2013-04-24 08:00:23 +00:00
}
function torrentid_to_groupid($TorrentID) {
global $Cache, $DB;
2013-07-04 08:00:56 +00:00
$DB->query("
2013-11-17 08:00:47 +00:00
SELECT GroupID
FROM torrents
WHERE ID = '".db_string($TorrentID)."'");
2013-04-24 08:00:23 +00:00
$GroupID = (int)array_pop($DB->next_record(MYSQLI_ASSOC));
if ($GroupID) {
return $GroupID;
}
2013-10-15 08:01:05 +00:00
return null;
2013-04-24 08:00:23 +00:00
}
2011-03-28 14:21:28 +00:00
//After adjusting / deleting logs, recalculate the score for the torrent.
function set_torrent_logscore($TorrentID) {
global $DB;
2013-07-04 08:00:56 +00:00
$DB->query("
UPDATE torrents
SET LogScore = (
SELECT FLOOR(AVG(Score))
FROM torrents_logs_new
WHERE TorrentID = $TorrentID
)
WHERE ID = $TorrentID");
2011-03-28 14:21:28 +00:00
}
2012-02-03 08:00:22 +00:00
function get_group_requests($GroupID) {
2012-10-16 08:00:18 +00:00
if (empty($GroupID) || !is_number($GroupID)) {
return array();
}
2012-02-03 08:00:22 +00:00
global $DB, $Cache;
2013-02-22 08:00:24 +00:00
2013-07-04 08:00:56 +00:00
$Requests = $Cache->get_value("requests_group_$GroupID");
2013-04-13 08:00:19 +00:00
if ($Requests === false) {
2013-07-04 08:00:56 +00:00
$DB->query("
SELECT ID
FROM requests
WHERE GroupID = $GroupID
AND TimeFilled = '0000-00-00 00:00:00'");
2012-02-03 08:00:22 +00:00
$Requests = $DB->collect('ID');
2013-07-04 08:00:56 +00:00
$Cache->cache_value("requests_group_$GroupID", $Requests, 0);
2012-02-03 08:00:22 +00:00
}
2013-09-13 08:00:53 +00:00
return Requests::get_requests($Requests);
2012-05-31 08:00:14 +00:00
}
2013-04-17 08:00:58 +00:00
//Used by both sections/torrents/details.php and sections/reportsv2/report.php
2013-12-12 08:01:01 +00:00
function build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $GroupName, $GroupCategoryID, $ReleaseType, $TorrentList, $Types, $Username, $ReportedTimes) {
2013-04-17 08:00:58 +00:00
2013-04-19 08:00:55 +00:00
function filelist($Str) {
2013-07-04 08:00:56 +00:00
return "</td>\n<td>" . Format::get_size($Str[1]) . "</td>\n</tr>";
2013-04-19 08:00:55 +00:00
}
2013-04-17 08:00:58 +00:00
2013-04-19 08:00:55 +00:00
$LastRemasterYear = '-';
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
2013-04-17 08:00:58 +00:00
2013-04-19 08:00:55 +00:00
$EditionID = 0;
foreach ($TorrentList as $Torrent) {
2013-04-17 08:00:58 +00:00
//t.ID, t.Media, t.Format, t.Encoding, t.Remastered, t.RemasterYear,
//t.RemasterTitle, t.RemasterRecordLabel, t.RemasterCatalogueNumber, t.Scene,
//t.HasLog, t.HasCue, t.LogScore, t.FileCount, t.Size, t.Seeders, t.Leechers,
//t.Snatched, t.FreeTorrent, t.Time, t.Description, t.FileList,
//t.FilePath, t.UserID, t.last_action, HEX(t.info_hash), (bad tags), (bad folders), (bad filenames),
//(cassette approved), (lossy master approved), (lossy web approved), t.LastReseedRequest,
//LogInDB, (has file), Torrents::torrent_properties()
list($TorrentID, $Media, $Format, $Encoding, $Remastered, $RemasterYear,
$RemasterTitle, $RemasterRecordLabel, $RemasterCatalogueNumber, $Scene,
$HasLog, $HasCue, $LogScore, $FileCount, $Size, $Seeders, $Leechers,
$Snatched, $FreeTorrent, $TorrentTime, $Description, $FileList,
$FilePath, $UserID, $LastActive, $InfoHash, $BadTags, $BadFolders, $BadFiles,
$CassetteApproved, $LossymasterApproved, $LossywebApproved, $LastReseedRequest,
$LogInDB, $HasFile, $PersonalFL, $IsSnatched) = array_values($Torrent);
if ($Remastered && !$RemasterYear) {
2013-04-19 08:00:55 +00:00
$FirstUnknown = !isset($FirstUnknown);
2013-04-17 08:00:58 +00:00
}
$Reported = false;
unset($ReportedTimes);
2013-11-07 08:00:43 +00:00
$Reports = Torrents::get_reports($TorrentID);
$NumReports = count($Reports);
if ($NumReports > 0) {
2013-04-19 08:00:55 +00:00
$Reported = true;
2013-11-07 08:00:43 +00:00
include(SERVER_ROOT.'/sections/reportsv2/array.php');
$ReportInfo = '
<table class="reportinfo_table">
<tr class="colhead_dark" style="font-weight: bold;">
<td>This torrent has '.$NumReports.' active '.($NumReports === 1 ? 'report' : 'reports').":</td>
</tr>";
2013-04-17 08:00:58 +00:00
2013-04-19 08:00:55 +00:00
foreach ($Reports as $Report) {
2013-11-07 08:00:43 +00:00
if (check_perms('admin_reports')) {
$ReporterID = $Report['ReporterID'];
$Reporter = Users::user_info($ReporterID);
$ReporterName = $Reporter['Username'];
$ReportLinks = "<a href=\"user.php?id=$ReporterID\">$ReporterName</a> <a href=\"reportsv2.php?view=report&amp;id=$Report[ID]\">reported it</a>";
} else {
$ReportLinks = 'Someone reported it';
}
2013-07-04 08:00:56 +00:00
2013-11-07 08:00:43 +00:00
if (isset($Types[$GroupCategoryID][$Report['Type']])) {
$ReportType = $Types[$GroupCategoryID][$Report['Type']];
} elseif (isset($Types['master'][$Report['Type']])) {
$ReportType = $Types['master'][$Report['Type']];
2013-07-04 08:00:56 +00:00
} else {
//There was a type but it wasn't an option!
$ReportType = $Types['master']['other'];
}
2013-11-07 08:00:43 +00:00
$ReportInfo .= "
<tr>
<td>$ReportLinks ".time_diff($Report['ReportedTime'], 2, true, true).' for the reason "'.$ReportType['title'].'":
2013-12-12 08:01:01 +00:00
<blockquote>'.Text::full_format($Report['UserComment']).'</blockquote>
2013-11-07 08:00:43 +00:00
</td>
</tr>';
2013-04-19 08:00:55 +00:00
}
2013-11-07 08:00:43 +00:00
$ReportInfo .= "\n\t\t</table>";
2013-04-17 08:00:58 +00:00
}
$CanEdit = (check_perms('torrents_edit') || (($UserID == $LoggedUser['ID'] && !$LoggedUser['DisableWiki']) && !($Remastered && !$RemasterYear)));
$RegenLink = check_perms('users_mod') ? ' <a href="torrents.php?action=regen_filelist&amp;torrentid=' . $TorrentID . '" class="brackets">Regenerate</a>' : '';
$FileTable = '
<table class="filelist_table">
2013-04-19 08:00:55 +00:00
<tr class="colhead_dark">
<td>
2013-08-28 23:08:41 +00:00
<div class="filelist_title" style="float: left;">File Names' . $RegenLink . '</div>
2013-04-19 08:00:55 +00:00
<div class="filelist_path" style="float: right;">' . ($FilePath ? "/$FilePath/" : '') . '</div>
</td>
<td>
<strong>Size</strong>
</td>
</tr>';
2013-04-17 08:00:58 +00:00
if (substr($FileList, -3) == '}}}') { // Old style
2013-04-19 08:00:55 +00:00
$FileListSplit = explode('|||', $FileList);
foreach ($FileListSplit as $File) {
2013-04-17 08:00:58 +00:00
$NameEnd = strrpos($File, '{{{');
$Name = substr($File, 0, $NameEnd);
if ($Spaces = strspn($Name, ' ')) {
2013-04-19 08:00:55 +00:00
$Name = str_replace(' ', '&nbsp;', substr($Name, 0, $Spaces)) . substr($Name, $Spaces);
2013-04-17 08:00:58 +00:00
}
$FileSize = substr($File, $NameEnd + 3, -3);
2013-08-28 23:08:41 +00:00
$FileTable .= sprintf("\n<tr><td>%s</td><td class=\"number_column\">%s</td></tr>", $Name, Format::get_size($FileSize));
2013-04-19 08:00:55 +00:00
}
2013-04-17 08:00:58 +00:00
} else {
2013-04-19 08:00:55 +00:00
$FileListSplit = explode("\n", $FileList);
foreach ($FileListSplit as $File) {
2013-04-17 08:00:58 +00:00
$FileInfo = Torrents::filelist_get_file($File);
2013-08-28 23:08:41 +00:00
$FileTable .= sprintf("\n<tr><td>%s</td><td class=\"number_column\">%s</td></tr>", $FileInfo['name'], Format::get_size($FileInfo['size']));
2013-04-19 08:00:55 +00:00
}
2013-04-17 08:00:58 +00:00
}
$FileTable .= '
</table>';
$ExtraInfo = ''; // String that contains information on the torrent (e.g. format and encoding)
$AddExtra = ''; // Separator between torrent properties
$TorrentUploader = $Username; // Save this for "Uploaded by:" below
// similar to Torrents::torrent_info()
if ($Format) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= display_str($Format);
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if ($Encoding) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= $AddExtra . display_str($Encoding);
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if ($HasLog) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= "{$AddExtra}Log";
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if ($HasLog && $LogInDB) {
2013-10-30 08:01:19 +00:00
$ExtraInfo .= ' (' . (int)$LogScore . '%)';
2013-04-17 08:00:58 +00:00
}
if ($HasCue) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= "{$AddExtra}Cue";
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if ($Scene) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= "{$AddExtra}Scene";
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if (!$ExtraInfo) {
2013-04-19 08:00:55 +00:00
$ExtraInfo = $GroupName;
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if ($IsSnatched) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= $AddExtra . Format::torrent_label('Snatched!');
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if ($FreeTorrent == '1') {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= $AddExtra . Format::torrent_label('Freeleech!');
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if ($FreeTorrent == '2') {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= $AddExtra . Format::torrent_label('Neutral Leech!');
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if ($PersonalFL) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= $AddExtra . Format::torrent_label('Personal Freeleech!');
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if ($Reported) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= $AddExtra . Format::torrent_label('Reported');
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if (!empty($BadTags)) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= $AddExtra . Format::torrent_label('Bad Tags');
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if (!empty($BadFolders)) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= $AddExtra . Format::torrent_label('Bad Folders');
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if (!empty($CassetteApproved)) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= $AddExtra . Format::torrent_label('Cassette Approved');
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if (!empty($LossymasterApproved)) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= $AddExtra . Format::torrent_label('Lossy Master Approved');
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if (!empty($LossywebApproved)) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= $AddExtra . Format::torrent_label('Lossy WEB Approved');
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if (!empty($BadFiles)) {
2013-07-04 08:00:56 +00:00
$ExtraInfo .= $AddExtra . Format::torrent_label('Bad File Names');
2013-04-19 08:00:55 +00:00
$AddExtra = ' / ';
2013-04-17 08:00:58 +00:00
}
if ($GroupCategoryID == 1
&& ($RemasterTitle != $LastRemasterTitle
|| $RemasterYear != $LastRemasterYear
|| $RemasterRecordLabel != $LastRemasterRecordLabel
|| $RemasterCatalogueNumber != $LastRemasterCatalogueNumber
|| $FirstUnknown
|| $Media != $LastMedia)) {
2013-04-19 08:00:55 +00:00
$EditionID++;
2013-04-17 08:00:58 +00:00
?>
2013-05-16 16:15:57 +00:00
<tr class="releases_<?=($ReleaseType)?> groupid_<?=($GroupID)?> edition group_torrent">
2015-11-15 08:00:28 +00:00
<td colspan="5" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=($GroupID)?>, <?=($EditionID)?>, this, event);" class="tooltip" title="Collapse this edition. Hold [Command] <em>(Mac)</em> or [Ctrl] <em>(PC)</em> while clicking to collapse all editions in this torrent group.">&minus;</a> <?= Torrents::edition_string($Torrent, $TorrentDetails) ?></strong></td>
2013-04-19 08:00:55 +00:00
</tr>
<?
2013-04-17 08:00:58 +00:00
}
$LastRemasterTitle = $RemasterTitle;
$LastRemasterYear = $RemasterYear;
$LastRemasterRecordLabel = $RemasterRecordLabel;
$LastRemasterCatalogueNumber = $RemasterCatalogueNumber;
$LastMedia = $Media;
2013-04-19 08:00:55 +00:00
?>
2013-05-16 16:15:57 +00:00
<tr class="torrent_row releases_<?=($ReleaseType)?> groupid_<?=($GroupID)?> edition_<?=($EditionID)?> group_torrent<?=($IsSnatched ? ' snatched_torrent' : '')?>" style="font-weight: normal;" id="torrent<?=($TorrentID)?>">
2013-04-17 08:00:58 +00:00
<td>
2013-10-26 08:00:58 +00:00
<span>[ <a href="torrents.php?action=download&amp;id=<?=($TorrentID)?>&amp;authkey=<?=($LoggedUser['AuthKey'])?>&amp;torrent_pass=<?=($LoggedUser['torrent_pass'])?>" class="tooltip" title="Download"><?=($HasFile ? 'DL' : 'Missing')?></a>
2013-04-19 08:00:55 +00:00
<? if (Torrents::can_use_token($Torrent)) { ?>
2013-10-26 08:00:58 +00:00
| <a href="torrents.php?action=download&amp;id=<?=($TorrentID)?>&amp;authkey=<?=($LoggedUser['AuthKey'])?>&amp;torrent_pass=<?=($LoggedUser['torrent_pass'])?>&amp;usetoken=1" class="tooltip" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
2013-04-19 08:00:55 +00:00
<? } ?>
2013-10-26 08:00:58 +00:00
| <a href="reportsv2.php?action=report&amp;id=<?=($TorrentID)?>" class="tooltip" title="Report">RP</a>
2013-04-19 08:00:55 +00:00
<? if ($CanEdit) { ?>
2013-10-26 08:00:58 +00:00
| <a href="torrents.php?action=edit&amp;id=<?=($TorrentID)?>" class="tooltip" title="Edit">ED</a>
2013-04-19 08:00:55 +00:00
<? }
if (check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) { ?>
2013-10-26 08:00:58 +00:00
| <a href="torrents.php?action=delete&amp;torrentid=<?=($TorrentID)?>" class="tooltip" title="Remove">RM</a>
2013-04-19 08:00:55 +00:00
<? } ?>
2013-10-26 08:00:58 +00:00
| <a href="torrents.php?torrentid=<?=($TorrentID)?>" class="tooltip" title="Permalink">PL</a>
2013-04-17 08:00:58 +00:00
]</span>
2013-06-17 08:01:02 +00:00
&raquo; <a href="#" onclick="$('#torrent_<?=($TorrentID)?>').gtoggle(); return false;"><?=($ExtraInfo)?></a>
2013-04-17 08:00:58 +00:00
</td>
2013-08-28 23:08:41 +00:00
<td class="number_column nobr"><?=(Format::get_size($Size))?></td>
<td class="number_column"><?=(number_format($Snatched))?></td>
<td class="number_column"><?=(number_format($Seeders))?></td>
<td class="number_column"><?=(number_format($Leechers))?></td>
2013-04-17 08:00:58 +00:00
</tr>
2013-05-16 16:15:57 +00:00
<tr class="releases_<?=($ReleaseType)?> groupid_<?=($GroupID)?> edition_<?=($EditionID)?> torrentdetails pad<? if (!isset($_GET['torrentid']) || $_GET['torrentid'] != $TorrentID) { ?> hidden<? } ?>" id="torrent_<?=($TorrentID)?>">
2013-04-17 08:00:58 +00:00
<td colspan="5">
<blockquote>
2013-05-16 16:15:57 +00:00
Uploaded by <?=(Users::format_username($UserID, false, false, false))?> <?=time_diff($TorrentTime);?>
2013-04-19 08:00:55 +00:00
<? if ($Seeders == 0) {
if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) { ?>
2013-05-16 16:15:57 +00:00
<br /><strong>Last active: <?=time_diff($LastActive);?></strong>
2013-04-19 08:00:55 +00:00
<? } else { ?>
2013-05-16 16:15:57 +00:00
<br />Last active: <?=time_diff($LastActive);?>
2013-04-19 08:00:55 +00:00
<? }
if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) { ?>
2013-05-16 16:15:57 +00:00
<br /><a href="torrents.php?action=reseed&amp;torrentid=<?=($TorrentID)?>&amp;groupid=<?=($GroupID)?>" class="brackets">Request re-seed</a>
2013-04-19 08:00:55 +00:00
<? }
} ?>
2013-04-17 08:00:58 +00:00
</blockquote>
2013-04-19 08:00:55 +00:00
<? if (check_perms('site_moderate_requests')) { ?>
<div class="linkbox">
2013-05-16 16:15:57 +00:00
<a href="torrents.php?action=masspm&amp;id=<?=($GroupID)?>&amp;torrentid=<?=($TorrentID)?>" class="brackets">Mass PM snatchers</a>
2013-04-19 08:00:55 +00:00
</div>
<? } ?>
2013-04-17 08:00:58 +00:00
<div class="linkbox">
2013-07-04 08:00:56 +00:00
<a href="#" class="brackets" onclick="show_peers('<?=($TorrentID)?>', 0); return false;">View peer list</a>
2013-04-19 08:00:55 +00:00
<? if (check_perms('site_view_torrent_snatchlist')) { ?>
2013-10-26 08:00:58 +00:00
<a href="#" class="brackets tooltip" onclick="show_downloads('<?=($TorrentID)?>', 0); return false;" title="View the list of users that have clicked the &quot;DL&quot; button.">View download list</a>
<a href="#" class="brackets tooltip" onclick="show_snatches('<?=($TorrentID)?>', 0); return false;" title="View the list of users that have reported a snatch to the tracker.">View snatch list</a>
2013-04-19 08:00:55 +00:00
<? } ?>
2013-07-04 08:00:56 +00:00
<a href="#" class="brackets" onclick="show_files('<?=($TorrentID)?>'); return false;">View file list</a>
2013-04-19 08:00:55 +00:00
<? if ($Reported) { ?>
2013-07-04 08:00:56 +00:00
<a href="#" class="brackets" onclick="show_reported('<?=($TorrentID)?>'); return false;">View report information</a>
2013-04-19 08:00:55 +00:00
<? } ?>
2013-04-17 08:00:58 +00:00
</div>
2013-05-16 16:15:57 +00:00
<div id="peers_<?=($TorrentID)?>" class="hidden"></div>
<div id="downloads_<?=($TorrentID)?>" class="hidden"></div>
<div id="snatches_<?=($TorrentID)?>" class="hidden"></div>
<div id="files_<?=($TorrentID)?>" class="hidden"><?=($FileTable)?></div>
2013-04-19 08:00:55 +00:00
<? if ($Reported) { ?>
2013-05-16 16:15:57 +00:00
<div id="reported_<?=($TorrentID)?>" class="hidden"><?=($ReportInfo)?></div>
2013-04-19 08:00:55 +00:00
<? }
2013-04-17 08:00:58 +00:00
if (!empty($Description)) {
2013-12-12 08:01:01 +00:00
echo "\n\t\t\t\t\t\t<blockquote>" . Text::full_format($Description) . '</blockquote>';
2013-04-20 08:01:01 +00:00
} ?>
2013-04-17 08:00:58 +00:00
</td>
</tr>
2013-04-19 08:00:55 +00:00
<?
}
2013-04-17 08:00:58 +00:00
}