diff options
author | Thomas Lange <code@nerdmind.de> | 2017-04-11 07:13:13 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2017-04-11 07:13:13 +0200 |
commit | 85e48b669f65933d5376f9214219c7e5eb10a9e7 (patch) | |
tree | 5a08463dc9d770d98442e1c9f8d65044cdd9f1ff /core | |
parent | dd0433cf81fe5329b694a148191f09e427d4a56c (diff) | |
download | blog-85e48b669f65933d5376f9214219c7e5eb10a9e7.tar.gz blog-85e48b669f65933d5376f9214219c7e5eb10a9e7.tar.xz blog-85e48b669f65933d5376f9214219c7e5eb10a9e7.zip |
The system directory has been moved to a non-public directory. After the commit e33c245d910e55b8cab407a03e669470509a705d, it is no longer necessary that the directory is publicly accessible via HTTP because all requests are running through the router.v1.2
Diffstat (limited to 'core')
-rw-r--r-- | core/include/feed/main.php | 77 | ||||
-rw-r--r-- | core/include/home.php | 55 | ||||
-rw-r--r-- | core/include/page/list.php | 65 | ||||
-rw-r--r-- | core/include/page/main.php | 90 | ||||
-rw-r--r-- | core/include/post/list.php | 65 | ||||
-rw-r--r-- | core/include/post/main.php | 90 | ||||
-rw-r--r-- | core/include/search/main.php | 90 | ||||
-rw-r--r-- | core/include/user/list.php | 61 | ||||
-rw-r--r-- | core/include/user/main.php | 98 |
9 files changed, 691 insertions, 0 deletions
diff --git a/core/include/feed/main.php b/core/include/feed/main.php new file mode 100644 index 0000000..671f5c7 --- /dev/null +++ b/core/include/feed/main.php @@ -0,0 +1,77 @@ +<?php +#=============================================================================== +# Get instances +#=============================================================================== +$Database = Application::getDatabase(); +$Language = Application::getLanguage(); + +#=============================================================================== +# HEADER: Content-Type for XML document +#=============================================================================== +HTTP::responseHeader(HTTP::HEADER_CONTENT_TYPE, HTTP::CONTENT_TYPE_XML); + +#=============================================================================== +# TRY: Template\Exception +#=============================================================================== +try { + if(!isset($param) OR $param !== 'page') { + $execSQL = 'SELECT id FROM %s ORDER BY '.Application::get('POST.FEED_SORT').' LIMIT '.Application::get('POST.FEED_SIZE'); + $postIDs = $Database->query(sprintf($execSQL, Post\Attribute::TABLE))->fetchAll($Database::FETCH_COLUMN); + + foreach($postIDs as $postID) { + try { + $Post = Post\Factory::build($postID); + $User = User\Factory::build($Post->attr('user')); + + $ItemTemplate = Template\Factory::build('feed/item_post'); + $ItemTemplate->set('POST', generatePostItemData($Post)); + $ItemTemplate->set('USER', generateUserItemData($User)); + + $posts[] = $ItemTemplate; + } + + catch(Post\Exception $Exception){} + catch(User\Exception $Exception){} + } + } + + if(!isset($param) OR $param !== 'post') { + $execSQL = 'SELECT id FROM %s ORDER BY '.Application::get('PAGE.FEED_SORT').' LIMIT '.Application::get('PAGE.FEED_SIZE'); + $pageIDs = $Database->query(sprintf($execSQL, Page\Attribute::TABLE))->fetchAll($Database::FETCH_COLUMN); + + foreach($pageIDs as $pageID) { + try { + $Page = Page\Factory::build($pageID); + $User = User\Factory::build($Page->attr('user')); + + $ItemTemplate = Template\Factory::build('feed/item_page'); + $ItemTemplate->set('PAGE', generatePageItemData($Page)); + $ItemTemplate->set('USER', generateUserItemData($User)); + + $pages[] = $ItemTemplate; + } + + catch(Page\Exception $Exception){} + catch(User\Exception $Exception){} + } + } + + $FeedTemplate = Template\Factory::build('feed/main'); + $FeedTemplate->set('FEED', [ + 'TYPE' => $param ?? NULL, + 'LIST' => [ + 'POSTS' => $posts ?? [], + 'PAGES' => $pages ?? [], + ] + ]); + + echo $FeedTemplate; +} + +#=============================================================================== +# CATCH: Template\Exception +#=============================================================================== +catch(Template\Exception $Exception) { + Application::exit($Exception->getMessage()); +} +?>
\ No newline at end of file diff --git a/core/include/home.php b/core/include/home.php new file mode 100644 index 0000000..ce91558 --- /dev/null +++ b/core/include/home.php @@ -0,0 +1,55 @@ +<?php +#=============================================================================== +# Get instances +#=============================================================================== +$Database = Application::getDatabase(); +$Language = Application::getLanguage(); + +#=============================================================================== +# TRY: Template\Exception +#=============================================================================== +try { + $execSQL = 'SELECT id FROM %s ORDER BY '.Application::get('POST.LIST_SORT').' LIMIT '.Application::get('POST.LIST_SIZE'); + $Statement = $Database->query(sprintf($execSQL, Post\Attribute::TABLE)); + + $postIDs = $Statement->fetchAll($Database::FETCH_COLUMN); + + foreach($postIDs as $postID) { + try { + $Post = Post\Factory::build($postID); + $User = User\Factory::build($Post->attr('user')); + + $ItemTemplate = generatePostItemTemplate($Post, $User); + + $posts[] = $ItemTemplate; + } + catch(Post\Exception $Exception){} + catch(User\Exception $Exception){} + } + + $HomeTemplate = Template\Factory::build('home'); + $HomeTemplate->set('PAGINATION', [ + 'HTML' => generatePostNaviTemplate(1) + ]); + $HomeTemplate->set('LIST', [ + 'POSTS' => $posts ?? [] + ]); + + $MainTemplate = Template\Factory::build('main'); + $MainTemplate->set('HTML', $HomeTemplate); + $MainTemplate->set('HEAD', [ + 'NAME' => Application::get('BLOGMETA.HOME'), + 'DESC' => Application::get('BLOGMETA.NAME').' – '.Application::get('BLOGMETA.DESC'), + 'PERM' => Application::getURL() + ]); + + echo $MainTemplate; +} + +#=============================================================================== +# CATCH: Template\Exception +#=============================================================================== +catch(Template\Exception $Exception) { + Application::exit($Exception->getMessage()); +} +?>
\ No newline at end of file diff --git a/core/include/page/list.php b/core/include/page/list.php new file mode 100644 index 0000000..25409e5 --- /dev/null +++ b/core/include/page/list.php @@ -0,0 +1,65 @@ +<?php +#=============================================================================== +# Get instances +#=============================================================================== +$Database = Application::getDatabase(); +$Language = Application::getLanguage(); + +$site_size = Application::get('PAGE.LIST_SIZE'); +$site_sort = Application::get('PAGE.LIST_SORT'); + +$lastSite = ceil($Database->query(sprintf('SELECT COUNT(id) FROM %s', Page\Attribute::TABLE))->fetchColumn() / $site_size); + +$currentSite = HTTP::GET('site') ?? 1; +$currentSite = abs(intval($currentSite)); + +if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) { + Application::error404(); +} + +#=============================================================================== +# TRY: Template\Exception +#=============================================================================== +try { + $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); + + foreach($pageIDs as $pageID) { + try { + $Page = Page\Factory::build($pageID); + $User = User\Factory::build($Page->attr('user')); + + $ItemTemplate = generatePageItemTemplate($Page, $User); + + $pages[] = $ItemTemplate; + } + catch(Page\Exception $Exception){} + catch(User\Exception $Exception){} + } + + $ListTemplate = Template\Factory::build('page/list'); + $ListTemplate->set('PAGINATION', [ + 'THIS' => $currentSite, + 'LAST' => $lastSite, + 'HTML' => generatePageNaviTemplate($currentSite) + ]); + $ListTemplate->set('LIST', [ + 'PAGES' => $pages ?? [] + ]); + + $MainTemplate = Template\Factory::build('main'); + $MainTemplate->set('HTML', $ListTemplate); + $MainTemplate->set('HEAD', [ + 'NAME' => $Language->text('title_page_overview', $currentSite) + ]); + + echo $MainTemplate; +} + +#=============================================================================== +# CATCH: Template\Exception +#=============================================================================== +catch(Template\Exception $Exception) { + Application::exit($Exception->getMessage()); +} +?>
\ No newline at end of file diff --git a/core/include/page/main.php b/core/include/page/main.php new file mode 100644 index 0000000..925d5d9 --- /dev/null +++ b/core/include/page/main.php @@ -0,0 +1,90 @@ +<?php +#=============================================================================== +# Get instances +#=============================================================================== +$Database = Application::getDatabase(); +$Language = Application::getLanguage(); + +#=============================================================================== +# TRY: Page\Exception, User\Exception +#=============================================================================== +try { + if(Application::get('PAGE.SLUG_URLS')) { + $Page = Page\Factory::buildBySlug($param); + } + + else { + $Page = Page\Factory::build($param); + } + + $User = User\Factory::build($Page->attr('user')); + + $page_data = generatePageItemData($Page); + $user_data = generateUserItemData($User); + + #=============================================================================== + # Add page data for previous and next page + #=============================================================================== + try { + $PrevPage = Page\Factory::build($Page->getPrevID()); + $page_data['PREV'] = generatePageItemData($PrevPage); + } catch(Page\Exception $Exception){} + + try { + $NextPage = Page\Factory::build($Page->getNextID()); + $page_data['NEXT'] = generatePageItemData($NextPage); + } catch(Page\Exception $Exception){} + + #=============================================================================== + # TRY: Template\Exception + #=============================================================================== + try { + $PageTemplate = Template\Factory::build('page/main'); + $PageTemplate->set('PAGE', $page_data); + $PageTemplate->set('USER', $user_data); + + $MainTemplate = Template\Factory::build('main'); + $MainTemplate->set('HTML', $PageTemplate); + $MainTemplate->set('HEAD', [ + 'NAME' => $page_data['ATTR']['NAME'], + 'DESC' => cut(removeLineBreaksAndTabs(removeHTML($page_data['BODY']['HTML']), ' '), Application::get('PAGE.DESCRIPTION_SIZE')), + 'PERM' => $page_data['URL'], + 'OG_IMAGES' => $page_data['FILE']['LIST'] + ]); + + echo $MainTemplate; + } + + #=============================================================================== + # CATCH: Template\Exception + #=============================================================================== + catch(Template\Exception $Exception) { + Application::exit($Exception->getMessage()); + } +} + +#=============================================================================== +# CATCH: Page\Exception +#=============================================================================== +catch(Page\Exception $Exception) { + try { + if(Application::get('PAGE.SLUG_URLS') === FALSE) { + $Page = Page\Factory::buildBySlug($param); + } else { + $Page = Page\Factory::build($param); + } + + HTTP::redirect($Page->getURL()); + } + + catch(Page\Exception $Exception) { + Application::error404(); + } +} + +#=============================================================================== +# CATCH: User\Exception +#=============================================================================== +catch(User\Exception $Exception) { + Application::exit($Exception->getMessage()); +}
\ No newline at end of file diff --git a/core/include/post/list.php b/core/include/post/list.php new file mode 100644 index 0000000..f2edd0b --- /dev/null +++ b/core/include/post/list.php @@ -0,0 +1,65 @@ +<?php +#=============================================================================== +# Get instances +#=============================================================================== +$Database = Application::getDatabase(); +$Language = Application::getLanguage(); + +$site_size = Application::get('POST.LIST_SIZE'); +$site_sort = Application::get('POST.LIST_SORT'); + +$lastSite = ceil($Database->query(sprintf('SELECT COUNT(id) FROM %s', Post\Attribute::TABLE))->fetchColumn() / $site_size); + +$currentSite = HTTP::GET('site') ?? 1; +$currentSite = abs(intval($currentSite)); + +if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) { + Application::error404(); +} + +#=============================================================================== +# TRY: Template\Exception +#=============================================================================== +try { + $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); + + foreach($postIDs as $postID) { + try { + $Post = Post\Factory::build($postID); + $User = User\Factory::build($Post->attr('user')); + + $ItemTemplate = generatePostItemTemplate($Post, $User); + + $posts[] = $ItemTemplate; + } + catch(Post\Exception $Exception){} + catch(User\Exception $Exception){} + } + + $ListTemplate = Template\Factory::build('post/list'); + $ListTemplate->set('PAGINATION', [ + 'THIS' => $currentSite, + 'LAST' => $lastSite, + 'HTML' => generatePostNaviTemplate($currentSite) + ]); + $ListTemplate->set('LIST', [ + 'POSTS' => $posts ?? [] + ]); + + $MainTemplate = Template\Factory::build('main'); + $MainTemplate->set('HTML', $ListTemplate); + $MainTemplate->set('HEAD', [ + 'NAME' => $Language->text('title_post_overview', $currentSite) + ]); + + echo $MainTemplate; +} + +#=============================================================================== +# CATCH: Template\Exception +#=============================================================================== +catch(Template\Exception $Exception) { + Application::exit($Exception->getMessage()); +} +?>
\ No newline at end of file diff --git a/core/include/post/main.php b/core/include/post/main.php new file mode 100644 index 0000000..46937f3 --- /dev/null +++ b/core/include/post/main.php @@ -0,0 +1,90 @@ +<?php +#=============================================================================== +# Get instances +#=============================================================================== +$Database = Application::getDatabase(); +$Language = Application::getLanguage(); + +#=============================================================================== +# TRY: Post\Exception, User\Exception +#=============================================================================== +try { + if(Application::get('POST.SLUG_URLS')) { + $Post = Post\Factory::buildBySlug($param); + } + + else { + $Post = Post\Factory::build($param); + } + + $User = User\Factory::build($Post->attr('user')); + + $post_data = generatePostItemData($Post); + $user_data = generateUserItemData($User); + + #=============================================================================== + # Add post data for previous and next post + #=============================================================================== + try { + $PrevPost = Post\Factory::build($Post->getPrevID()); + $post_data['PREV'] = generatePostItemData($PrevPost); + } catch(Post\Exception $Exception){} + + try { + $NextPost = Post\Factory::build($Post->getNextID()); + $post_data['NEXT'] = generatePostItemData($NextPost); + } catch(Post\Exception $Exception){} + + #=============================================================================== + # TRY: Template\Exception + #=============================================================================== + try { + $PostTemplate = Template\Factory::build('post/main'); + $PostTemplate->set('POST', $post_data); + $PostTemplate->set('USER', $user_data); + + $MainTemplate = Template\Factory::build('main'); + $MainTemplate->set('HTML', $PostTemplate); + $MainTemplate->set('HEAD', [ + 'NAME' => $post_data['ATTR']['NAME'], + 'DESC' => cut(removeLineBreaksAndTabs(removeHTML($post_data['BODY']['HTML']), ' '), Application::get('POST.DESCRIPTION_SIZE')), + 'PERM' => $post_data['URL'], + 'OG_IMAGES' => $post_data['FILE']['LIST'] + ]); + + echo $MainTemplate; + } + + #=============================================================================== + # CATCH: Template\Exception + #=============================================================================== + catch(Template\Exception $Exception) { + Application::exit($Exception->getMessage()); + } +} + +#=============================================================================== +# CATCH: Post\Exception +#=============================================================================== +catch(Post\Exception $Exception) { + try { + if(Application::get('POST.SLUG_URLS') === FALSE) { + $Post = Post\Factory::buildBySlug($param); + } else { + $Post = Post\Factory::build($param); + } + + HTTP::redirect($Post->getURL()); + } + + catch(Post\Exception $Exception) { + Application::error404(); + } +} + +#=============================================================================== +# CATCH: User\Exception +#=============================================================================== +catch(User\Exception $Exception) { + Application::exit($Exception->getMessage()); +}
\ No newline at end of file diff --git a/core/include/search/main.php b/core/include/search/main.php new file mode 100644 index 0000000..8854b79 --- /dev/null +++ b/core/include/search/main.php @@ -0,0 +1,90 @@ +<?php +#=============================================================================== +# Get instances +#=============================================================================== +$Database = Application::getDatabase(); +$Language = Application::getLanguage(); + +$SEARCH_SUCCESS = FALSE; +$D_LIST = $Database->query(sprintf('SELECT DISTINCT DAY(time_insert) AS temp FROM %s ORDER BY temp', Post\Attribute::TABLE)); +$M_LIST = $Database->query(sprintf('SELECT DISTINCT MONTH(time_insert) AS temp FROM %s ORDER BY temp', Post\Attribute::TABLE)); +$Y_LIST = $Database->query(sprintf('SELECT DISTINCT YEAR(time_insert) AS temp FROM %s ORDER BY temp', Post\Attribute::TABLE)); + +if($search = HTTP::GET('q')) { + if(!$postIDs = Post\Item::getSearchResultIDs($search, [HTTP::GET('d'), HTTP::GET('m'), HTTP::GET('y')], $Database)) { + $message = $Language->text('search_no_results', escapeHTML($search)); + } +} + +$form_data = [ + 'SELECT' => [ + 'D' => HTTP::GET('d'), + 'M' => HTTP::GET('m'), + 'Y' => HTTP::GET('y'), + ], + 'OPTIONS' => [ + 'D' => $D_LIST->fetchAll($Database::FETCH_COLUMN), + 'M' => $M_LIST->fetchAll($Database::FETCH_COLUMN), + 'Y' => $Y_LIST->fetchAll($Database::FETCH_COLUMN), + ] +]; + +$search_data = [ + 'TEXT' => $search, + 'INFO' => isset($message) ? $message : FALSE, +]; + +#=============================================================================== +# TRY: Template\Exception +#=============================================================================== +try { + if(isset($postIDs) AND !empty($postIDs)) { + foreach($postIDs as $postID) { + try { + $Post = Post\Factory::build($postID); + $User = User\Factory::build($Post->attr('user')); + + $posts[] = generatePostItemTemplate($Post, $User); + } + catch(Post\Exception $Exception){} + catch(User\Exception $Exception){} + } + + $ResultTemplate = Template\Factory::build('search/result'); + $ResultTemplate->set('FORM', $form_data); + $ResultTemplate->set('SEARCH', $search_data); + $ResultTemplate->set('RESULT', [ + 'LIST' => $posts ?? [] + ]); + + $MainTemplate = Template\Factory::build('main'); + $MainTemplate->set('HTML', $ResultTemplate); + $MainTemplate->set('HEAD', [ + 'NAME' => $Language->text('title_search_results', escapeHTML($search)), + 'PERM' => Application::getURL('search/') + ]); + } + + else { + $SearchTemplate = Template\Factory::build('search/main'); + $SearchTemplate->set('FORM', $form_data); + $SearchTemplate->set('SEARCH', $search_data); + + $MainTemplate = Template\Factory::build('main'); + $MainTemplate->set('HTML', $SearchTemplate); + $MainTemplate->set('HEAD', [ + 'NAME' => $Language->text('title_search_request'), + 'PERM' => Application::getURL('search/') + ]); + } + + echo $MainTemplate; +} + +#=============================================================================== +# CATCH: Template\Exception +#=============================================================================== +catch(Template\Exception $Exception) { + Application::exit($Exception->getMessage()); +} +?>
\ No newline at end of file diff --git a/core/include/user/list.php b/core/include/user/list.php new file mode 100644 index 0000000..692bba6 --- /dev/null +++ b/core/include/user/list.php @@ -0,0 +1,61 @@ +<?php +#=============================================================================== +# Get instances +#=============================================================================== +$Database = Application::getDatabase(); +$Language = Application::getLanguage(); + +$site_size = Application::get('USER.LIST_SIZE'); +$site_sort = Application::get('USER.LIST_SORT'); + +$lastSite = ceil($Database->query(sprintf('SELECT COUNT(id) FROM %s', User\Attribute::TABLE))->fetchColumn() / $site_size); + +$currentSite = HTTP::GET('site') ?? 1; +$currentSite = abs(intval($currentSite)); + +if($currentSite < 1 OR ($currentSite > $lastSite AND $lastSite > 0)) { + Application::error404(); +} + +#=============================================================================== +# TRY: Template\Exception +#=============================================================================== +try { + $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); + + foreach($userIDs as $userID) { + try { + $User = User\Factory::build($userID); + $ItemTemplate = generateUserItemTemplate($User); + + $users[] = $ItemTemplate; + } catch(User\Exception $Exception){} + } + + $ListTemplate = Template\Factory::build('user/list'); + $ListTemplate->set('PAGINATION', [ + 'THIS' => $currentSite, + 'LAST' => $lastSite, + 'HTML' => generateUserNaviTemplate($currentSite) + ]); + $ListTemplate->set('LIST', [ + 'USERS' => $users ?? [] + ]); + + $MainTemplate = Template\Factory::build('main'); + $MainTemplate->set('HTML', $ListTemplate); + $MainTemplate->set('HEAD', [ + 'NAME' => $Language->text('title_user_overview', $currentSite) + ]); + + echo $MainTemplate; +} + +#=============================================================================== +# CATCH: Template\Exception +#=============================================================================== +catch(Template\Exception $Exception) { + Application::exit($Exception->getMessage()); +} +?>
\ No newline at end of file diff --git a/core/include/user/main.php b/core/include/user/main.php new file mode 100644 index 0000000..7944f1f --- /dev/null +++ b/core/include/user/main.php @@ -0,0 +1,98 @@ +<?php +#=============================================================================== +# Get instances +#=============================================================================== +$Database = Application::getDatabase(); +$Language = Application::getLanguage(); + +#=============================================================================== +# TRY: User\Exception +#=============================================================================== +try { + if(Application::get('USER.SLUG_URLS')) { + $User = User\Factory::buildBySlug($param); + } + + else { + $User = User\Factory::build($param); + } + + $user_data = generateUserItemData($User); + + #=============================================================================== + # Add user data for previous and next user + #=============================================================================== + try { + $PrevUser = User\Factory::build($User->getPrevID()); + $user_data['PREV'] = generateUserItemData($PrevUser); + } catch(User\Exception $Exception){} + + try { + $NextUser = User\Factory::build($User->getNextID()); + $user_data['NEXT'] = generateUserItemData($NextUser); + } catch(User\Exception $Exception){} + + #=============================================================================== + # TRY: Template\Exception + #=============================================================================== + 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() + ]); + + $MainTemplate = Template\Factory::build('main'); + $MainTemplate->set('HTML', $UserTemplate); + $MainTemplate->set('HEAD', [ + 'NAME' => $user_data['ATTR']['FULLNAME'], + 'DESC' => cut(removeLineBreaksAndTabs(removeHTML($user_data['BODY']['HTML']), ' '), Application::get('USER.DESCRIPTION_SIZE')), + 'PERM' => $User->getURL(), + 'OG_IMAGES' => $User->getFiles() + ]); + + echo $MainTemplate; + } + + #=============================================================================== + # CATCH: Template\Exception + #=============================================================================== + catch(Template\Exception $Exception) { + Application::exit($Exception->getMessage()); + } +} + +#=============================================================================== +# CATCH: User\Exception +#=============================================================================== +catch(User\Exception $Exception) { + try { + if(Application::get('USER.SLUG_URLS') === FALSE) { + $User = User\Factory::buildBySlug($param); + } else { + $User = User\Factory::build($param); + } + + HTTP::redirect($User->getURL()); + } + + catch(User\Exception $Exception) { + Application::error404(); + } +}
\ No newline at end of file |