Empty commit

This commit is contained in:
Git 2012-02-09 08:00:20 +00:00
parent 096ad190af
commit a6e79bbfe2
15 changed files with 211 additions and 118 deletions

View File

@ -5,23 +5,22 @@
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); include(SERVER_ROOT.'/sections/bookmarks/functions.php');
include(SERVER_ROOT.'/sections/torrents/functions.php'); include(SERVER_ROOT.'/sections/torrents/functions.php');
// Search by infohash // The "order by x" links on columns headers
if(!empty($_GET['searchstr']) || !empty($_GET['groupname'])) { function header_link($SortKey,$DefaultWay="desc") {
if(!empty($_GET['searchstr'])) { global $OrderBy,$OrderWay;
$InfoHash = $_GET['searchstr']; if($SortKey==$OrderBy) {
} else { if($OrderWay=="desc") { $NewWay="asc"; }
$InfoHash = $_GET['groupname']; else { $NewWay="desc"; }
} } else { $NewWay=$DefaultWay; }
if($InfoHash = is_valid_torrenthash($InfoHash)) { return "torrents.php?order_way=".$NewWay."&order_by=".$SortKey."&".get_url(array('order_way','order_by'));
$InfoHash = db_string(pack("H*", $InfoHash)); }
$DB->query("SELECT ID,GroupID FROM torrents WHERE info_hash='$InfoHash'");
if($DB->record_count() > 0) { $TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
list($ID, $GroupID) = $DB->next_record(); if (empty($TokenTorrents)) {
header('Location: torrents.php?id='.$GroupID.'&torrentid='.$ID); $DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
die(); $TokenTorrents = $DB->collect('TorrentID');
} $Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
}
} }
// Setting default search options // Setting default search options
@ -156,7 +155,7 @@
if(!empty($_GET[$Search])) { if(!empty($_GET[$Search])) {
$_GET[$Search] = str_replace(array('%'), '', $_GET[$Search]); $_GET[$Search] = str_replace(array('%'), '', $_GET[$Search]);
if($Search == 'filelist') { if($Search == 'filelist') {
$Queries[]='@filelist "'.$SS->EscapeString(strtr($_GET['filelist'], '.', " ")).'"~20'; $Queries[]='@filelist "'.$SS->EscapeString($_GET['filelist']).'"~20';
} else { } else {
$Words = explode(' ', $_GET[$Search]); $Words = explode(' ', $_GET[$Search]);
foreach($Words as $Key => &$Word) { foreach($Words as $Key => &$Word) {
@ -255,14 +254,18 @@
$OrderWay = 'desc'; $OrderWay = 'desc';
} }
if(empty($_GET['order_by']) || !in_array($_GET['order_by'], array('year', 'time','size','seeders','leechers','snatched'))) { if(empty($_GET['order_by']) || !in_array($_GET['order_by'], array('year','time','size','seeders','leechers','snatched','random'))) {
$_GET['order_by'] = 'time'; $_GET['order_by'] = 'time';
$OrderBy = 'time'; // For header links $OrderBy = 'time'; // For header links
} elseif($_GET['order_by'] == 'random') {
$OrderBy = '@random';
$Way = SPH_SORT_EXTENDED;
$SS->limit(0, TORRENTS_PER_PAGE, TORRENTS_PER_PAGE);
} else { } else {
$OrderBy = $_GET['order_by']; $OrderBy = $_GET['order_by'];
} }
$SS->SetSortMode($Way, $_GET['order_by']); $SS->SetSortMode($Way, $OrderBy);
if(count($Queries)>0) { if(count($Queries)>0) {
@ -278,20 +281,6 @@
$Results = $SS->search($Query, '', 0, array(), '', ''); $Results = $SS->search($Query, '', 0, array(), '', '');
$TorrentCount = $SS->TotalResults; $TorrentCount = $SS->TotalResults;
/*
// If some were fetched from memcached, get their artists
if(!empty($Results['matches'])) { // Fetch the artists for groups
$GroupIDs = array_keys($Results['matches']);
$Artists = get_artists($GroupIDs);
foreach($Artists as $GroupID=>$Data) {
if(!empty($Data[1])) {
$Results['matches'][$GroupID]['Artists']=$Data[1]; // Only use main artists
}
ksort($Results['matches'][$GroupID]);
}
}
*/
// These ones were not found in the cache, run SQL // These ones were not found in the cache, run SQL
if(!empty($Results['notfound'])) { if(!empty($Results['notfound'])) {
$SQLResults = get_groups($Results['notfound']); $SQLResults = get_groups($Results['notfound']);
@ -320,27 +309,25 @@
$Action = 'action=advanced'; $Action = 'action=advanced';
} }
// List of pages
$Pages=get_pages($Page,$TorrentCount,TORRENTS_PER_PAGE);
if(count($Results)==0) { if(count($Results)==0) {
$DB->query("SELECT $DB->query("SELECT
tags.Name, tags.Name,
((COUNT(tags.Name)-2)*(SUM(tt.PositiveVotes)-SUM(tt.NegativeVotes)))/(tags.Uses*0.8) AS Score ((COUNT(tags.Name)-2)*(SUM(tt.PositiveVotes)-SUM(tt.NegativeVotes)))/(tags.Uses*0.8) AS Score
FROM xbt_snatched AS s FROM xbt_snatched AS s
INNER JOIN torrents AS t ON t.ID=s.fid INNER JOIN torrents AS t ON t.ID=s.fid
INNER JOIN torrents_group AS g ON t.GroupID=g.ID INNER JOIN torrents_group AS g ON t.GroupID=g.ID
INNER JOIN torrents_tags AS tt ON tt.GroupID=g.ID INNER JOIN torrents_tags AS tt ON tt.GroupID=g.ID
INNER JOIN tags ON tags.ID=tt.TagID INNER JOIN tags ON tags.ID=tt.TagID
WHERE s.uid='$LoggedUser[ID]' WHERE s.uid='$LoggedUser[ID]'
AND tt.TagID<>'13679' AND tt.TagID<>'13679'
AND tt.TagID<>'4820' AND tt.TagID<>'4820'
AND tt.TagID<>'2838' AND tt.TagID<>'2838'
AND g.CategoryID='1' AND g.CategoryID='1'
AND tags.Uses > '10' AND tags.Uses > '10'
GROUP BY tt.TagID GROUP BY tt.TagID
ORDER BY Score DESC ORDER BY Score DESC
LIMIT 8"); LIMIT 8");
$JsonYouMightLike = array(); $JsonYouMightLike = array();
while(list($Tag)=$DB->next_record()) { while(list($Tag)=$DB->next_record()) {
@ -364,14 +351,25 @@
$JsonGroups = array(); $JsonGroups = array();
foreach($Results as $GroupID=>$Data) { foreach($Results as $GroupID=>$Data) {
$JsonGroup = array(); 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);
list($Artists, $GroupCatalogueNumber, $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)); $TagList = explode(' ',str_replace('_','.',$TagList));
if(count($Torrents)>1 || $CategoryID==1) { if(count($Torrents)>1 || $CategoryID==1) {
// These torrents are in a group // These torrents are in a group
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1); if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
$IsBookmarked = in_array($GroupID, $Bookmarks); unset($ExtendedArtists[2]);
unset($ExtendedArtists[3]);
$DisplayName = display_artists($ExtendedArtists, false, false);
} elseif(!empty($Artists)) {
$DisplayName = display_artists(array(1=>$Artists), false, false);
} else {
$DisplayName='';
}
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent" dir="ltr">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
$DisplayName .= ' ['.$ReleaseTypes[$ReleaseType].']';
$LastRemasterYear = '-'; $LastRemasterYear = '-';
$LastRemasterTitle = ''; $LastRemasterTitle = '';
@ -384,8 +382,10 @@
$JsonTorrents = array(); $JsonTorrents = array();
foreach($Torrents as $TorrentID => $Data) { foreach($Torrents as $TorrentID => $Data) {
$JsonTorrent = array(); // All of the individual torrents in the group
// If they're using the advanced search and have chosen enabled grouping, we just skip the torrents that don't check out
$Filter = false; $Filter = false;
$Pass = false; $Pass = false;
@ -477,18 +477,19 @@
if ($Data['Remastered'] && !$Data['RemasterYear']) { if ($Data['Remastered'] && !$Data['RemasterYear']) {
$FirstUnknown = !isset($FirstUnknown); $FirstUnknown = !isset($FirstUnknown);
} }
if (in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent'])) {
$Data['PersonalFL'] = 1;
}
if($CategoryID == 1 && ($Data['RemasterTitle'] != $LastRemasterTitle || if($CategoryID == 1 && ($Data['RemasterTitle'] != $LastRemasterTitle || $Data['RemasterYear'] != $LastRemasterYear ||
$Data['RemasterYear'] != $LastRemasterYear || $Data['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Data['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber) || $FirstUnknown || $Data['Media'] != $LastMedia) {
$Data['RemasterRecordLabel'] != $LastRemasterRecordLabel ||
$Data['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber) ||
$FirstUnknown || $Data['Media'] != $LastMedia) {
$EditionID++; $EditionID++;
if($Data['Remastered'] && $Data['RemasterYear'] != 0) { if($Data['Remastered'] && $Data['RemasterYear'] != 0) {
$RemasterName = $Data['RemasterYear']; $RemasterName = $Data['RemasterYear'];
$AddExtra = " - "; $AddExtra = " - ";
if($Data['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Data['RemasterRecordLabel']); $AddExtra=' / '; } if($Data['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Data['RemasterRecordLabel']); $AddExtra=' / '; }
if($Data['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Data['RemasterCatalogueNumber']); $AddExtra=' / '; } if($Data['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Data['RemasterCatalogueNumber']); $AddExtra=' / '; }
if($Data['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Data['RemasterTitle']); $AddExtra=' / '; } if($Data['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Data['RemasterTitle']); $AddExtra=' / '; }
@ -505,29 +506,85 @@
$MasterName .= $AddExtra.display_str($Data['Media']); $MasterName .= $AddExtra.display_str($Data['Media']);
} }
} }
$JsonTorrents[] = $Data; $LastRemasterTitle = $Data['RemasterTitle'];
$LastRemasterYear = $Data['RemasterYear'];
$LastRemasterRecordLabel = $Data['RemasterRecordLabel'];
$LastRemasterCatalogueNumber = $Data['RemasterCatalogueNumber'];
$LastMedia = $Data['Media'];
$JsonTorrents[] = array(
'torrentId' => (int) $TorrentID,
'editionId' => (int) $EditionID,
'remastered' => $Data['Remastered'],
'remasterYear' => (int) $Data['RemasterYear'],
'remasterCatalogueNumber' => $Data['RemasterCatalogueNumber'],
'remasterTitle' => $Data['RemasterTitle'],
'media' => $Data['Media'],
'encoding' => $Data['Encoding'],
'format' => $Data['Format'],
'hasLog' => $Data['HasLog'] == '1',
'logScore' => (int) $Data['LogScore'],
'hasCue' => $Data['HasCue'] == '1',
'scene' => $Data['Scene'] == '1',
'vanityHouse' => $Data['VanityHouse'] == '1',
'fileCount' => (int) $Data['FileCount'],
'time' => $Data['Time'],
'size' => (int) $Data['Size'],
'snatches' => (int) $Data['Snatched'],
'seeders' => (int) $Data['Seeders'],
'leechers' => (int) $Data['Leechers'],
'isFreeleech' => $Data['FreeTorrent'] == '1',
'isNeutralLeech' => $Data['FreeTorrent'] == '2',
'isPersonalFreeleech' => in_array($TorrentID, $TokenTorrents),
'canUseToken' => ($LoggedUser['FLTokens'] > 0)
&& $Data['HasFile'] && ($Data['Size'] < 1073741824)
&& !in_array($TorrentID, $TokenTorrents)
&& empty($Data['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')
);
} }
$LastRemasterTitle = $Data['RemasterTitle'];
$LastRemasterYear = $Data['RemasterYear']; $JsonGroups[] = array(
$LastRemasterRecordLabel = $Data['RemasterRecordLabel']; 'groupId' => (int) $GroupID,
$LastRemasterCatalogueNumber = $Data['RemasterCatalogueNumber']; 'groupName' => $GroupName,
$LastMedia = $Data['Media']; 'tags' => $TagList,
$JsonGroup[] = $JsonTorrents; 'bookmarked' => in_array($GroupID, $Bookmarks),
} else { 'vanityHouse' => $GroupVanityHouse,
list($TorrentID, $Data) = each($Torrents); 'groupYear' => (int) $GroupYear,
$JsonGroup = $Data; 'releaseType' => $ReleaseTypes[$ReleaseType],
'groupTime' => $GroupTime,
'maxSize' => (int) $MaxSize,
'totalSnatched' => (int) $TotalSnatched,
'totalSeeders' => (int) $TotalSeeders,
'totalLeechers' => (int) $TotalLeechers,
'torrents' => $JsonTorrents
);
}
else {
// Viewing a type that does not require grouping
list($TorrentID, $Data) = each($Torrents);
$JsonGroups[] = array(
'groupId' => (int) $GroupID,
'groupName' => $GroupName,
'torrentId' => (int) $TorrentID,
'tags' => $TagList,
'category' => $Categories[$CategoryID-1],
'fileCount' => (int) $Data['FileCount'],
'groupTime' => $GroupTime,
'size' => (int) $Data['Size'],
'snatches' => (int) $TotalSnatched,
'seeders' => (int) $TotalSeeders,
'leechers' => (int) $TotalLeechers,
'isFreeleech' => $Data['FreeTorrent'] == '1',
'isNeutralLeech' => $Data['FreeTorrent'] == '2',
'isPersonalFreeleech' => in_array($TorrentID, $TokenTorrents),
'canUseToken' => ($LoggedUser['FLTokens'] > 0)
&& $Data['HasFile'] && ($Data['Size'] < 1073741824)
&& !in_array($TorrentID, $TokenTorrents)
&& empty($Data['FreeTorrent']) && ($LoggedUser['CanLeech'] == '1')
);
} }
$JsonGroups[] = array(
'groupId' => (int) $GroupID,
'groupName' => $GroupName,
'tags' => $TagList,
'torrentId' => (int) $TorrentID,
'categoryId' => (int) $Categories[$CategoryID-1],
'totalSnatched' => (int) $TotalSnatched,
'totalSeeders' => (int) $TotalSeeders,
'totalLeechers' => (int) $TotalLeechers,
'group' => $JsonGroup
);
} }
print print
@ -536,10 +593,8 @@
'status' => 'success', 'status' => 'success',
'response' => array( 'response' => array(
'currentPage' => intval($Page), 'currentPage' => intval($Page),
'pages' => ceil($Pages/TORRENTS_PER_PAGE), 'pages' => ceil($TorrentCount/TORRENTS_PER_PAGE),
'results' => $JsonGroups 'results' => $JsonGroups
) )
) )
); );
?>

View File

@ -4,6 +4,7 @@
if (!empty($LoggedUser['DisableForums'])) { if (!empty($LoggedUser['DisableForums'])) {
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
die();
} }
else { else {
include(SERVER_ROOT.'/sections/forums/functions.php'); include(SERVER_ROOT.'/sections/forums/functions.php');

View File

@ -30,9 +30,11 @@
die(); die();
} else { } else {
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
die();
} }
} else { } else {
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
die();
} }
} else { } else {
$ThreadID = $_GET['threadid']; $ThreadID = $_GET['threadid'];
@ -56,6 +58,7 @@
// Make sure they're allowed to look at the page // Make sure they're allowed to look at the page
if(!check_forumperm($ForumID)) { if(!check_forumperm($ForumID)) {
print json_encode(array('status' => 'failure')); print json_encode(array('status' => 'failure'));
die();
} }
//Post links utilize the catalogue & key params to prevent issues with custom posts per page //Post links utilize the catalogue & key params to prevent issues with custom posts per page
@ -227,7 +230,7 @@
'paranoia' => $Paranoia, 'paranoia' => $Paranoia,
'artist' => $Artist == 1, 'artist' => $Artist == 1,
'donor' => $Donor == 1, 'donor' => $Donor == 1,
'warned' => $Warned == 1, 'warned' => ($Warned!='0000-00-00 00:00:00'),
'avatar' => $Avatar, 'avatar' => $Avatar,
'enabled' => $Enabled == 2 ? false : true, 'enabled' => $Enabled == 2 ? false : true,
'userTitle' => $UserTitle 'userTitle' => $UserTitle
@ -254,4 +257,4 @@
'posts' => $JsonPosts 'posts' => $JsonPosts
) )
) )
); );

