From 347c04b7b5e4c6f78d8444522e42adf6e2f00d54 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Fri, 15 Nov 2019 12:53:37 -0600 Subject: [PATCH] Tweak usage of HttpInput::Get* to use default parameter instead of null coalesce --- www/ebooks/author.php | 2 +- www/ebooks/ebook.php | 2 +- www/ebooks/index.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/www/ebooks/author.php b/www/ebooks/author.php index 928c16d1..20f19d34 100644 --- a/www/ebooks/author.php +++ b/www/ebooks/author.php @@ -2,7 +2,7 @@ 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/ + $urlPath = trim(str_replace('.', '', HttpInput::GetString('url-path', true, '')), '/'); // Contains the portion of the URL (without query string) that comes after https://standardebooks.org/ebooks/ $wwwFilesystemPath = EBOOKS_DIST_PATH . $urlPath; // Path to the deployed WWW files for this ebook if($urlPath == '' || mb_stripos($wwwFilesystemPath, EBOOKS_DIST_PATH) !== 0 || !is_dir($wwwFilesystemPath)){ diff --git a/www/ebooks/ebook.php b/www/ebooks/ebook.php index c085ac65..90a6b925 100644 --- a/www/ebooks/ebook.php +++ b/www/ebooks/ebook.php @@ -7,7 +7,7 @@ use function Safe\apcu_fetch; 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/ + $urlPath = trim(str_replace('.', '', HttpInput::GetString('url-path', true, '')), '/'); // Contains the portion of the URL (without query string) that comes after https://standardebooks.org/ebooks/ $wwwFilesystemPath = EBOOKS_DIST_PATH . $urlPath; // Path to the deployed WWW files for this ebook if($urlPath == '' || mb_stripos($wwwFilesystemPath, EBOOKS_DIST_PATH) !== 0){ diff --git a/www/ebooks/index.php b/www/ebooks/index.php index 516ad4f1..f46ecd6e 100644 --- a/www/ebooks/index.php +++ b/www/ebooks/index.php @@ -4,11 +4,11 @@ require_once('Core.php'); use function Safe\preg_replace; try{ - $page = HttpInput::GetInt('page') ?? 1; + $page = HttpInput::GetInt('page', 1); $query = HttpInput::GetString('query', false); $tag = HttpInput::GetString('tag', false); $collection = HttpInput::GetString('collection', false); - $sort = HttpInput::GetString('sort', false) ?? SORT_NEWEST; + $sort = HttpInput::GetString('sort', false, SORT_NEWEST); $pages = 0; $totalEbooks = 0;