news things
This commit is contained in:
parent
49153a5822
commit
1359689ca1
5 changed files with 36 additions and 10 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -41,6 +41,7 @@ local.properties
|
|||
#################
|
||||
|
||||
errors.log
|
||||
config.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) {
|
||||
|
|
26
_sakura/config/config.example.php
Normal file
26
_sakura/config/config.example.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
// Flashii Configuration
|
||||
$sakuraConf = array(); // Define configuration array
|
||||
|
||||
// PDO Database Connection
|
||||
$sakuraConf['db'] = array();
|
||||
$sakuraConf['db']['driver'] = 'mysql';
|
||||
$sakuraConf['db']['unixsocket'] = false;
|
||||
$sakuraConf['db']['host'] = 'localhost';
|
||||
$sakuraConf['db']['port'] = 3306;
|
||||
$sakuraConf['db']['username'] = 'flashii';
|
||||
$sakuraConf['db']['password'] = 'password';
|
||||
$sakuraConf['db']['database'] = 'flashii';
|
||||
$sakuraConf['db']['prefix'] = 'fii_';
|
||||
|
||||
// URLs (for modularity)
|
||||
$sakuraConf['urls']['main'] = 'flashii.net';
|
||||
$sakuraConf['urls']['api'] = 'api.flashii.net';
|
||||
$sakuraConf['urls']['content'] = 'cdn.flashii.net';
|
||||
$sakuraConf['urls']['chat'] = 'chat.flashii.net';
|
||||
$sakuraConf['urls']['manage'] = 'manage.flashii.net';
|
||||
|
||||
// Errata
|
||||
$sakuraConf['etc']['localPath'] = '/var/www/flashii.net/';
|
||||
$sakuraConf['etc']['templatesPath'] = $sakuraConf['etc']['localPath'] .'_sakura/templates/';
|
||||
$sakuraConf['etc']['design'] = 'yuuno';
|
|
@ -15,20 +15,19 @@ Options +FollowSymLinks -Indexes
|
|||
|
||||
# Rewrite Rules
|
||||
|
||||
# Remove .php from the url
|
||||
RewriteEngine on
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME}\.php -f
|
||||
RewriteRule ^(.*)$ $1.php
|
||||
|
||||
## Info pages
|
||||
RewriteRule ^r/([a-z]+)$ infopage.php?r=$1
|
||||
|
||||
## News
|
||||
RewriteRule ^news?/?$ news.php
|
||||
RewriteRule ^news/([0-9]+)$ news.php?id=$1
|
||||
RewriteRule ^news.xml$ news.php?xml
|
||||
|
||||
# Serving Images
|
||||
RewriteRule ^a/([0-9]+)$ imageserve.php?m=avatar&u=$1
|
||||
RewriteRule ^a/([0-9]+).png$ imageserve.php?m=avatar&u=$1
|
||||
|
||||
# Remove .php from the url
|
||||
RewriteEngine on
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME}\.php -f
|
||||
RewriteRule ^(.*)$ $1.php
|
||||
|
|
|
@ -13,7 +13,7 @@ require_once '/var/www/flashii.net/_sakura/sakura.php';
|
|||
$renderData['page'] = [
|
||||
'title' => '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'])) {
|
||||
|
|
Reference in a new issue