View File

@ -71,9 +71,6 @@
case 'index': case 'index':
require(SERVER_ROOT.'/sections/ajax/info.php'); require(SERVER_ROOT.'/sections/ajax/info.php');
break; break;
case 'usersearch':
require(SERVER_ROOT.'/sections/ajax/usersearch.php');
break;
case 'bookmarks': case 'bookmarks':
require(SERVER_ROOT.'/sections/ajax/bookmarks.php'); require(SERVER_ROOT.'/sections/ajax/bookmarks.php');
break; break;

View File

@ -51,9 +51,9 @@
$DisplayName = display_artists(array('1'=>$Artists)); $DisplayName = display_artists(array('1'=>$Artists));
} }
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>'; $DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
$DisplayName.=" [".$GroupYear."]"; if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
}
$ExtraInfo = torrent_info($Torrents[$TorrentID]); $ExtraInfo = torrent_info($Torrents[$TorrentID]);
if($ExtraInfo) { if($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo; $DisplayName.=' - '.$ExtraInfo;

View File

@ -54,6 +54,7 @@
if($GroupYear>0) { if($GroupYear>0) {
$DisplayName.=" [".$GroupYear."]"; $DisplayName.=" [".$GroupYear."]";
} }
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
$ExtraInfo = torrent_info($Torrents[$TorrentID]); $ExtraInfo = torrent_info($Torrents[$TorrentID]);
if($ExtraInfo) { if($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo; $DisplayName.=' - '.$ExtraInfo;

View File

@ -34,6 +34,7 @@
} }
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$FlacID.'" title="View Torrent">'.$GroupName.'</a>'; $DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$FlacID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; } if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
$TagList=array(); $TagList=array();
if($TorrentTags!='') { if($TorrentTags!='') {

View File

@ -80,6 +80,7 @@
} }
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$FlacID.'" title="View Torrent">'.$GroupName.'</a>'; $DisplayName.='<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$FlacID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; } if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
$MissingEncodings = array('V0 (VBR)'=>1, 'V2 (VBR)'=>1, '320'=>1); $MissingEncodings = array('V0 (VBR)'=>1, 'V2 (VBR)'=>1, '320'=>1);

View File

@ -53,6 +53,7 @@
if($GroupYear>0) { if($GroupYear>0) {
$DisplayName.=" [".$GroupYear."]"; $DisplayName.=" [".$GroupYear."]";
} }
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
$ExtraInfo = torrent_info($Torrents[$TorrentID]); $ExtraInfo = torrent_info($Torrents[$TorrentID]);
if($ExtraInfo) { if($ExtraInfo) {
$DisplayName.=' - '.$ExtraInfo; $DisplayName.=' - '.$ExtraInfo;

View File

@ -102,7 +102,7 @@
} }
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>'; $DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; } if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
$MissingEncodings = array('V0 (VBR)'=>1, 'V2 (VBR)'=>1, '320'=>1); $MissingEncodings = array('V0 (VBR)'=>1, 'V2 (VBR)'=>1, '320'=>1);
$FlacID = 0; $FlacID = 0;

View File

@ -67,6 +67,7 @@
} }
$DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>'; $DisplayName.='<a href="torrents.php?id='.$GroupID.'" title="View Torrent">'.$GroupName.'</a>';
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; } if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
if($ReleaseType>0) { $DisplayName.=" [".$ReleaseTypes[$ReleaseType]."]"; }
$MissingEncodings = array('V0 (VBR)'=>1, 'V2 (VBR)'=>1, '320'=>1); $MissingEncodings = array('V0 (VBR)'=>1, 'V2 (VBR)'=>1, '320'=>1);

