Exemple #1
0
function build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $GroupName, $GroupCategoryID, $ReleaseType, $TorrentList, $Types, $Username, $ReportedTimes)
{
    function filelist($Str)
    {
        return "</td>\n<td>" . Format::get_size($Str[1]) . "</td>\n</tr>";
    }
    $LastRemasterYear = '-';
    $LastRemasterTitle = '';
    $LastRemasterRecordLabel = '';
    $LastRemasterCatalogueNumber = '';
    $EditionID = 0;
    foreach ($TorrentList as $Torrent) {
        //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) {
            $FirstUnknown = !isset($FirstUnknown);
        }
        $Reported = false;
        unset($ReportedTimes);
        $Reports = Torrents::get_reports($TorrentID);
        $NumReports = count($Reports);
        if ($NumReports > 0) {
            $Reported = true;
            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>\n\t\t\t</tr>";
            foreach ($Reports as $Report) {
                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';
                }
                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 .= "\n\t\t\t<tr>\n\t\t\t\t<td>{$ReportLinks} " . time_diff($Report['ReportedTime'], 2, true, true) . ' for the reason "' . $ReportType['title'] . '":
					<blockquote>' . Text::full_format($Report['UserComment']) . '</blockquote>
				</td>
			</tr>';
            }
            $ReportInfo .= "\n\t\t</table>";
        }
        $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">
		<tr class="colhead_dark">
			<td>
				<div class="filelist_title" style="float: left;">File Names' . $RegenLink . '</div>
				<div class="filelist_path" style="float: right;">' . ($FilePath ? "/{$FilePath}/" : '') . '</div>
			</td>
			<td>
				<strong>Size</strong>
			</td>
		</tr>';
        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(' ', '&nbsp;', substr($Name, 0, $Spaces)) . substr($Name, $Spaces);
                }
                $FileSize = substr($File, $NameEnd + 3, -3);
                $FileTable .= sprintf("\n<tr><td>%s</td><td class=\"number_column\">%s</td></tr>", $Name, Format::get_size($FileSize));
            }
        } else {
            $FileListSplit = explode("\n", $FileList);
            foreach ($FileListSplit as $File) {
                $FileInfo = Torrents::filelist_get_file($File);
                $FileTable .= sprintf("\n<tr><td>%s</td><td class=\"number_column\">%s</td></tr>", $FileInfo['name'], Format::get_size($FileInfo['size']));
            }
        }
        $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) {
            $ExtraInfo .= display_str($Format);
            $AddExtra = ' / ';
        }
        if ($Encoding) {
            $ExtraInfo .= $AddExtra . display_str($Encoding);
            $AddExtra = ' / ';
        }
        if ($HasLog) {
            $ExtraInfo .= "{$AddExtra}Log";
            $AddExtra = ' / ';
        }
        if ($HasLog && $LogInDB) {
            $ExtraInfo .= ' (' . (int) $LogScore . '%)';
        }
        if ($HasCue) {
            $ExtraInfo .= "{$AddExtra}Cue";
            $AddExtra = ' / ';
        }
        if ($Scene) {
            $ExtraInfo .= "{$AddExtra}Scene";
            $AddExtra = ' / ';
        }
        if (!$ExtraInfo) {
            $ExtraInfo = $GroupName;
            $AddExtra = ' / ';
        }
        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 = ' / ';
        }
        if ($PersonalFL) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Personal Freeleech!');
            $AddExtra = ' / ';
        }
        if ($Reported) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Reported');
            $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($CassetteApproved)) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Cassette Approved');
            $AddExtra = ' / ';
        }
        if (!empty($LossymasterApproved)) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Lossy Master Approved');
            $AddExtra = ' / ';
        }
        if (!empty($LossywebApproved)) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Lossy WEB Approved');
            $AddExtra = ' / ';
        }
        if (!empty($BadFiles)) {
            $ExtraInfo .= $AddExtra . Format::torrent_label('Bad File Names');
            $AddExtra = ' / ';
        }
        if ($GroupCategoryID == 1 && ($RemasterTitle != $LastRemasterTitle || $RemasterYear != $LastRemasterYear || $RemasterRecordLabel != $LastRemasterRecordLabel || $RemasterCatalogueNumber != $LastRemasterCatalogueNumber || $FirstUnknown || $Media != $LastMedia)) {
            $EditionID++;
            ?>
				<tr class="releases_<?php 
            echo $ReleaseType;
            ?>
 groupid_<?php 
            echo $GroupID;
            ?>
 edition group_torrent">
					<td colspan="5" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?php 
            echo $GroupID;
            ?>
, <?php 
            echo $EditionID;
            ?>
, this, event);" class="tooltip" title="Collapse this edition. Hold &quot;Ctrl&quot; while clicking to collapse all editions in this torrent group.">&minus;</a> <?php 
            echo Torrents::edition_string($Torrent, $TorrentDetails);
            ?>
