diff --git a/sections/artist/download.php b/sections/artist/download.php
index fa72b938..2afabb3e 100644
--- a/sections/artist/download.php
+++ b/sections/artist/download.php
@@ -66,13 +66,17 @@
$DB->query("SELECT Name FROM artists_group WHERE ArtistID='$ArtistID'");
list($ArtistName) = $DB->next_record(MYSQLI_NUM,false);
-$DB->query("SELECT GroupID FROM torrents_artists WHERE ArtistID='$ArtistID'");
+$DB->query("SELECT GroupID, Importance FROM torrents_artists WHERE ArtistID='$ArtistID'");
if($DB->record_count() == 0) { error(404); }
-$GroupIDs = $DB->collect(0,false);
+$Releases = $DB->to_array('GroupID',MYSQLI_ASSOC,false);
+$GroupIDs = array_keys($Releases);
$SQL = "SELECT CASE ";
foreach ($_REQUEST['list'] as $Priority => $Selection) {
+ if(!is_number($Priority)) {
+ continue;
+ }
$SQL .= "WHEN ";
switch ($Selection) {
case '00': $SQL .= "t.Format='MP3' AND t.Encoding='V0 (VBR)'"; break;
@@ -103,7 +107,7 @@
case '46': $SQL .= "t.Format='AAC' AND t.Encoding='192'"; break;
default: error(0);
}
- $SQL .= " THEN '".db_string($Priority)."' ";
+ $SQL .= " THEN $Priority ";
}
$SQL .= "ELSE 100 END AS Rank,
t.GroupID,
@@ -121,10 +125,9 @@
$DB->query($SQL);
$Downloads = $DB->to_array('1',MYSQLI_NUM,false);
-$Artists = get_artists($DB->collect('GroupID'), false);
+$Artists = get_artists($GroupIDs, false);
$Skips = array();
$TotalSize = 0;
-
if(count($Downloads)) {
foreach($Downloads as $Download) {
$TorrentIDs[] = $Download[2];
@@ -143,12 +146,19 @@
$Skips[] = $Artist.$Album.' '.$Year;
continue;
}
+ if($Releases[$GroupID]['Importance'] == 1) {
+ $ReleaseTypeName = $ReleaseTypes[$ReleaseType];
+ } elseif($Releases[$GroupID]['Importance'] == 2) {
+ $ReleaseTypeName = "Guest Appearance";
+ } elseif($Releases[$GroupID]['Importance'] == 3) {
+ $ReleaseTypeName = "Remixed By";
+ }
$TotalSize += $Size;
$Contents = unserialize(base64_decode($Torrents[$TorrentID]['file']));
$Tor = new TORRENT($Contents, true);
$Tor->set_announce_url(ANNOUNCE_URL.'/'.$LoggedUser['torrent_pass'].'/announce');
unset($Tor->Val['announce-list']);
- $Zip->add_file($Tor->enc(), $ReleaseTypes[$ReleaseType].'/'.file_string($Artist.$Album).' - '.file_string($Year).' ('.file_string($Media).' - '.file_string($Format).' - '.file_string($Encoding).').torrent');
+ $Zip->add_file($Tor->enc(), $ReleaseTypeName.'/'.file_string($Artist.$Album).' - '.file_string($Year).' ('.file_string($Media).' - '.file_string($Format).' - '.file_string($Encoding).').torrent');
}
$Analyzed = count($Downloads);
$Skipped = count($Skips);
diff --git a/sections/collages/download.php b/sections/collages/download.php
index 9b06211b..b4b03a4e 100644
--- a/sections/collages/download.php
+++ b/sections/collages/download.php
@@ -69,6 +69,9 @@
$SQL = "SELECT CASE ";
foreach ($_REQUEST['list'] as $Priority => $Selection) {
+ if(!is_number($Priority)) {
+ continue;
+ }
$SQL .= "WHEN ";
switch ($Selection) {
case '00': $SQL .= "t.Format='MP3' AND t.Encoding='V0 (VBR)'"; break;
diff --git a/sections/schedule/index.php b/sections/schedule/index.php
index a21fc9a6..b255cb64 100644
--- a/sections/schedule/index.php
+++ b/sections/schedule/index.php
@@ -112,12 +112,13 @@ function next_hour() {
//------------- Front page stats ----------------------------------------//
//Love or hate, this makes things a hell of a lot faster
- if ($Hour%6 == 0) {
+
+ if ($Hour%2 == 0) {
$DB->query("SELECT COUNT(uid) AS Snatches FROM xbt_snatched");
list($SnatchStats) = $DB->next_record();
$Cache->cache_value('stats_snatches',$SnatchStats,0);
}
-
+
$DB->query("SELECT COUNT(uid) FROM xbt_files_users WHERE remaining>0");
list($LeecherCount) = $DB->next_record();
$DB->query("SELECT COUNT(uid) FROM xbt_files_users WHERE remaining=0");
diff --git a/sections/torrents/browse2.php b/sections/torrents/browse2.php
index 6cdf9ea3..f304e537 100644
--- a/sections/torrents/browse2.php
+++ b/sections/torrents/browse2.php
@@ -292,14 +292,18 @@ function header_link($SortKey,$DefaultWay="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';
$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 {
$OrderBy = $_GET['order_by'];
}
-$SS->SetSortMode($Way, $_GET['order_by']);
+$SS->SetSortMode($Way, $OrderBy);
if(count($Queries)>0) {
@@ -540,6 +544,7 @@ function header_link($SortKey,$DefaultWay="desc") {
+