indenting

[collages] respect user grouping setting

changed sqltime

fix HTML character codes appearing in filenames
This commit is contained in:
What.CD 2011-07-05 08:00:07 +00:00
parent e61aa7c115
commit 8c7e564b47
7 changed files with 29 additions and 18 deletions

View File

@ -144,8 +144,11 @@ function time_minus($Offset, $Fuzzy = false) {
}
}
function sqltime() {
return date('Y-m-d H:i:s');
function sqltime($timestamp = false) {
if ($timestamp === false) {
$timestamp = time();
}
return date('Y-m-d H:i:s', $timestamp);
}
function validDate($DateString) {

View File

@ -1498,16 +1498,17 @@ function get_artist($GroupID) {
return $Results[$GroupID];
}
function display_artists($Artists, $MakeLink = true, $IncludeHyphen = true) {
function display_artists($Artists, $MakeLink = true, $IncludeHyphen = true, $Escape = true) {
if(!empty($Artists)) {
$ampersand = ($Escape) ? ' & ' : ' & ';
switch(count($Artists[1])) {
case 0:
return '';
case 1:
$link = display_artist($Artists[1][0], $MakeLink);
$link = display_artist($Artists[1][0], $MakeLink, $Escape);
break;
case 2:
$link = display_artist($Artists[1][0], $MakeLink).' & '.display_artist($Artists[1][1], $MakeLink);
$link = display_artist($Artists[1][0], $MakeLink, $Escape).$ampersand.display_artist($Artists[1][1], $MakeLink, $Escape);
break;
default:
$link = 'Various Artists';
@ -1515,10 +1516,10 @@ function display_artists($Artists, $MakeLink = true, $IncludeHyphen = true) {
if(!empty($Artists[2]) && (count($Artists[1]) < 3)) {
switch(count($Artists[2])) {
case 1:
$link .= ' with '.display_artist($Artists[2][0], $MakeLink);
$link .= ' with '.display_artist($Artists[2][0], $MakeLink, $Escape);
break;
case 2:
$link .= ' with '.display_artist($Artists[2][0], $MakeLink).' &amp; '.display_artist($Artists[2][1], $MakeLink);
$link .= ' with '.display_artist($Artists[2][0], $MakeLink, $Escape).$ampersand.display_artist($Artists[2][1], $MakeLink, $Escape);
break;
}
}
@ -1528,11 +1529,15 @@ function display_artists($Artists, $MakeLink = true, $IncludeHyphen = true) {
}
}
function display_artist($Artist, $MakeLink = true) {
if($MakeLink) {
function display_artist($Artist, $MakeLink = true, $Escape = true) {
if ($MakeLink && !$Escape) {
error('Invalid parameters to display_artist()');
} elseif ($MakeLink) {
return '<a href="artist.php?id='.$Artist['id'].'">'.display_str($Artist['name']).'</a>';
} else {
} elseif ($Escape) {
return display_str($Artist['name']);
} else {
return $Artist['name'];
}
}

View File

@ -127,7 +127,7 @@
$Zip = new ZIP(file_string($ArtistName));
foreach($Downloads as $Download) {
list($Rank, $GroupID, $Media, $Format, $Encoding, $ReleaseType, $Year, $Album, $Size, $Contents) = $Download;
$Artist = display_artists($Artists[$GroupID],false);
$Artist = display_artists($Artists[$GroupID],false,true,false);
if ($Rank == 100) {
$Skips[] = $Artist.$Album.' '.$Year;
continue;

View File

@ -129,11 +129,12 @@ function compare($X, $Y){
// Start an output buffer, so we can store this output in $TorrentTable
ob_start();
if(count($Torrents)>1 || $GroupCategoryID==1) {
// Grouped torrents
// Grouped torrents
$ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
?>
<tr class="group discog" id="group_<?=$GroupID?>">
<td class="center">
<div title="View" id="showimg_<?=$GroupID?>" class="hide_torrents">
<div title="View" id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
<a href="#" class="show_torrents_link" onclick="ToggleGroup(<?=$GroupID?>); return false;"></a>
</div>
</td>

View File

@ -127,7 +127,7 @@
$Zip = new ZIP(file_string($CollageName));
foreach($Downloads as $Download) {
list($Rank, $GroupID, $Media, $Format, $Encoding, $Year, $Album, $Size, $Contents) = $Download;
$Artist = display_artists($Artists[$GroupID],false);
$Artist = display_artists($Artists[$GroupID],false,true,false);
if ($Rank == 100) {
$Skips[] = $Artist.$Album.' '.$Year;
continue;

View File

@ -28,7 +28,7 @@
if (!is_number($TorrentID)){ error(0); }
$Info = $Cache->get_value('torrent_download_'.$TorrentID);
if(!is_array($Info)) {
if(!is_array($Info) || !array_key_exists('PlainArtists', $Info)) {
$DB->query("SELECT
t.Media,
t.Format,
@ -46,7 +46,9 @@
die();
}
$Info = array($DB->next_record(MYSQLI_NUM, array(4,5,6)));
$Info['Artists'] = display_artists(get_artist($Info[0][4],false), false, true);
$Artists = get_artist($Info[0][4],false);
$Info['Artists'] = display_artists($Artists, false, true);
$Info['PlainArtists'] = display_artists($Artists, false, true, false);
$Cache->cache_value('torrent_download_'.$TorrentID, $Info, 0);
}
if(!is_array($Info[0])) {
@ -93,7 +95,7 @@
$TorrentName='';
$TorrentInfo='';
$TorrentName = $Artists;
$TorrentName = $Info['PlainArtists'];
$TorrentName.=$Name;

View File

@ -65,7 +65,7 @@
$Zip = new ZIP($Username.'\'s '.ucfirst($_GET['type']));
foreach($Downloads as $Download) {
list($Month, $GroupID, $Media, $Format, $Encoding, $Year, $Album, $Size, $Contents) = $Download;
$Artist = display_artists($Artists[$GroupID],false);
$Artist = display_artists($Artists[$GroupID],false,true,false);
$Contents = unserialize(base64_decode($Contents));
$Tor = new TORRENT($Contents, true);
$Tor->set_announce_url(ANNOUNCE_URL.'/'.$LoggedUser['torrent_pass'].'/announce');