diff options
author | Thomas Lange <code@nerdmind.de> | 2021-06-17 22:00:39 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2021-06-17 22:00:39 +0200 |
commit | 5555624546ea48d6327700f32b80848e0662dc90 (patch) | |
tree | 47d61fb756a6cb008aaf33586d292fcfe43da2a1 /admin/page/update.php | |
parent | 91d8a28c664afa5378735bcd0efe068dd74d589f (diff) | |
parent | 0a2614cb69fc732c2115ef2f0c356f39f602d311 (diff) | |
download | blog-optimization.tar.gz blog-optimization.tar.xz blog-optimization.zip |
Merge branch 'master' into 'optimization'optimization
Diffstat (limited to 'admin/page/update.php')
-rw-r--r-- | admin/page/update.php | 60 |
1 files changed, 25 insertions, 35 deletions
diff --git a/admin/page/update.php b/admin/page/update.php index f0bef1e..ba34a86 100644 --- a/admin/page/update.php +++ b/admin/page/update.php @@ -39,45 +39,36 @@ try { } } - #=============================================================================== - # TRY: Template\Exception - #=============================================================================== - try { - $userIDs = $Database->query(sprintf('SELECT id FROM %s ORDER BY fullname ASC', User\Attribute::TABLE)); - - foreach($userIDs->fetchAll($Database::FETCH_COLUMN) as $userID) { - $User = User\Factory::build($userID); - $userAttributes[] = [ - 'ID' => $User->attr('id'), - 'FULLNAME' => $User->attr('fullname'), - 'USERNAME' => $User->attr('username'), - ]; - } - - $FormTemplate = Template\Factory::build('page/form'); - $FormTemplate->set('FORM', [ - 'TYPE' => 'UPDATE', - 'INFO' => $messages ?? [], - 'DATA' => array_change_key_case($Attribute->getAll(), CASE_UPPER), - 'USER_LIST' => $userAttributes ?? [], - 'TOKEN' => Application::getSecurityToken() - ]); + $userIDs = $Database->query(sprintf('SELECT id FROM %s ORDER BY fullname ASC', User\Attribute::TABLE)); - $PageUpdateTemplate = Template\Factory::build('page/update'); - $PageUpdateTemplate->set('HTML', $FormTemplate); - - $MainTemplate = Template\Factory::build('main'); - $MainTemplate->set('NAME', $Language->text('title_page_update')); - $MainTemplate->set('HTML', $PageUpdateTemplate); - echo $MainTemplate; + foreach($userIDs->fetchAll($Database::FETCH_COLUMN) as $userID) { + $User = User\Factory::build($userID); + $userAttributes[] = [ + 'ID' => $User->attr('id'), + 'FULLNAME' => $User->attr('fullname'), + 'USERNAME' => $User->attr('username'), + ]; } #=============================================================================== - # CATCH: Template\Exception + # Build document #=============================================================================== - catch(Template\Exception $Exception) { - Application::exit($Exception->getMessage()); - } + $FormTemplate = Template\Factory::build('page/form'); + $FormTemplate->set('FORM', [ + 'TYPE' => 'UPDATE', + 'INFO' => $messages ?? [], + 'DATA' => array_change_key_case($Attribute->getAll(), CASE_UPPER), + 'USER_LIST' => $userAttributes ?? [], + 'TOKEN' => Application::getSecurityToken() + ]); + + $PageUpdateTemplate = Template\Factory::build('page/update'); + $PageUpdateTemplate->set('HTML', $FormTemplate); + + $MainTemplate = Template\Factory::build('main'); + $MainTemplate->set('NAME', $Language->text('title_page_update')); + $MainTemplate->set('HTML', $PageUpdateTemplate); + echo $MainTemplate; } #=============================================================================== @@ -86,4 +77,3 @@ try { catch(Page\Exception $Exception) { Application::error404(); } -?>
\ No newline at end of file |