</strong></td>
				</tr>
<?php 
        }
        $LastRemasterTitle = $RemasterTitle;
        $LastRemasterYear = $RemasterYear;
        $LastRemasterRecordLabel = $RemasterRecordLabel;
        $LastRemasterCatalogueNumber = $RemasterCatalogueNumber;
        $LastMedia = $Media;
        ?>
				<tr class="torrent_row releases_<?php 
        echo $ReleaseType;
        ?>
 groupid_<?php 
        echo $GroupID;
        ?>
 edition_<?php 
        echo $EditionID;
        ?>
 group_torrent<?php 
        echo $IsSnatched ? ' snatched_torrent' : '';
        ?>
" style="font-weight: normal;" id="torrent<?php 
        echo $TorrentID;
        ?>
">
					<td>
						<span>[ <a href="torrents.php?action=download&amp;id=<?php 
        echo $TorrentID;
        ?>
&amp;authkey=<?php 
        echo $LoggedUser['AuthKey'];
        ?>
&amp;torrent_pass=<?php 
        echo $LoggedUser['torrent_pass'];
        ?>
" class="tooltip" title="Download"><?php 
        echo $HasFile ? 'DL' : 'Missing';
        ?>
</a>
<?php 
        if (Torrents::can_use_token($Torrent)) {
            ?>
							| <a href="torrents.php?action=download&amp;id=<?php 
            echo $TorrentID;
            ?>
&amp;authkey=<?php 
            echo $LoggedUser['AuthKey'];
            ?>
&amp;torrent_pass=<?php 
            echo $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>
<?php 
        }
        ?>
							| <a href="reportsv2.php?action=report&amp;id=<?php 
        echo $TorrentID;
        ?>
" class="tooltip" title="Report">RP</a>
<?php 
        if ($CanEdit) {
            ?>
							| <a href="torrents.php?action=edit&amp;id=<?php 
            echo $TorrentID;
            ?>
" class="tooltip" title="Edit">ED</a>
<?php 
        }
        if (check_perms('torrents_delete') || $UserID == $LoggedUser['ID']) {
            ?>
							| <a href="torrents.php?action=delete&amp;torrentid=<?php 
            echo $TorrentID;
            ?>
" class="tooltip" title="Remove">RM</a>
<?php 
        }
        ?>
							| <a href="torrents.php?torrentid=<?php 
        echo $TorrentID;
        ?>
" class="tooltip" title="Permalink">PL</a>
						]</span>
						&raquo; <a href="#" onclick="$('#torrent_<?php 
        echo $TorrentID;
        ?>
').gtoggle(); return false;"><?php 
        echo $ExtraInfo;
        ?>
</a>
					</td>
					<td class="number_column nobr"><?php 
        echo Format::get_size($Size);
        ?>
</td>
					<td class="number_column"><?php 
        echo number_format($Snatched);
        ?>
</td>
					<td class="number_column"><?php 
        echo number_format($Seeders);
        ?>
</td>
					<td class="number_column"><?php 
        echo number_format($Leechers);
        ?>
</td>
				</tr>
				<tr class="releases_<?php 
        echo $ReleaseType;
        ?>
 groupid_<?php 
        echo $GroupID;
        ?>
 edition_<?php 
        echo $EditionID;
        ?>
 torrentdetails pad<?php 
        if (!isset($_GET['torrentid']) || $_GET['torrentid'] != $TorrentID) {
            ?>
 hidden<?php 
        }
        ?>
" id="torrent_<?php 
        echo $TorrentID;
        ?>
