takin out the trash

This commit is contained in:
Pachira 2016-03-28 16:47:43 +02:00
parent 3b2df3b96c
commit 1962ff99a6
50 changed files with 585 additions and 592 deletions

View file

@ -1,60 +0,0 @@
<?php
/**
* Holds the ban manager.
*
* @package Sakura
*/
namespace Sakura;
/**
* User banishment management.
*
* @package Sakura
* @author Julian van de Groep <me@flash.moe>
*/
class Bans
{
/**
* Checks if a user is banned.
*
* @param int $uid The ID of the user that is being checked.
*
* @return array|bool Either false or an array containing information about the ban.
*/
public static function checkBan($uid)
{
// Attempt to get a ban from this user
$bans = DB::table('bans')
->where('user_id', $uid)
->get();
// Reverse the array so new bans are listed first
$bans = array_reverse($bans);
// Go over each ban
foreach ($bans as $ban) {
// Check if it hasn't expired
if ($ban->ban_end != 0 && $ban->ban_end < time()) {
// If it has delete the entry and continue
DB::table('bans')
->where('ban_id', $ban->ban_id)
->delete();
continue;
}
// Return the ban if all checks were passed
return [
'user' => $ban->user_id,
'issuer' => $ban->ban_moderator,
'issued' => $ban->ban_begin,
'expires' => $ban->ban_end,
'reason' => $ban->ban_reason,
];
}
// Else just return false
return false;
}
}

View file

@ -24,6 +24,7 @@ class Comment
public $upvotes = 0;
public $downvotes = 0;
private $replyCache = [];
private $parsedCache = "";
public function __construct($id = 0)
{
@ -69,6 +70,19 @@ class Comment
}
}
public function delete()
{
foreach ($this->replies() as $reply) {
$reply->delete();
}
DB::table('comments')
->where('comment_id', $this->id)
->delete();
$this->id = 0;
}
private function getVotes()
{
$votes = DB::table('comment_votes')
@ -77,20 +91,30 @@ class Comment
foreach ($votes as $vote) {
if ($vote->vote_state) {
$upvotes += 1;
$this->upvotes += 1;
} else {
$downvotes += 1;
$this->downvotes += 1;
}
}
}
public function parsed()
{
if (!$this->parsedCache) {
$this->parsedCache = BBcode::parseEmoticons(Utils::cleanString($this->text));
}
return $this->parsedCache;
}
public function replies()
{
if (!$this->replyCache) {
$commentIds = DB::table('comments')
->where('comment_reply_to', $this->id)
->orderBy('comment_id', 'desc')
->get(['comment_id']);
$commentIds = array_column($comments, 'comment_id');
$commentIds = array_column($commentIds, 'comment_id');
foreach ($commentIds as $comment) {
$this->replyCache[$comment] = new Comment($comment);

View file

@ -0,0 +1,38 @@
<?php
/**
* Holds the comments controller.
*
* @package Sakura
*/
namespace Sakura\Controllers;
use Sakura\Comment;
/**
* Handles comment stuff.
*
* @package Sakura
* @author Julian van de Groep <me@flash.moe>
*/
class CommentsController extends Controller
{
public function post($category = '', $reply = 0)
{
global $currentUser;
// todo: make not shit
$text = isset($_POST['text']) ? $_POST['text'] : '';
$comment = new Comment;
$comment->category = $category;
$comment->time = time();
$comment->reply = (int) $reply;
$comment->user = $currentUser->id;
$comment->text = $text;
$comment->save();
}
}

View file

@ -85,8 +85,7 @@ class FileController extends Controller
return $this->serve($deactive['data'], $deactive['mime'], $deactive['name']);
}
if ($user->checkBan()
|| $user->permission(Site::RESTRICTED)) {
if ($user->permission(Site::RESTRICTED)) {
return $this->serve($banned['data'], $banned['mime'], $banned['name']);
}
@ -126,7 +125,6 @@ class FileController extends Controller
$user = User::construct($id);
if ($user->permission(Site::DEACTIVATED)
|| $user->checkBan()
|| $user->permission(Site::RESTRICTED)
|| !$user->background) {
return $this->serve($none['data'], $none['mime'], $none['name']);
@ -164,7 +162,6 @@ class FileController extends Controller
$user = User::construct($id);
if ($user->permission(Site::DEACTIVATED)
|| $user->checkBan()
|| $user->permission(Site::RESTRICTED)
|| !$user->header) {
return $this->serve($none['data'], $none['mime'], $none['name']);

View file

@ -184,7 +184,7 @@ class ForumController extends Controller
]);
// Print page contents
return Template::render('forum/viewforum');
return Template::render('forum/forum');
}
/**
@ -295,7 +295,7 @@ class ForumController extends Controller
Template::vars(compact('forum', 'thread'));
// Print page contents
return Template::render('forum/viewtopic');
return Template::render('forum/thread');
}
/**
@ -699,7 +699,7 @@ class ForumController extends Controller
Template::vars(compact('forum'));
return Template::render('forum/viewtopic');
return Template::render('forum/thread');
}
/**

View file

@ -9,7 +9,7 @@ namespace Sakura\Controllers;
use Sakura\Config;
use Sakura\DB;
use Sakura\News;
use Sakura\News\Category;
use Sakura\Template;
use Sakura\User;
@ -60,10 +60,12 @@ class MetaController extends Controller
$onlineUsers[$user->id] = $user;
}
// Get news
$news = new Category(Config::get('site_news_category'));
// Merge index specific stuff with the global render data
Template::vars([
'news' => new News(Config::get('site_news_category')),
'newsCount' => Config::get('front_page_news_posts'),
'news' => $news->posts(Config::get('front_page_news_posts')),
'stats' => [
'userCount' => DB::table('users')
->where('password_algo', '!=', 'disabled')
@ -81,36 +83,7 @@ class MetaController extends Controller
]);
// Return the compiled page
return Template::render('main/index');
}
/**
* Handles the news pages.
*
* @return mixed HTML for the correct news section.
*/
public function news()
{
// Get arguments
$args = func_get_args();
$category = isset($args[0]) && !is_numeric($args[0]) ? $args[0] : Config::get('site_news_category');
$post = isset($args[1]) && is_numeric($args[1]) ? $args[1] : (
isset($args[0]) && is_numeric($args[0]) ? $args[0] : 0
);
// Create news object
$news = new News($category);
// Set parse variables
Template::vars([
'news' => $news,
'postsPerPage' => Config::get('news_posts_per_page'),
'viewPost' => $post != 0,
'postExists' => $news->postExists($post),
]);
// Print page contents
return Template::render('main/news');
return Template::render('meta/index');
}
/**
@ -134,7 +107,7 @@ class MetaController extends Controller
]);
// Print page contents
return Template::render('main/faq');
return Template::render('meta/faq');
}
/**
@ -174,7 +147,7 @@ class MetaController extends Controller
}
// Return the compiled page
return Template::render('main/infopage');
return Template::render('meta/infopage');
}
/**
@ -184,6 +157,6 @@ class MetaController extends Controller
*/
public function search()
{
return Template::render('main/search');
return Template::render('meta/search');
}
}

View file

@ -0,0 +1,64 @@
<?php
/**
* Holds the news controller.
*
* @package Sakura
*/
namespace Sakura\Controllers;
use Sakura\Config;
use Sakura\News\Category;
use Sakura\News\Post;
use Sakura\Template;
/**
* News controller.
*
* @package Sakura
* @author Julian van de Groep <me@flash.moe>
*/
class NewsController extends Controller
{
public function category($category = '')
{
// Check if the category is set
if ($category === '') {
// Fetch the default category from the config
$category = Config::get('site_news_category');
}
// Create the category object
$category = new Category($category);
if (!$category->posts()) {
$message = "This news category doesn't exist!";
Template::vars(compact('message'));
return Template::render('global/information');
}
Template::vars(compact('category'));
return Template::render('news/category');
}
public function post($id = 0)
{
// Create the post object
$post = new Post($id);
if (!$post->id) {
$message = "This news post doesn't exist!";
Template::vars(compact('message'));
return Template::render('global/information');
}
Template::vars(compact('post'));
return Template::render('news/post');
}
}

View file

@ -0,0 +1,71 @@
<?php
/**
* Holds the notification controllers.
*
* @package Sakura
*/
namespace Sakura\Controllers;
use Sakura\Notification;
use Sakura\Perms\Site;
use Sakura\User;
/**
* Notification stuff.
*
* @package Sakura
* @author Julian van de Groep <me@flash.moe>
*/
class NotificationsController extends Controller
{
/**
* Get the notification JSON object for the currently authenticated user.
*
* @return string The JSON object.
*/
public function notifications()
{
// TODO: add friend on/offline messages
global $currentUser;
// Set json content type
header('Content-Type: application/json; charset=utf-8');
return json_encode(
$currentUser->notifications(),
JSON_FORCE_OBJECT | JSON_NUMERIC_CHECK | JSON_BIGINT_AS_STRING
);
}
/**
* Mark a notification as read.
*
* @param int The ID of the notification.
*
* @return string Not entirely set on this one yet but 1 for success and 0 for fail.
*/
public function mark($id = 0)
{
global $currentUser;
// Check permission
if ($currentUser->permission(Site::DEACTIVATED)) {
return '0';
}
// Create the notification object
$alert = new Notification($id);
// Verify that the currently authed user is the one this alert is for
if ($alert->user !== $currentUser->id) {
return '0';
}
// Toggle the read status and save
$alert->toggleRead();
$alert->save();
return '1';
}
}

View file

@ -49,7 +49,7 @@ class PremiumController extends Controller
Template::vars(compact('price', 'amountLimit'));
return Template::render('main/support');
return Template::render('premium/index');
}
/**
@ -180,6 +180,6 @@ class PremiumController extends Controller
*/
public function complete()
{
return Template::render('main/premiumcomplete');
return Template::render('premium/complete');
}
}