View File

@ -92,19 +92,21 @@
} }
$Thread = catalogue_select($Catalogue,$Page,$PerPage,THREAD_CATALOGUE); $Thread = catalogue_select($Catalogue,$Page,$PerPage,THREAD_CATALOGUE);
$LastPost = end($Thread); if ($_GET['updatelastread'] != '0') {
$LastPost = $LastPost['ID']; $LastPost = end($Thread);
reset($Thread); $LastPost = $LastPost['ID'];
reset($Thread);
//Handle last read //Handle last read
if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) { if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
$DB->query("SELECT PostID From forums_last_read_topics WHERE UserID='$LoggedUser[ID]' AND TopicID='$ThreadID'"); $DB->query("SELECT PostID From forums_last_read_topics WHERE UserID='$LoggedUser[ID]' AND TopicID='$ThreadID'");
list($LastRead) = $DB->next_record(); list($LastRead) = $DB->next_record();
if($LastRead < $LastPost) { if($LastRead < $LastPost) {
$DB->query("INSERT INTO forums_last_read_topics $DB->query("INSERT INTO forums_last_read_topics
(UserID, TopicID, PostID) VALUES (UserID, TopicID, PostID) VALUES
('$LoggedUser[ID]', '".$ThreadID ."', '".db_string($LastPost)."') ('$LoggedUser[ID]', '".$ThreadID ."', '".db_string($LastPost)."')
ON DUPLICATE KEY UPDATE PostID='$LastPost'"); ON DUPLICATE KEY UPDATE PostID='$LastPost'");
}
} }
} }

