Replace Template::Emit...() functions with more generic function

This commit is contained in:
Alex Cabal 2024-12-18 13:14:16 -06:00
parent f449c024ea
commit 806939ca49
40 changed files with 86 additions and 68 deletions

View file

@ -6,7 +6,7 @@ $canDownload = false;
$class = HttpInput::Str(GET, 'class');
if($class === null || ($class != 'authors' && $class != 'collections' && $class != 'subjects' && $class != 'months')){
Template::Emit404();
Template::ExitWithCode(Enums\HttpCode::NotFound);
}
if(Session::$User?->Benefits->CanBulkDownload){

View file

@ -49,7 +49,7 @@ catch(Exceptions\InvalidPermissionsException){
http_response_code(Enums\HttpCode::Forbidden->value);
}
catch(Exceptions\InvalidFileException){
Template::Emit404();
Template::ExitWithCode(Enums\HttpCode::NotFound);
}
?><?= Template::Header(['title' => 'Downloading Ebook Collections', 'highlight' => '', 'description' => 'Download zip files containing all of the Standard Ebooks released in a given month.']) ?>

View file

@ -67,10 +67,10 @@ try{
}
}
catch(Exceptions\AuthorNotFoundException){
Template::Emit404();
Template::ExitWithCode(Enums\HttpCode::NotFound);
}
catch(Exceptions\CollectionNotFoundException){
Template::Emit404();
Template::ExitWithCode(Enums\HttpCode::NotFound);
}
?><?= Template::Header(['title' => 'Download ', 'highlight' => '', 'description' => 'Download zip files containing all of the Standard Ebooks released in a given month.']) ?>