Esempio n. 1
0
// Remove any suffixed id with .nzb which is added to help weblogging programs see nzb traffic.
$_GET['id'] = str_ireplace('.nzb', '', $_GET['id']);
$rel = new Releases(['Settings' => $page->settings]);
// User requested a zip of guid,guid,guid releases.
if (isset($_GET["zip"]) && $_GET["zip"] == "1") {
    $guids = explode(",", $_GET["id"]);
    if ($requests['num'] + sizeof($guids) > $maxDownloads) {
        header("X-DNZB-RCode: 503");
        header("X-DNZB-RText: User has exceeded maximum downloads for the day!");
        $page->show503();
    }
    $zip = $rel->getZipped($guids);
    if (strlen($zip) > 0) {
        $page->users->incrementGrabs($uid, count($guids));
        foreach ($guids as $guid) {
            $rel->updateGrab($guid);
            $page->users->addDownloadRequest($uid);
            if (isset($_GET["del"]) && $_GET["del"] == 1) {
                $page->users->delCartByUserAndRelease($guid, $uid);
            }
        }
        header("Content-type: application/octet-stream");
        header("Content-disposition: attachment; filename=" . date("Ymdhis") . ".nzb.zip");
        exit($zip);
    } else {
        $page->show404();
    }
}
$nzbPath = (new NZB($page->settings))->getNZBPath($_GET["id"]);
if (!file_exists($nzbPath)) {
    header("X-DNZB-RCode: 404");