View file

@ -9,7 +9,6 @@ namespace Sakura\Controllers;
use Sakura\Config;
use Sakura\DB;
use Sakura\Notification;
use Sakura\Perms\Site;
use Sakura\Rank;
use Sakura\Router;
@ -63,7 +62,7 @@ class UserController extends Controller
Template::vars(compact('profile'));
// Print page contents
return Template::render('main/profile');
return Template::render('user/profile');
}
/**
@ -107,56 +106,6 @@ class UserController extends Controller
Template::vars(compact('ranks', 'rank', 'membersPerPage'));
// Render the template
return Template::render('main/memberlist');
}
/**
* Get the notification JSON object for the currently authenticated user.
*
* @return string The JSON object.
*/
public function notifications()
{
// TODO: add friend on/offline messages
global $currentUser;
// Set json content type
header('Content-Type: application/json; charset=utf-8');
return json_encode(
$currentUser->notifications(),
JSON_FORCE_OBJECT | JSON_NUMERIC_CHECK | JSON_BIGINT_AS_STRING
);
}
/**
* Mark a notification as read.
*
* @param int The ID of the notification.
*
* @return string Not entirely set on this one yet but 1 for success and 0 for fail.
*/
public function markNotification($id = 0)
{
global $currentUser;
// Check permission
if ($currentUser->permission(Site::DEACTIVATED)) {
return '0';
}
// Create the notification object
$alert = new Notification($id);
// Verify that the currently authed user is the one this alert is for
if ($alert->user !== $currentUser->id) {
return '0';
}
// Toggle the read status and save
$alert->toggleRead();
$alert->save();
return '1';
return Template::render('user/members');
}
}

View file

