Benefits->CanBulkDownload){ throw new Exceptions\InvalidPermissionsException(); } // Everything OK, serve the file using Apache. // The xsendfile Apache module tells Apache to serve the file, including not-modified or etag headers. // Much more efficient than reading it in PHP and outputting it that way. header('X-Sendfile: ' . WEB_ROOT . $path); header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename="' . basename($path) . '"'); exit(); } catch(Exceptions\LoginRequiredException){ if(isset($_SERVER['HTTP_REFERER'])){ Template::RedirectToLogin(true, $_SERVER['HTTP_REFERER']); } else{ preg_match('|(^/bulk-downloads/[^/]+?)/|ius', $path, $matches); if(sizeof($matches) == 2){ // If we arrived from the bulk-downloads page, // Make the login form redirect to the bulk download root, instead of refreshing directly into a download Template::RedirectToLogin(true, $matches[1]); } else{ Template::RedirectToLogin(); } } } catch(Exceptions\InvalidPermissionsException){ http_response_code(403); } catch(Exceptions\InvalidFileException){ Template::Emit404(); } ?> 'Download ', 'highlight' => '', 'description' => 'Download zip files containing all of the Standard Ebooks released in a given month.']) ?>

Downloading ebook collections

Patrons circle members can download zip files containing all of the ebooks that were released in a given month of Standard Ebooks history. You can join the Patrons Circle with a small donation in support of our continuing mission to create free, beautiful digital literature.