diff options
Diffstat (limited to 'admin')
-rw-r--r-- | admin/page/index.php | 10 | ||||
-rw-r--r-- | admin/post/index.php | 10 | ||||
-rw-r--r-- | admin/user/index.php | 10 |
3 files changed, 15 insertions, 15 deletions
diff --git a/admin/page/index.php b/admin/page/index.php index c14bf13..caff257 100644 --- a/admin/page/index.php +++ b/admin/page/index.php @@ -26,18 +26,18 @@ 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)); #=============================================================================== # TRY: Template\Exception #=============================================================================== try { - 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/post/index.php b/admin/post/index.php index 57b19e9..7e492ba 100644 --- a/admin/post/index.php +++ b/admin/post/index.php @@ -26,18 +26,18 @@ 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)); #=============================================================================== # TRY: Template\Exception #=============================================================================== try { - 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/user/index.php b/admin/user/index.php index b474fc8..dc5a4e7 100644 --- a/admin/user/index.php +++ b/admin/user/index.php @@ -26,18 +26,18 @@ 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)); #=============================================================================== # TRY: Template\Exception #=============================================================================== try { - 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; |