@ -1,76 +0,0 @@
<?php
/**
* Holds the news handler.
*
* @package Sakura
*/
namespace Sakura;
/**
* Used to serve news posts.
*
* @package Sakura
* @author Julian van de Groep <me@flash.moe>
*/
class News
{
/**
* Array containing news posts.
*
* @var array
*/
public $posts = [];
/**
* Constructor
*
* @param mixed $category ID of the category that should be constructed.
*/
public function __construct($category)
{
// Get the news posts and assign them to $posts
$posts = DB::table('news')
->where('news_category', $category)
->orderBy('news_id', 'desc')
->get();
// Attach poster data
foreach ($posts as $post) {
// See Comments.php
$post = get_object_vars($post);
// Attach the poster
$post['news_poster'] = User::construct($post['user_id']);
// Load comments
$post['news_comments'] = $this->comments = new Comments('news-' . $category . '-' . $post['news_id']);
// Add post to posts array
$this->posts[$post['news_id']] = $post;
}
}
/**
* Get the amount of news posts.
*
* @return int Number of posts.
*/
public function getCount()
{
return count($this->posts);
}
/**
* Check if a post exists in this category.
*
* @param int $pid The ID of the post.
*
* @return int If true the post it gets returns, else 0.
*/
public function postExists($pid)
{
return array_key_exists($pid, $this->posts) ? $pid : 0;
}
}

View file

@ -1 +1,46 @@
donderdag
<?php
/**
* Holds the news category object.
*
* @package Sakura
*/
namespace Sakura\News;
use Sakura\DB;
/**
* News category object.
*
* @package Sakura
* @author Julian van de Groep <me@flash.moe>
*/
class Category
{
public $name = "";
public function __construct($name)
{
$this->name = $name;
}
public function posts($limit = 0)
{
$postIds = DB::table('news')
->where('news_category', $this->name)
->orderBy('news_id', 'desc');
if ($limit) {
$postIds->limit($limit);
}
$postIds = $postIds->get(['news_id']);
$postIds = array_column($postIds, 'news_id');
$posts = [];
foreach ($postIds as $post) {
$posts[$post] = new Post($post);
}
return $posts;
}
}

View file

@ -1 +1,117 @@
vrijdag
<?php
/**
* Holds the news post object.
*
* @package Sakura
*/
namespace Sakura\News;
use Sakura\Comment;
use Sakura\DB;
use Sakura\User;
/**
* News post object.
*
* @package Sakura
* @author Julian van de Groep <me@flash.moe>
*/
class Post
{
const COMMENT_CATEGORY_FORMAT = "news-%s-%u";
public $id = 0;
public $category = "";
public $user = 0;
public $time = 0;
public $title = "";
public $text = "";
private $commentCountCache = 0;
private $commentsCache = [];
public function __construct($id = 0)
{
// Get comment data from the database
$data = DB::table('news')
->where('news_id', $id)
->get();
// Check if anything was returned and assign data
if ($data) {
$data = $data[0];
$this->id = $data->news_id;
$this->category = $data->news_category;
$this->user = $data->user_id;
$this->time = $data->news_timestamp;
$this->title = $data->news_title;
$this->text = $data->news_content;
}
}
public function save()
{
// Create submission data, insert and update take the same format
$data = [
'news_category' => $this->category,
'user_id' => $this->user,
'news_timestamp' => $this->time,
'news_title' => $this->title,
'news_content' => $this->text,
];
// Update if id isn't 0
if ($this->id) {
DB::table('news')
->where('news_id', $this->id)
->update($data);
} else {
$this->id = DB::table('news')
->insertGetId($data);
}
}
public function delete()
{
DB::table('news')
->where('news_id', $this->id)
->delete();
$this->id = 0;
}
public function userData()
{
return User::construct($this->user);
}
public function commentCount()
{
if (!$this->commentCountCache) {
$this->commentCountCache = DB::table('comments')
->where('comment_category', sprintf(self::COMMENT_CATEGORY_FORMAT, $this->category, $this->id))
->count();
}
return $this->commentCountCache;
}
public function comments()
{
if (!$this->commentsCache) {
$commentIds = DB::table('comments')
->where('comment_category', sprintf(self::COMMENT_CATEGORY_FORMAT, $this->category, $this->id))
->orderBy('comment_id', 'desc')
->where('comment_reply_to', 0)
->get(['comment_id']);
$commentIds = array_column($commentIds, 'comment_id');
foreach ($commentIds as $comment) {
$this->commentsCache[$comment] = new Comment($comment);
}
}
return $this->commentsCache;
}
}

View file

