From 1359689ca18e1dd8097ad3fc3013689fea9182ee Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 5 Apr 2015 18:24:07 +0200 Subject: [PATCH] news things --- .gitignore | 1 + _sakura/components/Main.php | 4 ++-- _sakura/config/config.example.php | 26 ++++++++++++++++++++++++++ main/.htaccess | 13 ++++++------- main/news.php | 2 +- 5 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 _sakura/config/config.example.php diff --git a/.gitignore b/.gitignore index 0a156ec..d23f169 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ local.properties ################# errors.log +config.php ################# diff --git a/_sakura/components/Main.php b/_sakura/components/Main.php index ef86614..6b3cf12 100644 --- a/_sakura/components/Main.php +++ b/_sakura/components/Main.php @@ -159,10 +159,10 @@ class Main { } // Getting news posts - public static function getNewsPosts($limit = null) { + public static function getNewsPosts($limit = null, $pid = false) { // Get news posts - $newsPosts = Database::fetch('news', true, null, ['id', true], ($limit ? [$limit] : null)); + $newsPosts = Database::fetch('news', true, ($pid ? ['id' => [$limit, '=']] : null), ['id', true], ($limit && !$pid ? [$limit] : null)); // Get user data foreach($newsPosts as $newsId => $newsPost) { diff --git a/_sakura/config/config.example.php b/_sakura/config/config.example.php new file mode 100644 index 0000000..9a8626f --- /dev/null +++ b/_sakura/config/config.example.php @@ -0,0 +1,26 @@ + 'Flashii News' ]; -$renderData['newsPosts'] = Main::getNewsPosts((isset($_GET['id']) && !isset($_GET['xml']) && is_numeric($_GET['id'])) ? $_GET['id'] : null); +$renderData['newsPosts'] = Main::getNewsPosts((isset($_GET['id']) && !isset($_GET['xml']) && is_numeric($_GET['id'])) ? $_GET['id'] : null, (isset($_GET['id']) && !isset($_GET['xml']) && is_numeric($_GET['id']))); // News XML, don't really care so yeah if(isset($_GET['xml'])) {