">
					<td colspan="5">
						<blockquote>
							Uploaded by <?php 
        echo Users::format_username($UserID, false, false, false);
        ?>
 <?php 
        echo time_diff($TorrentTime);
        if ($Seeders == 0) {
            if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) {
                ?>
								<br /><strong>Last active: <?php 
                echo time_diff($LastActive);
                ?>
</strong>
<?php 
            } else {
                ?>
								<br />Last active: <?php 
                echo time_diff($LastActive);
            }
            if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) {
                ?>
								<br /><a href="torrents.php?action=reseed&amp;torrentid=<?php 
                echo $TorrentID;
                ?>
&amp;groupid=<?php 
                echo $GroupID;
                ?>
" class="brackets">Request re-seed</a>
<?php 
            }
        }
        ?>
						</blockquote>
<?php 
        if (check_perms('site_moderate_requests')) {
            ?>
						<div class="linkbox">
							<a href="torrents.php?action=masspm&amp;id=<?php 
            echo $GroupID;
            ?>
&amp;torrentid=<?php 
            echo $TorrentID;
            ?>
" class="brackets">Mass PM snatchers</a>
						</div>
<?php 
        }
        ?>
						<div class="linkbox">
							<a href="#" class="brackets" onclick="show_peers('<?php 
        echo $TorrentID;
        ?>
