diff options
Diffstat (limited to 'admin/page')
-rw-r--r-- | admin/page/index.php | 10 | ||||
-rw-r--r-- | admin/page/search.php | 16 |
2 files changed, 12 insertions, 14 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){} } } |