aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to 'admin')
-rw-r--r--admin/page/search.php13
-rw-r--r--admin/post/search.php13
2 files changed, 20 insertions, 6 deletions
diff --git a/admin/page/search.php b/admin/page/search.php
index 85448df..a88ab15 100644
--- a/admin/page/search.php
+++ b/admin/page/search.php
@@ -30,9 +30,13 @@ $offset = ($currentSite-1) * $site_size;
# Check for search request
#===============================================================================
if($search = HTTP::GET('q')) {
- foreach($PageRepository->search($search, [], $site_size, $offset) as $Page) {
- $User = $UserRepository->find($Page->get('user'));
- $templates[] = generatePageItemTemplate($Page, $User);
+ try {
+ foreach($PageRepository->search($search, [], $site_size, $offset) as $Page) {
+ $User = $UserRepository->find($Page->get('user'));
+ $templates[] = generatePageItemTemplate($Page, $User);
+ }
+ } catch(PDOException $Exception) {
+ $messages[] = $Exception->getMessage();
}
}
@@ -57,6 +61,9 @@ if($count = $PageRepository->getLastSearchOverallCount()) {
$SearchTemplate = Template\Factory::build('page/search');
$SearchTemplate->set('QUERY', $search);
$SearchTemplate->set('PAGES', $templates ?? []);
+$SearchTemplate->set('FORM', [
+ 'INFO' => $messages ?? []
+]);
$SearchTemplate->set('PAGINATION', $pagination_data ?? []);
$MainTemplate = Template\Factory::build('main');
diff --git a/admin/post/search.php b/admin/post/search.php
index a270ccb..8cbfafb 100644
--- a/admin/post/search.php
+++ b/admin/post/search.php
@@ -30,9 +30,13 @@ $offset = ($currentSite-1) * $site_size;
# Check for search request
#===============================================================================
if($search = HTTP::GET('q')) {
- foreach($PostRepository->search($search, [], $site_size, $offset) as $Post) {
- $User = $UserRepository->find($Post->get('user'));
- $templates[] = generatePostItemTemplate($Post, $User);
+ try {
+ foreach ($PostRepository->search($search, [], $site_size, $offset) as $Post) {
+ $User = $UserRepository->find($Post->get('user'));
+ $templates[] = generatePostItemTemplate($Post, $User);
+ }
+ } catch(PDOException $Exception) {
+ $messages[] = $Exception->getMessage();
}
}
@@ -57,6 +61,9 @@ if($count = $PostRepository->getLastSearchOverallCount()) {
$SearchTemplate = Template\Factory::build('post/search');
$SearchTemplate->set('QUERY', $search);
$SearchTemplate->set('POSTS', $templates ?? []);
+$SearchTemplate->set('FORM', [
+ 'INFO' => $messages ?? []
+]);
$SearchTemplate->set('PAGINATION', $pagination_data ?? []);
$MainTemplate = Template\Factory::build('main');