View File

@ -62,20 +62,21 @@
?> ?>
<h2>Latest notifications <a href="torrents.php?action=notify_clear&amp;auth=<?=$LoggedUser['AuthKey']?>">(clear all)</a> <a href="user.php?action=notify">(edit filters)</a></h2> <h2>Latest notifications <a href="torrents.php?action=notify_clear&amp;auth=<?=$LoggedUser['AuthKey']?>">(clear all)</a> <a href="javascript:SuperGroupClear()">(clear selected)</a> <a href="user.php?action=notify">(edit filters)</a></h2>
<div class="linkbox"> <div class="linkbox">
<?=$Pages?> <?=$Pages?>
</div> </div>
<? if($DB->record_count()==0) { ?> <? if($DB->record_count()==0) { ?>
<table class="border"> <table class="border">
<tr class="rowb"> <tr class="rowb">
<td colspan="7" class="center"> <td colspan="8" class="center">
No new notifications found! <a href="user.php?action=notify">Edit notification filters</a> No new notifications found! <a href="user.php?action=notify">Edit notification filters</a>
</td> </td>
</tr> </tr>
</table> </table>
<? } else { <? } else {
$FilterGroups = array(); $FilterGroups = array();
$i = 0;
while($Result = $DB->next_record()) { while($Result = $DB->next_record()) {
if(!$Result['FilterID']) { if(!$Result['FilterID']) {
$Result['FilterID'] = 0; $Result['FilterID'] = 0;
@ -88,10 +89,13 @@
} }
unset($Result); unset($Result);
foreach($FilterGroups as $ID => $FilterResults) { foreach($FilterGroups as $ID => $FilterResults) {
$i++;
?> ?>
<h3>Matches for <?=$FilterResults['FilterLabel']?> (<a href="torrents.php?action=notify_cleargroup&amp;filterid=<?=$ID?>&amp;auth=<?=$LoggedUser['AuthKey']?>">Clear</a>)</h3> <h3>Matches for <?=$FilterResults['FilterLabel']?> (<a href="torrents.php?action=notify_cleargroup&amp;filterid=<?=$ID?>&amp;auth=<?=$LoggedUser['AuthKey']?>">Clear</a>) <a href="javascript:GroupClear($('#notificationform_<?=$i?>').raw())">(clear selected)</a></h3>
<form id="notificationform_<?=$i?>">
<table class="border"> <table class="border">
<tr class="colhead"> <tr class="colhead">
<td style="text-align: center"><input type="checkbox" name="toggle" onClick="ToggleBoxes(this.form, this.checked)" /></td>
<td class="small cats_col"></td> <td class="small cats_col"></td>
<td style="width:100%;"><strong>Name</strong></td> <td style="width:100%;"><strong>Name</strong></td>
<td><strong>Files</strong></td> <td><strong>Files</strong></td>
@ -159,6 +163,7 @@
// print row // print row
?> ?>
<tr class="group_torrent" id="torrent<?=$TorrentID?>"> <tr class="group_torrent" id="torrent<?=$TorrentID?>">
<td style="text-align: center"><input type="checkbox" value="<?=$TorrentID?>" id="clear_<?=$TorrentID?>" /></td>
<td class="center cats_cols"><div title="<?=ucfirst(str_replace('_',' ',$MainTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1])).' tags_'.str_replace('.','_',$MainTag)?>"></div></td> <td class="center cats_cols"><div title="<?=ucfirst(str_replace('_',' ',$MainTag))?>" class="cats_<?=strtolower(str_replace(array('-',' '),array('',''),$Categories[$GroupCategoryID-1])).' tags_'.str_replace('.','_',$MainTag)?>"></div></td>
<td> <td>
<span> <span>
@ -184,6 +189,7 @@
} }
?> ?>
</table> </table>
</form>
<? <?
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,29 @@
function Clear(torrentid) { function Clear(torrentid) {
ajax.get("?action=notify_clearitem&torrentid=" + torrentid + "&auth=" + authkey, function() { ajax.get("?action=notify_clearitem&torrentid=" + torrentid + "&auth=" + authkey, function() {
$("#torrent" + torrentid).remove(); $("#torrent" + torrentid).remove();
}); });
}
function GroupClear(form) {
for (var i = 0; i < form.elements.length; i++ ) {
if (form.elements[i].type == 'checkbox' && form.elements[i].name != 'toggle') {
if (form.elements[i].checked == true) {
Clear(form.elements[i].value);
}
}
}
}
function ToggleBoxes(form, newval) {
for (var i = 0; i < form.elements.length; i++ ) {
if (form.elements[i].type == 'checkbox' && form.elements[i].name != 'toggle') {
form.elements[i].checked = newval;
}
}
}
function SuperGroupClear() {
for (var i = 0; i < document.forms.length; i++ ) {
GroupClear(document.forms[i]);
}
} }