r20151210

Signed-off-by: Flashwave <me@flash.moe>
This commit is contained in:
flash 2015-12-10 21:55:51 +01:00
parent 60b60ad30a
commit 5cce6c3e82
23 changed files with 166 additions and 269 deletions

View file

@ -21,10 +21,10 @@ class Forum
public $category = 0;
public $type = 0;
public $icon = "";
public $firstPost = null;
public $lastPost = null;
public $forums = [];
public $threads = [];
private $_firstPost = null;
private $_lastPost = null;
private $_forums = [];
private $_threads = [];
// Constructor
public function __construct($forumId = 0)
@ -44,23 +44,13 @@ class Forum
} elseif ($forumId != 0) {
$this->id = -1;
}
// Populate the forums array
$this->forums = $this->getForums();
// and the threads array
$this->threads = $this->getThreads();
// and the first post
$this->firstPost = $this->getFirstPost();
// and finally the last post
$this->lastPost = $this->getLastPost();
}
// Subforums
public function getForums()
public function forums()
{
// Check if _forums is populated
if (!count($this->_forums)) {
// Get all rows with the category id set to the forum id
$forumRows = Database::fetch('forums', true, ['forum_category' => [$this->id, '=']]);
@ -72,13 +62,20 @@ class Forum
$forums[$forum['forum_id']] = new Forum($forum['forum_id']);
}
$this->_forums = $forums;
} else {
$forums = $this->_forums;
}
// Return the forum objects
return $forums;
}
// Threads
public function getThreads()
public function threads()
{
// Check if _threads is populated
if (!count($this->_threads)) {
// Get all rows with the forum id for this forum
$announcements = Database::fetch('topics', true, ['forum_id' => [$this->id, '='], 'topic_type' => ['2', '=']], ['topic_last_reply', true]);
$sticky = Database::fetch('topics', true, ['forum_id' => [$this->id, '='], 'topic_type' => ['1', '=']], ['topic_last_reply', true]);
@ -95,34 +92,55 @@ class Forum
$threads[$thread['topic_id']] = new Thread($thread['topic_id']);
}
$this->_threads = $threads;
} else {
$threads = $this->_threads;
}
// Return the thread objects
return $threads;
}
// First post
public function getFirstPost()
public function firstPost()
{
// Check if _firstPost is set
if ($this->_firstPost === null) {
// Get the row
$firstPost = Database::fetch('posts', false, ['forum_id' => [$this->id, '=']], ['post_id'], [1]);
// Create the post object
$post = new Post(empty($firstPost) ? 0 : $firstPost['post_id']);
// Assign it to a "cache" variable
$this->_firstPost = $post;
// Return the post object
return $post;
} else {
return $this->_firstPost;
}
}
// Last post
public function getLastPost()
public function lastPost()
{
// Check if _lastPost is set
if ($this->_lastPost === null) {
// Get the row
$lastPost = Database::fetch('posts', false, ['forum_id' => [$this->id, '=']], ['post_id', true], [1]);
// Create the post object
$post = new Post(empty($lastPost) ? 0 : $lastPost['post_id']);
// Assign it to a "cache" variable
$this->_lastPost = $post;
// Return the post object
return $post;
} else {
return $this->_lastPost;
}
}
// Thread count
@ -146,14 +164,14 @@ class Forum
}
// Check forums
foreach ($this->forums as $forum) {
foreach ($this->forums() as $forum) {
if ($forum->unread($user)) {
return true;
}
}
// Check each thread
foreach ($this->threads as $thread) {
foreach ($this->threads() as $thread) {
if ($thread->unread($user)) {
return true;
}
@ -167,13 +185,13 @@ class Forum
public function trackUpdateAll($user)
{
// Iterate over every forum
foreach ($this->forums as $forum) {
foreach ($this->forums() as $forum) {
// Update every forum
$forum->trackUpdateAll($user);
}
// Iterate over every thread
foreach ($this->threads as $thread) {
foreach ($this->threads() as $thread) {
// Update every thread
$thread->trackUpdate($user);
}

View file

@ -26,6 +26,8 @@ class Thread
public $statusChange = 0;
public $type = 0;
private $_posts = [];
private $_firstPost = null;
private $_lastPost = null;
// Constructor
public function __construct($threadId)
@ -53,7 +55,6 @@ class Thread
{
// Check if _posts is something
if (!count($this->_posts)) {
// Get all rows with the thread id
$postRows = Database::fetch('posts', true, ['topic_id' => [$this->id, '=']]);
@ -77,13 +78,43 @@ class Thread
// Get the opening post
public function firstPost()
{
return $this->posts() ? array_values($this->_posts)[0] : (new Post(0));
// Check if the cache var is set
if ($this->_firstPost !== null) {
return $this->_firstPost;
}
// Get the row from the database
$post = Database::fetch('posts', false, ['topic_id' => [$this->id, '=']], ['post_id'], [1]);
// Create the post class
$post = new Post($post ? $post['post_id'] : 0);
// Assign it to the cache var
$this->_firstPost = $post;
// Return
return $post;
}
// Get the last reply
public function lastPost()
{
return $this->posts() ? end($this->_posts) : (new Post(0));
// Check if the cache var is set
if ($this->_lastPost !== null) {
return $this->_firstPost;
}
// Get the row from the database
$post = Database::fetch('posts', false, ['topic_id' => [$this->id, '=']], ['post_id', true], [1]);
// Create the post class
$post = new Post($post ? $post['post_id'] : 0);
// Assign it to the cache var
$this->_lastPost = $post;
// Return
return $post;
}
// Reply count
@ -108,18 +139,13 @@ class Thread
public function unread($user)
{
// Attempt to get track row from the database
$track = Database::fetch('topics_track', false, ['user_id' => [$user, '='], 'topic_id' => [$this->id, '=']]);
$track = Database::fetch('topics_track', false, ['user_id' => [$user, '='], 'topic_id' => [$this->id, '='], 'mark_time' => [$this->lastPost()->time, '>']]);
// If nothing was returned it's obvious that the status is unread
if (!$track) {
return true;
}
// Check if the last time the user has been here is less than the creation timestamp of the latest post
if ($track['mark_time'] < $this->lastPost()->time) {
return true;
}
// Else just return false meaning everything is read
return false;
}

View file

@ -14,19 +14,6 @@ use PHPMailer;
*/
class Main
{
// Constructor
public static function init($config)
{
// Configuration Management and local configuration
Config::init($config);
// Database
Database::init(Config::local('database', 'driver'));
// "Dynamic" Configuration
Config::initDB();
}
// Parse markdown
public static function mdParse($text, $escape = false)
{

View file

@ -20,6 +20,7 @@ class Template
private $template;
private $templateName;
private $templateOptions;
protected $templateFileExtension = ".tpl";
// Initialise templating engine and data
public function __construct()
@ -80,9 +81,9 @@ class Template
public function render($file)
{
try {
return $this->template->render($file, $this->vars);
return $this->template->render($file . $this->templateFileExtension, $this->vars);
} catch (\Exception $e) {
trigger_error($e->getMessage(), E_USER_ERROR);
return trigger_error($e->getMessage(), E_USER_ERROR);
}
}
}

View file

@ -22,4 +22,4 @@ $template->setTemplate($templateName);
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/notfound.tpl');
echo $template->render('global/notfound');

View file

@ -296,7 +296,7 @@ if (isset($_REQUEST['mode'])) {
$renderData['page']['redirect'];
} else {
$template->setVariables($renderData);
echo $template->render('global/information.tpl');
echo $template->render('global/information');
}
exit;
}
@ -324,7 +324,7 @@ if (Users::checkLogin()) {
];
$template->setVariables($renderData);
echo $template->render('global/information.tpl');
echo $template->render('global/information');
exit;
}
@ -348,10 +348,10 @@ if (isset($_REQUEST['pw']) && $_REQUEST['pw']) {
}
$template->setVariables($renderData);
echo $template->render('main/forgotpassword.tpl');
echo $template->render('main/forgotpassword');
exit;
}
// Print page contents
$template->setVariables($renderData);
echo $template->render('main/authenticate.tpl');
echo $template->render('main/authenticate');

View file

@ -27,4 +27,4 @@ $template->setTemplate($templateName);
$template->setVariables($renderData);
// Print page contents
echo $template->render('main/faq.tpl');
echo $template->render('main/faq');

View file

@ -19,4 +19,4 @@ $template->setTemplate($templateName);
$template->setVariables($renderData);
// Print page contents
echo $template->render('group/index.tpl');
echo $template->render('group/index');

View file

@ -39,7 +39,7 @@ if (isset($_GET['p'])) {
$template->setVariables($renderData);
// Print page contents
echo $template->render('main/infopage.tpl');
echo $template->render('main/infopage');
exit;
}
@ -75,4 +75,4 @@ $renderData['stats'] = [
$template->setVariables($renderData);
// Print page contents
echo $template->render(($forumMode ? 'forum' : 'main') . '/index.tpl');
echo $template->render(($forumMode ? 'forum' : 'main') . '/index');

View file

@ -86,4 +86,4 @@ $template->setTemplate($templateName);
$template->setVariables($renderData);
// Print page contents
echo $template->render('pages/' . $category . '/' . $mode . '.tpl');
echo $template->render('pages/' . $category . '/' . $mode);

View file

@ -45,11 +45,11 @@ if (Users::checkLogin()) {
$template->setVariables($renderData);
// Print page contents
echo $template->render('main/memberlist.tpl');
echo $template->render('main/memberlist');
} else {
// Set parse variables
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/restricted.tpl');
echo $template->render('global/restricted');
}

View file

@ -135,4 +135,4 @@ $template->setTemplate($templateName);
$template->setVariables($renderData);
// Print page contents
echo $template->render('main/news.tpl');
echo $template->render('main/news');

View file

@ -52,7 +52,7 @@ if ($mode != 'f') {
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/information.tpl');
echo $template->render('global/information');
exit;
}
@ -78,7 +78,7 @@ if ($mode != 'f') {
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/information.tpl');
echo $template->render('global/information');
exit;
}
@ -105,7 +105,7 @@ if ($mode != 'f') {
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/information.tpl');
echo $template->render('global/information');
exit;
}
@ -138,7 +138,7 @@ if ($mode != 'f') {
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/information.tpl');
echo $template->render('global/information');
exit;
// Return to previous page
} else {
@ -159,7 +159,7 @@ if ($mode != 'f') {
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/confirm.tpl');
echo $template->render('global/confirm');
exit;
}
@ -191,7 +191,7 @@ if (isset($_POST['post'])) {
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/information.tpl');
echo $template->render('global/information');
}
exit;
}
@ -205,4 +205,4 @@ $renderData = array_merge($renderData, [
$template->setVariables($renderData);
// Print page contents
echo $template->render('forum/posting.tpl');
echo $template->render('forum/posting');

View file

@ -35,4 +35,4 @@ $renderData['profileView'] = isset($_GET['view']) && in_array($_GET['view'], $vi
$template->setVariables($renderData);
// Print page contents
echo $template->render('main/profile.tpl');
echo $template->render('main/profile');

View file

@ -19,4 +19,4 @@ $template->setTemplate($templateName);
$template->setVariables($renderData);
// Print page contents
echo $template->render('main/report.tpl');
echo $template->render('main/report');

View file

@ -24,4 +24,4 @@ $template->setTemplate($templateName);
$template->setVariables($renderData);
// Print page contents
echo $template->render('main/search.tpl');
echo $template->render('main/search');

View file

@ -276,7 +276,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/information.tpl');
echo $template->render('global/information');
}
exit;
} elseif (isset($_REQUEST['friend-action']) && $_REQUEST['friend-action'] && Users::checkLogin()) {
@ -405,7 +405,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/information.tpl');
echo $template->render('global/information');
}
exit;
} elseif (isset($_POST['submit']) && isset($_POST['submit'])) {
@ -1036,7 +1036,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/information.tpl');
echo $template->render('global/information');
}
exit;
}
@ -1044,15 +1044,10 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
if (Users::checkLogin()) {
// Settings page list
$pages = [
'general' => [
'title' => 'General',
'modes' => [
'home' => [
'title' => 'Home',
'description' => [
@ -1062,317 +1057,200 @@ if (Users::checkLogin()) {
],
'access' => !$currentUser->checkPermission('SITE', 'DEACTIVATED'),
'menu' => true,
],
'profile' => [
'title' => 'Edit Profile',
'description' => [
'These are the external account links etc.
on your profile, shouldn\'t need any additional explanation for this one.',
],
'access' => $currentUser->checkPermission('SITE', 'ALTER_PROFILE'),
'menu' => true,
],
'options' => [
'title' => 'Site Options',
'description' => [
'These are a few personalisation options for the site while you\'re logged in.',
],
'access' => !$currentUser->checkPermission('SITE', 'DEACTIVATED'),
'menu' => true,
], /*,
'groups' => [
'title' => 'Groups',
'description' => [
'{{ user.colour }}'
],
'access' => $currentUser->checkPermission('SITE', 'JOIN_GROUPS'),
'menu' => true
]*/
],
],
'friends' => [
'title' => 'Friends',
'modes' => [
'listing' => [
'title' => 'Listing',
'description' => [
'Manage your friends.',
],
'access' => $currentUser->checkPermission('SITE', 'MANAGE_FRIENDS'),
'menu' => true,
],
'requests' => [
'title' => 'Requests',
'description' => [
'Handle friend requests.',
],
'access' => $currentUser->checkPermission('SITE', 'MANAGE_FRIENDS'),
'menu' => true,
],
],
],
'messages' => [
'title' => 'Messages',
'modes' => [
'inbox' => [
'title' => 'Inbox',
'description' => [
'The list of messages you\'ve received.',
],
'access' => $currentUser->checkPermission('SITE', 'USE_MESSAGES'),
'menu' => true,
],
'sent' => [
'title' => 'Sent',
'description' => [
'The list of messages you\'ve sent to other users.',
],
'access' => $currentUser->checkPermission('SITE', 'USE_MESSAGES'),
'menu' => true,
],
'compose' => [
'title' => 'Compose',
'description' => [
'Write a new message.',
],
'access' => $currentUser->checkPermission('SITE', 'SEND_MESSAGES'),
'menu' => true,
],
'read' => [
'title' => 'Read',
'description' => [
'Read a message.',
],
'access' => $currentUser->checkPermission('SITE', 'USE_MESSAGES'),
'menu' => false,
],
],
],
'notifications' => [
'title' => 'Notifications',
'modes' => [
'history' => [
'title' => 'History',
'description' => [
'The history of notifications that have been sent to you in the last month.',
],
'access' => !$currentUser->checkPermission('SITE', 'DEACTIVATED'),
'menu' => true,
],
],
],
'appearance' => [
'title' => 'Appearance',
'modes' => [
'avatar' => [
'title' => 'Avatar',
'description' => [
'Your avatar which is displayed all over the site and on your profile.',
'Maximum image size is {{ avatar.max_width }}x{{ avatar.max_height }},
minimum image size is {{ avatar.min_width }}x{{ avatar.min_height }},
maximum file size is {{ avatar.max_size_view }}.',
],
'access' => $currentUser->checkPermission('SITE', 'CHANGE_AVATAR'),
'menu' => true,
],
'background' => [
'title' => 'Background',
'description' => [
'The background that is displayed on your profile.',
'Maximum image size is {{ background.max_width }}x{{ background.max_height }},
minimum image size is {{ background.min_width }}x{{ background.min_height }},
maximum file size is {{ background.max_size_view }}.',
],
'access' => (
isset($currentUser->userData()['profileBackground'])
&& $currentUser->checkPermission('SITE', 'CHANGE_BACKGROUND')
) || $currentUser->checkPermission('SITE', 'CREATE_BACKGROUND'),
'menu' => true,
],
'userpage' => [
'title' => 'Userpage',
'description' => [
'The custom text that is displayed on your profile.',
],
'access' => (
isset($currentUser->userData()['userPage'])
&& $currentUser->checkPermission('SITE', 'CHANGE_USERPAGE')
) || $currentUser->checkPermission('SITE', 'CREATE_USERPAGE'),
'menu' => true,
],
'signature' => [
'title' => 'Signature',
'description' => [
'This signature is displayed at the end of all your posts (unless you choose not to show it).',
],
'access' => $currentUser->checkPermission('SITE', 'CHANGE_SIGNATURE'),
'menu' => true,
],
],
],
'account' => [
'title' => 'Account',
'modes' => [
'email' => [
'title' => 'E-mail Address',
'description' => [
'You e-mail address is used for password recovery and stuff like that, we won\'t spam you ;).',
],
'access' => $currentUser->checkPermission('SITE', 'CHANGE_EMAIL'),
'menu' => true,
],
'username' => [
'title' => 'Username',
'description' => [
'Probably the biggest part of your identity on a site.',
'<b>You can only change this once every 30 days so choose wisely.</b>',
],
'access' => $currentUser->checkPermission('SITE', 'CHANGE_USERNAME'),
'menu' => true,
],
'usertitle' => [
'title' => 'Usertitle',
'description' => [
'That little piece of text displayed under your username on your profile.',
],
'access' => $currentUser->checkPermission('SITE', 'CHANGE_USERTITLE'),
'menu' => true,
],
'password' => [
'title' => 'Password',
'description' => [
'Used to authenticate with the site and certain related services.',
],
'access' => $currentUser->checkPermission('SITE', 'CHANGE_PASSWORD'),
'menu' => true,
],
'ranks' => [
'title' => 'Ranks',
'description' => [
'Manage what ranks you\'re in and what is set as your main rank.
Your main rank is highlighted.
You get the permissions of all of the ranks you\'re in combined.',
],
'access' => $currentUser->checkPermission('SITE', 'ALTER_RANKS'),
'menu' => true,
],
],
],
'advanced' => [
'title' => 'Advanced',
'modes' => [
'sessions' => [
'title' => 'Sessions',
'description' => [
'Session keys are a way of identifying yourself with the system without keeping
your password in memory.',
'If someone finds one of your session keys they could possibly compromise your account,
@ -1380,43 +1258,30 @@ if (Users::checkLogin()) {
selected session.',
'If you get logged out after clicking one you\'ve most likely killed your current session,
to make it easier to avoid this from happening your current session is highlighted.',
],
'access' => $currentUser->checkPermission('SITE', 'MANAGE_SESSIONS'),
'menu' => true,
],
'registrationkeys' => [
'title' => 'Registration Keys',
'description' => [
'Sometimes we activate the registration key system which means that users can only
register using your "referer" keys,this means we can keep unwanted people from registering.',
'Each user can generate 5 of these keys, bans and deactivates render these keys useless.',
],
'access' => $currentUser->checkPermission('SITE', 'CREATE_REGKEYS'),
'menu' => true,
],
'deactivate' => [
'title' => 'Deactivate Account',
'description' => [
'You can deactivate your account here if you want to leave :(.',
],
'access' => $currentUser->checkPermission('SITE', 'DEACTIVATE_ACCOUNT'),
'menu' => true,
],
],
],
];
// Current settings page
@ -1444,7 +1309,7 @@ if (Users::checkLogin()) {
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/notfound.tpl');
echo $template->render('global/notfound');
exit;
}
@ -1534,11 +1399,11 @@ if (Users::checkLogin()) {
$template->setVariables($renderData);
// Print page contents
echo $template->render('main/settings.tpl');
echo $template->render('main/settings');
} else {
// If not allowed print the restricted page
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/restricted.tpl');
echo $template->render('global/restricted');
}

View file

@ -127,7 +127,7 @@ if (isset($_REQUEST['mode'])
$template->setVariables($renderData);
// Print page contents
echo $template->render('main/premiumcomplete.tpl');
echo $template->render('main/premiumcomplete');
break;
default:
@ -148,7 +148,7 @@ if (isset($_GET['tracker'])) {
$template->setVariables($renderData);
// Print page contents
echo $template->render('main/supporttracker.tpl');
echo $template->render('main/supporttracker');
exit;
}
@ -166,4 +166,4 @@ $renderData['page'] = [
$template->setVariables($renderData);
// Print page contents
echo $template->render('main/support.tpl');
echo $template->render('main/support');

View file

@ -30,7 +30,7 @@ if ($forum->id < 0) {
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/information.tpl');
echo $template->render('global/information');
exit;
}
@ -47,7 +47,7 @@ if ($forum->type === 2) {
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/information.tpl');
echo $template->render('global/information');
exit;
}
@ -67,7 +67,7 @@ if (isset($_GET['read']) && $_GET['read'] && isset($_GET['session']) && $_GET['s
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/information.tpl');
echo $template->render('global/information');
exit;
}
@ -83,4 +83,4 @@ $renderData['forum'] = $forum;
$template->setVariables($renderData);
// Print page contents
echo $template->render('forum/viewforum.tpl');
echo $template->render('forum/viewforum');

View file

@ -36,7 +36,7 @@ if (!$thread) {
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/information.tpl');
echo $template->render('global/information');
exit;
}
@ -56,4 +56,4 @@ $renderData = array_merge($renderData, [
$template->setVariables($renderData);
// Print page contents
echo $template->render('forum/viewtopic.tpl');
echo $template->render('forum/viewtopic');

View file

@ -8,7 +8,7 @@
namespace Sakura;
// Define Sakura version
define('SAKURA_VERSION', '20151209');
define('SAKURA_VERSION', '20151210');
define('SAKURA_VLABEL', 'Eminence');
define('SAKURA_COLOUR', '#6C3082');
@ -23,12 +23,12 @@ mb_internal_encoding('utf-8');
// Stop the execution if the PHP Version is older than 5.4.0
if (version_compare(phpversion(), '5.4.0', '<')) {
die('<h3>Sakura requires at least PHP 5.4.0, please upgrade to a newer PHP version.</h3>');
die('Sakura requires at least PHP 5.4.0, please upgrade to a newer PHP version.');
}
// Include third-party libraries
if (!@include_once ROOT . 'vendor/autoload.php') {
die('<h3>Autoloader not found, did you run composer?</h3>');
die('Autoloader not found, did you run composer?');
}
// Include components
@ -66,12 +66,18 @@ foreach (glob(ROOT . 'libraries/DBWrapper/*.php') as $driver) {
// Set Error handler
set_error_handler(['Sakura\Main', 'errorHandler']);
// Initialise Main Class
Main::init(ROOT . 'config/config.ini');
// Load the local configuration
Config::init(ROOT . 'config/config.ini');
// Change error reporting according to the dev configuration
error_reporting(Config::local('dev', 'enable') ? -1 : 0);
// Make the database connection
Database::init(Config::local('database', 'driver'));
// Load the configuration stored in the database
Config::initDB();
// Assign servers file to whois class
Whois::setServers(ROOT . Config::local('data', 'whoisservers'));
@ -87,14 +93,7 @@ if (Config::get('no_cron_service')) {
}
// Update last execution time
Database::update('config', [
[
'config_value' => time(),
],
[
'config_name' => ['no_cron_last', '='],
],
]);
Database::update('config', [['config_value' => time()], ['config_name' => ['no_cron_last', '=']]]);
}
}
@ -205,12 +204,12 @@ if (!defined('SAKURA_NO_TPL')) {
$template->setVariables($renderData);
// Print page contents
echo $template->render('global/information.tpl');
echo $template->render('global/information');
exit;
}
// Ban checking
if ($authCheck && !in_array($_SERVER['PHP_SELF'], ['/authenticate.php']) && $ban = Bans::checkBan($currentUser->id())) {
if ($authCheck && !in_array($_SERVER['PHP_SELF'], [$urls->format('AUTH_ACTION', [], false)]) && $ban = Bans::checkBan($currentUser->id())) {
// Additional render data
$renderData = array_merge($renderData, [
'ban' => [
@ -231,7 +230,7 @@ if (!defined('SAKURA_NO_TPL')) {
$template->setVariables($renderData);
// Print page contents
echo $template->render('main/banned.tpl');
echo $template->render('main/banned');
exit;
}
}

View file

@ -115,6 +115,7 @@
<li><a href="{% if session.checkLogin %}{{ urls.format('USER_PROFILE', [user.id]) }}{% else %}{{ urls.format('SITE_LOGIN') }}{% endif %}"><img src="{{ sakura.contentPath }}/pixel.png" alt="{{ user.username }}" style="background-image: url('{{ urls.format('IMAGE_AVATAR', [user.id]) }}');" class="nav-avatar" /></a></li>
</ul>
</div>
{#<div id="banner" style="height: 120px; width: 1024px; background: url('http://i.flash.moe/headtest.png'); margin: 0 auto 5px; box-shadow: 0 2px 6px rgba(0, 0, 0, .75);"></div>#}
<div id="content">
{% block content %}
<div class="platform">

View file

@ -36,7 +36,7 @@
{% block content %}
<div class="content homepage forum viewtopic">
<div class="content-column">
<div class="head">{{ forum.name }} / {{ thread.title }}</div>
<div class="head"><a href="{{ forumBackLink }}" class="clean">{{ forum.name }}</a> / <a href="{{ paginationUrl }}" class="clean">{{ thread.title }}</a></div>
{% include 'forum/forumBtns.tpl' %}
<table class="posts">
{% for post in posts[get.page|default(1) - 1] %}