', 0); return false;">View peer list</a>
<?php 
        if (check_perms('site_view_torrent_snatchlist')) {
            ?>
							<a href="#" class="brackets tooltip" onclick="show_downloads('<?php 
            echo $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('<?php 
            echo $TorrentID;
            ?>
', 0); return false;" title="View the list of users that have reported a snatch to the tracker.">View snatch list</a>
<?php 
        }
        ?>
							<a href="#" class="brackets" onclick="show_files('<?php 
        echo $TorrentID;
        ?>
'); return false;">View file list</a>
<?php 
        if ($Reported) {
            ?>
							<a href="#" class="brackets" onclick="show_reported('<?php 
            echo $TorrentID;
            ?>
'); return false;">View report information</a>
<?php 
        }
        ?>
						</div>
						<div id="peers_<?php 
        echo $TorrentID;
        ?>
" class="hidden"></div>
						<div id="downloads_<?php 
        echo $TorrentID;
        ?>
" class="hidden"></div>
						<div id="snatches_<?php 
        echo $TorrentID;
        ?>
" class="hidden"></div>
						<div id="files_<?php 
        echo $TorrentID;
        ?>
" class="hidden"><?php 
        echo $FileTable;
        ?>
</div>
<?php 
        if ($Reported) {
            ?>
						<div id="reported_<?php 
            echo $TorrentID;
            ?>
" class="hidden"><?php 
            echo $ReportInfo;
            ?>
</div>
<?php 
        }
        if (!empty($Description)) {
            echo "\n\t\t\t\t\t\t<blockquote>" . Text::full_format($Description) . '</blockquote>';
        }
        ?>
					</td>
				</tr>
<?php 
    }
}
Exemple #2
0
$EditionID = 0;
foreach ($TorrentList as $Torrent) {
    //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) {
        $FirstUnknown = !isset($FirstUnknown);
    }
    $Reported = false;
    unset($ReportedTimes);
    $Reports = Torrents::get_reports($TorrentID);
    $NumReports = count($Reports);
    if ($NumReports > 0) {
        $Reported = true;
        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>\n\t\t\t</tr>";
        foreach ($Reports as $Report) {
            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 {
Exemple #3
0
    $TorrentGroups = array();
    $DB->query("\n\t\tSELECT\n\t\t\tct.GroupID\n\t\tFROM collages_torrents AS ct\n\t\t\tJOIN torrents_group AS tg ON tg.ID = ct.GroupID\n\t\tWHERE ct.CollageID = '{$CollageID}'\n\t\tORDER BY ct.Sort");
    $GroupIDs = $DB->collect('GroupID');
    $GroupList = Torrents::get_groups($GroupIDs);
    foreach ($GroupIDs as $GroupID) {
        if (!empty($GroupList[$GroupID])) {
            $GroupDetails = Torrents::array_group($GroupList[$GroupID]);
            if ($GroupDetails['GroupCategoryID'] > 0 && $Categories[$GroupDetails['GroupCategoryID'] - 1] == 'Music') {
                $ArtistForm = $GroupDetails['ExtendedArtists'];
                $JsonMusicInfo = array('composers' => isset($ArtistForm[4]) ? pullmediainfo($ArtistForm[4]) : array(), 'dj' => isset($ArtistForm[6]) ? pullmediainfo($ArtistForm[6]) : array(), 'artists' => isset($ArtistForm[1]) ? pullmediainfo($ArtistForm[1]) : array(), 'with' => isset($ArtistForm[2]) ? pullmediainfo($ArtistForm[2]) : array(), 'conductor' => isset($ArtistForm[5]) ? pullmediainfo($ArtistForm[5]) : array(), 'remixedBy' => isset($ArtistForm[3]) ? pullmediainfo($ArtistForm[3]) : array(), 'producer' => isset($ArtistForm[7]) ? pullmediainfo($ArtistForm[7]) : array());
            } else {
                $JsonMusicInfo = null;
            }
            $TorrentList = array();
            foreach ($GroupDetails['Torrents'] as $Torrent) {
                $TorrentList[] = array('torrentid' => (int) $Torrent['ID'], 'media' => $Torrent['Media'], 'format' => $Torrent['Format'], 'encoding' => $Torrent['Encoding'], 'remastered' => $Torrent['Remastered'] == 1, 'remasterYear' => (int) $Torrent['RemasterYear'], 'remasterTitle' => $Torrent['RemasterTitle'], 'remasterRecordLabel' => $Torrent['RemasterRecordLabel'], 'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'], 'scene' => $Torrent['Scene'] == 1, 'hasLog' => $Torrent['HasLog'] == 1, 'hasCue' => $Torrent['HasCue'] == 1, 'logScore' => (int) $Torrent['LogScore'], 'fileCount' => (int) $Torrent['FileCount'], 'size' => (int) $Torrent['Size'], 'seeders' => (int) $Torrent['Seeders'], 'leechers' => (int) $Torrent['Leechers'], 'snatched' => (int) $Torrent['Snatched'], 'freeTorrent' => $Torrent['FreeTorrent'] == 1, 'reported' => count(Torrents::get_reports((int) $Torrent['ID'])) > 0, 'time' => $Torrent['Time']);
            }
            $TorrentGroups[] = array('id' => $GroupDetails['GroupID'], 'name' => $GroupDetails['GroupName'], 'year' => $GroupDetails['GroupYear'], 'categoryId' => $GroupDetails['GroupCategoryID'], 'recordLabel' => $GroupDetails['GroupRecordLabel'], 'catalogueNumber' => $GroupDetails['GroupCatalogueNumber'], 'vanityHouse' => $GroupDetails['GroupVanityHouse'], 'tagList' => $GroupDetails['TagList'], 'releaseType' => $GroupDetails['ReleaseType'], 'wikiImage' => $GroupDetails['WikiImage'], 'musicInfo' => $JsonMusicInfo, 'torrents' => $TorrentList);
        }
    }
    $JSON['torrentgroups'] = $TorrentGroups;
} else {
    // artist collage
    $DB->query("\n\t\tSELECT\n\t\t\tca.ArtistID,\n\t\t\tag.Name,\n\t\t\taw.Image\n\t\tFROM collages_artists AS ca\n\t\t\tJOIN artists_group AS ag ON ag.ArtistID=ca.ArtistID\n\t\t\tLEFT JOIN wiki_artists AS aw ON aw.RevisionID = ag.RevisionID\n\t\tWHERE ca.CollageID='{$CollageID}'\n\t\tORDER BY ca.Sort");
    $Artists = array();
    while (list($ArtistID, $ArtistName, $ArtistImage) = $DB->next_record()) {
        $Artists[] = array('id' => (int) $ArtistID, 'name' => $ArtistName, 'image' => $ArtistImage);
    }
    $JSON['artists'] = $Artists;
}
if (isset($SetCache)) {
Exemple #4
0
function generate_torrent_table($Caption, $Tag, $Details, $Limit)
{
    global $LoggedUser, $Categories, $ReleaseTypes, $GroupBy;
    ?>
		<h3>Top <?php 
    echo "{$Limit} {$Caption}";
    if (empty($_GET['advanced'])) {
        ?>
		<small class="top10_quantity_links">
<?php 
        switch ($Limit) {
            case 100:
                ?>
				- <a href="top10.php?details=<?php 
                echo $Tag;
                ?>
" class="brackets">Top 10</a>
				- <span class="brackets">Top 100</span>
				- <a href="top10.php?type=torrents&amp;limit=250&amp;details=<?php 
                echo $Tag;
                ?>
" class="brackets">Top 250</a>
<?php 
                break;
            case 250:
                ?>
				- <a href="top10.php?details=<?php 
                echo $Tag;
                ?>
" class="brackets">Top 10</a>
				- <a href="top10.php?type=torrents&amp;limit=100&amp;details=<?php 
                echo $Tag;
                ?>
" class="brackets">Top 100</a>
				- <span class="brackets">Top 250</span>
<?php 
                break;
            default:
                ?>
				- <span class="brackets">Top 10</span>
				- <a href="top10.php?type=torrents&amp;limit=100&amp;details=<?php 
                echo $Tag;
                ?>
" class="brackets">Top 100</a>
				- <a href="top10.php?type=torrents&amp;limit=250&amp;details=<?php 
                echo $Tag;
                ?>
" class="brackets">Top 250</a>
<?php 
        }
        ?>
		</small>
<?php 
    }
    ?>
		</h3>
	<table class="torrent_table cats numbering border">
	<tr class="colhead">
		<td class="center" style="width: 15px;"></td>
		<td class="cats_col"></td>
		<td>Name</td>
		<td style="text-align: right;">Size</td>
		<td style="text-align: right;">Data</td>
		<td style="text-align: right;" class="sign snatches"><img src="static/styles/<?php 
    echo $LoggedUser['StyleName'];
    ?>
/images/snatched.png" alt="Snatches" title="Snatches" class="tooltip" /></td>
		<td style="text-align: right;" class="sign seeders"><img src="static/styles/<?php 
    echo $LoggedUser['StyleName'];
    ?>
/images/seeders.png" alt="Seeders" title="Seeders" class="tooltip" /></td>
		<td style="text-align: right;" class="sign leechers"><img src="static/styles/<?php 
    echo $LoggedUser['StyleName'];
    ?>
/images/leechers.png" alt="Leechers" title="Leechers" class="tooltip" /></td>
		<td style="text-align: right;">Peers</td>
	</tr>
<?php 
    // Server is already processing a top10 query. Starting another one will make things slow
    if ($Details === false) {
        ?>
		<tr class="rowb">
			<td colspan="9" class="center">
				Server is busy processing another top list request. Please try again in a minute.
			</td>
		</tr>
		</table><br />
<?php 
        return;
    }
    // in the unlikely event that query finds 0 rows...
    if (empty($Details)) {
        ?>
		<tr class="rowb">
			<td colspan="9" class="center">
				Found no torrents matching the criteria.
			</td>
		</tr>
		</table><br />
<?php 
        return;
    }
    $Rank = 0;
    foreach ($Details as $Detail) {
        $GroupIDs[] = $Detail[1];
    }
    $Artists = Artists::get_artists($GroupIDs);
    foreach ($Details as $Detail) {
        list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $WikiImage, $TagsList, $Format, $Encoding, $Media, $Scene, $HasLog, $HasCue, $LogScore, $Year, $GroupYear, $RemasterTitle, $Snatched, $Seeders, $Leechers, $Data, $ReleaseType, $Size) = $Detail;
        $IsBookmarked = Bookmarks::has_bookmarked('torrent', $GroupID);
        $IsSnatched = Torrents::has_snatched($TorrentID);
        // highlight every other row
        $Rank++;
        $Highlight = $Rank % 2 ? 'a' : 'b';
        // generate torrent's title
        $DisplayName = '';
        if (!empty($Artists[$GroupID])) {
            $DisplayName = Artists::display_artists($Artists[$GroupID], true, true);
        }
        $DisplayName .= "<a href=\"torrents.php?id={$GroupID}&amp;torrentid={$TorrentID}\" class=\"tooltip\" title=\"View torrent\" dir=\"ltr\">{$GroupName}</a>";
        if ($GroupCategoryID == 1 && $GroupYear > 0) {
            $DisplayName .= " [{$GroupYear}]";
        }
        if ($GroupCategoryID == 1 && $ReleaseType > 0) {
            $DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']';
        }
        // append extra info to torrent title
        $ExtraInfo = '';
        $AddExtra = '';
        if (empty($GroupBy)) {
            if ($Format) {
                $ExtraInfo .= $Format;
                $AddExtra = ' / ';
            }
            if ($Encoding) {
                $ExtraInfo .= $AddExtra . $Encoding;
                $AddExtra = ' / ';
            }
            // "FLAC / Lossless / Log (100%) / Cue / CD";
            if ($HasLog) {
                $ExtraInfo .= $AddExtra . 'Log (' . $LogScore . '%)';
                $AddExtra = ' / ';
            }
            if ($HasCue) {
                $ExtraInfo .= $AddExtra . 'Cue';
                $AddExtra = ' / ';
            }
            if ($Media) {
                $ExtraInfo .= $AddExtra . $Media;
                $AddExtra = ' / ';
            }
            if ($Scene) {
                $ExtraInfo .= $AddExtra . 'Scene';
                $AddExtra = ' / ';
            }
            if ($Year > 0) {
                $ExtraInfo .= $AddExtra . $Year;
                $AddExtra = ' ';
            }
            if ($RemasterTitle) {
                $ExtraInfo .= $AddExtra . $RemasterTitle;
            }
            if ($IsSnatched) {
                if ($GroupCategoryID == 1) {
                    $ExtraInfo .= ' / ';
                }
                $ExtraInfo .= Format::torrent_label('Snatched!');
            }
            if ($ExtraInfo != '') {
                $ExtraInfo = "- [{$ExtraInfo}]";
            }
        }
        $TorrentTags = new Tags($TagsList);
        //Get report info, use the cache if available, if not, add to it.
        $Reported = false;
        $Reports = Torrents::get_reports($TorrentID);
        if (count($Reports) > 0) {
            $Reported = true;
        }
        // print row
        ?>
	<tr class="torrent row<?php 
        echo $Highlight . ($IsBookmarked ? ' bookmarked' : '') . ($IsSnatched ? ' snatched_torrent' : '');
        ?>
">
		<td style="padding: 8px; text-align: center;"><strong><?php 
        echo $Rank;
        ?>
</strong></td>
		<td class="center cats_col"><div title="<?php 
        echo $TorrentTags->title();
        ?>
" class="tooltip <?php 
        echo Format::css_category($GroupCategoryID);
        ?>
 <?php 
        echo $TorrentTags->css_name();
        ?>
"></div></td>
		<td class="big_info">
<?php 
        if ($LoggedUser['CoverArt']) {
            ?>
			<div class="group_image float_left clear">
				<?php 
            ImageTools::cover_thumb($WikiImage, $GroupCategoryID);
            ?>
			</div>
<?php 
        }
        ?>
			<div class="group_info clear">

				<span><a href="torrents.php?action=download&amp;id=<?php 
        echo $TorrentID;
        ?>
&amp;authkey=<?php 
        echo $LoggedUser['AuthKey'];
        ?>
&amp;torrent_pass=<?php 
        echo $LoggedUser['torrent_pass'];
        ?>
" title="Download" class="brackets tooltip">DL</a></span>

				<strong><?php 
        echo $DisplayName;
        ?>
</strong> <?php 
        echo $ExtraInfo;
        if ($Reported) {
            ?>
 - <strong class="torrent_label tl_reported">Reported</strong><?php 
        }
        if ($IsBookmarked) {
            ?>
				<span class="remove_bookmark float_right">
					<a href="#" id="bookmarklink_torrent_<?php 
            echo $GroupID;
            ?>
" class="bookmarklink_torrent_<?php 
            echo $GroupID;
            ?>
 brackets" onclick="Unbookmark('torrent', <?php 
            echo $GroupID;
            ?>
, 'Bookmark'); return false;">Remove bookmark</a>
				</span>
<?php 
        } else {
            ?>
				<span class="add_bookmark float_right">
					<a href="#" id="bookmarklink_torrent_<?php 
            echo $GroupID;
            ?>
" class="bookmarklink_torrent_<?php 
            echo $GroupID;
            ?>
 brackets" onclick="Bookmark('torrent', <?php 
            echo $GroupID;
            ?>
, 'Remove bookmark'); return false;">Bookmark</a>
				</span>
<?php 
        }
        ?>
				<div class="tags"><?php 
        echo $TorrentTags->format();
        ?>
</div>
			</div>
		</td>
		<td class="number_column nobr"><?php 
        echo Format::get_size($Size);
        ?>
</td>
		<td class="number_column nobr"><?php 
        echo Format::get_size($Data);
        ?>
</td>
		<td class="number_column"><?php 
        echo number_format((double) $Snatched);
        ?>
</td>
		<td class="number_column"><?php 
        echo number_format((double) $Seeders);
        ?>
</td>
		<td class="number_column"><?php 
        echo number_format((double) $Leechers);
        ?>
</td>
		<td class="number_column"><?php 
        echo number_format($Seeders + $Leechers);
        ?>
</td>
	</tr>
<?php 
    }
    //foreach ($Details as $Detail)
    ?>
	</table><br />
<?php 
}
Exemple #5
0
}
list($TorrentDetails, $TorrentList) = $TorrentCache;
$ArtistForm = Artists::get_artist($GroupID);
if ($TorrentDetails['CategoryID'] == 0) {
    $CategoryName = 'Unknown';
} else {
    $CategoryName = $Categories[$TorrentDetails['CategoryID'] - 1];
}
$JsonMusicInfo = array();
if ($CategoryName == 'Music') {
    $JsonMusicInfo = array('composers' => $ArtistForm[4] == null ? array() : pullmediainfo($ArtistForm[4]), 'dj' => $ArtistForm[6] == null ? array() : pullmediainfo($ArtistForm[6]), 'artists' => $ArtistForm[1] == null ? array() : pullmediainfo($ArtistForm[1]), 'with' => $ArtistForm[2] == null ? array() : pullmediainfo($ArtistForm[2]), 'conductor' => $ArtistForm[5] == null ? array() : pullmediainfo($ArtistForm[5]), 'remixedBy' => $ArtistForm[3] == null ? array() : pullmediainfo($ArtistForm[3]), 'producer' => $ArtistForm[7] == null ? array() : pullmediainfo($ArtistForm[7]));
} else {
    $JsonMusicInfo = null;
}
$TagList = explode('|', $TorrentDetails['GROUP_CONCAT(DISTINCT tags.Name SEPARATOR \'|\')']);
$JsonTorrentDetails = array('wikiBody' => Text::full_format($TorrentDetails['WikiBody']), 'wikiImage' => $TorrentDetails['WikiImage'], 'id' => (int) $TorrentDetails['ID'], 'name' => $TorrentDetails['Name'], 'year' => (int) $TorrentDetails['Year'], 'recordLabel' => $TorrentDetails['RecordLabel'], 'catalogueNumber' => $TorrentDetails['CatalogueNumber'], 'releaseType' => (int) $TorrentDetails['ReleaseType'], 'categoryId' => (int) $TorrentDetails['CategoryID'], 'categoryName' => $CategoryName, 'time' => $TorrentDetails['Time'], 'vanityHouse' => $TorrentDetails['VanityHouse'] == 1, 'isBookmarked' => Bookmarks::has_bookmarked('torrent', $GroupID), 'musicInfo' => $JsonMusicInfo, 'tags' => $TagList);
$JsonTorrentList = array();
foreach ($TorrentList as $Torrent) {
    // Convert file list back to the old format
    $FileList = explode("\n", $Torrent['FileList']);
    foreach ($FileList as &$File) {
        $File = Torrents::filelist_old_format($File);
    }
    unset($File);
    $FileList = implode('|||', $FileList);
    $Userinfo = Users::user_info($Torrent['UserID']);
    $Reports = Torrents::get_reports($Torrent['ID']);
    $Torrent['Reported'] = count($Reports) > 0;
    $JsonTorrentList[] = array('id' => (int) $Torrent['ID'], 'media' => $Torrent['Media'], 'format' => $Torrent['Format'], 'encoding' => $Torrent['Encoding'], 'remastered' => $Torrent['Remastered'] == 1, 'remasterYear' => (int) $Torrent['RemasterYear'], 'remasterTitle' => $Torrent['RemasterTitle'], 'remasterRecordLabel' => $Torrent['RemasterRecordLabel'], 'remasterCatalogueNumber' => $Torrent['RemasterCatalogueNumber'], 'scene' => $Torrent['Scene'] == 1, 'hasLog' => $Torrent['HasLog'] == 1, 'hasCue' => $Torrent['HasCue'] == 1, 'logScore' => (int) $Torrent['LogScore'], 'fileCount' => (int) $Torrent['FileCount'], 'size' => (int) $Torrent['Size'], 'seeders' => (int) $Torrent['Seeders'], 'leechers' => (int) $Torrent['Leechers'], 'snatched' => (int) $Torrent['Snatched'], 'freeTorrent' => $Torrent['FreeTorrent'] == 1, 'reported' => $Torrent['Reported'], 'time' => $Torrent['Time'], 'description' => $Torrent['Description'], 'fileList' => $FileList, 'filePath' => $Torrent['FilePath'], 'userId' => (int) $Torrent['UserID'], 'username' => $Userinfo['Username']);
}
json_print("success", array('group' => $JsonTorrentDetails, 'torrents' => $JsonTorrentList));