aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to 'admin')
-rw-r--r--admin/page/index.php10
-rw-r--r--admin/page/search.php16
-rw-r--r--admin/post/index.php10
-rw-r--r--admin/post/search.php16
-rw-r--r--admin/user/index.php10
5 files changed, 29 insertions, 33 deletions
diff --git a/admin/page/index.php b/admin/page/index.php
index 7c8b1a6..82ac05f 100644
--- a/admin/page/index.php
+++ b/admin/page/index.php
@@ -26,14 +26,14 @@ if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) {
}
#===============================================================================
-# Fetch page IDs from database
+# Fetch items from database
#===============================================================================
-$execSQL = "SELECT id FROM %s ORDER BY {$site_sort} LIMIT ".(($currentSite-1) * $site_size).", {$site_size}";
-$pageIDs = $Database->query(sprintf($execSQL, Page\Attribute::TABLE))->fetchAll($Database::FETCH_COLUMN);
+$execSQL = "SELECT * FROM %s ORDER BY {$site_sort} LIMIT ".(($currentSite-1) * $site_size).", {$site_size}";
+$Statement = $Database->query(sprintf($execSQL, Page\Attribute::TABLE));
-foreach($pageIDs as $pageID) {
+while($Attribute = $Statement->fetchObject('Page\Attribute')) {
try {
- $Page = Page\Factory::build($pageID);
+ $Page = Page\Factory::buildByAttribute($Attribute);
$User = User\Factory::build($Page->attr('user'));
$ItemTemplate = generatePageItemTemplate($Page, $User);
diff --git a/admin/page/search.php b/admin/page/search.php
index eb57a7c..9f68b69 100644
--- a/admin/page/search.php
+++ b/admin/page/search.php
@@ -14,17 +14,15 @@ require '../../core/application.php';
# IF: Handle search request
#===============================================================================
if($search = HTTP::GET('q')) {
- if($pageIDs = Page\Item::getSearchResultIDs($search, $Database)) {
- foreach($pageIDs as $pageID) {
- try {
- $Page = Page\Factory::build($pageID);
- $User = User\Factory::build($Page->attr('user'));
+ foreach(Page\Item::getSearchResults($search, $Database) as $Attribute) {
+ try {
+ $Page = Page\Factory::buildByAttribute($Attribute);
+ $User = User\Factory::build($Page->attr('user'));
- $pages[] = generatePageItemTemplate($Page, $User);
- }
- catch(Page\Exception $Exception){}
- catch(User\Exception $Exception){}
+ $pages[] = generatePageItemTemplate($Page, $User);
}
+ catch(Page\Exception $Exception){}
+ catch(User\Exception $Exception){}
}
}
diff --git a/admin/post/index.php b/admin/post/index.php
index e18a634..1269236 100644
--- a/admin/post/index.php
+++ b/admin/post/index.php
@@ -26,14 +26,14 @@ if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) {
}
#===============================================================================
-# Fetch post IDs from database
+# Fetch items from database
#===============================================================================
-$execSQL = "SELECT id FROM %s ORDER BY {$site_sort} LIMIT ".(($currentSite-1) * $site_size).", {$site_size}";
-$postIDs = $Database->query(sprintf($execSQL, Post\Attribute::TABLE))->fetchAll($Database::FETCH_COLUMN);
+$execSQL = "SELECT * FROM %s ORDER BY {$site_sort} LIMIT ".(($currentSite-1) * $site_size).", {$site_size}";
+$Statement = $Database->query(sprintf($execSQL, Post\Attribute::TABLE));
-foreach($postIDs as $postID) {
+while($Attribute = $Statement->fetchObject('Post\Attribute')) {
try {
- $Post = Post\Factory::build($postID);
+ $Post = Post\Factory::buildByAttribute($Attribute);
$User = User\Factory::build($Post->attr('user'));
$ItemTemplate = generatePostItemTemplate($Post, $User);
diff --git a/admin/post/search.php b/admin/post/search.php
index 8fe6a51..261cc06 100644
--- a/admin/post/search.php
+++ b/admin/post/search.php
@@ -14,17 +14,15 @@ require '../../core/application.php';
# IF: Handle search request
#===============================================================================
if($search = HTTP::GET('q')) {
- if($postIDs = Post\Item::getSearchResultIDs($search, [NULL, NULL, NULL], $Database)) {
- foreach($postIDs as $postID) {
- try {
- $Post = Post\Factory::build($postID);
- $User = User\Factory::build($Post->attr('user'));
+ foreach(Post\Item::getSearchResults($search, [NULL, NULL, NULL], $Database) 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);
}
+ catch(Post\Exception $Exception){}
+ catch(User\Exception $Exception){}
}
}
diff --git a/admin/user/index.php b/admin/user/index.php
index 7d0cfa8..8276d91 100644
--- a/admin/user/index.php
+++ b/admin/user/index.php
@@ -26,14 +26,14 @@ if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) {
}
#===============================================================================
-# Fetch user IDs from database
+# Fetch items from database
#===============================================================================
-$execSQL = "SELECT id FROM %s ORDER BY {$site_sort} LIMIT ".(($currentSite-1) * $site_size).", {$site_size}";
-$userIDs = $Database->query(sprintf($execSQL, User\Attribute::TABLE))->fetchAll($Database::FETCH_COLUMN);
+$execSQL = "SELECT * FROM %s ORDER BY {$site_sort} LIMIT ".(($currentSite-1) * $site_size).", {$site_size}";
+$Statement = $Database->query(sprintf($execSQL, User\Attribute::TABLE));
-foreach($userIDs as $userID) {
+while($Attribute = $Statement->fetchObject('User\Attribute')) {
try {
- $User = User\Factory::build($userID);
+ $User = User\Factory::buildByAttribute($Attribute);
$ItemTemplate = generateUserItemTemplate($User);
$users[] = $ItemTemplate;