news things

This commit is contained in:
flash 2015-04-05 18:24:07 +02:00
parent 49153a5822
commit 1359689ca1
5 changed files with 36 additions and 10 deletions

1
.gitignore vendored
View file

@ -41,6 +41,7 @@ local.properties
################# #################
errors.log errors.log
config.php
################# #################

View file

@ -159,10 +159,10 @@ class Main {
} }
// Getting news posts // Getting news posts
public static function getNewsPosts($limit = null) { public static function getNewsPosts($limit = null, $pid = false) {
// Get news posts // 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 // Get user data
foreach($newsPosts as $newsId => $newsPost) { foreach($newsPosts as $newsId => $newsPost) {

View 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';

View file

@ -15,20 +15,19 @@ Options +FollowSymLinks -Indexes
# Rewrite Rules # Rewrite Rules
# Remove .php from the url
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
## Info pages ## Info pages
RewriteRule ^r/([a-z]+)$ infopage.php?r=$1 RewriteRule ^r/([a-z]+)$ infopage.php?r=$1
## News ## News
RewriteRule ^news?/?$ news.php
RewriteRule ^news/([0-9]+)$ news.php?id=$1 RewriteRule ^news/([0-9]+)$ news.php?id=$1
RewriteRule ^news.xml$ news.php?xml RewriteRule ^news.xml$ news.php?xml
# Serving Images # Serving Images
RewriteRule ^a/([0-9]+)$ imageserve.php?m=avatar&u=$1 RewriteRule ^a/([0-9]+)$ imageserve.php?m=avatar&u=$1
RewriteRule ^a/([0-9]+).png$ 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

View file

@ -13,7 +13,7 @@ require_once '/var/www/flashii.net/_sakura/sakura.php';
$renderData['page'] = [ $renderData['page'] = [
'title' => 'Flashii News' '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 // News XML, don't really care so yeah
if(isset($_GET['xml'])) { if(isset($_GET['xml'])) {