Empty commit

This commit is contained in:
Git 2012-08-10 08:00:14 +00:00
parent 14be209994
commit 08cb7c2eb8

View File

@ -5,6 +5,7 @@ function compare($X, $Y){
}
define('MAX_PERS_COLLAGES', 3); // How many personal collages should be shown by default
define('MAX_COLLAGES', 5); // How many normal collages should be shown by default
include(SERVER_ROOT.'/sections/bookmarks/functions.php'); // has_bookmarked()
include(SERVER_ROOT.'/classes/class_text.php');
@ -646,19 +647,38 @@ function filelist($Str) {
$Cache->cache_value('torrent_collages_'.$GroupID, $Collages, 3600*6);
}
if(count($Collages)>0) {
if (count($Collages) > MAX_COLLAGES) {
// Pick some at random
$Range = range(0,count($Collages) - 1);
shuffle($Range);
$Indices = array_slice($Range, 0, MAX_COLLAGES);
$SeeAll = ' <a href="#" onClick="$(\'.collage_rows\').toggle(); return false;">(See all)</a>';
} else {
$Indices = range(0, count($Collages)-1);
$SeeAll = '';
}
?>
<table id="collages">
<tr class="colhead">
<td width="85%">Collage name</td>
<td width="85%">This album is in <?=count($Collages)?> collage<?=((count($Collages)>1)?'s':'')?><?=$SeeAll?></td>
<td># torrents</td>
</tr>
<? foreach ($Collages as $Collage) {
list($CollageName, $CollageTorrents, $CollageID) = $Collage;
<? foreach ($Indices as $i) {
list($CollageName, $CollageTorrents, $CollageID) = $Collages[$i];
unset($Collages[$i]);
?>
<tr>
<td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
<td><?=$CollageTorrents?></td>
</tr>
<? }
foreach ($Collages as $Collage) {
list($CollageName, $CollageTorrents, $CollageID) = $Collage;
?>
<tr class="collage_rows hidden">
<td><a href="collages.php?id=<?=$CollageID?>"><?=$CollageName?></a></td>
<td><?=$CollageTorrents?></td>
</tr>
<? } ?>
</table>
<?
@ -673,7 +693,7 @@ function filelist($Str) {
if(count($PersonalCollages)>0) {
if (count($PersonalCollages) > MAX_PERS_COLLAGES) {
// Pick 5 at random
// Pick some at random
$Range = range(0,count($PersonalCollages) - 1);
shuffle($Range);
$Indices = array_slice($Range, 0, MAX_PERS_COLLAGES);