mirror of
https://github.com/standardebooks/web.git
synced 2025-07-22 07:14:59 -04:00
Rearrange filesystem layout, and add configuration files
This commit is contained in:
parent
0acc64cb06
commit
8f33a1021c
18 changed files with 590 additions and 57 deletions
|
@ -3,9 +3,9 @@ require_once('Core.php');
|
|||
|
||||
try{
|
||||
$urlPath = trim(str_replace('.', '', HttpInput::GetString('url-path') ?? ''), '/'); // Contains the portion of the URL (without query string) that comes after https://standardebooks.org/ebooks/
|
||||
$wwwFilesystemPath = SITE_ROOT . '/www/ebooks/' . $urlPath; // Path to the deployed WWW files for this ebook
|
||||
$wwwFilesystemPath = EBOOKS_DIST_PATH . $urlPath; // Path to the deployed WWW files for this ebook
|
||||
|
||||
if($urlPath == '' || mb_stripos($wwwFilesystemPath, SITE_ROOT . '/www/ebooks/') !== 0 || !is_dir($wwwFilesystemPath)){
|
||||
if($urlPath == '' || mb_stripos($wwwFilesystemPath, EBOOKS_DIST_PATH) !== 0 || !is_dir($wwwFilesystemPath)){
|
||||
// Ensure the path exists and that the root is in our www directory
|
||||
throw new InvalidAuthorException();
|
||||
}
|
||||
|
|
|
@ -8,9 +8,9 @@ use function Safe\shuffle;
|
|||
|
||||
try{
|
||||
$urlPath = trim(str_replace('.', '', HttpInput::GetString('url-path') ?? ''), '/'); // Contains the portion of the URL (without query string) that comes after https://standardebooks.org/ebooks/
|
||||
$wwwFilesystemPath = SITE_ROOT . '/www/ebooks/' . $urlPath; // Path to the deployed WWW files for this ebook
|
||||
$wwwFilesystemPath = EBOOKS_DIST_PATH . $urlPath; // Path to the deployed WWW files for this ebook
|
||||
|
||||
if($urlPath == '' || mb_stripos($wwwFilesystemPath, SITE_ROOT . '/www/ebooks/') !== 0){
|
||||
if($urlPath == '' || mb_stripos($wwwFilesystemPath, EBOOKS_DIST_PATH) !== 0){
|
||||
// Ensure the path exists and that the root is in our www directory
|
||||
throw new InvalidEbookException();
|
||||
}
|
||||
|
@ -46,7 +46,9 @@ try{
|
|||
shuffle($ebooks);
|
||||
|
||||
for($i = 0; $i < 5; $i++){
|
||||
$carousel[] = $ebooks[$i];
|
||||
if(isset($ebooks[$i])){
|
||||
$carousel[] = $ebooks[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(SeeOtherEbookException $ex){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue