diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/feed/main.php | 77 | ||||
-rw-r--r-- | system/home.php | 55 | ||||
-rw-r--r-- | system/page/list.php | 65 | ||||
-rw-r--r-- | system/page/main.php | 90 | ||||
-rw-r--r-- | system/post/list.php | 65 | ||||
-rw-r--r-- | system/post/main.php | 90 | ||||
-rw-r--r-- | system/search/main.php | 90 | ||||
-rw-r--r-- | system/user/list.php | 61 | ||||
-rw-r--r-- | system/user/main.php | 98 |
9 files changed, 0 insertions, 691 deletions
diff --git a/system/feed/main.php b/system/feed/main.php deleted file mode 100644 index 671f5c7..0000000 --- a/system/feed/main.php +++ /dev/null @@ -1,77 +0,0 @@ -<?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/system/home.php b/system/home.php deleted file mode 100644 index ce91558..0000000 --- a/system/home.php +++ /dev/null @@ -1,55 +0,0 @@ -<?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/system/page/list.php b/system/page/list.php deleted file mode 100644 index 25409e5..0000000 --- a/system/page/list.php +++ /dev/null @@ -1,65 +0,0 @@ -<?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/system/page/main.php b/system/page/main.php deleted file mode 100644 index 925d5d9..0000000 --- a/system/page/main.php +++ /dev/null @@ -1,90 +0,0 @@ -<?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/system/post/list.php b/system/post/list.php deleted file mode 100644 index f2edd0b..0000000 --- a/system/post/list.php +++ /dev/null @@ -1,65 +0,0 @@ -<?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/system/post/main.php b/system/post/main.php deleted file mode 100644 index 46937f3..0000000 --- a/system/post/main.php +++ /dev/null @@ -1,90 +0,0 @@ -<?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/system/search/main.php b/system/search/main.php deleted file mode 100644 index 8854b79..0000000 --- a/system/search/main.php +++ /dev/null @@ -1,90 +0,0 @@ -<?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/system/user/list.php b/system/user/list.php deleted file mode 100644 index 692bba6..0000000 --- a/system/user/list.php +++ /dev/null @@ -1,61 +0,0 @@ -<?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/system/user/main.php b/system/user/main.php deleted file mode 100644 index 7944f1f..0000000 --- a/system/user/main.php +++ /dev/null @@ -1,98 +0,0 @@ -<?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 |