@ -73,15 +73,6 @@ class Notification
}
}
public function delete()
{
DB::table('comments')
->where('comment_id', $this->id)
->delete();
$this->id = 0;
}
public function toggleRead()
{
// Set read to the negative value of itself

View file

@ -41,13 +41,6 @@ class Template
*/
private static $templateName;
/**
* The template options.
*
* @var array
*/
private static $templateOptions;
/**
* The file extension used by template files
*/
@ -60,17 +53,6 @@ class Template
*/
public static function set($name)
{
// Assign config path to a variable so we don't have to type it out twice
$confPath = ROOT . 'templates/' . $name . '/template.ini';
// Check if the configuration file exists
if (!file_exists($confPath)) {
trigger_error('Template configuration does not exist', E_USER_ERROR);
}
// Parse and store the configuration
self::$templateOptions = parse_ini_file($confPath, true);
// Set variables
self::$templateName = $name;

View file

@ -741,16 +741,6 @@ class User
return $objects;
}
/**
* Check if the user is banned.
*
* @return array|bool Ban status.
*/
public function checkBan()
{
return Bans::checkBan($this->id);
}
/**
* Check if the user has a certaing permission flag.
*
@ -774,12 +764,26 @@ class User
}
/**
* Get the comments from the user's profile.
* Get the comments from the user's profile.
*
* @return Comments
*/
public function profileComments()
{
return new Comments('profile-' . $this->id);
$commentIds = DB::table('comments')
->where('comment_category', "profile-{$this->id}")
->orderBy('comment_id', 'desc')
->where('comment_reply_to', 0)
->get(['comment_id']);
$commentIds = array_column($commentIds, 'comment_id');
$comments = [];
foreach ($commentIds as $comment) {
$comments[$comment] = new Comment($comment);
}
return $comments;
}
/**

View file

@ -1528,7 +1528,7 @@ if (Users::checkLogin()) {
Template::vars($renderData);
// Print page contents
echo Template::render('main/settings');
echo Template::render('meta/settings');
} else {
// If not allowed print the restricted page
Template::vars($renderData);

View file

@ -56,9 +56,8 @@ Router::group(['before' => 'loginCheck'], function () {
// News
Router::group(['prefix' => 'news'], function () {
Router::get('/', 'MetaController@news', 'news.index');
Router::get('/{category}', 'MetaController@news', 'news.category');
Router::get('/{category}/{id}', 'MetaController@news', 'news.post');
Router::get('/{category:c}?', 'NewsController@category', 'news.category');
Router::get('/post/{id:i}', 'NewsController@post', 'news.post');
});
// Forum
@ -66,8 +65,8 @@ Router::group(['prefix' => 'forum'], function () {
// Post
Router::group(['prefix' => 'post'], function () {
Router::get('/{id:i}', 'ForumController@post', 'forums.post');
Router::get('/{id:i}/raw', 'ForumController@postRaw', 'forums.post.raw');
Router::group(['before' => 'loginCheck'], function () {
Router::get('/{id:i}/raw', 'ForumController@postRaw', 'forums.post.raw');
Router::get('/{id:i}/delete', 'ForumController@deletePost', 'forums.post.delete');
Router::post('/{id:i}/delete', 'ForumController@deletePost', 'forums.post.delete');
Router::post('/{id:i}/edit', 'ForumController@editPost', 'forums.post.edit');
@ -84,13 +83,15 @@ Router::group(['prefix' => 'forum'], function () {
// Forum
Router::get('/', 'ForumController@index', 'forums.index');
Router::get('/{id:i}', 'ForumController@forum', 'forums.forum');
Router::get('/{id:i}/mark', 'ForumController@markForumRead', 'forums.mark');
Router::get('/{id:i}/new', 'ForumController@createThread', 'forums.new');
Router::post('/{id:i}/new', 'ForumController@createThread', 'forums.new');
Router::group(['before' => 'loginCheck'], function () {
Router::get('/{id:i}/mark', 'ForumController@markForumRead', 'forums.mark');
Router::get('/{id:i}/new', 'ForumController@createThread', 'forums.new');
Router::post('/{id:i}/new', 'ForumController@createThread', 'forums.new');
});
});
// Members
Router::group(['prefix' => 'members'], function () {
Router::group(['prefix' => 'members', 'before' => 'loginCheck'], function () {
Router::get('/', 'UserController@members', 'members.index');
Router::get('/{rank:i}', 'UserController@members', 'members.rank');
});
@ -98,8 +99,17 @@ Router::group(['prefix' => 'members'], function () {
// User
Router::get('/u/{id}', 'UserController@profile', 'user.profile');
Router::get('/u/{id}/header', 'FileController@header', 'user.header');
Router::get('/notifications', 'UserController@notifications', 'user.notifications');
Router::get('/notifications/{id}/mark', 'UserController@markNotification', 'user.notifications.mark');
// Notifications
Router::group(['prefix' => 'notifications'], function () {
Router::get('/', 'NotificationsController@notifications', 'notifications.get');
Router::get('/{id}/mark', 'NotificationsController@mark', 'notifications.mark');
});
// Comments
Router::group(['prefix' => 'comments', 'before' => 'loginCheck'], function () {
Router::post('/{category:c}/post/{reply:i}?', 'CommentsController@post', 'comments.post');
});
// Files
Router::get('/a/{id}', 'FileController@avatar', 'file.avatar');
@ -116,7 +126,7 @@ Router::group(['prefix' => 'support', 'before' => 'loginCheck'], function () {
// Helpers
Router::group(['prefix' => 'helper'], function () {
// BBcode
Router::group(['prefix' => 'bbcode'], function () {
Router::group(['prefix' => 'bbcode', 'before' => 'loginCheck'], function () {
Router::post('/parse', 'HelperController@bbcodeParse', 'helper.bbcode.parse');
});
});
@ -211,35 +221,6 @@ Router::group(['prefix' => 'settings', 'before' => 'loginCheck'], function () {
Router::get('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate');
});
});
/*
* General
* - Home (make this not worthless while you're at it)
* - Edit Profile
* - Site Options
* Friends
* - Listing
* - Requests
* Groups
* - Listing
* - Invites
* Notifications (will probably deprecate this entire section at some point but not relevant yet)
* - History
* Appearance (possibly combine ava, bg and header down into one menu as well as userpage and signature maybe)
* - Avatar
* - Background
* - Header
* - Userpage
* - Signature
* Account (also down to one section maybe)
* - E-mail
* - Username
* - Usertitle
* - Password
* - Ranks (except this one i guess)
* Advanced
* - Session manager
* - Deactivate account
*/
// Management
/*

View file

@ -8,7 +8,7 @@
namespace Sakura;
// Define Sakura version
define('SAKURA_VERSION', 20160327);
define('SAKURA_VERSION', 20160328);
// Define Sakura Path
define('ROOT', __DIR__ . '/');
@ -104,11 +104,7 @@ $currentUser = User::construct($authCheck[0]);
$urls = new Urls();
// Prepare the name of the template to load
$templateName =
!defined('SAKURA_MANAGE')
&& isset($currentUser->optionFields()['useMisaki'])
&& $currentUser->optionFields()['useMisaki'] ?
'misaki' : Config::get('site_style');
$templateName = Config::get('site_style');
if (!defined('SAKURA_NO_TPL')) {
// Start templating engine
@ -181,32 +177,11 @@ if (!defined('SAKURA_NO_TPL')) {
if (Config::get('site_closed')) {
// Set parse variables
Template::vars([
'page' => [
'message' => Config::get('site_closed_reason'),
],
'message' => Config::get('site_closed_reason'),
]);
// Print page contents
echo Template::render('global/information');
exit;
}
// Ban checking
if ($authCheck
&& !in_array($_SERVER['PHP_SELF'], [$urls->format('AUTH_ACTION', [], false)])
&& $ban = Bans::checkBan($currentUser->id)) {
// Additional render data
Template::vars([
'ban' => [
'reason' => $ban['reason'],
'issued' => $ban['issued'],
'expires' => $ban['expires'],
'issuer' => (User::construct($ban['issuer'])),
],
]);
// Print page contents
echo Template::render('main/banned');
exit;
}
}

View file

@ -145,8 +145,6 @@
<div class="title">Account Standing</div>
{% if profileHidden %}
<div class="standing" style="color: #444;">Unknown</div>
{% elseif profile.checkBan %}
<h2 class="standing" style="color: #811;">Banned</h2>
{% elseif profile.permission(constant('Sakura\\Perms\\Site::RESTRICTED')) %}
<h2 class="standing" style="color: #811;">Restricted</h2>
{% else %}

View file

@ -1,28 +1,28 @@
<li id="comment-{{ comment.comment_id }}">
<li id="comment-{{ comment.id }}">
<div class="comment">
<a class="comment-avatar clean" href="{{ route('user.profile', comment.comment_poster.id) }}" style="background-image: url('{{ route('file.avatar', comment.comment_poster.id) }}');"><span style="color: {{ comment.comment_poster.colour }};">{{ comment.comment_poster.username }}</span></a>
<a class="comment-avatar clean" href="{{ route('user.profile', comment.userData.id) }}" style="background-image: url('{{ route('file.avatar', comment.userData.id) }}');"><span style="color: {{ comment.userData.colour }};">{{ comment.userData.username }}</span></a>
<div class="comment-pointer"></div>
<div class="comment-content">
<div class="comment-controls">
<ul>
{% if comment.comment_poster.id == user.id %}
<li><a href="{{ urls.format('COMMENT_DELETE', [comment.comment_id, comment.comment_category, session_id()])}}" class="clean fa fa-trash-o comment-deletion-link" title="Delete" id="comment-action-delete-{{ comment.comment_id }}"></a></li>
{% if comment.userData.id == user.id %}
<li><a href="{{ urls.format('COMMENT_DELETE', [comment.id, comment.category, session_id()])}}" class="clean fa fa-trash-o comment-deletion-link" title="Delete" id="comment-action-delete-{{ comment.id }}"></a></li>
{% else %}
<li><a href="{{ urls.format('USER_REPORT', [comment.comment_poster.id]) }}" class="clean fa fa-exclamation-circle" title="Report" id="comment-action-report-{{ comment.comment_id }}"></a></li>
<li><a href="{{ urls.format('USER_REPORT', [comment.userData.id]) }}" class="clean fa fa-exclamation-circle" title="Report" id="comment-action-report-{{ comment.id }}"></a></li>
{% endif %}
<li><a href="javascript:void(0);" onclick="commentReply({{ comment.comment_id }}, '{{ session_id() }}', '{{ comment.comment_category }}', '{{ urls.format('COMMENT_POST') }}', '{{ route('file.avatar', user.id) }}');" class="clean fa fa-reply" title="Reply" id="comment-action-reply-{{ comment.comment_id }}"></a></li>
<li class="shown voting like"><a href="{{ urls.format('COMMENT_VOTE', [comment.comment_id, 1, comment.comment_category, session_id()])}}" class="clean comment-like-link" id="comment-action-like-{{ comment.comment_id }}"><span class="fa fa-thumbs-up"></span> <span id="comment-{{ comment.comment_id }}-likes">{{ comment.comment_likes }}</span></a></li>
<li class="shown voting dislike"><a id="comment-action-dislike-{{ comment.comment_id }}" href="{{ urls.format('COMMENT_VOTE', [comment.comment_id, 0, comment.comment_category, session_id()])}}" class="clean comment-dislike-link"><span class="fa fa-thumbs-down"></span> <span id="comment-{{ comment.comment_id }}-dislikes">{{ comment.comment_dislikes }}</span></a></li>
<li><a href="javascript:void(0);" onclick="commentReply({{ comment.id }}, '{{ session_id() }}', '{{ comment.category }}', '{{ urls.format('COMMENT_POST') }}', '{{ route('file.avatar', user.id) }}');" class="clean fa fa-reply" title="Reply" id="comment-action-reply-{{ comment.id }}"></a></li>
<li class="shown voting like"><a href="{{ urls.format('COMMENT_VOTE', [comment.id, 1, comment.category, session_id()])}}" class="clean comment-like-link" id="comment-action-like-{{ comment.id }}"><span class="fa fa-thumbs-up"></span> <span id="comment-{{ comment.id }}-likes">{{ comment.upvotes }}</span></a></li>
<li class="shown voting dislike"><a id="comment-action-dislike-{{ comment.id }}" href="{{ urls.format('COMMENT_VOTE', [comment.id, 0, comment.category, session_id()])}}" class="clean comment-dislike-link"><span class="fa fa-thumbs-down"></span> <span id="comment-{{ comment.id }}-dislikes">{{ comment.downvotes }}</span></a></li>
</ul>
<div class="clear"></div>
</div>
<div class="comment-text">
{{ comment.comment_text|raw|nl2br }}
{{ comment.parsed|raw|nl2br }}
</div>
</div>
</div>
<ul>
{% for comment in comment.comment_replies %}
{% for comment in comment.replies %}
{% include 'elements/comment.twig' %}
{% endfor %}
</ul>

View file

@ -1,16 +1,17 @@
{% if not (viewPost and postExists) %}<a href="{{ route('news.post', [post.news_category, post.news_id]) }}" class="news-head" id="{{ post.news_category }}_{{ post.news_id }}">{{ post.news_title }}</a>{% endif %}
{% if newsHideTitle is not defined %}<a href="{{ route('news.post', post.id) }}" class="news-head" id="p{{ post.id }}">{{ post.title }}</a>{% endif %}
<div class="news-body">
<a class="no-underline" href="{{ route('user.profile', post.news_poster.id) }}">
<a class="no-underline" href="{{ route('user.profile', post.userData.id) }}">
<div class="news-poster">
<img src="{{ route('file.avatar', post.news_poster.id) }}" alt="{{ post.news_poster.username }}" class="default-avatar-setting" />
<h1 style="color: {{ post.news_poster.colour }}; text-shadow: 0 0 7px {% if post.news_poster.colour != 'inherit' %}{{ post.news_poster.colour }}{% else %}#222{% endif %}; padding: 0 0 10px;">{{ post.news_poster.username }}</h1>
<img src="{{ route('file.avatar', post.userData.id) }}" alt="{{ post.userData.username }}" class="default-avatar-setting" />
<h1 style="color: {{ post.userData.colour }}; text-shadow: 0 0 7px {% if post.userData.colour != 'inherit' %}{{ post.userData.colour }}{% else %}#222{% endif %}; padding: 0 0 10px;">{{ post.userData.username }}</h1>
</div>
</a>
<div class="bbcode">
{{ post.news_content|raw }}
{{ post.text|raw }}
</div>
</div>
<div class="clear"></div>
<div class="news-post-time">
Posted <time>{{ post.news_timestamp|date(sakura.dateFormat) }}</time>{% if not (viewPost and postExists) %} <a class="default" href="{{ route('news.post', [post.news_category, post.news_id]) }}#comments">{{ post.news_comments.count }} comment{% if post.news_comments.count != 1 %}s{% endif %}</a>{% endif %}
Posted <time>{{ post.time|date(sakura.dateFormat) }}</time>
{% if newsHideCommentCount is not defined %}<a class="default" href="{{ route('news.post', post.id) }}#comments">{{ post.commentCount }} comment{% if post.commentCount != 1 %}s{% endif %}</a>{% endif %}
</div>

View file

@ -0,0 +1,55 @@
<div class="head">{{ title }}</div>
<div class="forumList">
{% for forum in forum.forums %}
{% if forum.type == 1 %}
{% if forum.forums|length and forum.permission(constant('Sakura\\Perms\\Forum::VIEW'), user.id) %}
<div class="forumCategory">
{% if forum.type != 1 %}Subforums{% else %}<a href="{{ route('forums.forum', forum.id) }}" class="clean">{{ forum.name }}</a>{% endif %}
</div>
{% for forum in forum.forums %}
{% include 'forum/elements/forumEntry.twig' %}
{% endfor %}
{% endif %}
{% else %}
{% include 'forum/elements/forumEntry.twig' %}
{% endif %}
{% endfor %}
</div>
{% if not forum.type and forum.id > 0 %}
{% set threads = forum.threads|batch(25) %}
{% set paginationPages = threads %}
{% set paginationUrl %}{{ route('forums.forum', forum.id) }}{% endset %}
{% include 'forum/elements/forumBtns.twig' %}
{% if forum.threads %}
<table class="topicList">
<thead>
<tr>
<th></th>
<th>Topic</th>
<th>Author</th>
<th></th>
<th>Last post</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th>Topic</th>
<th>Author</th>
<th></th>
<th>Last post</th>
</tr>
</tfoot>
<tbody>
{% for thread in threads[get.page|default(1) - 1] %}
{% include 'forum/elements/topicEntry.twig' %}
{% endfor %}
</tbody>
</table>
{% else %}
<h1 class="stylised" style="margin: 2em auto; text-align: center;">There are no posts in this forum!</h1>
{% endif %}
{% include 'forum/elements/forumBtns.twig' %}
{% endif %}

View file

@ -15,7 +15,7 @@
<a href="{{ forumMarkRead }}" class="forumbtn"><span class="fa fa-check-square-o"></span> Mark as Read</a>
{% endif %}
{% if thread.id and showMod %}
{% include 'forum/forumMod.twig' %}
{% include 'forum/elements/forumMod.twig' %}
{% endif %}
</div>
{% include 'elements/pagination.twig' %}

View file

@ -1,55 +1,17 @@
<div class="head">{{ title }}</div>
<div class="forumList">
{% for forum in forum.forums %}
{% if forum.type == 1 %}
{% if forum.forums|length and forum.permission(constant('Sakura\\Perms\\Forum::VIEW'), user.id) %}
<div class="forumCategory">
{% if forum.type != 1 %}Subforums{% else %}<a href="{{ route('forums.forum', forum.id) }}" class="clean">{{ forum.name }}</a>{% endif %}
</div>
{% for forum in forum.forums %}
{% include 'forum/forumEntry.twig' %}
{% endfor %}
{% endif %}
{% else %}
{% include 'forum/forumEntry.twig' %}
{% endif %}
{% endfor %}
</div>
{% if not forum.type and forum.id > 0 %}
{% set threads = forum.threads|batch(25) %}
{% extends 'global/master.twig' %}
{% set paginationPages = threads %}
{% set paginationUrl %}{{ route('forums.forum', forum.id) }}{% endset %}
{% set title %}Forums / {{ forum.name }}{% endset %}
{% include 'forum/forumBtns.twig' %}
{% if forum.threads %}
<table class="topicList">
<thead>
<tr>
<th></th>
<th>Topic</th>
<th>Author</th>
<th></th>
<th>Last post</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th>Topic</th>
<th>Author</th>
<th></th>
<th>Last post</th>
</tr>
</tfoot>
<tbody>
{% for thread in threads[get.page|default(1) - 1] %}
{% include 'forum/topicEntry.twig' %}
{% endfor %}
</tbody>
</table>
{% else %}
<h1 class="stylised" style="margin: 2em auto; text-align: center;">There are no posts in this forum!</h1>
{% endif %}
{% include 'forum/forumBtns.twig' %}
{% endif %}
{% set forumBackLink %}{{ route('forums.index') }}{% endset %}
{% set forumNewLink %}{{ route('forums.new', forum.id) }}{% endset %}
{% set forumMarkRead %}{{ route('forums.mark', forum.id) }}?s={{ session_id() }}{% endset %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
<div class="content homepage forum viewforum">
<div class="content-column">
{% include 'forum/elements/forumBase.twig' %}
</div>
</div>
{% endblock %}

View file

@ -61,7 +61,7 @@
</div>
</div>
<div class="content-left content-column">
{% include 'forum/forum.twig' %}
{% include 'forum/elements/forumBase.twig' %}
</div>
<div class="clear"></div>
</div>

View file

@ -70,7 +70,7 @@
<div class="content homepage forum viewtopic">
<div class="content-column">
<div class="head">{{ forum.name }} / <span id="threadTitle">{{ thread.title }}</span></div>
{% include 'forum/forumBtns.twig' %}
{% include 'forum/elements/forumBtns.twig' %}
<table class="posts">
{% if thread is defined %}
{% set textCache = session.replyText['t' ~ thread.id] %}
@ -162,9 +162,9 @@
{% endif %}
</table>
{% if forumReplyLink is defined or thread is not defined %}
{% include 'forum/replyForm.twig' %}
{% include 'forum/elements/replyForm.twig' %}
{% endif %}
{% include 'forum/forumBtns.twig' %}
{% include 'forum/elements/forumBtns.twig' %}
</div>
</div>
{% endblock %}

View file

@ -1,17 +0,0 @@
{% extends 'global/master.twig' %}
{% set title %}Forums / {{ forum.name }}{% endset %}
{% set forumBackLink %}{{ route('forums.index') }}{% endset %}
{% set forumNewLink %}{{ route('forums.new', forum.id) }}{% endset %}
{% set forumMarkRead %}{{ route('forums.mark', forum.id) }}?s={{ session_id() }}{% endset %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
<div class="content homepage forum viewforum">
<div class="content-column">
{% include 'forum/forum.twig' %}
</div>
</div>
{% endblock %}

View file

@ -84,7 +84,7 @@
<div class="menu-nav" id="navMenuSite">
<!-- Navigation menu, displayed on left side of the bar. -->
<a class="menu-item fa-home" href="{{ route('main.index') }}" title="Home"></a>
<a class="menu-item fa-newspaper-o" href="{{ route('news.index') }}" title="News"></a>
<a class="menu-item fa-newspaper-o" href="{{ route('news.category') }}" title="News"></a>
<a class="menu-item fa-commenting" href="{{ route('main.infopage', 'chat') }}" title="Chat"></a>
<a class="menu-item fa-list" href="{{ route('forums.index') }}" title="Forums"></a>
<a class="menu-item fa-search" href="{{ route('main.search') }}" title="Search"></a>
@ -178,27 +178,27 @@
<div class="copycentre">Powered by <a href="https://github.com/flashwave/sakura/" target="_blank">Sakura</a>{% if sakura.dev.showChangelog %} <a href="https://sakura.flash.moe/#r{{ sakura.versionInfo.version }}" target="_blank">r{{ sakura.versionInfo.version }}</a>{% endif %} &copy; 2013-2016 <a href="http://flash.moe/" target="_blank">Flashwave</a></div>
<ul class="ftsection">
<li class="fthead">General</li>
<li><a href="{{ route('main.index') }}" title="Flashii Frontpage">Home</a></li>
<li><a href="{{ route('news.index') }}" title="Flashii News &amp; Updates">News</a></li>
<li><a href="{{ route('main.search') }}" title="Do full-site search requests">Search</a></li>
<li><a href="{{ route('main.infopage', 'contact') }}" title="Contact our Staff">Contact</a></li>
<li><a href="https://sakura.flash.moe" target="_blank" title="All the changes made to Sakura are listed here">Changelog</a></li>
<li><a href="{{ route('premium.index') }}" title="Get Tenshi and help us pay the bills">Support us</a></li>
<li><a href="{{ route('main.index') }}">Home</a></li>
<li><a href="{{ route('news.category') }}">News</a></li>
<li><a href="{{ route('main.search') }}">Search</a></li>
<li><a href="{{ route('main.infopage', 'contact') }}">Contact</a></li>
<li><a href="https://sakura.flash.moe" target="_blank">Changelog</a></li>
<li><a href="{{ route('premium.index') }}">Support us</a></li>
</ul>
<ul class="ftsection">
<li class="fthead">Community</li>
<li><a href="{{ route('forums.index') }}" title="Read and post on our forums">Forums</a></li>
<li><a href="https://twitter.com/_flashii" target="_blank" title="Follow us on Twitter for news messages that are too short for the news page">Twitter</a></li>
<li><a href="https://youtube.com/user/flashiinet" target="_blank" title="Our YouTube page where stuff barely ever gets uploaded, mainly used to archive community creations">YouTube</a></li>
<li><a href="https://steamcommunity.com/groups/flashiinet" target="_blank" title="Our Steam group, play games with other members on the site">Steam</a></li>
<li><a href="https://github.com/flashii" target="_blank" title="Our GitHub organisation">GitHub</a></li>
<li><a href="{{ route('forums.index') }}">Forums</a></li>
<li><a href="https://twitter.com/_flashii" target="_blank">Twitter</a></li>
<li><a href="https://youtube.com/user/flashiinet" target="_blank">YouTube</a></li>
<li><a href="https://steamcommunity.com/groups/flashiinet" target="_blank">Steam</a></li>
<li><a href="https://github.com/flashii" target="_blank">GitHub</a></li>
</ul>
<ul class="ftsection">
<li class="fthead">Information</li>
<li><a href="{{ route('main.faq') }}" title="Questions that get Asked Frequently but not actually">FAQ</a></li>
<li><a href="{{ route('main.infopage', 'rules') }}" title="Some Rules and Information kind of summing up the ToS">Rules</a></li>
<li><a href="//fiistat.us" target="_blank" title="Check the status on our Servers and related services">Server Status</a></li>
<li><a href="{{ route('main.infopage', 'terms') }}" title="Our Terms of Service">Terms of Service</a></li>
<li><a href="{{ route('main.faq') }}">FAQ</a></li>
<li><a href="{{ route('main.infopage', 'rules') }}">Rules</a></li>
<li><a href="//fiistat.us" target="_blank">Server Status</a></li>
<li><a href="{{ route('main.infopage', 'terms') }}">Terms of Service</a></li>
</ul>
</div>
</div>

View file

@ -1,56 +0,0 @@
{% extends 'global/master.twig' %}
{% set newsPosts = viewPost and postExists ? [news.posts[postExists]] : news.posts|batch(postsPerPage)[get.page|default(1) - 1] %}
{% if viewPost and postExists %}
{% set commentsCategory = 'news-' ~ newsPosts[0].news_category ~ '-' ~ newsPosts[0].news_id %}
{% set comments = newsPosts[0].news_comments.comments %}
{% else %}
{% set paginationPages = news.posts|batch(postsPerPage) %}
{% set paginationUrl %}{{ route('news.index') }}{% endset %}
{% endif %}
{% set title %}
{% if not (viewPost ? postExists : newsPosts|length) %}Post does not exist!{% elseif viewPost and postExists %}{{ newsPosts[0].news_title }}{% else %}News{% endif %}
{% endset %}
{% block title %}{{ title }}{% endblock %}
{% block css %}
<style type="text/css">
.pagination {
float: right;
}
</style>
{% endblock %}
{% block content %}
<div class="content">
<div class="content-column news">
<div class="head">{{ title }}</div>
{% if (viewPost ? postExists : newsPosts|length) %}
{% for post in newsPosts %}
{% include 'elements/newsPost.twig' %}
{% if viewPost and postExists %}
{% include 'elements/comments.twig' %}
{% endif %}
{% endfor %}
{% if not (viewPost and postExists) and news.posts|batch(postsPerPage)|length > 1 %}
<div>
{% include 'elements/pagination.twig' %}
<div class="clear"></div>
</div>
{% endif %}
{% else %}
<div style="padding: 20px;">
<h1>The requested news post does not exist!</h1>
There are a few possible reasons for this;
<ul style="margin-left: 30px;">
<li>The post may have been deleted due to irrelevancy.</li>
<li>The post never existed.</li>
</ul>
</div>
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -1,61 +0,0 @@
{% extends 'global/master.twig' %}
{% block title %}Donation Tracker{% endblock %}
{% set paginationPages = tracker.table|batch(20) %}
{% set paginationUrl %}{{ route('premium.tracker') }}{% endset %}
{% block css %}
<style type="text/css">
.pagination {
float: right;
}
</style>
{% endblock %}
{% block content %}
<div class="content support">
<div class="head">Donation Tracker</div>
<h1 class="stylised" style="margin: 1em auto; text-align: center;">Our current overall balance is &#8364;{{ tracker.balance|number_format(2) }}</h1>
<div class="sectionHeader">
Donation Log
</div>
<table>
<thead>
<tr>
<th>Supporter</th>
<th>Amount</th>
<th>Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Supporter</th>
<th>Amount</th>
<th>Action</th>
</tr>
</tfoot>
<tbody>
{% for supporter in tracker.table|batch(20)[get.page|default(1) - 1] %}
<tr>
<td>
<a href="{{ route('user.profile', tracker.users[supporter.user_id].id) }}" class="default" style="color: {{ tracker.users[supporter.user_id].colour }}; text-shadow: 0 0 7px {% if tracker.users[supporter.user_id].colour != 'inherit' %}{{ tracker.users[supporter.user_id].colour }}{% else %}#222{% endif %};">{{ tracker.users[supporter.user_id].username }}</a>
</td>
<td style="color: {% if supporter.transaction_amount > 0 %}#0A0{% else %}#A00{% endif %};">
&#8364;{{ supporter.transaction_amount|number_format(2) }}
</td>
<td>
{{ supporter.transaction_comment }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if tracker.table|batch(20)|length > 1 %}
<div>
{% include 'elements/pagination.twig' %}
<div class="clear"></div>
</div>
{% endif %}
</div>
{% endblock %}

View file

@ -7,7 +7,7 @@
</div>
<div class="content-left content-column">
<div class="head">News</div>
{% for post in news.posts|batch(newsCount)[0] %}
{% for post in news %}
{% include 'elements/newsPost.twig' %}
{% endfor %}
</div>

View file

@ -0,0 +1,33 @@
{% extends 'global/master.twig' %}
{% block title %}News{% endblock %}
{% block css %}
<style type="text/css">
.pagination {
float: right;
}
</style>
{% endblock %}
{% set posts = category.posts|batch(3) %}
{% set paginationPages = posts|keys %}
{% set paginationUrl %}{{ route('news.category', category.name) }}{% endset %}
{% block content %}
<div class="content">
<div class="content-column news">
<div class="head">News</div>
{% for post in posts[get.page|default(1) - 1] %}
{% include 'elements/newsPost.twig' %}
{% endfor %}
{% if posts|length > 1 %}
<div>
{% include 'elements/pagination.twig' %}
<div class="clear"></div>
</div>
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,20 @@
{% extends 'global/master.twig' %}
{% block title %}{{ post.title }}{% endblock %}
{% set commentsCategory = 'news-' ~ post.category ~ '-' ~ post.id %}
{% set comments = post.comments %}
{% set newsHideTitle = true %}
{% set newsHideCommentCount = true %}
{% block content %}
<div class="content">
<div class="content-column news">
<div class="head">{{ post.title }}</div>
{% include 'elements/newsPost.twig' %}
{% include 'elements/comments.twig' %}
</div>
</div>
{% endblock %}

View file

@ -1,4 +1,4 @@
{% set comments = profile.profileComments.comments %}
{% set comments = profile.profileComments %}
{% set commentsCategory = 'profile-' ~ profile.id %}
<div class="new-profile-mode-title">
<h1 class="stylised">Comments</h1>

View file

@ -1,14 +0,0 @@
; Sakura Template Configuration
[meta]
; Display name of the style, only used in the admin section of the management panel.
name = Yuuno
; Author of this template.
author = Flashwave
; If you set a URL below your name becomes a clickable link in the management panel.
author_url = https://flash.moe
[manage]
; This defines whether the template is intended for the management panel.
; When it's incorrect Sakura will halt execution of the script.
mode = 0

View file

@ -207,10 +207,8 @@
<b>Account Standing</b>
{% if profile.permission(constant('Sakura\\Perms\\Site::DEACTIVATED')) %}
<h2 style="color: #888; text-shadow: 0 0 7px #888; margin-top: 0;">Deactivated</h2>
{% elseif profile.checkBan %}
<h2 style="color: #222; text-shadow: 0 0 7px #222; margin-top: 0;">Banned</h2>
{% elseif profile.permission(constant('Sakura\\Perms\\Site::RESTRICTED')) %}
<h2 style="color: #800; text-shadow: 0 0 7px #800; margin-top: 0;">Restricted</h2>
<h2 style="color: #222; text-shadow: 0 0 7px #800; margin-top: 0;">Restricted</h2>
{% elseif profile.getWarnings %}
<h2 style="color: #A00; text-shadow: 0 0 7px #A00; margin-top: 0;">Bad</h2>
{% else %}