Example #1
0
    }
}
//Stupid Recent Snatches On User Page
if ($CategoryID == '1' && $Image != '') {
    $RecentSnatches = $Cache->get_value("recent_snatches_{$UserID}");
    if (!empty($RecentSnatches)) {
        $Snatch = array('ID' => $GroupID, 'Name' => $Name, 'Artist' => $Artists, 'WikiImage' => $Image);
        if (!in_array($Snatch, $RecentSnatches)) {
            if (count($RecentSnatches) === 5) {
                array_pop($RecentSnatches);
            }
            array_unshift($RecentSnatches, $Snatch);
        } elseif (!is_array($RecentSnatches)) {
            $RecentSnatches = array($Snatch);
        }
        $Cache->cache_value("recent_snatches_{$UserID}", $RecentSnatches, 0);
    }
}
$DB->query("\n\tINSERT IGNORE INTO users_downloads (UserID, TorrentID, Time)\n\tVALUES ('{$UserID}', '{$TorrentID}', '" . sqltime() . "')");
$DB->query("\n\tSELECT File\n\tFROM torrents_files\n\tWHERE TorrentID = '{$TorrentID}'");
Torrents::set_snatch_update_time($UserID, Torrents::SNATCHED_UPDATE_AFTERDL);
list($Contents) = $DB->next_record(MYSQLI_NUM, false);
$FileName = TorrentsDL::construct_file_name($Info['PlainArtists'], $Name, $Year, $Media, $Format, $Encoding, false, $DownloadAlt);
if ($DownloadAlt) {
    header('Content-Type: text/plain; charset=utf-8');
} elseif (!$DownloadAlt || $Failed) {
    header('Content-Type: application/x-bittorrent; charset=utf-8');
}
header('Content-disposition: attachment; filename="' . $FileName . '"');
echo TorrentsDL::get_file($Contents, ANNOUNCE_URL . "/{$TorrentPass}/announce");
define('SKIP_NO_CACHE_HEADERS', 1);