diff options
Diffstat (limited to 'core/include/user/main.php')
-rw-r--r-- | core/include/user/main.php | 66 |
1 files changed, 22 insertions, 44 deletions
diff --git a/core/include/user/main.php b/core/include/user/main.php index 4f30020..80969da 100644 --- a/core/include/user/main.php +++ b/core/include/user/main.php @@ -32,54 +32,33 @@ try { $user_data['NEXT'] = generateItemTemplateData($NextUser); } catch(User\Exception $Exception){} + $PostCountStatement = $Database->query(sprintf('SELECT COUNT(*) FROM %s WHERE user = %d', Post\Attribute::TABLE, $User->getID())); + $PageCountStatement = $Database->query(sprintf('SELECT COUNT(*) FROM %s WHERE user = %d', Page\Attribute::TABLE, $User->getID())); + #=============================================================================== - # TRY: Template\Exception + # Build document #=============================================================================== - try { - #=============================================================================== - # TRY: PDOException - #=============================================================================== - try { - $PostCountStatement = $Database->query(sprintf('SELECT COUNT(*) FROM %s WHERE user = %d', Post\Attribute::TABLE, $User->getID())); - $PageCountStatement = $Database->query(sprintf('SELECT COUNT(*) FROM %s WHERE user = %d', Page\Attribute::TABLE, $User->getID())); - } - - #=============================================================================== - # CATCH: PDOException - #=============================================================================== - catch(PDOException $Exception) { - exit($Exception->getMessage()); - } - - $UserTemplate = Template\Factory::build('user/main'); - $UserTemplate->set('USER', $user_data); - $UserTemplate->set('COUNT', [ - 'POST' => $PostCountStatement->fetchColumn(), - 'PAGE' => $PageCountStatement->fetchColumn() - ]); + $UserTemplate = Template\Factory::build('user/main'); + $UserTemplate->set('USER', $user_data); + $UserTemplate->set('COUNT', [ + 'POST' => $PostCountStatement->fetchColumn(), + 'PAGE' => $PageCountStatement->fetchColumn() + ]); - $MainTemplate = Template\Factory::build('main'); - $MainTemplate->set('HTML', $UserTemplate); - $MainTemplate->set('HEAD', [ - 'NAME' => $user_data['ATTR']['FULLNAME'], - 'DESC' => description($user_data['BODY']['HTML'](), Application::get('USER.DESCRIPTION_SIZE')), - 'PERM' => $User->getURL(), - 'OG_IMAGES' => $User->getFiles() - ]); + $MainTemplate = Template\Factory::build('main'); + $MainTemplate->set('HTML', $UserTemplate); + $MainTemplate->set('HEAD', [ + 'NAME' => $user_data['ATTR']['FULLNAME'], + 'DESC' => description($user_data['BODY']['HTML'](), Application::get('USER.DESCRIPTION_SIZE')), + 'PERM' => $User->getURL(), + 'OG_IMAGES' => $User->getFiles() + ]); - # Get access to the current item data from main template - $MainTemplate->set('TYPE', 'USER'); - $MainTemplate->set('USER', $user_data); + # Get access to the current item data from main template + $MainTemplate->set('TYPE', 'USER'); + $MainTemplate->set('USER', $user_data); - echo $MainTemplate; - } - - #=============================================================================== - # CATCH: Template\Exception - #=============================================================================== - catch(Template\Exception $Exception) { - Application::exit($Exception->getMessage()); - } + echo $MainTemplate; } #=============================================================================== @@ -100,4 +79,3 @@ catch(User\Exception $Exception) { Application::error404(); } } -?>
\ No newline at end of file |