From 1d118971c972771927539161be8fc06455dca346 Mon Sep 17 00:00:00 2001 From: Git Date: Sun, 6 Nov 2011 08:00:31 +0000 Subject: [PATCH] Empty commit --- sections/artist/download.php | 17 ++++++++++++----- sections/collages/download.php | 16 ++++++++++++---- sections/requests/takeunfill.php | 4 +++- sections/schedule/index.php | 2 ++ 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/sections/artist/download.php b/sections/artist/download.php index 4d7f5875..fa72b938 100644 --- a/sections/artist/download.php +++ b/sections/artist/download.php @@ -107,17 +107,16 @@ } $SQL .= "ELSE 100 END AS Rank, t.GroupID, +t.ID, t.Media, t.Format, t.Encoding, tg.ReleaseType, IF(t.RemasterYear=0,tg.Year,t.RemasterYear), tg.Name, -t.Size, -f.File +t.Size FROM torrents AS t JOIN torrents_group AS tg ON tg.ID=t.GroupID AND tg.CategoryID='1' AND tg.ID IN (".implode(',',$GroupIDs).") -LEFT JOIN torrents_files AS f ON t.ID=f.TorrentID ORDER BY t.GroupID ASC, Rank DESC, t.$Preference"; $DB->query($SQL); @@ -126,18 +125,26 @@ $Skips = array(); $TotalSize = 0; +if(count($Downloads)) { + foreach($Downloads as $Download) { + $TorrentIDs[] = $Download[2]; + } + $DB->query("SELECT TorrentID, file FROM torrents_files WHERE TorrentID IN (".implode(',', $TorrentIDs).")"); + $Torrents = $DB->to_array('TorrentID',MYSQLI_ASSOC,false); +} + require(SERVER_ROOT.'/classes/class_torrent.php'); require(SERVER_ROOT.'/classes/class_zip.php'); $Zip = new ZIP(file_string($ArtistName)); foreach($Downloads as $Download) { - list($Rank, $GroupID, $Media, $Format, $Encoding, $ReleaseType, $Year, $Album, $Size, $Contents) = $Download; + list($Rank, $GroupID, $TorrentID, $Media, $Format, $Encoding, $ReleaseType, $Year, $Album, $Size) = $Download; $Artist = display_artists($Artists[$GroupID],false,true,false); if ($Rank == 100) { $Skips[] = $Artist.$Album.' '.$Year; continue; } $TotalSize += $Size; - $Contents = unserialize(base64_decode($Contents)); + $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']); diff --git a/sections/collages/download.php b/sections/collages/download.php index 8d25c1ec..9b06211b 100644 --- a/sections/collages/download.php +++ b/sections/collages/download.php @@ -103,13 +103,13 @@ } $SQL .= "ELSE 100 END AS Rank, t.GroupID, +t.ID, t.Media, t.Format, t.Encoding, IF(t.RemasterYear=0,tg.Year,t.RemasterYear), tg.Name, -t.Size, -f.File +t.Size FROM torrents AS t INNER JOIN collages_torrents AS c ON t.GroupID=c.GroupID AND c.CollageID='$CollageID' INNER JOIN torrents_group AS tg ON tg.ID=t.GroupID AND tg.CategoryID='1' @@ -122,18 +122,26 @@ $Skips = array(); $TotalSize = 0; +if(count($Downloads)) { + foreach($Downloads as $Download) { + $TorrentIDs[] = $Download[2]; + } + $DB->query("SELECT TorrentID, file FROM torrents_files WHERE TorrentID IN (".implode(',', $TorrentIDs).")"); + $Torrents = $DB->to_array('TorrentID',MYSQLI_ASSOC,false); +} + require(SERVER_ROOT.'/classes/class_torrent.php'); require(SERVER_ROOT.'/classes/class_zip.php'); $Zip = new ZIP(file_string($CollageName)); foreach($Downloads as $Download) { - list($Rank, $GroupID, $Media, $Format, $Encoding, $Year, $Album, $Size, $Contents) = $Download; + list($Rank, $GroupID, $TorrentID, $Media, $Format, $Encoding, $Year, $Album, $Size) = $Download; $Artist = display_artists($Artists[$GroupID],false,true,false); if ($Rank == 100) { $Skips[] = $Artist.$Album.' '.$Year; continue; } $TotalSize += $Size; - $Contents = unserialize(base64_decode($Contents)); + $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']); diff --git a/sections/requests/takeunfill.php b/sections/requests/takeunfill.php index 2a7a4d80..8b947543 100644 --- a/sections/requests/takeunfill.php +++ b/sections/requests/takeunfill.php @@ -45,7 +45,9 @@ $RequestVotes = get_votes_array($RequestID); if ($RequestVotes['TotalBounty'] > $Uploaded) { - $DB->query("UPDATE users_main SET Downloaded = Downloaded + ".$RequestVotes['TotalBounty']." WHERE ID = ".$FillerID); + // If we can't take it all out of upload, zero that out and add whatever is left as download. + $DB->query("UPDATE users_main SET Uploaded = 0 WHERE ID = ".$FillerID); + $DB->query("UPDATE users_main SET Downloaded = Downloaded + ".($RequestVotes['TotalBounty']-$Uploaded)." WHERE ID = ".$FillerID); } else { $DB->query("UPDATE users_main SET Uploaded = Uploaded - ".$RequestVotes['TotalBounty']." WHERE ID = ".$FillerID); } diff --git a/sections/schedule/index.php b/sections/schedule/index.php index 572a4d20..a21fc9a6 100644 --- a/sections/schedule/index.php +++ b/sections/schedule/index.php @@ -924,7 +924,9 @@ function next_hour() { \*************************************************************************/ + if($BiWeek != next_biweek() || $_GET['runbiweek']) { + echo "Ran bi-weekly functions\n"; //------------- Cycle auth keys -----------------------------------------//