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; }
return "torrents.php?order_way=".$NewWay."&order_by=".$SortKey."&".get_url(array('order_way','order_by'));
} }
if($InfoHash = is_valid_torrenthash($InfoHash)) { $TokenTorrents = $Cache->get_value('users_tokens_'.$UserID);
$InfoHash = db_string(pack("H*", $InfoHash)); if (empty($TokenTorrents)) {
$DB->query("SELECT ID,GroupID FROM torrents WHERE info_hash='$InfoHash'"); $DB->query("SELECT TorrentID FROM users_freeleeches WHERE UserID=$UserID AND Expired=FALSE");
if($DB->record_count() > 0) { $TokenTorrents = $DB->collect('TorrentID');
list($ID, $GroupID) = $DB->next_record(); $Cache->cache_value('users_tokens_'.$UserID, $TokenTorrents);
header('Location: torrents.php?id='.$GroupID.'&torrentid='.$ID);
die();
}
}
} }
// 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,8 +309,6 @@
$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
@ -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,7 +382,9 @@
$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;
@ -478,11 +478,12 @@
$FirstUnknown = !isset($FirstUnknown); $FirstUnknown = !isset($FirstUnknown);
} }
if($CategoryID == 1 && ($Data['RemasterTitle'] != $LastRemasterTitle || if (in_array($TorrentID, $TokenTorrents) && empty($Torrent['FreeTorrent'])) {
$Data['RemasterYear'] != $LastRemasterYear || $Data['PersonalFL'] = 1;
$Data['RemasterRecordLabel'] != $LastRemasterRecordLabel || }
$Data['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber) ||
$FirstUnknown || $Data['Media'] != $LastMedia) { if($CategoryID == 1 && ($Data['RemasterTitle'] != $LastRemasterTitle || $Data['RemasterYear'] != $LastRemasterYear ||
$Data['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Data['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber) || $FirstUnknown || $Data['Media'] != $LastMedia) {
$EditionID++; $EditionID++;
if($Data['Remastered'] && $Data['RemasterYear'] != 0) { if($Data['Remastered'] && $Data['RemasterYear'] != 0) {
@ -505,30 +506,86 @@
$MasterName .= $AddExtra.display_str($Data['Media']); $MasterName .= $AddExtra.display_str($Data['Media']);
} }
} }
$JsonTorrents[] = $Data;
}
$LastRemasterTitle = $Data['RemasterTitle']; $LastRemasterTitle = $Data['RemasterTitle'];
$LastRemasterYear = $Data['RemasterYear']; $LastRemasterYear = $Data['RemasterYear'];
$LastRemasterRecordLabel = $Data['RemasterRecordLabel']; $LastRemasterRecordLabel = $Data['RemasterRecordLabel'];
$LastRemasterCatalogueNumber = $Data['RemasterCatalogueNumber']; $LastRemasterCatalogueNumber = $Data['RemasterCatalogueNumber'];
$LastMedia = $Data['Media']; $LastMedia = $Data['Media'];
$JsonGroup[] = $JsonTorrents;
} else { $JsonTorrents[] = array(
list($TorrentID, $Data) = each($Torrents); 'torrentId' => (int) $TorrentID,
$JsonGroup = $Data; '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')
);
} }
$JsonGroups[] = array( $JsonGroups[] = array(
'groupId' => (int) $GroupID, 'groupId' => (int) $GroupID,
'groupName' => $GroupName, 'groupName' => $GroupName,
'tags' => $TagList, 'tags' => $TagList,
'torrentId' => (int) $TorrentID, 'bookmarked' => in_array($GroupID, $Bookmarks),
'categoryId' => (int) $Categories[$CategoryID-1], 'vanityHouse' => $GroupVanityHouse,
'groupYear' => (int) $GroupYear,
'releaseType' => $ReleaseTypes[$ReleaseType],
'groupTime' => $GroupTime,
'maxSize' => (int) $MaxSize,
'totalSnatched' => (int) $TotalSnatched, 'totalSnatched' => (int) $TotalSnatched,
'totalSeeders' => (int) $TotalSeeders, 'totalSeeders' => (int) $TotalSeeders,
'totalLeechers' => (int) $TotalLeechers, 'totalLeechers' => (int) $TotalLeechers,
'group' => $JsonGroup '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')
);
}
}
print print
json_encode( json_encode(
@ -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

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,6 +92,7 @@
} }
$Thread = catalogue_select($Catalogue,$Page,$PerPage,THREAD_CATALOGUE); $Thread = catalogue_select($Catalogue,$Page,$PerPage,THREAD_CATALOGUE);
if ($_GET['updatelastread'] != '0') {
$LastPost = end($Thread); $LastPost = end($Thread);
$LastPost = $LastPost['ID']; $LastPost = $LastPost['ID'];
reset($Thread); reset($Thread);
@ -107,6 +108,7 @@
ON DUPLICATE KEY UPDATE PostID='$LastPost'"); ON DUPLICATE KEY UPDATE PostID='$LastPost'");
} }
} }
}
//Handle subscriptions //Handle subscriptions
if(($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === FALSE) { if(($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === FALSE) {

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

@ -3,3 +3,27 @@ function Clear(torrentid) {
$("#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]);
}
}