mirror of
https://github.com/standardebooks/web.git
synced 2025-07-18 12:26:39 -04:00
Move delete form and more multi select fixes
This commit is contained in:
parent
93b8008c7e
commit
8e8cbb0c5e
10 changed files with 136 additions and 24 deletions
35
www/ebooks/delete.php
Normal file
35
www/ebooks/delete.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?
|
||||
|
||||
$ebook = null;
|
||||
|
||||
try{
|
||||
if(Session::$User === null){
|
||||
throw new Exceptions\LoginRequiredException();
|
||||
}
|
||||
|
||||
if(!Session::$User->Benefits->CanEditEbookPlaceholders){
|
||||
throw new Exceptions\InvalidPermissionsException();
|
||||
}
|
||||
|
||||
$identifier = EBOOKS_IDENTIFIER_PREFIX . trim(str_replace('.', '', HttpInput::Str(GET, 'url-path') ?? ''), '/');
|
||||
|
||||
$ebook = Ebook::GetByIdentifier($identifier);
|
||||
|
||||
if($ebook->IsPlaceholder()){
|
||||
require(WEB_ROOT . '/ebook-placeholders/delete.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
// Deleting published `Ebooks` is not supported.
|
||||
Template::ExitWithCode(Enums\HttpCode::NotFound);
|
||||
}
|
||||
catch(Exceptions\EbookNotFoundException){
|
||||
Template::ExitWithCode(Enums\HttpCode::NotFound);
|
||||
}
|
||||
catch(Exceptions\LoginRequiredException){
|
||||
Template::RedirectToLogin();
|
||||
}
|
||||
catch(Exceptions\InvalidPermissionsException){
|
||||
Template::ExitWithCode(Enums\HttpCode::Forbidden);
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ try{
|
|||
$ebook = Ebook::GetByIdentifier($identifier);
|
||||
|
||||
if($ebook->IsPlaceholder()){
|
||||
require('/standardebooks.org/web/www/ebook-placeholders/edit.php');
|
||||
require(WEB_ROOT . '/ebook-placeholders/edit.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ try{
|
|||
$ebook = Ebook::GetByIdentifier($identifier);
|
||||
|
||||
if($ebook->IsPlaceholder()){
|
||||
require('/standardebooks.org/web/www/ebook-placeholders/get.php');
|
||||
require(WEB_ROOT . '/ebook-placeholders/get.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ catch(Exceptions\EbookNotFoundException){
|
|||
|
||||
// Are we accessing a placeholder for a Public Domain Day book that is not yet released?
|
||||
if(array_key_exists($identifier, PD_DAY_EBOOKS)){
|
||||
require('/standardebooks.org/web/www/ebooks/public-domain-day-placeholder.php');
|
||||
require(WEB_ROOT . '/ebooks/public-domain-day-placeholder.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ try{
|
|||
$ebook = Ebook::GetByIdentifier($identifier);
|
||||
|
||||
if($ebook->IsPlaceholder()){
|
||||
require('/standardebooks.org/web/www/ebook-placeholders/post.php');
|
||||
require(WEB_ROOT . '/ebook-placeholders/post.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue