Yeah
This commit is contained in:
parent
be33f3cb89
commit
1cd487248f
19 changed files with 232 additions and 92 deletions
|
@ -11,7 +11,8 @@
|
||||||
"20150508",
|
"20150508",
|
||||||
"20150509",
|
"20150509",
|
||||||
"20150509.1",
|
"20150509.1",
|
||||||
"20150512"
|
"20150512",
|
||||||
|
"20150523"
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1037,6 +1038,27 @@
|
||||||
{
|
{
|
||||||
"type": "FIX",
|
"type": "FIX",
|
||||||
"change": "Fix {{ sakura.currentpage }} redirecting to the php file that's being used without the right attributes."
|
"change": "Fix {{ sakura.currentpage }} redirecting to the php file that's being used without the right attributes."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "UPD",
|
||||||
|
"change": "Rebuilt news XML to be more modular as opposed to a pile of prints."
|
||||||
|
}
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
"20150523": [
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "UPD",
|
||||||
|
"change": "Move Manage and Forum to a subdirectory instead of a subdomain."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ADD",
|
||||||
|
"change": "Add links to forum and management pages."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "FIX",
|
||||||
|
"change": "Fixed broken links because of the domainset changes."
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -56,4 +56,31 @@ class Forum {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Creating a new post
|
||||||
|
public static function createPost($subject, $text, $enableMD, $enableSig, $forum, $topic = 0, $type = 0, $status = 0) {
|
||||||
|
|
||||||
|
// Check if this post is OP
|
||||||
|
if(!$topic) {
|
||||||
|
|
||||||
|
// If so create a new topic
|
||||||
|
Database::insert('topics', [
|
||||||
|
'forum_id' => $forum,
|
||||||
|
'topic_hidden' => 0,
|
||||||
|
'topic_title' => $subject,
|
||||||
|
'topic_time' => time(),
|
||||||
|
'topic_time_limit' => 0,
|
||||||
|
'topic_last_reply' => 0,
|
||||||
|
'topic_views' => 0,
|
||||||
|
'topic_replies' => 0,
|
||||||
|
'topic_status' => $status,
|
||||||
|
'topic_status_change' => 0,
|
||||||
|
'topic_type' => $type,
|
||||||
|
'topic_first_post_id' => 0,
|
||||||
|
'topic_first_poster_id' => Session::$userId
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -511,4 +511,48 @@ class Main {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get log type string
|
||||||
|
public static function getLogStringFromType($type) {
|
||||||
|
|
||||||
|
// Query the database
|
||||||
|
$return = Database::fetch('logtypes', false, ['id' => [$type, '=']]);
|
||||||
|
|
||||||
|
// Check if type exists and else return a unformattable string
|
||||||
|
if(count($return) < 2)
|
||||||
|
return 'Unknown action.';
|
||||||
|
|
||||||
|
// Return the string
|
||||||
|
return $return['string'];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get formatted logs
|
||||||
|
public static function getUserLogs($uid = 0) {
|
||||||
|
|
||||||
|
// Check if a user is specified
|
||||||
|
$conditions = ($uid ? ['uid' => [$uid, '=']] : null);
|
||||||
|
|
||||||
|
// Get data from database
|
||||||
|
$logsDB = Database::fetch('logs', true, $conditions, ['id', true]);
|
||||||
|
|
||||||
|
// Storage array
|
||||||
|
$logs = array();
|
||||||
|
|
||||||
|
// Iterate over entries
|
||||||
|
foreach($logsDB as $log) {
|
||||||
|
|
||||||
|
// Store usable data
|
||||||
|
$logs[$log['id']] = [
|
||||||
|
'user' => $_USER = Users::getUser($log['uid']),
|
||||||
|
'rank' => Users::getRank($_USER['rank_main']),
|
||||||
|
'string' => vsprintf(self::getLogStringFromType($log['action']), json_decode($log['attribs'], true))
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return new logs
|
||||||
|
return $logs;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Define Sakura version
|
// Define Sakura version
|
||||||
define('SAKURA_VERSION', '20150512');
|
define('SAKURA_VERSION', '20150523');
|
||||||
define('SAKURA_VLABEL', 'Eminence');
|
define('SAKURA_VLABEL', 'Eminence');
|
||||||
define('SAKURA_VTYPE', 'Development');
|
define('SAKURA_VTYPE', 'Development');
|
||||||
define('SAKURA_COLOUR', '#6C3082');
|
define('SAKURA_COLOUR', '#6C3082');
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
<span id="top"></span>
|
<span id="top"></span>
|
||||||
<div class="header" id="header">
|
<div class="header" id="header">
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
<a href="/">Broom Closet</a> /
|
<a href="//{{ sakura.urls.main }}/manage/">Broom Closet</a> /
|
||||||
<a href="/{{ page.activepage }}/">{{ page.pages[page.activepage].desc }}</a> /
|
<a href="//{{ sakura.urls.main }}/manage/{{ page.activepage }}/">{{ page.pages[page.activepage].desc }}</a> /
|
||||||
<a href="/{{ page.activepage }}/{{ page.activesub }}/">{{ page.pages[page.activepage].subs[page.activesub].desc }}</a>
|
<a href="//{{ sakura.urls.main }}/manage/{{ page.activepage }}/{{ page.activesub }}/">{{ page.pages[page.activepage].subs[page.activesub].desc }}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav">
|
<div class="nav">
|
||||||
<div class="menu" id="siteNav">
|
<div class="menu" id="siteNav">
|
||||||
|
@ -33,13 +33,13 @@
|
||||||
<div class="menu" id="pageNav">
|
<div class="menu" id="pageNav">
|
||||||
<div>Navigation</div>
|
<div>Navigation</div>
|
||||||
{% for short,page in page.pages %}
|
{% for short,page in page.pages %}
|
||||||
<a href="/{{ short }}/">{{ page.desc }}</a>
|
<a href="//{{ sakura.urls.main }}/manage/{{ short }}/">{{ page.desc }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="menu" id="subNav">
|
<div class="menu" id="subNav">
|
||||||
<div>{{ page.pages[page.activepage].desc }}</div>
|
<div>{{ page.pages[page.activepage].desc }}</div>
|
||||||
{% for short,sub in page.pages[page.activepage].subs %}
|
{% for short,sub in page.pages[page.activepage].subs %}
|
||||||
<a href="/{{ page.activepage }}/{{ short }}/">{{ sub.desc }}</a>
|
<a href="//{{ sakura.urls.main }}/manage/{{ page.activepage }}/{{ short }}/">{{ sub.desc }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
{% for category in page.boards %}
|
{% for category in page.boards %}
|
||||||
{% if category.forums|length %}
|
{% if category.forums|length %}
|
||||||
<tr class="forumCategory">
|
<tr class="forumCategory">
|
||||||
<td class="forumCategoryTitleColumn" colspan="4"><a href="//{{ sakura.urls.forum }}/{{ category.data.forum_id }}/" class="clean">{{ category.data.forum_name }}</a></td>
|
<td class="forumCategoryTitleColumn" colspan="4"><a href="//{{ sakura.urls.main }}/forum/{{ category.data.forum_id }}/" class="clean">{{ category.data.forum_name }}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% for forum in category.forums %}
|
{% for forum in category.forums %}
|
||||||
<tr class="forumForum">
|
<tr class="forumForum">
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<div class="forumIcon read fa fa-3x {% if forum.forum_icon %}{{ forum.forum_icon }}{% else %}{% if forum.forum_type %}fa-chevron-circle-right{% else %}fa-comments{% endif %}{% endif %}"></div>
|
<div class="forumIcon read fa fa-3x {% if forum.forum_icon %}{{ forum.forum_icon }}{% else %}{% if forum.forum_type %}fa-chevron-circle-right{% else %}fa-comments{% endif %}{% endif %}"></div>
|
||||||
</td>
|
</td>
|
||||||
<td class="forumTitleColumn"{% if forum.forum_type == 2 %} colspan="3"{% endif %}>
|
<td class="forumTitleColumn"{% if forum.forum_type == 2 %} colspan="3"{% endif %}>
|
||||||
<div class="name"><a href="{% if forum.forum_type == 2 %}{{ forum.forum_link }}" target="_blank"{% else %}//{{ sakura.urls.forum }}/{{ forum.forum_id }}/"{% endif %} class="default">{{ forum.forum_name }}</a></div>
|
<div class="name"><a href="{% if forum.forum_type == 2 %}{{ forum.forum_link }}" target="_blank"{% else %}//{{ sakura.urls.main }}/forum/{{ forum.forum_id }}/"{% endif %} class="default">{{ forum.forum_name }}</a></div>
|
||||||
<div class="desc">{{ forum.forum_desc }}</div>
|
<div class="desc">{{ forum.forum_desc }}</div>
|
||||||
</td>
|
</td>
|
||||||
{% if forum.forum_type != 2 %}
|
{% if forum.forum_type != 2 %}
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
<td class="forumLastColumn">
|
<td class="forumLastColumn">
|
||||||
<div>
|
<div>
|
||||||
{% if forum.forum_last_post_id %}
|
{% if forum.forum_last_post_id %}
|
||||||
Last post in <a href="//{{ sakura.urls.forum }}/thread/{{ forum.forum_last_post_id }}" class="default">Thread with an obnoxiously long fucking title</a><br />12 years ago by <a href="//{{ sakura.urls.main }}/u/{{ forum.last_poster_data.id }}" class="default" style="color: {% if forum.last_poster_data.name_colour %}{{ forum.last_poster_data.name_colour }}{% else %}{{ forum.last_poster_rank.colour }}{% endif %};">{{ forum.last_poster_data.username }}</a>
|
Last post in <a href="//{{ sakura.urls.main }}/forum/thread/{{ forum.forum_last_post_id }}" class="default">Thread with an obnoxiously long fucking title</a><br />12 years ago by <a href="//{{ sakura.urls.main }}/u/{{ forum.last_poster_data.id }}" class="default" style="color: {% if forum.last_poster_data.name_colour %}{{ forum.last_poster_data.name_colour }}{% else %}{{ forum.last_poster_rank.colour }}{% endif %};">{{ forum.last_poster_data.username }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
There are no posts in this forum.<br />
|
There are no posts in this forum.<br />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -173,6 +173,7 @@
|
||||||
<a class="menu-item" href="//{{ sakura.urls.main }}/" title="Return to the front page of Flashii">Home</a>
|
<a class="menu-item" href="//{{ sakura.urls.main }}/" title="Return to the front page of Flashii">Home</a>
|
||||||
<a class="menu-item" href="//{{ sakura.urls.main }}/news" title="Here you can read updates on Flashii">News</a>
|
<a class="menu-item" href="//{{ sakura.urls.main }}/news" title="Here you can read updates on Flashii">News</a>
|
||||||
<a class="menu-item" href="//{{ sakura.urls.chat }}/" title="Chat with other Flashii members">Chat</a>
|
<a class="menu-item" href="//{{ sakura.urls.chat }}/" title="Chat with other Flashii members">Chat</a>
|
||||||
|
<a class="menu-item" href="//{{ sakura.urls.main }}/forum" title="Discuss things with other members but static">Forums</a>
|
||||||
{% if user.checklogin %}
|
{% if user.checklogin %}
|
||||||
<a class="menu-item" href="//{{ sakura.urls.main }}/members" title="View a list with all the activated user accounts">Members</a>
|
<a class="menu-item" href="//{{ sakura.urls.main }}/members" title="View a list with all the activated user accounts">Members</a>
|
||||||
<a class="menu-item menu-donate" href="//{{ sakura.urls.main }}/support" title="Give us money to keep the site (and other services) up and running">Support us</a>
|
<a class="menu-item menu-donate" href="//{{ sakura.urls.main }}/support" title="Give us money to keep the site (and other services) up and running">Support us</a>
|
||||||
|
@ -183,6 +184,7 @@
|
||||||
{% if user.checklogin %}
|
{% if user.checklogin %}
|
||||||
<a class="menu-item avatar" href="//{{ sakura.urls.main }}/u/{{ user.data.id }}" title="View and edit your own profile" style="background-image: url('//{{ sakura.urls.main }}/a/{{ user.data.id }}'); width: auto; color: {{ user.colour }}; font-weight: 700;">{{ user.data.username }}</a>
|
<a class="menu-item avatar" href="//{{ sakura.urls.main }}/u/{{ user.data.id }}" title="View and edit your own profile" style="background-image: url('//{{ sakura.urls.main }}/a/{{ user.data.id }}'); width: auto; color: {{ user.colour }}; font-weight: 700;">{{ user.data.username }}</a>
|
||||||
<a class="menu-item" href="//{{ sakura.urls.main }}/messages" title="Read your private message">Messages</a>
|
<a class="menu-item" href="//{{ sakura.urls.main }}/messages" title="Read your private message">Messages</a>
|
||||||
|
<a class="menu-item" href="//{{ sakura.urls.main }}/manage" title="Manage the site">Manage</a>
|
||||||
<a class="menu-item" href="//{{ sakura.urls.main }}/settings" title="Change your settings">Settings</a>
|
<a class="menu-item" href="//{{ sakura.urls.main }}/settings" title="Change your settings">Settings</a>
|
||||||
<a class="menu-item" href="//{{ sakura.urls.main }}/logout?mode=logout&time={{ php.time }}&session={{ php.sessionid }}&redirect={{ sakura.currentpage }}" title="End your login session" id="headerLogoutLink">Logout</a>
|
<a class="menu-item" href="//{{ sakura.urls.main }}/logout?mode=logout&time={{ php.time }}&session={{ php.sessionid }}&redirect={{ sakura.currentpage }}" title="End your login session" id="headerLogoutLink">Logout</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
# Empty .htaccess to make git realise this directory exists
|
|
Binary file not shown.
Before Width: | Height: | Size: 361 KiB |
|
@ -14,47 +14,57 @@ RewriteBase /
|
||||||
Options +FollowSymLinks -Indexes
|
Options +FollowSymLinks -Indexes
|
||||||
|
|
||||||
# Rewrite Rules
|
# Rewrite Rules
|
||||||
RewriteRule ^feedback?/?$ http://forum.flash.moe/viewforum.php?f=22
|
RewriteRule ^feedback/?$ http://forum.flash.moe/viewforum.php?f=22
|
||||||
RewriteRule ^credits?/?$ credits.php
|
RewriteRule ^credits/?$ credits.php
|
||||||
RewriteRule ^index?/?$ index.php
|
RewriteRule ^index/?$ index.php
|
||||||
RewriteRule ^login?/?$|logout?/?$|activate?/?$|register?/?$|forgotpassword?/?|authenticate?/?$ authenticate.php
|
RewriteRule ^login/?$|logout?/?$|activate?/?$|register?/?$|forgotpassword?/?|authenticate?/?$ authenticate.php
|
||||||
RewriteRule ^donate?/?$|support?/?$ donate.php
|
RewriteRule ^donate/?$|support?/?$ donate.php
|
||||||
RewriteRule ^contact?/?$ infopage.php?r=contact
|
RewriteRule ^contact/?$ infopage.php?r=contact
|
||||||
RewriteRule ^changelog?/?$ changelog.php
|
RewriteRule ^changelog/?$ changelog.php
|
||||||
RewriteRule ^faq?/?$ faq.php
|
RewriteRule ^faq/?$ faq.php
|
||||||
RewriteRule ^search?/?$ search.php
|
RewriteRule ^search/?$ search.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/?$ 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
|
||||||
|
|
||||||
## Settings
|
## Settings
|
||||||
RewriteRule ^settings?/?$ settings.php
|
RewriteRule ^settings/?$ settings.php
|
||||||
RewriteRule ^settings/([a-z]+)?/?$ settings.php?mode=$1
|
RewriteRule ^settings/([a-z]+)/?$ settings.php?mode=$1
|
||||||
|
|
||||||
## Private Messages
|
## Private Messages
|
||||||
RewriteRule ^messages?/?$ messages.php
|
RewriteRule ^messages/?$ messages.php
|
||||||
RewriteRule ^messages/([a-z]+)?/?$ messages.php?mode=$1
|
RewriteRule ^messages/([a-z]+)/?$ messages.php?mode=$1
|
||||||
|
|
||||||
## Members
|
## Members
|
||||||
RewriteRule ^members?/?$ members.php
|
RewriteRule ^members/?$ members.php
|
||||||
RewriteRule ^members/([a-z]+)?/?$ members.php?sort=$1
|
RewriteRule ^members/([a-z]+)/?$ members.php?sort=$1
|
||||||
RewriteRule ^members/([0-9]+)?/?$ members.php?rank=$1
|
RewriteRule ^members/([0-9]+)/?$ members.php?rank=$1
|
||||||
RewriteRule ^members/p([0-9]+)?/?$ members.php?page=$1
|
RewriteRule ^members/p([0-9]+)/?$ members.php?page=$1
|
||||||
RewriteRule ^members/([a-z]+)/([0-9]+)?/?$ members.php?sort=$1&rank=$2
|
RewriteRule ^members/([a-z]+)/([0-9]+)/?$ members.php?sort=$1&rank=$2
|
||||||
RewriteRule ^members/([0-9]+)/p([0-9]+)?/?$ members.php?rank=$1&page=$2
|
RewriteRule ^members/([0-9]+)/p([0-9]+)/?$ members.php?rank=$1&page=$2
|
||||||
RewriteRule ^members/([a-z]+)/p([0-9]+)?/?$ members.php?sort=$1&page=$2
|
RewriteRule ^members/([a-z]+)/p([0-9]+)/?$ members.php?sort=$1&page=$2
|
||||||
RewriteRule ^members/([a-z]+)/([0-9]+)/p([0-9]+)?/?$ members.php?sort=$1&rank=$2&page=$3
|
RewriteRule ^members/([a-z]+)/([0-9]+)/p([0-9]+)/?$ members.php?sort=$1&rank=$2&page=$3
|
||||||
|
|
||||||
## Profiles
|
## Profiles
|
||||||
RewriteRule ^u$|u/$ profile.php
|
RewriteRule ^u/?$ profile.php
|
||||||
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)?/?$ profile.php?u=$1
|
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/?$ profile.php?u=$1
|
||||||
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/api?/?$ profile.php?data
|
RewriteRule ^u/([A-Za-z0-9_-\s\.]+)/api/?$ profile.php?data
|
||||||
|
|
||||||
# Serving Images
|
# Serving Images
|
||||||
RewriteRule ^a/([0-9]+)$|a/([0-9]+).png$ imageserve.php?m=avatar&u=$1
|
RewriteRule ^a/([0-9]+)$|a/([0-9]+).png$ imageserve.php?m=avatar&u=$1
|
||||||
RewriteRule ^bg/([0-9]+)$|bg/([0-9]+).png$ imageserve.php?m=background&u=$1
|
RewriteRule ^bg/([0-9]+)$|bg/([0-9]+).png$ imageserve.php?m=background&u=$1
|
||||||
|
|
||||||
|
# Forum
|
||||||
|
RewriteRule ^forum/?$ forum/index.php
|
||||||
|
RewriteRule ^forum/([0-9]+)/?$ forum/viewforum.php?id=$2
|
||||||
|
RewriteRule ^forum/(thread|topic)/([0-9]+)/?$ forum/viewtopic.php?id=$2
|
||||||
|
|
||||||
|
# Management
|
||||||
|
RewriteRule ^manage/?$ manage.php
|
||||||
|
RewriteRule ^manage/([a-z\-]+)/?$ manage.php?page=$1&sub=0
|
||||||
|
RewriteRule ^manage/([a-z\-]+)/([a-z\-]+)/?$ manage.php?page=$1&sub=$2
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Include components
|
// Include components
|
||||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
require_once str_replace(basename(__DIR__), '../', dirname(__FILE__)) .'_sakura/sakura.php';
|
||||||
|
|
||||||
// Add page specific things
|
// Add page specific things
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
|
@ -7,4 +7,4 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Include components
|
// Include components
|
||||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
require_once str_replace(basename(__DIR__), '../', dirname(__FILE__)) .'_sakura/sakura.php';
|
|
@ -7,4 +7,4 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Include components
|
// Include components
|
||||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
require_once str_replace(basename(__DIR__), '../', dirname(__FILE__)) .'_sakura/sakura.php';
|
|
@ -7,4 +7,4 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Include components
|
// Include components
|
||||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
require_once str_replace(basename(__DIR__), '../', dirname(__FILE__)) .'_sakura/sakura.php';
|
109
main/news.php
109
main/news.php
|
@ -6,6 +6,9 @@
|
||||||
// Declare Namespace
|
// Declare Namespace
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
|
// Use DOMDocument
|
||||||
|
use DOMDocument;
|
||||||
|
|
||||||
// Include components
|
// Include components
|
||||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
||||||
|
|
||||||
|
@ -18,37 +21,101 @@ $renderData['page'] = [
|
||||||
// News XML feed
|
// News XML feed
|
||||||
if(isset($_GET['xml'])) {
|
if(isset($_GET['xml'])) {
|
||||||
|
|
||||||
print '<?xml version="1.0" encoding="UTF-8"?>';
|
// Meta data attributes
|
||||||
print '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">';
|
$metaData = [
|
||||||
|
'title' => ($_FEED_TITLE = Configuration::getConfig('sitename')) .' News',
|
||||||
|
'link' => ($_FEED_URL = 'http://'. Configuration::getLocalConfig('urls', 'main')),
|
||||||
|
'description' => 'News about '. $_FEED_TITLE,
|
||||||
|
'language' => 'en-gb',
|
||||||
|
'webMaster' => Users::getUser(1)['email'] .' ('. $_FEED_TITLE .' Webmaster)',
|
||||||
|
'pubDate' => ($_FEED_DATE = date('r', $renderData['newsPosts'][0]['date'])),
|
||||||
|
'lastBuildDate' => $_FEED_DATE,
|
||||||
|
];
|
||||||
|
|
||||||
print '<channel>';
|
// Item attributes
|
||||||
|
$itemData = [
|
||||||
|
'title' => ['text' => '{EVAL}', 'eval' => '$newsPost["title"]'],
|
||||||
|
'link' => ['text' => $_FEED_URL .'/news/{EVAL}', 'eval' => '$newsPost["id"]'],
|
||||||
|
'guid' => ['text' => $_FEED_URL .'/news/{EVAL}', 'eval' => '$newsPost["id"]'],
|
||||||
|
'pubDate' => ['text' => '{EVAL}', 'eval' => 'date("D, d M Y G:i:s O", $newsPost["date"])'],
|
||||||
|
'dc:publisher' => ['text' => '{EVAL}', 'eval' => '$newsPost["udata"]["username"]'],
|
||||||
|
'description' => ['cdata' => '{EVAL}', 'eval' => '$newsPost["parsed"]'],
|
||||||
|
];
|
||||||
|
|
||||||
print '<title>Flashii News</title>';
|
// Create a new DOM document
|
||||||
print '<link>http://flashii.net/</link>';
|
$feed = new DOMDocument('1.0', 'utf-8');
|
||||||
print '<description>News on Flashii.net.</description>';
|
|
||||||
print '<language>en-gb</language>';
|
|
||||||
print '<language><webMaster>admin@flashii.net (Flashii Administrator)</webMaster></language>';
|
|
||||||
print '<pubDate>'. date('D, d M Y G:i:s O') .'</pubDate>';
|
|
||||||
print '<lastBuildDate>'. date('D, d M Y G:i:s O') .'</lastBuildDate>';
|
|
||||||
|
|
||||||
foreach($renderData['newsPosts'] as $newsPost) {
|
// Create the RSS element
|
||||||
|
$fRss = $feed->createElement('rss');
|
||||||
|
|
||||||
print '<item>';
|
// Set attributes
|
||||||
|
$fRss->setAttribute('version', '2.0');
|
||||||
|
$fRss->setAttribute('xmlns:atom', 'http://www.w3.org/2005/Atom');
|
||||||
|
$fRss->setAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1');
|
||||||
|
|
||||||
print '<title>'. $newsPost['title'] .'</title>';
|
// Create the channel element
|
||||||
print '<link>http://flashii.net/news/'. $newsPost['id'] .'</link>';
|
$fChannel = $feed->createElement('channel');
|
||||||
print '<guid>http://flashii.net/news/'. $newsPost['id'] .'</guid>';
|
|
||||||
print '<pubDate>'. date('D, d M Y G:i:s O', $newsPost['date']) .'</pubDate>';
|
|
||||||
print '<dc:publisher>'. $newsPost['udata']['username'] .'</dc:publisher>';
|
|
||||||
print '<description><![CDATA['. $newsPost['parsed'] .']]></description>';
|
|
||||||
|
|
||||||
print '</item>';
|
// Build meta elements
|
||||||
|
foreach($metaData as $name => $value) {
|
||||||
|
|
||||||
|
// Create the elements
|
||||||
|
$mElem = $feed->createElement($name);
|
||||||
|
$mElemText = $feed->createTextNode($value);
|
||||||
|
|
||||||
|
// Append them
|
||||||
|
$mElem ->appendChild($mElemText);
|
||||||
|
$fChannel ->appendChild($mElem);
|
||||||
|
|
||||||
|
// Unset the working vars
|
||||||
|
unset($mElem);
|
||||||
|
unset($mElemText);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</channel>';
|
// Add all the posts
|
||||||
|
foreach($renderData['newsPosts'] as $newsPost) {
|
||||||
|
|
||||||
print '</rss>';
|
// Create item element
|
||||||
|
$fPost = $feed->createElement('item');
|
||||||
|
|
||||||
|
// Create post attributes
|
||||||
|
foreach($itemData as $tag => $valueData) {
|
||||||
|
|
||||||
|
// Create the element
|
||||||
|
$pElem = $feed->createElement($tag);
|
||||||
|
|
||||||
|
// Create value
|
||||||
|
eval('$value = '. $valueData['eval'] .';');
|
||||||
|
$value = str_replace('{EVAL}', $value, $valueData[(array_key_exists('cdata', $valueData) ? 'cdata' : 'text')]);
|
||||||
|
|
||||||
|
// Create text node or cdata container
|
||||||
|
$pElemText = (array_key_exists('cdata', $valueData)) ? $feed->createCDATASection($value) : $feed->createTextNode($value);
|
||||||
|
|
||||||
|
// Append them
|
||||||
|
$pElem ->appendChild($pElemText);
|
||||||
|
$fPost ->appendChild($pElem);
|
||||||
|
|
||||||
|
// Unset the working vars
|
||||||
|
unset($pElem);
|
||||||
|
unset($pElemText);
|
||||||
|
unset($value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append the item to the channel
|
||||||
|
$fChannel->appendChild($fPost);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append the channel element to RSS
|
||||||
|
$fRss->appendChild($fChannel);
|
||||||
|
|
||||||
|
// Append the RSS element to the DOM
|
||||||
|
$feed->appendChild($fRss);
|
||||||
|
|
||||||
|
// Return the feed
|
||||||
|
print $feed->saveXML();
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
# Block access to every file starting with a dot
|
|
||||||
<Files ".*">
|
|
||||||
Require all denied
|
|
||||||
</Files>
|
|
||||||
|
|
||||||
# Set Error documents
|
|
||||||
ErrorDocument 404 /404.php
|
|
||||||
ErrorDocument 403 /404.php
|
|
||||||
ErrorDocument 401 /404.php
|
|
||||||
|
|
||||||
# Rewrite Stuff
|
|
||||||
RewriteEngine on
|
|
||||||
RewriteBase /
|
|
||||||
Options +FollowSymLinks -Indexes
|
|
||||||
|
|
||||||
# Manage pages
|
|
||||||
RewriteRule ^([a-z\-]+)?/?$ index.php?page=$1&sub=0
|
|
||||||
RewriteRule ^([a-z\-]+)/([a-z\-]+)?/?$ index.php?page=$1&sub=$2
|
|
|
@ -1,13 +0,0 @@
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
* Flashii.net Main Index
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Declare Namespace
|
|
||||||
namespace Sakura;
|
|
||||||
|
|
||||||
// Include components
|
|
||||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
|
|
||||||
|
|
||||||
// Print page contents
|
|
||||||
print Templates::render('errors/http404.tpl', $renderData);
|
|
Binary file not shown.
Before Width: | Height: | Size: 361 KiB |
Reference in a new issue