More refactoring for static analysis

This commit is contained in:
Alex Cabal 2019-01-18 17:49:13 -06:00
parent 5939195955
commit ba53958596
9 changed files with 55 additions and 36 deletions

View file

@ -5,6 +5,8 @@ try{
$page = HttpInput::GetInt('page') ?? 1;
$query = HttpInput::GetString('query', false);
$sort = HttpInput::GetString('sort', false) ?? SORT_NEWEST;
$pages = 0;
$totalEbooks = 0;
if($page <= 0){
$page = 1;
@ -14,11 +16,7 @@ try{
$sort = SORT_NEWEST;
}
if($query !== null){
$ebooks = Library::Search($query);
$pageDescription = 'Search results';
}
else{
if($query === null){
$ebooks = Library::GetEbooks($sort);
$pages = ceil(sizeof($ebooks) / EBOOKS_PER_PAGE);
@ -37,6 +35,10 @@ try{
break;
}
}
else{
$ebooks = Library::Search($query);
$pageDescription = 'Search results';
}
$pageTitle = 'Browse Standard Ebooks';
if($query !== null){