mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-13 02:46:30 +00:00
Empty commit
This commit is contained in:
parent
910b956b26
commit
5cc951be31
@ -95,16 +95,15 @@ public static function display_artists($Artists, $MakeLink = true, $IncludeHyphe
|
||||
$ampersand = ($Escape) ? ' & ' : ' & ';
|
||||
$link = '';
|
||||
|
||||
$MainArtists = $Artists[1];
|
||||
$Guests = $Artists[2];
|
||||
$Composers = $Artists[4];
|
||||
$Conductors = $Artists[5];
|
||||
$DJs = $Artists[6];
|
||||
$MainArtists = isset($Artists[1]) ? $Artists[1] : null;
|
||||
$Guests = isset($Artists[2]) ? $Artists[2] : null;
|
||||
$Composers = isset($Artists[4]) ? $Artists[4] : null;
|
||||
$Conductors = isset($Artists[5]) ? $Artists[5] : null;
|
||||
$DJs = isset($Artists[6]) ? $Artists[6] : null;
|
||||
|
||||
if ((count($MainArtists) + count($Conductors) + count($DJs) == 0) && (count($Composers) == 0)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Various Composers is not needed and is ugly and should die
|
||||
switch(count($Composers)) {
|
||||
case 0:
|
||||
@ -121,7 +120,7 @@ public static function display_artists($Artists, $MakeLink = true, $IncludeHyphe
|
||||
$link .= ' performed by ';
|
||||
}
|
||||
|
||||
$ComposerStr .= $link;
|
||||
$ComposerStr = $link;
|
||||
|
||||
switch(count($MainArtists)) {
|
||||
case 0:
|
||||
@ -182,7 +181,6 @@ public static function display_artists($Artists, $MakeLink = true, $IncludeHyphe
|
||||
default :
|
||||
$link = 'Various DJs';
|
||||
}
|
||||
|
||||
return $link.($IncludeHyphen?' - ':'');
|
||||
} else {
|
||||
return '';
|
||||
|
@ -24,7 +24,7 @@ class Torrents {
|
||||
* GroupID, Media, Format, Encoding, RemasterYear, Remastered,
|
||||
* RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, Scene,
|
||||
* HasLog, HasCue, LogScore, FileCount, FreeTorrent, Size, Leechers,
|
||||
* Seeders, Snatched, Time, HasFile
|
||||
* Seeders, Snatched, Time, HasFile, PersonalFL
|
||||
* }
|
||||
* }
|
||||
* ExtendedArtists => {
|
||||
@ -57,7 +57,7 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
|
||||
and anywhere else the get_groups function is used.
|
||||
*/
|
||||
|
||||
if (count($NotFound)>0) {
|
||||
if (count($NotFound) > 0) {
|
||||
$DB->query("SELECT
|
||||
g.ID, g.Name, g.Year, g.RecordLabel, g.CatalogueNumber, g.TagList, g.ReleaseType, g.VanityHouse
|
||||
FROM torrents_group AS g WHERE g.ID IN ($IDs)");
|
||||
@ -69,6 +69,13 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
|
||||
$Found[$Group['ID']]['Artists'] = array();
|
||||
}
|
||||
|
||||
// Orphan torrents. There shouldn't ever be any
|
||||
if (count($NotFound) > 0) {
|
||||
foreach (array_keys($NotFound) as $GroupID) {
|
||||
unset($Found[$GroupID]);
|
||||
}
|
||||
}
|
||||
|
||||
if ($Torrents) {
|
||||
$DB->query("SELECT
|
||||
ID, GroupID, Media, Format, Encoding, RemasterYear, Remastered, RemasterTitle,
|
||||
@ -99,21 +106,23 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
|
||||
}
|
||||
|
||||
if ($Return) { // If we're interested in the data, and not just caching it
|
||||
foreach ($Artists as $GroupID=>$Data) {
|
||||
foreach ($Artists as $GroupID => $Data) {
|
||||
if (array_key_exists(1, $Data) || array_key_exists(4, $Data) || array_key_exists(6, $Data)) {
|
||||
$Found[$GroupID]['Artists']=$Data[1]; // Only use main artists (legacy)
|
||||
$Found[$GroupID]['ExtendedArtists'][1]=$Data[1];
|
||||
$Found[$GroupID]['ExtendedArtists'][2]=$Data[2];
|
||||
$Found[$GroupID]['ExtendedArtists'][3]=$Data[3];
|
||||
$Found[$GroupID]['ExtendedArtists'][4]=$Data[4];
|
||||
$Found[$GroupID]['ExtendedArtists'][5]=$Data[5];
|
||||
$Found[$GroupID]['ExtendedArtists'][6]=$Data[6];
|
||||
$Found[$GroupID]['Artists'] = isset($Data[1]) ? $Data[1] : null; // Only use main artists (legacy)
|
||||
for ($i = 1; $i <= 6; $i++) {
|
||||
$Found[$GroupID]['ExtendedArtists'][$i] = isset($Data[$i]) ? $Data[$i] : null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$Found[$GroupID]['ExtendedArtists'] = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch all user specific torrent properties
|
||||
foreach ($Found as &$Group) {
|
||||
if (!empty($Group['Torrents'])) {
|
||||
array_walk($Group['Torrents'], 'self::torrent_properties');
|
||||
}
|
||||
}
|
||||
$Matches = array('matches'=>$Found, 'notfound'=>array_flip($NotFound));
|
||||
|
||||
return $Matches;
|
||||
@ -121,6 +130,17 @@ public static function get_groups($GroupIDs, $Return = true, $GetArtists = true,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Supplements a torrent array with information that only concerns certain users and therefore cannot be cached
|
||||
*
|
||||
* @param array $Torrent torrent array preferably in the form used by Torrents::get_groups() or get_group_info()
|
||||
* @param int $TorrentID
|
||||
*/
|
||||
public static function torrent_properties(&$Torrent, $TorrentID) {
|
||||
$Torrent['PersonalFL'] = empty($Torrent['FreeTorrent']) && self::has_token($TorrentID);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Write to the group log.
|
||||
*
|
||||
@ -417,7 +437,7 @@ public static function torrent_info($Data, $ShowMedia = false, $ShowEdition = fa
|
||||
}
|
||||
if ($Data['FreeTorrent'] == '1') { $Info[]='<strong>Freeleech!</strong>'; }
|
||||
if ($Data['FreeTorrent'] == '2') { $Info[]='<strong>Neutral Leech!</strong>'; }
|
||||
if ($Data['PersonalFL'] == 1) { $Info[]='<strong>Personal Freeleech!</strong>'; }
|
||||
if ($Data['PersonalFL']) { $Info[]='<strong>Personal Freeleech!</strong>'; }
|
||||
return implode(' / ', $Info);
|
||||
}
|
||||
|
||||
@ -477,5 +497,31 @@ public static function freeleech_groups($GroupIDs, $FreeNeutral = 1, $FreeLeechT
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the logged in user has an active freeleech token
|
||||
*
|
||||
* @param int $TorrentID
|
||||
* @return true if an active token exists
|
||||
*/
|
||||
|
||||
public static function has_token($TorrentID) {
|
||||
global $DB, $Cache, $LoggedUser;
|
||||
if (empty($LoggedUser) || empty($LoggedUser['ID'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static $TokenTorrents;
|
||||
$UserID = $LoggedUser['ID'];
|
||||
if (!isset($TokenTorrents)) {
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if ($TokenTorrents === false) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=0");
|
||||
$TokenTorrents = array_fill_keys($DB->collect('TorrentID', false), true);
|
||||
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
|
||||
}
|
||||
}
|
||||
return isset($TokenTorrents[$TorrentID]);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -6,7 +6,7 @@ class Users {
|
||||
* @return array ($Classes, $ClassLevels)
|
||||
*/
|
||||
public static function get_classes() {
|
||||
global $Cache, $DB, $Debug, $UserClassesHidePMs;
|
||||
global $Cache, $DB, $Debug;
|
||||
// Get permissions
|
||||
list($Classes, $ClassLevels) = $Cache->get_value('classes');
|
||||
if (!$Classes || !$ClassLevels) {
|
||||
@ -120,7 +120,6 @@ public static function user_info($UserID) {
|
||||
*/
|
||||
public static function user_heavy_info($UserID) {
|
||||
global $DB, $Cache;
|
||||
//global $Debug;
|
||||
|
||||
$HeavyInfo = $Cache->get_value('user_info_heavy_'.$UserID);
|
||||
|
||||
@ -176,16 +175,13 @@ public static function user_heavy_info($UserID) {
|
||||
$PermittedForums = array();
|
||||
}
|
||||
unset($HeavyInfo['PermittedForums']);
|
||||
//$Debug->log_var($PermittedForums, 'PermittedForums - User');
|
||||
|
||||
$DB->query("SELECT PermissionID FROM users_levels WHERE UserID = $UserID");
|
||||
$PermIDs = $DB->collect('PermissionID');
|
||||
foreach ($PermIDs AS $PermID) {
|
||||
$Perms = Permissions::get_permissions($PermID);
|
||||
if (!empty($Perms['PermittedForums'])) {
|
||||
//$Debug->log_var("'".$Perms['PermittedForums']."'", "PermittedForums - Perm $PermID");
|
||||
$PermittedForums = array_merge($PermittedForums, array_map('trim', explode(',',$Perms['PermittedForums'])));
|
||||
//$Debug->log_var($PermittedForums, "PermittedForums - After Perm $PermID");
|
||||
}
|
||||
}
|
||||
$Perms = Permissions::get_permissions($HeavyInfo['PermissionID']);
|
||||
@ -193,7 +189,6 @@ public static function user_heavy_info($UserID) {
|
||||
if (!empty($Perms['PermittedForums'])) {
|
||||
$PermittedForums = array_merge($PermittedForums, array_map('trim', explode(',',$Perms['PermittedForums'])));
|
||||
}
|
||||
//$Debug->log_var($PermittedForums, 'PermittedForums - Done');
|
||||
|
||||
if (!empty($PermittedForums) || !empty($RestrictedForums)) {
|
||||
$HeavyInfo['CustomForums'] = array();
|
||||
@ -206,7 +201,6 @@ public static function user_heavy_info($UserID) {
|
||||
} else {
|
||||
$HeavyInfo['CustomForums'] = null;
|
||||
}
|
||||
//$Debug->log_var($HeavyInfo['CustomForums'], 'CustomForums');
|
||||
|
||||
$HeavyInfo['SiteOptions'] = unserialize($HeavyInfo['SiteOptions']);
|
||||
if (!empty($HeavyInfo['SiteOptions'])) {
|
||||
|
@ -15,13 +15,6 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
return "torrents.php?order_way=".$NewWay."&order_by=".$SortKey."&".Format::get_url(array('order_way','order_by'));
|
||||
}
|
||||
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
|
||||
}
|
||||
|
||||
// Setting default search options
|
||||
if(!empty($_GET['setdefault'])) {
|
||||
$UnsetList = array('page','setdefault');
|
||||
@ -490,10 +483,6 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
$FirstUnknown = !isset($FirstUnknown);
|
||||
}
|
||||
|
||||
if (in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent'])) {
|
||||
$Data['PersonalFL'] = 1;
|
||||
}
|
||||
|
||||
if($CategoryID == 1 && ($Data['RemasterTitle'] != $LastRemasterTitle || $Data['RemasterYear'] != $LastRemasterYear ||
|
||||
$Data['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Data['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber) || $FirstUnknown || $Data['Media'] != $LastMedia) {
|
||||
$EditionID++;
|
||||
@ -548,10 +537,10 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
'leechers' => (int) $Data['Leechers'],
|
||||
'isFreeleech' => $Data['FreeTorrent'] == '1',
|
||||
'isNeutralLeech' => $Data['FreeTorrent'] == '2',
|
||||
'isPersonalFreeleech' => in_array($TorrentID, $TokenTorrents),
|
||||
'isPersonalFreeleech' => $Data['PersonalFL'],
|
||||
'canUseToken' => ($LoggedUser['FLTokens'] > 0)
|
||||
&& $Data['HasFile'] && ($Data['Size'] < 1073741824)
|
||||
&& !in_array($TorrentID, $TokenTorrents)
|
||||
&& !$Data['PersonalFL']
|
||||
&& empty($Data['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')
|
||||
);
|
||||
}
|
||||
@ -592,10 +581,10 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
'leechers' => (int) $TotalLeechers,
|
||||
'isFreeleech' => $Data['FreeTorrent'] == '1',
|
||||
'isNeutralLeech' => $Data['FreeTorrent'] == '2',
|
||||
'isPersonalFreeleech' => in_array($TorrentID, $TokenTorrents),
|
||||
'isPersonalFreeleech' => $Data['PersonalFL'],
|
||||
'canUseToken' => ($LoggedUser['FLTokens'] > 0)
|
||||
&& $Data['HasFile'] && ($Data['Size'] < 1073741824)
|
||||
&& !in_array($TorrentID, $TokenTorrents)
|
||||
&& !$Data['PersonalFL']
|
||||
&& empty($Data['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')
|
||||
);
|
||||
}
|
||||
|
@ -14,13 +14,6 @@
|
||||
define('NOTIFICATIONS_PER_PAGE', 50);
|
||||
list($Page,$Limit) = Format::page_limit(NOTIFICATIONS_PER_PAGE);
|
||||
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$LoggedUser['ID']);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$LoggedUser[ID] AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
$Cache->cache_value('users_tokens_'.$LoggedUser['ID'], $TokenTorrents);
|
||||
}
|
||||
|
||||
$Results = $DB->query("SELECT SQL_CALC_FOUND_ROWS unt.TorrentID, unt.UnRead, unt.FilterID, unf.Label, t.GroupID
|
||||
FROM users_notify_torrents AS unt
|
||||
JOIN torrents AS t ON t.ID = unt.TorrentID
|
||||
|
@ -14,11 +14,7 @@
|
||||
if ($GroupID == 0) { error('bad id parameter', true); }
|
||||
|
||||
$TorrentCache = get_group_info($GroupID, true, 0);
|
||||
|
||||
// http://stackoverflow.com/questions/4260086/php-how-to-use-array-filter-to-filter-array-keys
|
||||
function filter_by_key($input, $keys) { return array_intersect_key($input, array_flip($keys)); }
|
||||
|
||||
$TorrentDetails = filter_by_key($TorrentCache[0][0], $GroupAllowed);
|
||||
list($TorrentDetails, $TorrentList) = $TorrentCache;
|
||||
|
||||
$ArtistForm = Artists::get_artist($GroupID);
|
||||
if($TorrentDetails['CategoryID'] == 0) {
|
||||
@ -57,10 +53,7 @@ function filter_by_key($input, $keys) { return array_intersect_key($input, array
|
||||
'vanityHouse' => $TorrentDetails['VanityHouse'] == 1,
|
||||
'musicInfo' => $JsonMusicInfo
|
||||
);
|
||||
$TorrentList = array();
|
||||
foreach ($TorrentCache[1] as $Torrent) {
|
||||
$TorrentList[] = filter_by_key($Torrent, $TorrentAllowed);
|
||||
}
|
||||
|
||||
$JsonTorrentList = array();
|
||||
foreach ($TorrentList as $Torrent) {
|
||||
$JsonTorrentList[] = array(
|
||||
|
@ -61,13 +61,6 @@ function compare($X, $Y){
|
||||
list($Name, $Image, $Body, $VanityHouseArtist) = $DB->next_record(MYSQLI_NUM, array(0));
|
||||
}
|
||||
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
|
||||
}
|
||||
|
||||
//----------------- Build list and get stats
|
||||
|
||||
ob_start();
|
||||
@ -388,10 +381,6 @@ function compare($X, $Y){
|
||||
$FirstUnknown = !isset($FirstUnknown);
|
||||
}
|
||||
|
||||
if (in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent'])) {
|
||||
$Torrent['PersonalFL'] = 1;
|
||||
}
|
||||
|
||||
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
|
||||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
|
||||
|
||||
@ -438,7 +427,7 @@ function compare($X, $Y){
|
||||
<span>
|
||||
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download"><?=$Torrent['HasFile'] ? 'DL' : 'Missing'?></a>
|
||||
<? if (($LoggedUser['FLTokens'] > 0) && ($Torrent['Size'] < 1073741824)
|
||||
&& !in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
&& !$Torrent['PersonalFL'] && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||
<? } ?> ]
|
||||
</span>
|
||||
|
@ -17,7 +17,7 @@
|
||||
$Query = '@format FLAC @encoding '.$List;
|
||||
|
||||
if(!empty($_GET['search'])) {
|
||||
$Query.=' @(groupname,artistname,yearfulltext) '.$SS->escape_string($_GET['search']);
|
||||
$Query.=' @(groupname,artistname,yearfulltext,taglist) '.$SS->escape_string($_GET['search']);
|
||||
}
|
||||
|
||||
$SS->SetFilter('logscore', array(100));
|
||||
|
@ -50,13 +50,6 @@ function compare($X, $Y){
|
||||
}
|
||||
}
|
||||
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
|
||||
}
|
||||
|
||||
$Title = ($Sneaky)?"$Username's bookmarked torrents":'Your bookmarked torrents';
|
||||
|
||||
// Loop through the result set, building up $Collage and $TorrentTable
|
||||
@ -156,10 +149,6 @@ function compare($X, $Y){
|
||||
$FirstUnknown = !isset($FirstUnknown);
|
||||
}
|
||||
|
||||
if (in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent'])) {
|
||||
$Torrent['PersonalFL'] = 1;
|
||||
}
|
||||
|
||||
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
|
||||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
|
||||
|
||||
@ -205,7 +194,7 @@ function compare($X, $Y){
|
||||
<td colspan="3">
|
||||
<span>[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
|
||||
<? if (($LoggedUser['FLTokens'] > 0) && ($Torrent['Size'] < 1073741824)
|
||||
&& !in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
&& !$Torrent['PersonalFL'] && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||
<? } ?>
|
||||
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a> ]
|
||||
@ -225,10 +214,10 @@ function compare($X, $Y){
|
||||
list($TorrentID, $Torrent) = each($Torrents);
|
||||
|
||||
$DisplayName = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||
|
||||
|
||||
if(!empty($Torrent['FreeTorrent'])) {
|
||||
$DisplayName .=' <strong>Freeleech!</strong>';
|
||||
} elseif(in_array($TorrentID, $TokenTorrents)) {
|
||||
$DisplayName .=' <strong>Freeleech!</strong>';
|
||||
} elseif($Torrent['PersonalFL']) {
|
||||
$DisplayName .= '<strong>Personal Freeleech!</strong>';
|
||||
}
|
||||
?>
|
||||
@ -242,7 +231,7 @@ function compare($X, $Y){
|
||||
<span>
|
||||
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
|
||||
<? if (($LoggedUser['FLTokens'] > 0) && ($Torrent['Size'] < 1073741824)
|
||||
&& !in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
&& !$Torrent['PersonalFL'] && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||
<? } ?>
|
||||
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a> ]
|
||||
|
@ -16,13 +16,6 @@ function compare($X, $Y){
|
||||
$CollageID = $_GET['id'];
|
||||
if(!is_number($CollageID)) { error(0); }
|
||||
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
|
||||
}
|
||||
|
||||
$Data = $Cache->get_value('collage_'.$CollageID);
|
||||
|
||||
if($Data) {
|
||||
@ -202,10 +195,6 @@ function compare($X, $Y){
|
||||
$FirstUnknown = !isset($FirstUnknown);
|
||||
}
|
||||
|
||||
if (in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent'])) {
|
||||
$Torrent['PersonalFL'] = 1;
|
||||
}
|
||||
|
||||
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
|
||||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $FirstUnknown || $Torrent['Media'] != $LastMedia) {
|
||||
$EditionID++;
|
||||
@ -250,7 +239,7 @@ function compare($X, $Y){
|
||||
<span>
|
||||
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
|
||||
<? if (($LoggedUser['FLTokens'] > 0) && ($Torrent['Size'] < 1073741824)
|
||||
&& !in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
&& !$Torrent['PersonalFL'] && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||
<? } ?>
|
||||
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a> ]
|
||||
@ -270,10 +259,10 @@ function compare($X, $Y){
|
||||
list($TorrentID, $Torrent) = each($Torrents);
|
||||
|
||||
$DisplayName = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||
|
||||
|
||||
if(!empty($Torrent['FreeTorrent'])) {
|
||||
$DisplayName .=' <strong>Freeleech!</strong>';
|
||||
} elseif(in_array($TorrentID, $TokenTorrents)) {
|
||||
$DisplayName .=' <strong>Freeleech!</strong>';
|
||||
} elseif($Torrent['PersonalFL']) {
|
||||
$DisplayName .= $AddExtra.'<strong>Personal Freeleech!</strong>';
|
||||
}
|
||||
?>
|
||||
@ -287,7 +276,7 @@ function compare($X, $Y){
|
||||
<span>
|
||||
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
|
||||
<? if (($LoggedUser['FLTokens'] > 0) && ($Torrent['Size'] < 1073741824)
|
||||
&& !in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
&& !$Torrent['PersonalFL'] && empty($Torrent['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||
<? } ?>
|
||||
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a> ]
|
||||
|
@ -288,7 +288,7 @@
|
||||
<p><strong><?=display_str($Question)?></strong></p>
|
||||
<? if ($UserResponse !== null || $Closed) { ?>
|
||||
<ul class="poll nobullet">
|
||||
<? for ($i = 1, $il = count($Answers); $i <= $il; $i++) {
|
||||
<? foreach ($Answers as $i => $Answer) {
|
||||
if ($TotalVotes > 0) {
|
||||
$Ratio = $Votes[$i]/$MaxVotes;
|
||||
$Percent = $Votes[$i]/$TotalVotes;
|
||||
@ -312,7 +312,7 @@
|
||||
<input type="hidden" name="action" value="poll" />
|
||||
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
|
||||
<input type="hidden" name="topicid" value="<?=$TopicID?>" />
|
||||
<? for ($i = 1, $il = count($Answers); $i <= $il; $i++) { ?>
|
||||
<? foreach ($Answers as $i => $Answer) { ?>
|
||||
<input type="radio" name="vote" id="answer_<?=$i?>" value="<?=$i?>" />
|
||||
<label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
|
||||
<? } ?>
|
||||
|
@ -35,13 +35,6 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
return "torrents.php?order_way=".$NewWay."&order_by=".$SortKey."&".Format::get_url(array('order_way','order_by'));
|
||||
}
|
||||
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
|
||||
}
|
||||
|
||||
// Search by infohash
|
||||
if(!empty($_GET['searchstr']) || !empty($_GET['groupname'])) {
|
||||
if(!empty($_GET['searchstr'])) {
|
||||
@ -126,6 +119,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
}
|
||||
|
||||
// Collect all entered search terms to find out whether to enable the NOT operator
|
||||
$SearchWords = array();
|
||||
foreach(array('artistname','groupname', 'recordlabel', 'cataloguenumber',
|
||||
'remastertitle', 'remasteryear', 'remasterrecordlabel', 'remastercataloguenumber',
|
||||
'encoding', 'format', 'media', 'taglist') as $Search) {
|
||||
@ -749,8 +743,11 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
<?
|
||||
// Start printing torrent list
|
||||
|
||||
foreach($Results as $GroupID=>$Data) {
|
||||
list($Artists, $GroupCatalogueNumber, $ExtendedArtists, $GroupID2, $GroupName, $GroupRecordLabel, $ReleaseType, $TagList, $Torrents, $GroupVanityHouse, $GroupYear, $CategoryID, $FreeTorrent, $HasCue, $HasLog, $TotalLeechers, $LogScore, $ReleaseType, $ReleaseType, $TotalSeeders, $MaxSize, $TotalSnatched, $GroupTime) = array_values($Data);
|
||||
foreach($Results as $GroupID => $Data) {
|
||||
list($Artists, $GroupCatalogueNumber, $ExtendedArtists, $GroupID2, $GroupName, $GroupRecordLabel,
|
||||
$ReleaseType, $TagList, $Torrents, $GroupVanityHouse, $GroupYear, $CategoryID, $FreeTorrent,
|
||||
$HasCue, $HasLog, $TotalLeechers, $LogScore, $ReleaseType, $ReleaseType, $TotalSeeders,
|
||||
$MaxSize, $TotalSnatched, $GroupTime) = array_values($Data);
|
||||
|
||||
$TagList = explode(' ',str_replace('_','.',$TagList));
|
||||
|
||||
@ -815,7 +812,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
$LastMedia = '';
|
||||
|
||||
$EditionID = 0;
|
||||
unset($FirstUnknown);
|
||||
$FirstUnknown = null;
|
||||
|
||||
foreach($Torrents as $TorrentID => $Data) {
|
||||
// All of the individual torrents in the group
|
||||
@ -914,10 +911,6 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
$FirstUnknown = !isset($FirstUnknown);
|
||||
}
|
||||
|
||||
if (in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent'])) {
|
||||
$Data['PersonalFL'] = 1;
|
||||
}
|
||||
|
||||
if($CategoryID == 1 && ($Data['RemasterTitle'] != $LastRemasterTitle || $Data['RemasterYear'] != $LastRemasterYear ||
|
||||
$Data['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Data['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber) || $FirstUnknown || $Data['Media'] != $LastMedia) {
|
||||
$EditionID++;
|
||||
@ -964,7 +957,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
<span>
|
||||
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download"><?=$Data['HasFile'] ? 'DL' : 'Missing'?></a>
|
||||
<? if (($LoggedUser['FLTokens'] > 0) && $Data['HasFile'] && ($Data['Size'] < 1073741824)
|
||||
&& !in_array($TorrentID, $TokenTorrents) && empty($Data['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
&& !$Data['PersonalFL'] && empty($Data['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
| <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||
<? } ?>
|
||||
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a> ]
|
||||
@ -986,12 +979,13 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
list($TorrentID, $Data) = each($Torrents);
|
||||
|
||||
$DisplayName = '<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
|
||||
if($Data['FreeTorrent'] == '1') {
|
||||
|
||||
if ($Data['FreeTorrent'] == '1') {
|
||||
$DisplayName .= ' <strong>Freeleech!</strong>';
|
||||
} elseif($Data['FreeTorrent'] == '2') {
|
||||
} elseif ($Data['FreeTorrent'] == '2') {
|
||||
$DisplayName .= ' <strong>Neutral Leech!</strong>';
|
||||
} elseif(in_array($TorrentID, $TokenTorrents)) {
|
||||
$DisplayName .= $AddExtra.'<strong>Personal Freeleech!</strong>';
|
||||
} elseif ($Data['PersonalFL']) {
|
||||
$DisplayName .= $AddExtra.' <strong>Personal Freeleech!</strong>';
|
||||
}
|
||||
?>
|
||||
<tr class="torrent">
|
||||
@ -1003,7 +997,7 @@ function header_link($SortKey,$DefaultWay="desc") {
|
||||
<span>
|
||||
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
|
||||
<? if (($LoggedUser['FLTokens'] > 0) && $Data['HasFile'] && ($Data['Size'] < 1073741824)
|
||||
&& !in_array($TorrentID, $TokenTorrents) && empty($Data['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
&& !$Data['PersonalFL'] && empty($Data['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||
<? } ?>
|
||||
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a> ]
|
||||
|
@ -2,12 +2,19 @@
|
||||
$TorrentID = $_GET['torrentid'];
|
||||
if (!$TorrentID || !is_number($TorrentID)) { error(404); }
|
||||
|
||||
|
||||
|
||||
$DB->query("SELECT t.UserID, t.Time, COUNT(x.uid) FROM torrents AS t LEFT JOIN xbt_snatched AS x ON x.fid=t.ID WHERE t.ID=".$TorrentID." GROUP BY t.UserID");
|
||||
|
||||
if($DB->record_count() < 1) {
|
||||
error('Torrent already deleted.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
list($UserID, $Time, $Snatches) = $DB->next_record();
|
||||
|
||||
|
||||
if ($LoggedUser['ID']!=$UserID && !check_perms('torrents_delete')) {
|
||||
error(403);
|
||||
}
|
||||
@ -24,6 +31,7 @@
|
||||
error('You can no longer delete this torrent as it has been snatched by 5 or more users. If you believe there is a problem with the torrent please report it instead.');
|
||||
}
|
||||
|
||||
|
||||
View::show_header('Delete torrent', 'reportsv2');
|
||||
?>
|
||||
<div class="thin center">
|
||||
|
@ -20,13 +20,14 @@ function compare($X, $Y){
|
||||
|
||||
include(SERVER_ROOT.'/sections/torrents/functions.php');
|
||||
$TorrentCache = get_group_info($GroupID, true, $RevisionID);
|
||||
|
||||
$TorrentDetails = $TorrentCache[0];
|
||||
$TorrentList = $TorrentCache[1];
|
||||
|
||||
// Group details
|
||||
list($WikiBody, $WikiImage, $GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $ReleaseType, $GroupCategoryID,
|
||||
$GroupTime, $GroupVanityHouse, $TorrentTags, $TorrentTagIDs, $TorrentTagUserIDs, $TagPositiveVotes, $TagNegativeVotes) = array_shift($TorrentDetails);
|
||||
list($WikiBody, $WikiImage, $GroupID, $GroupName, $GroupYear,
|
||||
$GroupRecordLabel, $GroupCatalogueNumber, $ReleaseType, $GroupCategoryID,
|
||||
$GroupTime, $GroupVanityHouse, $TorrentTags, $TorrentTagIDs, $TorrentTagUserIDs,
|
||||
$TagPositiveVotes, $TagNegativeVotes) = array_values($TorrentDetails);
|
||||
|
||||
$DisplayName=$GroupName;
|
||||
$AltName=$GroupName; // Goes in the alt text of the image
|
||||
@ -79,13 +80,6 @@ function compare($X, $Y){
|
||||
die();
|
||||
}*/
|
||||
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
|
||||
}
|
||||
|
||||
// Start output
|
||||
View::show_header($Title,'browse,comments,torrent,bbcode');
|
||||
?>
|
||||
@ -387,16 +381,20 @@ function filelist($Str) {
|
||||
$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,
|
||||
//(bad tags), (bad folders), (bad filenames), (cassette approved), (lossy master approved), (lossy web approved), t.LastReseedRequest, LogInDB
|
||||
|
||||
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,
|
||||
$BadTags, $BadFolders, $BadFiles, $CassetteApproved, $LossymasterApproved, $LossywebApproved, $LastReseedRequest, $LogInDB, $HasFile) = $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, (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, $BadTags, $BadFolders, $BadFiles,
|
||||
$CassetteApproved, $LossymasterApproved, $LossywebApproved, $LastReseedRequest,
|
||||
$LogInDB, $HasFile, $PersonalFL) = array_values($Torrent);
|
||||
|
||||
if($Remastered && !$RemasterYear) {
|
||||
$FirstUnknown = !isset($FirstUnknown);
|
||||
@ -417,7 +415,7 @@ function filelist($Str) {
|
||||
AND Status != 'Resolved'");
|
||||
$Reports = $DB->to_array();
|
||||
$Cache->cache_value('reports_torrent_'.$TorrentID, $Reports, 0);
|
||||
}
|
||||
}
|
||||
if(count($Reports) > 0) {
|
||||
$Reported = true;
|
||||
include(SERVER_ROOT.'/sections/reportsv2/array.php');
|
||||
@ -467,7 +465,7 @@ function filelist($Str) {
|
||||
}
|
||||
if($FreeTorrent == '1') { $ExtraInfo.=$AddExtra.'<strong>Freeleech!</strong>'; $AddExtra=' / '; }
|
||||
if($FreeTorrent == '2') { $ExtraInfo.=$AddExtra.'<strong>Neutral Leech!</strong>'; $AddExtra=' / '; }
|
||||
if(in_array($TorrentID, $TokenTorrents)) { $ExtraInfo.=$AddExtra.'<strong>Personal Freeleech!</strong>'; $AddExtra=' / '; }
|
||||
if($PersonalFL) { $ExtraInfo.=$AddExtra.'<strong>Personal Freeleech!</strong>'; $AddExtra=' / '; }
|
||||
if($Reported) { $ExtraInfo.=$AddExtra.'<strong>Reported</strong>'; $AddExtra=' / '; }
|
||||
if(!empty($BadTags)) { $ExtraInfo.=$AddExtra.'<strong>Bad Tags</strong>'; $AddExtra=' / '; }
|
||||
if(!empty($BadFolders)) { $ExtraInfo.=$AddExtra.'<strong>Bad Folders</strong>'; $AddExtra=' / '; }
|
||||
@ -527,7 +525,7 @@ function filelist($Str) {
|
||||
<td>
|
||||
<span>[ <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download"><?=$HasFile ? 'DL' : 'Missing'?></a>
|
||||
<? if (($LoggedUser['FLTokens'] > 0) && $HasFile && ($Size < 1073741824)
|
||||
&& !in_array($TorrentID, $TokenTorrents) && ($FreeTorrent == '0') && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
&& !$PersonalFL && ($FreeTorrent == '0') && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
| <a href="torrents.php?action=download&id=<?=$TorrentID ?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||
<? } ?>
|
||||
| <a href="reportsv2.php?action=report&id=<?=$TorrentID?>" title="Report">RP</a>
|
||||
|
@ -82,13 +82,8 @@
|
||||
}
|
||||
|
||||
// First make sure this isn't already FL, and if it is, do nothing
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
}
|
||||
|
||||
if (!in_array($TorrentID, $TokenTorrents)) {
|
||||
if (!Torrents::has_token($TorrentID)) {
|
||||
if ($FLTokens <= 0) {
|
||||
error("You do not have any freeleech tokens left. Please use the regular DL link.");
|
||||
}
|
||||
@ -101,15 +96,7 @@
|
||||
error("Sorry! An error occurred while trying to register your token. Most often, this is due to the tracker being down or under heavy load. Please try again later.");
|
||||
}
|
||||
|
||||
// We need to fetch and check this again here because of people
|
||||
// double-clicking the FL link while waiting for a tracker response.
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
}
|
||||
|
||||
if (!in_array($TorrentID, $TokenTorrents)) {
|
||||
if (!Torrents::has_token($TorrentID)) {
|
||||
$DB->query("INSERT INTO users_freeleeches (UserID, TorrentID, Time) VALUES ($UserID, $TorrentID, NOW())
|
||||
ON DUPLICATE KEY UPDATE Time=VALUES(Time), Expired=FALSE, Uses=Uses+1");
|
||||
$DB->query("UPDATE users_main SET FLTokens = FLTokens - 1 WHERE ID=$UserID");
|
||||
@ -122,8 +109,7 @@
|
||||
$Cache->update_row(false, array('FLTokens'=>($FLTokens - 1)));
|
||||
$Cache->commit_transaction(0);
|
||||
|
||||
$TokenTorrents[] = $TorrentID;
|
||||
$Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
|
||||
$Cache->delete_value('users_tokens_'.$UserID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,21 +3,21 @@
|
||||
|
||||
function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
|
||||
global $Cache, $DB;
|
||||
if(!$RevisionID) {
|
||||
if (!$RevisionID) {
|
||||
$TorrentCache=$Cache->get_value('torrents_details_'.$GroupID);
|
||||
}
|
||||
|
||||
if($RevisionID || !is_array($TorrentCache)) {
|
||||
|
||||
if ($RevisionID || !is_array($TorrentCache) || isset($TorrentCache[0][0])) {
|
||||
// Fetch the group details
|
||||
|
||||
$SQL = "SELECT ";
|
||||
|
||||
if(!$RevisionID) {
|
||||
$SQL.="
|
||||
if (!$RevisionID) {
|
||||
$SQL .= "
|
||||
g.WikiBody,
|
||||
g.WikiImage, ";
|
||||
} else {
|
||||
$SQL.="
|
||||
$SQL .= "
|
||||
w.Body,
|
||||
w.Image, ";
|
||||
}
|
||||
@ -41,17 +41,17 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
|
||||
LEFT JOIN torrents_tags AS tt ON tt.GroupID=g.ID
|
||||
LEFT JOIN tags ON tags.ID=tt.TagID";
|
||||
|
||||
if($RevisionID) {
|
||||
$SQL.="
|
||||
if ($RevisionID) {
|
||||
$SQL .= "
|
||||
LEFT JOIN wiki_torrents AS w ON w.PageID='".db_string($GroupID)."' AND w.RevisionID='".db_string($RevisionID)."' ";
|
||||
}
|
||||
|
||||
$SQL .="
|
||||
$SQL .= "
|
||||
WHERE g.ID='".db_string($GroupID)."'
|
||||
GROUP BY NULL";
|
||||
|
||||
$DB->query($SQL);
|
||||
$TorrentDetails=$DB->to_array();
|
||||
$TorrentDetails = $DB->next_record(MYSQLI_ASSOC);
|
||||
|
||||
// Fetch the individual torrents
|
||||
|
||||
@ -82,12 +82,12 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
|
||||
t.FilePath,
|
||||
t.UserID,
|
||||
t.last_action,
|
||||
tbt.TorrentID,
|
||||
tbf.TorrentID,
|
||||
tfi.TorrentID,
|
||||
ca.TorrentID,
|
||||
lma.TorrentID,
|
||||
lwa.TorrentID,
|
||||
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
|
||||
@ -103,27 +103,30 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
|
||||
GROUP BY t.ID
|
||||
ORDER BY t.Remastered ASC, (t.RemasterYear <> 0) DESC, t.RemasterYear ASC, t.RemasterTitle ASC, t.RemasterRecordLabel ASC, t.RemasterCatalogueNumber ASC, t.Media ASC, t.Format, t.Encoding, t.ID");
|
||||
|
||||
$TorrentList = $DB->to_array();
|
||||
if(count($TorrentList) == 0) {
|
||||
$TorrentList = $DB->to_array('ID', MYSQLI_ASSOC);
|
||||
if (count($TorrentList) == 0) {
|
||||
header("Location: log.php?search=Torrent+$GroupID");
|
||||
die();
|
||||
}
|
||||
if(in_array(0, $DB->collect('Seeders'))) {
|
||||
if (in_array(0, $DB->collect('Seeders'))) {
|
||||
$CacheTime = 600;
|
||||
} else {
|
||||
$CacheTime = 3600;
|
||||
}
|
||||
// Store it all in cache
|
||||
if(!$RevisionID) {
|
||||
$Cache->cache_value('torrents_details_'.$GroupID,array($TorrentDetails,$TorrentList),$CacheTime);
|
||||
if (!$RevisionID) {
|
||||
$Cache->cache_value('torrents_details_'.$GroupID, array($TorrentDetails, $TorrentList), $CacheTime);
|
||||
}
|
||||
} else { // If we're reading from cache
|
||||
$TorrentDetails=$TorrentCache[0];
|
||||
$TorrentList=$TorrentCache[1];
|
||||
$TorrentDetails = $TorrentCache[0];
|
||||
$TorrentList = $TorrentCache[1];
|
||||
}
|
||||
|
||||
if($Return) {
|
||||
return array($TorrentDetails,$TorrentList);
|
||||
// Fetch all user specific torrent properties
|
||||
array_walk($TorrentList, 'Torrents::torrent_properties');
|
||||
|
||||
if ($Return) {
|
||||
return array($TorrentDetails, $TorrentList);
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,6 +147,9 @@ function set_torrent_logscore($TorrentID) {
|
||||
}
|
||||
|
||||
function get_group_requests($GroupID) {
|
||||
if (empty($GroupID) || !is_number($GroupID)) {
|
||||
return array();
|
||||
}
|
||||
global $DB, $Cache;
|
||||
|
||||
$Requests = $Cache->get_value('requests_group_'.$GroupID);
|
||||
|
@ -4,13 +4,6 @@
|
||||
define('NOTIFICATIONS_PER_PAGE', 50);
|
||||
list($Page,$Limit) = Format::page_limit(NOTIFICATIONS_PER_PAGE);
|
||||
|
||||
$TokenTorrents = $Cache->get_value('users_tokens_'.$LoggedUser['ID']);
|
||||
if (empty($TokenTorrents)) {
|
||||
$DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$LoggedUser[ID] AND Expired=FALSE");
|
||||
$TokenTorrents = $DB->collect('TorrentID');
|
||||
$Cache->cache_value('users_tokens_'.$LoggedUser['ID'], $TokenTorrents);
|
||||
}
|
||||
|
||||
|
||||
$UserID = $LoggedUser['ID'];
|
||||
|
||||
@ -101,13 +94,11 @@
|
||||
foreach($FilterResults as $Result) {
|
||||
$TorrentID = $Result['TorrentID'];
|
||||
$GroupID = $Result['GroupID'];
|
||||
$GroupCategoryID = $GroupCategoryIDs[$GroupID]['CategoryID'];
|
||||
|
||||
$GroupInfo = $TorrentGroups[$Result['GroupID']];
|
||||
if(!$TorrentInfo = $GroupInfo['Torrents'][$TorrentID]) {
|
||||
if(!isset($GroupInfo['Torrents'][$TorrentID]) || !isset($GroupInfo['ID'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$TorrentInfo = $GroupInfo['Torrents'][$TorrentID];
|
||||
// generate torrent's title
|
||||
$DisplayName = '';
|
||||
if(!empty($GroupInfo['ExtendedArtists'])) {
|
||||
@ -115,6 +106,7 @@
|
||||
}
|
||||
$DisplayName .= "<a href='torrents.php?id=$GroupID&torrentid=$TorrentID#torrent$TorrentID' title='View Torrent'>".$GroupInfo['Name']."</a>";
|
||||
|
||||
$GroupCategoryID = $GroupCategoryIDs[$GroupID]['CategoryID'];
|
||||
if($GroupCategoryID == 1) {
|
||||
if($GroupInfo['Year'] > 0) {
|
||||
$DisplayName .= " [$GroupInfo[Year]]";
|
||||
@ -152,7 +144,7 @@
|
||||
<span>
|
||||
[ <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>
|
||||
<? if (($LoggedUser['FLTokens'] > 0) && ($TorrentInfo['Size'] < 1073741824)
|
||||
&& !in_array($TorrentID, $TokenTorrents) && empty($TorrentInfo['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
&& !$TorrentInfo['PersonalFL'] && empty($TorrentInfo['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')) { ?>
|
||||
| <a href="torrents.php?action=download&id=<?=$TorrentID?>&authkey=<?=$LoggedUser['AuthKey']?>&torrent_pass=<?=$LoggedUser['torrent_pass']?>&usetoken=1" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
|
||||
<? } ?>
|
||||
| <a href="#" onclick="Clear(<?=$TorrentID?>);return false;" title="Remove from notifications list">CL</a> ]
|
||||
|
@ -37,8 +37,8 @@
|
||||
$VanityHouse = 0;
|
||||
}
|
||||
|
||||
if($GroupInfo = $Cache->get_value('torrents_details_'.$GroupID)) {
|
||||
$GroupCategoryID = $GroupInfo[0][0]['CategoryID'];
|
||||
if(($GroupInfo = $Cache->get_value('torrents_details_'.$GroupID)) && !isset($GroupInfo[0][0])) {
|
||||
$GroupCategoryID = $GroupInfo[0]['CategoryID'];
|
||||
} else {
|
||||
$DB->query("SELECT CategoryID FROM torrents_group WHERE ID='$GroupID'");
|
||||
list($GroupCategoryID) = $DB->next_record();
|
||||
|
Loading…
Reference in New Issue
Block a user