63 changes from Sun Aug 21 14:42:15 2011 -0400 to Sun Sep 4 00:42:07 2011 +0000

trying to roll this out with dirty cache support
Go back to memcached's internal incr/decr functions
fixed nextElementSibling()
patappatch g  [patapper]
This commit is contained in:
Git 2011-09-04 08:00:07 +00:00
parent 288b8f1b6a
commit 8b4454b09d
11 changed files with 102 additions and 65 deletions

View File

@ -303,6 +303,7 @@ public function update($Key, $Rows, $Values, $Time=2592000) {
}
// Built-in increment/decrement functions are said not to be thread safe
/* Supposedly fixed in v1.4.6
public function increment($Key, $Value=1) {
if(($OldValue = $this->get($Key)) === false || !is_number($Value)) {
return false;
@ -319,5 +320,5 @@ public function decrement($Key, $Value=1) {
}
$this->replace_value($Key, $OldValue-$Value);
}
*/
}

View File

@ -1618,9 +1618,9 @@ function get_groups($GroupIDs, $Return = true, $GetArtists = true) {
foreach($GroupIDs as $GroupID) {
$Data = $Cache->get_value('torrent_group_'.$GroupID, true);
if(!empty($Data)) {
if(!empty($Data) && (@$Data['ver'] >= 2)) {
unset($NotFound[$GroupID]);
$Found[$GroupID] = $Data;
$Found[$GroupID] = $Data['d'];
}
}
@ -1645,11 +1645,11 @@ function get_groups($GroupIDs, $Return = true, $GetArtists = true) {
$DB->query("SELECT
ID, GroupID, Media, Format, Encoding, RemasterYear, Remastered, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, Scene, HasLog, HasCue, LogScore, FileCount, FreeTorrent, Size, Leechers, Seeders, Snatched, Time, ID AS HasFile
FROM torrents AS t WHERE GroupID IN($IDs) ORDER BY GroupID, RemasterYear, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, Format, Encoding");
FROM torrents AS t WHERE GroupID IN($IDs) ORDER BY GroupID, RemasterYear, RemasterTitle, RemasterRecordLabel, RemasterCatalogueNumber, Media, Format, Encoding");
while($Torrent = $DB->next_record(MYSQLI_ASSOC, true)) {
$Found[$Torrent['GroupID']]['Torrents'][$Torrent['ID']] = $Torrent;
$Cache->cache_value('torrent_group_'.$Torrent['GroupID'], $Found[$Torrent['GroupID']], 0);
$Cache->cache_value('torrent_group_'.$Torrent['GroupID'], array('ver'=>2, 'd'=>$Found[$Torrent['GroupID']]), 0);
}
}
@ -1802,7 +1802,6 @@ function torrent_info($Data) {
$Info[]=$Str;
}
if(!empty($Data['HasCue'])) { $Info[]='Cue'; }
if(!empty($Data['Media'])) { $Info[]=$Data['Media']; }
if(!empty($Data['Scene'])) { $Info[]='Scene'; }
if($Data['FreeTorrent'] == '1') { $Info[]='<strong>Freeleech!</strong>'; }
if($Data['FreeTorrent'] == '2') { $Info[]='<strong>Neutral Leech!</strong>'; }

View File

@ -176,6 +176,7 @@ function compare($X, $Y){
$NumSnatches = 0;
$OpenTable = false;
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
foreach ($TorrentList as $GroupID=>$Group) {
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists) = array_values($Group);
$GroupVanityHouse = $Importances[$GroupID]['VanityHouse'];
@ -224,6 +225,7 @@ function compare($X, $Y){
<? } ?>
<table class="torrent_table" id="torrents_<?=$ReleaseTypeLabel?>">
<tr class="colhead_dark">
<td><!-- expand/collapse --></td>
<td width="70%"><a href="#">&uarr;</a>&nbsp;<strong><?=$DisplayName?></strong> (<a href="#" onclick="$('.releases_<?=$ReleaseType?>').toggle();return false;">View</a>)</td>
<td>Size</td>
<td class="sign"><img src="static/styles/<?=$LoggedUser['StyleName'] ?>/images/snatched.png" alt="Snatches" title="Snatches" /></td>
@ -250,6 +252,11 @@ function compare($X, $Y){
?>
<tr class="releases_<?=$ReleaseType?> group discog<?=$HideDiscog?>">
<td class="center">
<div title="View" id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event)" title="Collapse this group"></a>
</div>
</td>
<td colspan="5">
<strong><?=$DisplayName?></strong>
<?=$TorrentTags?>
@ -260,6 +267,9 @@ function compare($X, $Y){
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$LastMedia = '';
$EditionID = 0;
foreach ($Torrents as $TorrentID => $Torrent) {
$NumTorrents++;
@ -273,7 +283,10 @@ function compare($X, $Y){
$NumSnatches+=$Torrent['Snatched'];
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber) {
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $Torrent['Media'] != $LastMedia) {
$EditionID++;
if($Torrent['RemasterTitle'] || $Torrent['RemasterYear'] || $Torrent['RemasterRecordLabel'] || $Torrent['RemasterCatalogueNumber']) {
$RemasterName = $Torrent['RemasterYear'];
@ -281,10 +294,11 @@ function compare($X, $Y){
if($Torrent['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterRecordLabel']); $AddExtra=' / '; }
if($Torrent['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterCatalogueNumber']); $AddExtra=' / '; }
if($Torrent['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterTitle']); $AddExtra=' / '; }
$RemasterName .= $AddExtra.display_str($Torrent['Media']);
?>
<tr class="releases_<?=$ReleaseType?> group_torrent discog <?=$HideDiscog?>">
<td colspan="5" class="edition_info"><strong><?=$RemasterName?></strong></td>
<tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition group_torrent discog <?=$HideDiscog?>">
<td colspan="6" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition">&minus;</a> <?=$RemasterName?></strong></a></td>
</tr>
<?
} else {
@ -292,9 +306,10 @@ function compare($X, $Y){
$AddExtra = " / ";
if($GroupRecordLabel) { $MasterName .= $AddExtra.$GroupRecordLabel; $AddExtra=' / '; }
if($GroupCatalogueNumber) { $MasterName .= $AddExtra.$GroupCatalogueNumber; $AddExtra=' / '; }
$MasterName .= $AddExtra.display_str($Torrent['Media']);
?>
<tr class="releases_<?=$ReleaseType?> group_torrent <?=$HideDiscog?>">
<td colspan="5" class="edition_info"><strong><?=$MasterName?></strong></td>
<tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition group_torrent <?=$HideDiscog?>">
<td colspan="6" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition">&minus;</a> <?=$MasterName?></strong></a></td>
</tr>
<?
}
@ -303,9 +318,10 @@ function compare($X, $Y){
$LastRemasterYear = $Torrent['RemasterYear'];
$LastRemasterRecordLabel = $Torrent['RemasterRecordLabel'];
$LastRemasterCatalogueNumber = $Torrent['RemasterCatalogueNumber'];
$LastMedia = $Torrent['Media'];
?>
<tr class="releases_<?=$ReleaseType?> group_torrent discog <?=$HideDiscog?>">
<td>
<tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition_<?=$EditionID?> group_torrent discog <?=$HideDiscog?>">
<td colspan="2">
<span>
[<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download"><?=$Torrent['HasFile'] ? 'DL' : 'Missing'?></a>]
</span>
@ -328,7 +344,7 @@ function compare($X, $Y){
//----------------- End building list and getting stats
show_header($Name, 'requests,bbcode');
show_header($Name, 'browse,requests,bbcode');
?>
<div class="thin">
<h2><?=display_str($Name)?><? if ($RevisionID) { ?> (Revision #<?=$RevisionID?>)<? } if ($VanityHouseArtist) { ?> [Vanity House] <? } ?></h2>

View File

@ -109,7 +109,7 @@ function compare($X, $Y){
<tr class="group discog" id="group_<?=$GroupID?>">
<td class="center">
<div title="View" id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
<a href="#" class="show_torrents_link" onclick="ToggleGroup(<?=$GroupID?>); return false;"></a>
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event)" title="Collapse this group"></a>
</div>
</td>
<td class="center">
@ -132,11 +132,16 @@ function compare($X, $Y){
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$LastMedia = '';
$EditionID = 0;
foreach ($Torrents as $TorrentID => $Torrent) {
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber) {
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $Torrent['Media'] != $LastMedia) {
$EditionID++;
if($Torrent['RemasterTitle'] || $Torrent['RemasterYear'] || $Torrent['RemasterRecordLabel'] || $Torrent['RemasterCatalogueNumber']) {
$RemasterName = $Torrent['RemasterYear'];
@ -144,10 +149,11 @@ function compare($X, $Y){
if($Torrent['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterRecordLabel']); $AddExtra=' / '; }
if($Torrent['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterCatalogueNumber']); $AddExtra=' / '; }
if($Torrent['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterTitle']); $AddExtra=' / '; }
$RemasterName .= $AddExtra.display_str($Torrent['Media']);
?>
<tr class="group_torrent groupid_<?=$GroupID?><? if(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; } ?>">
<td colspan="7" class="edition_info"><strong><?=$RemasterName?></strong></td>
<tr class="group_torrent groupid_<?=$GroupID?> edition<? if(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; } ?>">
<td colspan="7" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition">&minus;</a> <?=$RemasterName?></strong></td>
</tr>
<?
} else {
@ -155,9 +161,10 @@ function compare($X, $Y){
$AddExtra = " / ";
if($GroupRecordLabel) { $MasterName .= $AddExtra.$GroupRecordLabel; $AddExtra=' / '; }
if($GroupCatalogueNumber) { $MasterName .= $AddExtra.$GroupCatalogueNumber; $AddExtra=' / '; }
$MasterName .= $AddExtra.display_str($Torrent['Media']);
?>
<tr class="group_torrent groupid_<?=$GroupID?><? if (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; }?>">
<td colspan="7" class="edition_info"><strong><?=$MasterName?></strong></td>
<tr class="group_torrent groupid_<?=$GroupID?> edition<? if (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; }?>">
<td colspan="7" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition">&minus;</a> <?=$MasterName?></strong></td>
</tr>
<?
}
@ -166,8 +173,9 @@ function compare($X, $Y){
$LastRemasterYear = $Torrent['RemasterYear'];
$LastRemasterRecordLabel = $Torrent['RemasterRecordLabel'];
$LastRemasterCatalogueNumber = $Torrent['RemasterCatalogueNumber'];
$LastMedia = $Torrent['Media'];
?>
<tr class="group_torrent groupid_<?=$GroupID?><? if(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; } ?>">
<tr class="group_torrent groupid_<?=$GroupID?> edition_<?=$EditionID?><? if(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; } ?>">
<td colspan="3">
<span>
[<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>]

View File

@ -136,7 +136,7 @@ function compare($X, $Y){
<tr class="group discog" id="group_<?=$GroupID?>">
<td class="center">
<div title="View" id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
<a href="#" class="show_torrents_link" onclick="ToggleGroup(<?=$GroupID?>); return false;"></a>
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event)" title="Collapse this group"></a>
</div>
</td>
<td class="center">
@ -152,22 +152,28 @@ function compare($X, $Y){
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$LastMedia = '';
$EditionID = 0;
foreach ($Torrents as $TorrentID => $Torrent) {
if($Torrent['RemasterTitle'] != $LastRemasterTitle || $Torrent['RemasterYear'] != $LastRemasterYear ||
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber) {
$Torrent['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Torrent['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber || $Torrent['Media'] != $LastMedia) {
if($Torrent['RemasterTitle'] || $Torrent['RemasterYear'] || $Torrent['RemasterRecordLabel'] || $Torrent['RemasterCatalogueNumber']) {
$EditionID++;
$RemasterName = $Torrent['RemasterYear'];
$AddExtra = " - ";
if($Torrent['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterRecordLabel']); $AddExtra=' / '; }
if($Torrent['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterCatalogueNumber']); $AddExtra=' / '; }
if($Torrent['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Torrent['RemasterTitle']); $AddExtra=' / '; }
$RemasterName .= $AddExtra.display_str($Torrent['Media']);
?>
<tr class="group_torrent groupid_<?=$GroupID?><? if(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; } ?>">
<td colspan="7" class="edition_info"><strong><?=$RemasterName?></strong></td>
<tr class="group_torrent groupid_<?=$GroupID?> edition<? if(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; } ?>">
<td colspan="7" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition">&minus;</a> <?=$RemasterName?></strong></td>
</tr>
<?
} else {
@ -175,9 +181,10 @@ function compare($X, $Y){
$AddExtra = " / ";
if($GroupRecordLabel) { $MasterName .= $AddExtra.$GroupRecordLabel; $AddExtra=' / '; }
if($GroupCatalogueNumber) { $MasterName .= $AddExtra.$GroupCatalogueNumber; $AddExtra=' / '; }
$MasterName .= $AddExtra.display_str($Torrent['Media']);
?>
<tr class="group_torrent groupid_<?=$GroupID?><? if (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; }?>">
<td colspan="7" class="edition_info"><strong><?=$MasterName?></strong></td>
<tr class="group_torrent groupid_<?=$GroupID?> edition<? if (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; }?>">
<td colspan="7" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition">&minus;</a> <?=$MasterName?></strong></td>
</tr>
<?
}
@ -186,8 +193,9 @@ function compare($X, $Y){
$LastRemasterYear = $Torrent['RemasterYear'];
$LastRemasterRecordLabel = $Torrent['RemasterRecordLabel'];
$LastRemasterCatalogueNumber = $Torrent['RemasterCatalogueNumber'];
$LastMedia = $Torrent['Media'];
?>
<tr class="group_torrent groupid_<?=$GroupID?><? if(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; } ?>">
<tr class="group_torrent groupid_<?=$GroupID?> edition_<?=$EditionID?><? if(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; } ?>">
<td colspan="3">
<span>
[<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download">DL</a>]

View File

@ -30,7 +30,8 @@
while(list($GroupID,$Seeders,$Leechers,$Snatched) = $DB->next_record(MYSQLI_NUM)) {
$Data = $Cache->get_value('torrent_group_'.$GroupID);
if(!is_array($Data)) { continue; }
if (!(is_array($Data) && (@$Data['ver'] >= 2))) { continue; }
$Data = $Data['d'];
$Changed = false;
@ -89,4 +90,4 @@
echo '<pre>';
show_footer();
}
?>
?>

View File

@ -696,12 +696,12 @@ function header_link($SortKey,$DefaultWay="desc") {
if($GroupVanityHouse) { $DisplayName .= ' [<abbr title="This is a vanity house release">VH</abbr>]'; }
?>
<tr class="group">
<td class="center">
<?
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
?>
<td class="center">
<div title="View" id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
<a href="#" class="show_torrents_link" onclick="ToggleGroup(<?=$GroupID?>); return false;"></a>
<a href="#" class="show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event)" title="Collapse this group"></a>
</div>
</td>
<td class="center cats_col">
@ -731,6 +731,9 @@ function header_link($SortKey,$DefaultWay="desc") {
$LastRemasterTitle = '';
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$LastMedia = '';
$EditionID = 0;
foreach($Torrents as $TorrentID => $Data) {
// All of the individual torrents in the group
@ -826,18 +829,20 @@ function header_link($SortKey,$DefaultWay="desc") {
}
if($CategoryID == 1 && ($Data['RemasterTitle'] != $LastRemasterTitle || $Data['RemasterYear'] != $LastRemasterYear ||
$Data['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Data['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber)) {
$Data['RemasterRecordLabel'] != $LastRemasterRecordLabel || $Data['RemasterCatalogueNumber'] != $LastRemasterCatalogueNumber) || $Data['Media'] != $LastMedia) {
if($Data['RemasterTitle'] || $Data['RemasterYear'] || $Data['RemasterRecordLabel'] || $Data['RemasterCatalogueNumber']) {
$EditionID++;
$RemasterName = $Data['RemasterYear'];
$AddExtra = " - ";
if($Data['RemasterRecordLabel']) { $RemasterName .= $AddExtra.display_str($Data['RemasterRecordLabel']); $AddExtra=' / '; }
if($Data['RemasterCatalogueNumber']) { $RemasterName .= $AddExtra.display_str($Data['RemasterCatalogueNumber']); $AddExtra=' / '; }
if($Data['RemasterTitle']) { $RemasterName .= $AddExtra.display_str($Data['RemasterTitle']); $AddExtra=' / '; }
$RemasterName .= $AddExtra.display_str($Data['Media']);
?>
<tr class="group_torrent groupid_<?=$GroupID?><? if (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; }?>">
<td colspan="9" class="edition_info"><strong><?=$RemasterName?></strong></td>
<tr class="group_torrent groupid_<?=$GroupID?> edition<? if (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; }?>">
<td colspan="9" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition">&minus;</a> <?=$RemasterName?></strong></td>
</tr>
<?
} else {
@ -845,9 +850,10 @@ function header_link($SortKey,$DefaultWay="desc") {
$AddExtra = " / ";
if($GroupRecordLabel) { $MasterName .= $AddExtra.$GroupRecordLabel; $AddExtra=' / '; }
if($GroupCatalogueNumber) { $MasterName .= $AddExtra.$GroupCatalogueNumber; $AddExtra=' / '; }
$MasterName .= $AddExtra.display_str($Data['Media']);
?>
<tr class="group_torrent groupid_<?=$GroupID?><? if (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; }?>">
<td colspan="9" class="edition_info"><strong><?=$MasterName?></strong></td>
<tr class="group_torrent groupid_<?=$GroupID?> edition<? if (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; }?>">
<td colspan="9" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition">&minus;</a> <?=$MasterName?></strong></td>
</tr>
<?
}
@ -856,8 +862,9 @@ function header_link($SortKey,$DefaultWay="desc") {
$LastRemasterYear = $Data['RemasterYear'];
$LastRemasterRecordLabel = $Data['RemasterRecordLabel'];
$LastRemasterCatalogueNumber = $Data['RemasterCatalogueNumber'];
$LastMedia = $Data['Media'];
?>
<tr class="group_torrent groupid_<?=$GroupID?><? if (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; }?>">
<tr class="group_torrent groupid_<?=$GroupID?> edition_<?=$EditionID?><? if (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping']==1) { echo ' hidden'; }?>">
<td colspan="3">
<span>
[<a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download"><?=$Data['HasFile'] ? 'DL' : 'Missing'?></a>

View File

@ -279,6 +279,8 @@ function filelist($Str) {
$LastRemasterRecordLabel = '';
$LastRemasterCatalogueNumber = '';
$EditionID = 0;
foreach ($TorrentList as $Torrent) {
//t.ID, t.Media, t.Format, t.Encoding, t.Remastered, t.RemasterYear, t.RemasterTitle, t.RemasterRecordLabel,t.RemasterCatalogueNumber,
@ -352,12 +354,12 @@ function filelist($Str) {
$TorrentUploader = $Username; // Save this for "Uploaded by:" below
// similar to torrent_info()
if($Format) { $ExtraInfo.=display_str($Format); $AddExtra=' / '; }
if($Encoding) { $ExtraInfo.=$AddExtra.display_str($Encoding); $AddExtra=' / '; }
if($HasLog) { $ExtraInfo.=$AddExtra.'Log'; $AddExtra=' / '; }
if($HasLog && $LogInDB) { $ExtraInfo.=' ('.(int) $LogScore.'%)'; }
if($HasCue) { $ExtraInfo.=$AddExtra.'Cue'; $AddExtra=' / '; }
if($Media) { $ExtraInfo.=$AddExtra.display_str($Media); $AddExtra=' / '; }
if($Scene) { $ExtraInfo.=$AddExtra.'Scene'; $AddExtra=' / '; }
if(!$ExtraInfo) {
$ExtraInfo = $GroupName ; $AddExtra=' / ';
@ -376,7 +378,10 @@ function filelist($Str) {
|| $RemasterYear != $LastRemasterYear
|| $RemasterRecordLabel != $LastRemasterRecordLabel
|| $RemasterCatalogueNumber != $LastRemasterCatalogueNumber
|| $FirstUnknown)) {
|| $FirstUnknown
|| $Media != $LastMedia)) {
$EditionID++;
if($Remastered && $RemasterYear != 0){
@ -385,9 +390,10 @@ function filelist($Str) {
if($RemasterRecordLabel) { $RemasterName .= $AddExtra.display_str($RemasterRecordLabel); $AddExtra=' / '; }
if($RemasterCatalogueNumber) { $RemasterName .= $AddExtra.display_str($RemasterCatalogueNumber); $AddExtra=' / '; }
if($RemasterTitle) { $RemasterName .= $AddExtra.display_str($RemasterTitle); $AddExtra=' / '; }
$RemasterName .= $AddExtra.display_str($Media);
?>
<tr class="group_torrent">
<td colspan="5" class="edition_info"><strong><?=$RemasterName?></strong></td>
<tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition group_torrent">
<td colspan="5" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition">&minus;</a> <?=$RemasterName?></strong></td>
</tr>
<?
} else {
@ -396,9 +402,10 @@ function filelist($Str) {
$AddExtra = " / ";
if($GroupRecordLabel) { $MasterName .= $AddExtra.$GroupRecordLabel; $AddExtra=' / '; }
if($GroupCatalogueNumber) { $MasterName .= $AddExtra.$GroupCatalogueNumber; $AddExtra=' / '; }
$MasterName .= $AddExtra.display_str($Media);
?>
<tr class="group_torrent">
<td colspan="5" class="edition_info"><strong><?=$MasterName?></strong></td>
<tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition group_torrent">
<td colspan="5" class="edition_info"><strong><a href="#" onclick="toggle_edition(<?=$GroupID?>, <?=$EditionID?>, this, event)" title="Collapse this edition">&minus;</a> <?=$MasterName?></strong></td>
</tr>
<?
} else {
@ -414,9 +421,10 @@ function filelist($Str) {
$LastRemasterYear = $RemasterYear;
$LastRemasterRecordLabel = $RemasterRecordLabel;
$LastRemasterCatalogueNumber = $RemasterCatalogueNumber;
$LastMedia = $Media;
?>
<tr class="group_torrent" style="font-weight: normal;" id="torrent<?=$TorrentID?>">
<tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition_<?=$EditionID?> group_torrent" style="font-weight: normal;" id="torrent<?=$TorrentID?>">
<td>
<span>[
<a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" title="Download"><?=$HasFile ? 'DL' : 'Missing'?></a>
@ -437,7 +445,7 @@ function filelist($Str) {
<td><?=number_format($Seeders)?></td>
<td><?=number_format($Leechers)?></td>
</tr>
<tr class="pad <? if(!isset($_GET['torrentid']) || $_GET['torrentid']!=$TorrentID) { ?>hidden<? } ?>" id="torrent_<?=$TorrentID; ?>">
<tr class="releases_<?=$ReleaseType?> groupid_<?=$GroupID?> edition_<?=$EditionID?> torrentdetails pad <? if(!isset($_GET['torrentid']) || $_GET['torrentid']!=$TorrentID) { ?>hidden<? } ?>" id="torrent_<?=$TorrentID; ?>">
<td colspan="5">
<blockquote>
Uploaded by <?=format_username($UserID, $TorrentUploader)?> <?=time_diff($TorrentTime);?>

View File

@ -102,7 +102,7 @@ function get_group_info($GroupID, $Return = true, $RevisionID = 0) {
WHERE t.GroupID='".db_string($GroupID)."'
AND flags != 1
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.Format, t.Encoding, 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) {

View File

@ -91,17 +91,18 @@ function toggle_group(groupid, link, event) {
clickedRow = clickedRow.parentNode;
}
var group_rows = clickedRow.parentNode.children;
//var showing = has_class(nextElementSibling(clickedRow), 'hidden'); // nextElementSibling(clickedRow) is a .edition
var showing = $(clickedRow).nextElementSibling().has_class('hidden');
var allGroups = event.ctrlKey;
for (var i = 0; i < group_rows.length; i++) {
var row = $(group_rows[i]);
if (row.has_class('colhead_dark')) { continue; }
if (row.has_class('colhead')) { continue; }
var relevantRow = row.has_class('group') ? row.nextElementSibling() : row;
var relevantRow = row.has_class('group') ? $(group_rows[i+1]) : row;
if (allGroups || relevantRow.has_class('groupid_' + groupid)) {
row = $(group_rows[i]); // idk why we need this :S
if (row.has_class('group')) {
$('a.show_torrents_link', row).raw().title = (showing) ? 'Collapse this group' : 'Expand this group';
$('a.show_torrents_link', row.raw()).raw().title = (showing) ? 'Collapse this group' : 'Expand this group';
$('a.show_torrents_link', row.raw()).raw().parentNode.className = (showing) ? 'hide_torrents' : 'show_torrents';
} else {
if (showing) {
// show the row depending on whether the edition it's in is collapsed or not
@ -135,7 +136,7 @@ function toggle_edition(groupid, editionid, lnk, event) {
var group_rows = $('tr.groupid_' + groupid);
for (var i = 0; i < group_rows.results(); i++) {
var row = $(group_rows.raw(i));
if (row.has_class('edition') && (allEditions || row == clickedRow)) {
if (row.has_class('edition') && (allEditions || row.raw(0) == clickedRow)) {
$('a', row.raw()).raw().innerHTML = (showing) ? '&minus;' : '+';
$('a', row.raw()).raw().title = (showing) ? 'Collapse this edition' : 'Expand this edition';
continue;
@ -185,15 +186,3 @@ function ToggleEditionRows() {
$('#edition_label').toggle();
$('#edition_catalogue').toggle();
}
function ToggleGroup(groupid) {
var show = $('#showimg_' + groupid).has_class('show_torrents')
if(show) {
$('.groupid_' + groupid).show();
$('#showimg_' + groupid).remove_class('show_torrents').add_class('hide_torrents');
} else {
$('.groupid_' + groupid).hide();
$('#showimg_' + groupid).remove_class('hide_torrents').add_class('show_torrents');
}
}

View File

@ -259,7 +259,7 @@ util.fn = util.prototype = {
return this.objects[number];
},
nextElementSibling: function () {
here = this.objects[0];
var here = this.objects[0];
if (here.nextElementSibling) {
return $(here.nextElementSibling);
}
@ -269,7 +269,7 @@ util.fn = util.prototype = {
return $(here);
},
previousElementSibling: function () {
here = this.objects[0];
var here = this.objects[0];
if (here.previousElementSibling) {
return $(here.previousElementSibling);
}