aboutsummaryrefslogtreecommitdiffstats
path: root/core/include/post/list.php
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2021-06-17 22:00:39 +0200
committerThomas Lange <code@nerdmind.de>2021-06-17 22:00:39 +0200
commit5555624546ea48d6327700f32b80848e0662dc90 (patch)
tree47d61fb756a6cb008aaf33586d292fcfe43da2a1 /core/include/post/list.php
parent91d8a28c664afa5378735bcd0efe068dd74d589f (diff)
parent0a2614cb69fc732c2115ef2f0c356f39f602d311 (diff)
downloadblog-5555624546ea48d6327700f32b80848e0662dc90.tar.gz
blog-5555624546ea48d6327700f32b80848e0662dc90.tar.xz
blog-5555624546ea48d6327700f32b80848e0662dc90.zip
Merge branch 'master' into 'optimization'optimization
Diffstat (limited to 'core/include/post/list.php')
-rw-r--r--core/include/post/list.php66
1 files changed, 28 insertions, 38 deletions
diff --git a/core/include/post/list.php b/core/include/post/list.php
index 6ade592..68183c7 100644
--- a/core/include/post/list.php
+++ b/core/include/post/list.php
@@ -30,49 +30,39 @@ if(Application::get('POST.SINGLE_REDIRECT') === TRUE AND $count === '1') {
HTTP::redirect($Post->getURL());
}
-#===============================================================================
-# TRY: Template\Exception
-#===============================================================================
-try {
- $execSQL = "SELECT * FROM %s ORDER BY {$site_sort} LIMIT ".(($currentSite-1) * $site_size).", {$site_size}";
- $Statement = $Database->query(sprintf($execSQL, Post\Attribute::TABLE));
+$execSQL = "SELECT * FROM %s ORDER BY {$site_sort} LIMIT ".(($currentSite-1) * $site_size).", {$site_size}";
+$Statement = $Database->query(sprintf($execSQL, Post\Attribute::TABLE));
- while($Attribute = $Statement->fetchObject('Post\Attribute')) {
- try {
- $Post = Post\Factory::buildByAttribute($Attribute);
- $User = User\Factory::build($Post->attr('user'));
+while($Attribute = $Statement->fetchObject('Post\Attribute')) {
+ try {
+ $Post = Post\Factory::buildByAttribute($Attribute);
+ $User = User\Factory::build($Post->attr('user'));
- $ItemTemplate = generatePostItemTemplate($Post, $User);
+ $ItemTemplate = generatePostItemTemplate($Post, $User);
- $posts[] = $ItemTemplate;
- }
- catch(Post\Exception $Exception){}
- catch(User\Exception $Exception){}
+ $posts[] = $ItemTemplate;
}
-
- $ListTemplate = Template\Factory::build('post/list');
- $ListTemplate->set('PAGINATION', [
- 'THIS' => $currentSite,
- 'LAST' => $lastSite,
- 'HTML' => generatePostNaviTemplate($currentSite)
- ]);
- $ListTemplate->set('LIST', [
- 'POSTS' => $posts ?? []
- ]);
-
- $MainTemplate = Template\Factory::build('main');
- $MainTemplate->set('HTML', $ListTemplate);
- $MainTemplate->set('HEAD', [
- 'NAME' => $Language->text('title_post_overview', $currentSite)
- ]);
-
- echo $MainTemplate;
+ catch(Post\Exception $Exception){}
+ catch(User\Exception $Exception){}
}
#===============================================================================
-# CATCH: Template\Exception
+# Build document
#===============================================================================
-catch(Template\Exception $Exception) {
- Application::exit($Exception->getMessage());
-}
-?> \ No newline at end of file
+$ListTemplate = Template\Factory::build('post/list');
+$ListTemplate->set('PAGINATION', [
+ 'THIS' => $currentSite,
+ 'LAST' => $lastSite,
+ 'HTML' => generatePostNaviTemplate($currentSite)
+]);
+$ListTemplate->set('LIST', [
+ 'POSTS' => $posts ?? []
+]);
+
+$MainTemplate = Template\Factory::build('main');
+$MainTemplate->set('HTML', $ListTemplate);
+$MainTemplate->set('HEAD', [
+ 'NAME' => $Language->text('title_post_overview', $currentSite)
+]);
+
+echo $MainTemplate;