aboutsummaryrefslogtreecommitdiffstats
path: root/core/include/search/main.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/include/search/main.php')
-rw-r--r--core/include/search/main.php78
1 files changed, 34 insertions, 44 deletions
diff --git a/core/include/search/main.php b/core/include/search/main.php
index 5a9708e..ac7e23a 100644
--- a/core/include/search/main.php
+++ b/core/include/search/main.php
@@ -35,56 +35,46 @@ $search_data = [
];
#===============================================================================
-# TRY: Template\Exception
+# Build document
#===============================================================================
-try {
- if(isset($attributes) AND !empty($attributes)) {
- foreach($attributes as $Attribute) {
- try {
- $Post = Post\Factory::buildByAttribute($Attribute);
- $User = User\Factory::build($Post->attr('user'));
+if(isset($attributes) AND !empty($attributes)) {
+ foreach($attributes as $Attribute) {
+ try {
+ $Post = Post\Factory::buildByAttribute($Attribute);
+ $User = User\Factory::build($Post->attr('user'));
- $posts[] = generatePostItemTemplate($Post, $User);
- }
- catch(Post\Exception $Exception){}
- catch(User\Exception $Exception){}
+ $posts[] = generatePostItemTemplate($Post, $User);
}
-
- $ResultTemplate = Template\Factory::build('search/result');
- $ResultTemplate->set('FORM', $form_data);
- $ResultTemplate->set('SEARCH', $search_data);
- $ResultTemplate->set('RESULT', [
- 'LIST' => $posts ?? []
- ]);
-
- $MainTemplate = Template\Factory::build('main');
- $MainTemplate->set('HTML', $ResultTemplate);
- $MainTemplate->set('HEAD', [
- 'NAME' => $Language->text('title_search_results', escapeHTML($search)),
- 'PERM' => Application::getURL('search/')
- ]);
+ catch(Post\Exception $Exception){}
+ catch(User\Exception $Exception){}
}
- else {
- $SearchTemplate = Template\Factory::build('search/main');
- $SearchTemplate->set('FORM', $form_data);
- $SearchTemplate->set('SEARCH', $search_data);
-
- $MainTemplate = Template\Factory::build('main');
- $MainTemplate->set('HTML', $SearchTemplate);
- $MainTemplate->set('HEAD', [
- 'NAME' => $Language->text('title_search_request'),
- 'PERM' => Application::getURL('search/')
- ]);
- }
+ $ResultTemplate = Template\Factory::build('search/result');
+ $ResultTemplate->set('FORM', $form_data);
+ $ResultTemplate->set('SEARCH', $search_data);
+ $ResultTemplate->set('RESULT', [
+ 'LIST' => $posts ?? []
+ ]);
- echo $MainTemplate;
+ $MainTemplate = Template\Factory::build('main');
+ $MainTemplate->set('HTML', $ResultTemplate);
+ $MainTemplate->set('HEAD', [
+ 'NAME' => $Language->text('title_search_results', escapeHTML($search)),
+ 'PERM' => Application::getURL('search/')
+ ]);
}
-#===============================================================================
-# CATCH: Template\Exception
-#===============================================================================
-catch(Template\Exception $Exception) {
- Application::exit($Exception->getMessage());
+else {
+ $SearchTemplate = Template\Factory::build('search/main');
+ $SearchTemplate->set('FORM', $form_data);
+ $SearchTemplate->set('SEARCH', $search_data);
+
+ $MainTemplate = Template\Factory::build('main');
+ $MainTemplate->set('HTML', $SearchTemplate);
+ $MainTemplate->set('HEAD', [
+ 'NAME' => $Language->text('title_search_request'),
+ 'PERM' => Application::getURL('search/')
+ ]);
}
-?> \ No newline at end of file
+
+echo $MainTemplate;