r20151210
Signed-off-by: Flashwave <me@flash.moe>
This commit is contained in:
parent
60b60ad30a
commit
5cce6c3e82
23 changed files with 166 additions and 269 deletions
|
@ -21,10 +21,10 @@ class Forum
|
||||||
public $category = 0;
|
public $category = 0;
|
||||||
public $type = 0;
|
public $type = 0;
|
||||||
public $icon = "";
|
public $icon = "";
|
||||||
public $firstPost = null;
|
private $_firstPost = null;
|
||||||
public $lastPost = null;
|
private $_lastPost = null;
|
||||||
public $forums = [];
|
private $_forums = [];
|
||||||
public $threads = [];
|
private $_threads = [];
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
public function __construct($forumId = 0)
|
public function __construct($forumId = 0)
|
||||||
|
@ -44,23 +44,13 @@ class Forum
|
||||||
} elseif ($forumId != 0) {
|
} elseif ($forumId != 0) {
|
||||||
$this->id = -1;
|
$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
|
// 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
|
// Get all rows with the category id set to the forum id
|
||||||
$forumRows = Database::fetch('forums', true, ['forum_category' => [$this->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']);
|
$forums[$forum['forum_id']] = new Forum($forum['forum_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->_forums = $forums;
|
||||||
|
} else {
|
||||||
|
$forums = $this->_forums;
|
||||||
|
}
|
||||||
|
|
||||||
// Return the forum objects
|
// Return the forum objects
|
||||||
return $forums;
|
return $forums;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Threads
|
// 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
|
// 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]);
|
$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]);
|
$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']);
|
$threads[$thread['topic_id']] = new Thread($thread['topic_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->_threads = $threads;
|
||||||
|
} else {
|
||||||
|
$threads = $this->_threads;
|
||||||
|
}
|
||||||
|
|
||||||
// Return the thread objects
|
// Return the thread objects
|
||||||
return $threads;
|
return $threads;
|
||||||
}
|
}
|
||||||
|
|
||||||
// First post
|
// First post
|
||||||
public function getFirstPost()
|
public function firstPost()
|
||||||
{
|
{
|
||||||
|
// Check if _firstPost is set
|
||||||
|
if ($this->_firstPost === null) {
|
||||||
// Get the row
|
// Get the row
|
||||||
$firstPost = Database::fetch('posts', false, ['forum_id' => [$this->id, '=']], ['post_id'], [1]);
|
$firstPost = Database::fetch('posts', false, ['forum_id' => [$this->id, '=']], ['post_id'], [1]);
|
||||||
|
|
||||||
// Create the post object
|
// Create the post object
|
||||||
$post = new Post(empty($firstPost) ? 0 : $firstPost['post_id']);
|
$post = new Post(empty($firstPost) ? 0 : $firstPost['post_id']);
|
||||||
|
|
||||||
|
// Assign it to a "cache" variable
|
||||||
|
$this->_firstPost = $post;
|
||||||
|
|
||||||
// Return the post object
|
// Return the post object
|
||||||
return $post;
|
return $post;
|
||||||
|
} else {
|
||||||
|
return $this->_firstPost;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last post
|
// Last post
|
||||||
public function getLastPost()
|
public function lastPost()
|
||||||
{
|
{
|
||||||
|
// Check if _lastPost is set
|
||||||
|
if ($this->_lastPost === null) {
|
||||||
// Get the row
|
// Get the row
|
||||||
$lastPost = Database::fetch('posts', false, ['forum_id' => [$this->id, '=']], ['post_id', true], [1]);
|
$lastPost = Database::fetch('posts', false, ['forum_id' => [$this->id, '=']], ['post_id', true], [1]);
|
||||||
|
|
||||||
// Create the post object
|
// Create the post object
|
||||||
$post = new Post(empty($lastPost) ? 0 : $lastPost['post_id']);
|
$post = new Post(empty($lastPost) ? 0 : $lastPost['post_id']);
|
||||||
|
|
||||||
|
// Assign it to a "cache" variable
|
||||||
|
$this->_lastPost = $post;
|
||||||
|
|
||||||
// Return the post object
|
// Return the post object
|
||||||
return $post;
|
return $post;
|
||||||
|
} else {
|
||||||
|
return $this->_lastPost;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thread count
|
// Thread count
|
||||||
|
@ -146,14 +164,14 @@ class Forum
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check forums
|
// Check forums
|
||||||
foreach ($this->forums as $forum) {
|
foreach ($this->forums() as $forum) {
|
||||||
if ($forum->unread($user)) {
|
if ($forum->unread($user)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check each thread
|
// Check each thread
|
||||||
foreach ($this->threads as $thread) {
|
foreach ($this->threads() as $thread) {
|
||||||
if ($thread->unread($user)) {
|
if ($thread->unread($user)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -167,13 +185,13 @@ class Forum
|
||||||
public function trackUpdateAll($user)
|
public function trackUpdateAll($user)
|
||||||
{
|
{
|
||||||
// Iterate over every forum
|
// Iterate over every forum
|
||||||
foreach ($this->forums as $forum) {
|
foreach ($this->forums() as $forum) {
|
||||||
// Update every forum
|
// Update every forum
|
||||||
$forum->trackUpdateAll($user);
|
$forum->trackUpdateAll($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterate over every thread
|
// Iterate over every thread
|
||||||
foreach ($this->threads as $thread) {
|
foreach ($this->threads() as $thread) {
|
||||||
// Update every thread
|
// Update every thread
|
||||||
$thread->trackUpdate($user);
|
$thread->trackUpdate($user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ class Thread
|
||||||
public $statusChange = 0;
|
public $statusChange = 0;
|
||||||
public $type = 0;
|
public $type = 0;
|
||||||
private $_posts = [];
|
private $_posts = [];
|
||||||
|
private $_firstPost = null;
|
||||||
|
private $_lastPost = null;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
public function __construct($threadId)
|
public function __construct($threadId)
|
||||||
|
@ -53,7 +55,6 @@ class Thread
|
||||||
{
|
{
|
||||||
// Check if _posts is something
|
// Check if _posts is something
|
||||||
if (!count($this->_posts)) {
|
if (!count($this->_posts)) {
|
||||||
|
|
||||||
// Get all rows with the thread id
|
// Get all rows with the thread id
|
||||||
$postRows = Database::fetch('posts', true, ['topic_id' => [$this->id, '=']]);
|
$postRows = Database::fetch('posts', true, ['topic_id' => [$this->id, '=']]);
|
||||||
|
|
||||||
|
@ -77,13 +78,43 @@ class Thread
|
||||||
// Get the opening post
|
// Get the opening post
|
||||||
public function firstPost()
|
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
|
// Get the last reply
|
||||||
public function lastPost()
|
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
|
// Reply count
|
||||||
|
@ -108,18 +139,13 @@ class Thread
|
||||||
public function unread($user)
|
public function unread($user)
|
||||||
{
|
{
|
||||||
// Attempt to get track row from the database
|
// 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 nothing was returned it's obvious that the status is unread
|
||||||
if (!$track) {
|
if (!$track) {
|
||||||
return true;
|
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
|
// Else just return false meaning everything is read
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,19 +14,6 @@ use PHPMailer;
|
||||||
*/
|
*/
|
||||||
class Main
|
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
|
// Parse markdown
|
||||||
public static function mdParse($text, $escape = false)
|
public static function mdParse($text, $escape = false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,6 +20,7 @@ class Template
|
||||||
private $template;
|
private $template;
|
||||||
private $templateName;
|
private $templateName;
|
||||||
private $templateOptions;
|
private $templateOptions;
|
||||||
|
protected $templateFileExtension = ".tpl";
|
||||||
|
|
||||||
// Initialise templating engine and data
|
// Initialise templating engine and data
|
||||||
public function __construct()
|
public function __construct()
|
||||||
|
@ -80,9 +81,9 @@ class Template
|
||||||
public function render($file)
|
public function render($file)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return $this->template->render($file, $this->vars);
|
return $this->template->render($file . $this->templateFileExtension, $this->vars);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
trigger_error($e->getMessage(), E_USER_ERROR);
|
return trigger_error($e->getMessage(), E_USER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,4 +22,4 @@ $template->setTemplate($templateName);
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/notfound.tpl');
|
echo $template->render('global/notfound');
|
||||||
|
|
|
@ -296,7 +296,7 @@ if (isset($_REQUEST['mode'])) {
|
||||||
$renderData['page']['redirect'];
|
$renderData['page']['redirect'];
|
||||||
} else {
|
} else {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ if (Users::checkLogin()) {
|
||||||
];
|
];
|
||||||
|
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,10 +348,10 @@ if (isset($_REQUEST['pw']) && $_REQUEST['pw']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
echo $template->render('main/forgotpassword.tpl');
|
echo $template->render('main/forgotpassword');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
echo $template->render('main/authenticate.tpl');
|
echo $template->render('main/authenticate');
|
||||||
|
|
|
@ -27,4 +27,4 @@ $template->setTemplate($templateName);
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('main/faq.tpl');
|
echo $template->render('main/faq');
|
||||||
|
|
|
@ -19,4 +19,4 @@ $template->setTemplate($templateName);
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('group/index.tpl');
|
echo $template->render('group/index');
|
||||||
|
|
|
@ -39,7 +39,7 @@ if (isset($_GET['p'])) {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('main/infopage.tpl');
|
echo $template->render('main/infopage');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,4 +75,4 @@ $renderData['stats'] = [
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render(($forumMode ? 'forum' : 'main') . '/index.tpl');
|
echo $template->render(($forumMode ? 'forum' : 'main') . '/index');
|
||||||
|
|
|
@ -86,4 +86,4 @@ $template->setTemplate($templateName);
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('pages/' . $category . '/' . $mode . '.tpl');
|
echo $template->render('pages/' . $category . '/' . $mode);
|
||||||
|
|
|
@ -45,11 +45,11 @@ if (Users::checkLogin()) {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('main/memberlist.tpl');
|
echo $template->render('main/memberlist');
|
||||||
} else {
|
} else {
|
||||||
// Set parse variables
|
// Set parse variables
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/restricted.tpl');
|
echo $template->render('global/restricted');
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,4 +135,4 @@ $template->setTemplate($templateName);
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('main/news.tpl');
|
echo $template->render('main/news');
|
||||||
|
|
|
@ -52,7 +52,7 @@ if ($mode != 'f') {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ if ($mode != 'f') {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ if ($mode != 'f') {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ if ($mode != 'f') {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
exit;
|
exit;
|
||||||
// Return to previous page
|
// Return to previous page
|
||||||
} else {
|
} else {
|
||||||
|
@ -159,7 +159,7 @@ if ($mode != 'f') {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/confirm.tpl');
|
echo $template->render('global/confirm');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ if (isset($_POST['post'])) {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -205,4 +205,4 @@ $renderData = array_merge($renderData, [
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('forum/posting.tpl');
|
echo $template->render('forum/posting');
|
||||||
|
|
|
@ -35,4 +35,4 @@ $renderData['profileView'] = isset($_GET['view']) && in_array($_GET['view'], $vi
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('main/profile.tpl');
|
echo $template->render('main/profile');
|
||||||
|
|
|
@ -19,4 +19,4 @@ $template->setTemplate($templateName);
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('main/report.tpl');
|
echo $template->render('main/report');
|
||||||
|
|
|
@ -24,4 +24,4 @@ $template->setTemplate($templateName);
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('main/search.tpl');
|
echo $template->render('main/search');
|
||||||
|
|
|
@ -276,7 +276,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
} elseif (isset($_REQUEST['friend-action']) && $_REQUEST['friend-action'] && Users::checkLogin()) {
|
} 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);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
} elseif (isset($_POST['submit']) && isset($_POST['submit'])) {
|
} elseif (isset($_POST['submit']) && isset($_POST['submit'])) {
|
||||||
|
@ -1036,7 +1036,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -1044,15 +1044,10 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
|
||||||
if (Users::checkLogin()) {
|
if (Users::checkLogin()) {
|
||||||
// Settings page list
|
// Settings page list
|
||||||
$pages = [
|
$pages = [
|
||||||
|
|
||||||
'general' => [
|
'general' => [
|
||||||
|
|
||||||
'title' => 'General',
|
'title' => 'General',
|
||||||
|
|
||||||
'modes' => [
|
'modes' => [
|
||||||
|
|
||||||
'home' => [
|
'home' => [
|
||||||
|
|
||||||
'title' => 'Home',
|
'title' => 'Home',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
|
@ -1062,317 +1057,200 @@ if (Users::checkLogin()) {
|
||||||
],
|
],
|
||||||
'access' => !$currentUser->checkPermission('SITE', 'DEACTIVATED'),
|
'access' => !$currentUser->checkPermission('SITE', 'DEACTIVATED'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'profile' => [
|
'profile' => [
|
||||||
|
|
||||||
'title' => 'Edit Profile',
|
'title' => 'Edit Profile',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'These are the external account links etc.
|
'These are the external account links etc.
|
||||||
on your profile, shouldn\'t need any additional explanation for this one.',
|
on your profile, shouldn\'t need any additional explanation for this one.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'ALTER_PROFILE'),
|
'access' => $currentUser->checkPermission('SITE', 'ALTER_PROFILE'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'options' => [
|
'options' => [
|
||||||
|
|
||||||
'title' => 'Site Options',
|
'title' => 'Site Options',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'These are a few personalisation options for the site while you\'re logged in.',
|
'These are a few personalisation options for the site while you\'re logged in.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => !$currentUser->checkPermission('SITE', 'DEACTIVATED'),
|
'access' => !$currentUser->checkPermission('SITE', 'DEACTIVATED'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
], /*,
|
|
||||||
'groups' => [
|
|
||||||
|
|
||||||
'title' => 'Groups',
|
|
||||||
'description' => [
|
|
||||||
|
|
||||||
'{{ user.colour }}'
|
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'JOIN_GROUPS'),
|
|
||||||
'menu' => true
|
|
||||||
|
|
||||||
]*/
|
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
'friends' => [
|
'friends' => [
|
||||||
|
|
||||||
'title' => 'Friends',
|
'title' => 'Friends',
|
||||||
|
|
||||||
'modes' => [
|
'modes' => [
|
||||||
|
|
||||||
'listing' => [
|
'listing' => [
|
||||||
|
|
||||||
'title' => 'Listing',
|
'title' => 'Listing',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'Manage your friends.',
|
'Manage your friends.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'MANAGE_FRIENDS'),
|
'access' => $currentUser->checkPermission('SITE', 'MANAGE_FRIENDS'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'requests' => [
|
'requests' => [
|
||||||
|
|
||||||
'title' => 'Requests',
|
'title' => 'Requests',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'Handle friend requests.',
|
'Handle friend requests.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'MANAGE_FRIENDS'),
|
'access' => $currentUser->checkPermission('SITE', 'MANAGE_FRIENDS'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
'messages' => [
|
'messages' => [
|
||||||
|
|
||||||
'title' => 'Messages',
|
'title' => 'Messages',
|
||||||
|
|
||||||
'modes' => [
|
'modes' => [
|
||||||
|
|
||||||
'inbox' => [
|
'inbox' => [
|
||||||
|
|
||||||
'title' => 'Inbox',
|
'title' => 'Inbox',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'The list of messages you\'ve received.',
|
'The list of messages you\'ve received.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'USE_MESSAGES'),
|
'access' => $currentUser->checkPermission('SITE', 'USE_MESSAGES'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'sent' => [
|
'sent' => [
|
||||||
|
|
||||||
'title' => 'Sent',
|
'title' => 'Sent',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'The list of messages you\'ve sent to other users.',
|
'The list of messages you\'ve sent to other users.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'USE_MESSAGES'),
|
'access' => $currentUser->checkPermission('SITE', 'USE_MESSAGES'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'compose' => [
|
'compose' => [
|
||||||
|
|
||||||
'title' => 'Compose',
|
'title' => 'Compose',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'Write a new message.',
|
'Write a new message.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'SEND_MESSAGES'),
|
'access' => $currentUser->checkPermission('SITE', 'SEND_MESSAGES'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'read' => [
|
'read' => [
|
||||||
|
|
||||||
'title' => 'Read',
|
'title' => 'Read',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'Read a message.',
|
'Read a message.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'USE_MESSAGES'),
|
'access' => $currentUser->checkPermission('SITE', 'USE_MESSAGES'),
|
||||||
'menu' => false,
|
'menu' => false,
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
'notifications' => [
|
'notifications' => [
|
||||||
|
|
||||||
'title' => 'Notifications',
|
'title' => 'Notifications',
|
||||||
|
|
||||||
'modes' => [
|
'modes' => [
|
||||||
|
|
||||||
'history' => [
|
'history' => [
|
||||||
|
|
||||||
'title' => 'History',
|
'title' => 'History',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'The history of notifications that have been sent to you in the last month.',
|
'The history of notifications that have been sent to you in the last month.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => !$currentUser->checkPermission('SITE', 'DEACTIVATED'),
|
'access' => !$currentUser->checkPermission('SITE', 'DEACTIVATED'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
'appearance' => [
|
'appearance' => [
|
||||||
|
|
||||||
'title' => 'Appearance',
|
'title' => 'Appearance',
|
||||||
|
|
||||||
'modes' => [
|
'modes' => [
|
||||||
|
|
||||||
'avatar' => [
|
'avatar' => [
|
||||||
|
|
||||||
'title' => 'Avatar',
|
'title' => 'Avatar',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'Your avatar which is displayed all over the site and on your profile.',
|
'Your avatar which is displayed all over the site and on your profile.',
|
||||||
'Maximum image size is {{ avatar.max_width }}x{{ avatar.max_height }},
|
'Maximum image size is {{ avatar.max_width }}x{{ avatar.max_height }},
|
||||||
minimum image size is {{ avatar.min_width }}x{{ avatar.min_height }},
|
minimum image size is {{ avatar.min_width }}x{{ avatar.min_height }},
|
||||||
maximum file size is {{ avatar.max_size_view }}.',
|
maximum file size is {{ avatar.max_size_view }}.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'CHANGE_AVATAR'),
|
'access' => $currentUser->checkPermission('SITE', 'CHANGE_AVATAR'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'background' => [
|
'background' => [
|
||||||
|
|
||||||
'title' => 'Background',
|
'title' => 'Background',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'The background that is displayed on your profile.',
|
'The background that is displayed on your profile.',
|
||||||
'Maximum image size is {{ background.max_width }}x{{ background.max_height }},
|
'Maximum image size is {{ background.max_width }}x{{ background.max_height }},
|
||||||
minimum image size is {{ background.min_width }}x{{ background.min_height }},
|
minimum image size is {{ background.min_width }}x{{ background.min_height }},
|
||||||
maximum file size is {{ background.max_size_view }}.',
|
maximum file size is {{ background.max_size_view }}.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => (
|
'access' => (
|
||||||
isset($currentUser->userData()['profileBackground'])
|
isset($currentUser->userData()['profileBackground'])
|
||||||
&& $currentUser->checkPermission('SITE', 'CHANGE_BACKGROUND')
|
&& $currentUser->checkPermission('SITE', 'CHANGE_BACKGROUND')
|
||||||
) || $currentUser->checkPermission('SITE', 'CREATE_BACKGROUND'),
|
) || $currentUser->checkPermission('SITE', 'CREATE_BACKGROUND'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'userpage' => [
|
'userpage' => [
|
||||||
|
|
||||||
'title' => 'Userpage',
|
'title' => 'Userpage',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'The custom text that is displayed on your profile.',
|
'The custom text that is displayed on your profile.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => (
|
'access' => (
|
||||||
isset($currentUser->userData()['userPage'])
|
isset($currentUser->userData()['userPage'])
|
||||||
&& $currentUser->checkPermission('SITE', 'CHANGE_USERPAGE')
|
&& $currentUser->checkPermission('SITE', 'CHANGE_USERPAGE')
|
||||||
) || $currentUser->checkPermission('SITE', 'CREATE_USERPAGE'),
|
) || $currentUser->checkPermission('SITE', 'CREATE_USERPAGE'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'signature' => [
|
'signature' => [
|
||||||
|
|
||||||
'title' => 'Signature',
|
'title' => 'Signature',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'This signature is displayed at the end of all your posts (unless you choose not to show it).',
|
'This signature is displayed at the end of all your posts (unless you choose not to show it).',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'CHANGE_SIGNATURE'),
|
'access' => $currentUser->checkPermission('SITE', 'CHANGE_SIGNATURE'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
'account' => [
|
'account' => [
|
||||||
|
|
||||||
'title' => 'Account',
|
'title' => 'Account',
|
||||||
|
|
||||||
'modes' => [
|
'modes' => [
|
||||||
|
|
||||||
'email' => [
|
'email' => [
|
||||||
|
|
||||||
'title' => 'E-mail Address',
|
'title' => 'E-mail Address',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'You e-mail address is used for password recovery and stuff like that, we won\'t spam you ;).',
|
'You e-mail address is used for password recovery and stuff like that, we won\'t spam you ;).',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'CHANGE_EMAIL'),
|
'access' => $currentUser->checkPermission('SITE', 'CHANGE_EMAIL'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'username' => [
|
'username' => [
|
||||||
|
|
||||||
'title' => 'Username',
|
'title' => 'Username',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'Probably the biggest part of your identity on a site.',
|
'Probably the biggest part of your identity on a site.',
|
||||||
'<b>You can only change this once every 30 days so choose wisely.</b>',
|
'<b>You can only change this once every 30 days so choose wisely.</b>',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'CHANGE_USERNAME'),
|
'access' => $currentUser->checkPermission('SITE', 'CHANGE_USERNAME'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'usertitle' => [
|
'usertitle' => [
|
||||||
|
|
||||||
'title' => 'Usertitle',
|
'title' => 'Usertitle',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'That little piece of text displayed under your username on your profile.',
|
'That little piece of text displayed under your username on your profile.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'CHANGE_USERTITLE'),
|
'access' => $currentUser->checkPermission('SITE', 'CHANGE_USERTITLE'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'password' => [
|
'password' => [
|
||||||
|
|
||||||
'title' => 'Password',
|
'title' => 'Password',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'Used to authenticate with the site and certain related services.',
|
'Used to authenticate with the site and certain related services.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'CHANGE_PASSWORD'),
|
'access' => $currentUser->checkPermission('SITE', 'CHANGE_PASSWORD'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'ranks' => [
|
'ranks' => [
|
||||||
|
|
||||||
'title' => 'Ranks',
|
'title' => 'Ranks',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'Manage what ranks you\'re in and what is set as your main rank.
|
'Manage what ranks you\'re in and what is set as your main rank.
|
||||||
Your main rank is highlighted.
|
Your main rank is highlighted.
|
||||||
You get the permissions of all of the ranks you\'re in combined.',
|
You get the permissions of all of the ranks you\'re in combined.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'ALTER_RANKS'),
|
'access' => $currentUser->checkPermission('SITE', 'ALTER_RANKS'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
'advanced' => [
|
'advanced' => [
|
||||||
|
|
||||||
'title' => 'Advanced',
|
'title' => 'Advanced',
|
||||||
|
|
||||||
'modes' => [
|
'modes' => [
|
||||||
|
|
||||||
'sessions' => [
|
'sessions' => [
|
||||||
|
|
||||||
'title' => 'Sessions',
|
'title' => 'Sessions',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'Session keys are a way of identifying yourself with the system without keeping
|
'Session keys are a way of identifying yourself with the system without keeping
|
||||||
your password in memory.',
|
your password in memory.',
|
||||||
'If someone finds one of your session keys they could possibly compromise your account,
|
'If someone finds one of your session keys they could possibly compromise your account,
|
||||||
|
@ -1380,43 +1258,30 @@ if (Users::checkLogin()) {
|
||||||
selected session.',
|
selected session.',
|
||||||
'If you get logged out after clicking one you\'ve most likely killed your current 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.',
|
to make it easier to avoid this from happening your current session is highlighted.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'MANAGE_SESSIONS'),
|
'access' => $currentUser->checkPermission('SITE', 'MANAGE_SESSIONS'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'registrationkeys' => [
|
'registrationkeys' => [
|
||||||
|
|
||||||
'title' => 'Registration Keys',
|
'title' => 'Registration Keys',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'Sometimes we activate the registration key system which means that users can only
|
'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.',
|
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.',
|
'Each user can generate 5 of these keys, bans and deactivates render these keys useless.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'CREATE_REGKEYS'),
|
'access' => $currentUser->checkPermission('SITE', 'CREATE_REGKEYS'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
'deactivate' => [
|
'deactivate' => [
|
||||||
|
|
||||||
'title' => 'Deactivate Account',
|
'title' => 'Deactivate Account',
|
||||||
'description' => [
|
'description' => [
|
||||||
|
|
||||||
'You can deactivate your account here if you want to leave :(.',
|
'You can deactivate your account here if you want to leave :(.',
|
||||||
|
|
||||||
],
|
],
|
||||||
'access' => $currentUser->checkPermission('SITE', 'DEACTIVATE_ACCOUNT'),
|
'access' => $currentUser->checkPermission('SITE', 'DEACTIVATE_ACCOUNT'),
|
||||||
'menu' => true,
|
'menu' => true,
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Current settings page
|
// Current settings page
|
||||||
|
@ -1444,7 +1309,7 @@ if (Users::checkLogin()) {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/notfound.tpl');
|
echo $template->render('global/notfound');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1534,11 +1399,11 @@ if (Users::checkLogin()) {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('main/settings.tpl');
|
echo $template->render('main/settings');
|
||||||
} else {
|
} else {
|
||||||
// If not allowed print the restricted page
|
// If not allowed print the restricted page
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/restricted.tpl');
|
echo $template->render('global/restricted');
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ if (isset($_REQUEST['mode'])
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('main/premiumcomplete.tpl');
|
echo $template->render('main/premiumcomplete');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -148,7 +148,7 @@ if (isset($_GET['tracker'])) {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('main/supporttracker.tpl');
|
echo $template->render('main/supporttracker');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,4 +166,4 @@ $renderData['page'] = [
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('main/support.tpl');
|
echo $template->render('main/support');
|
||||||
|
|
|
@ -30,7 +30,7 @@ if ($forum->id < 0) {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ if ($forum->type === 2) {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ if (isset($_GET['read']) && $_GET['read'] && isset($_GET['session']) && $_GET['s
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,4 +83,4 @@ $renderData['forum'] = $forum;
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('forum/viewforum.tpl');
|
echo $template->render('forum/viewforum');
|
||||||
|
|
|
@ -36,7 +36,7 @@ if (!$thread) {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,4 +56,4 @@ $renderData = array_merge($renderData, [
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('forum/viewtopic.tpl');
|
echo $template->render('forum/viewtopic');
|
||||||
|
|
31
sakura.php
31
sakura.php
|
@ -8,7 +8,7 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Define Sakura version
|
// Define Sakura version
|
||||||
define('SAKURA_VERSION', '20151209');
|
define('SAKURA_VERSION', '20151210');
|
||||||
define('SAKURA_VLABEL', 'Eminence');
|
define('SAKURA_VLABEL', 'Eminence');
|
||||||
define('SAKURA_COLOUR', '#6C3082');
|
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
|
// Stop the execution if the PHP Version is older than 5.4.0
|
||||||
if (version_compare(phpversion(), '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
|
// Include third-party libraries
|
||||||
if (!@include_once ROOT . 'vendor/autoload.php') {
|
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
|
// Include components
|
||||||
|
@ -66,12 +66,18 @@ foreach (glob(ROOT . 'libraries/DBWrapper/*.php') as $driver) {
|
||||||
// Set Error handler
|
// Set Error handler
|
||||||
set_error_handler(['Sakura\Main', 'errorHandler']);
|
set_error_handler(['Sakura\Main', 'errorHandler']);
|
||||||
|
|
||||||
// Initialise Main Class
|
// Load the local configuration
|
||||||
Main::init(ROOT . 'config/config.ini');
|
Config::init(ROOT . 'config/config.ini');
|
||||||
|
|
||||||
// Change error reporting according to the dev configuration
|
// Change error reporting according to the dev configuration
|
||||||
error_reporting(Config::local('dev', 'enable') ? -1 : 0);
|
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
|
// Assign servers file to whois class
|
||||||
Whois::setServers(ROOT . Config::local('data', 'whoisservers'));
|
Whois::setServers(ROOT . Config::local('data', 'whoisservers'));
|
||||||
|
|
||||||
|
@ -87,14 +93,7 @@ if (Config::get('no_cron_service')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update last execution time
|
// Update last execution time
|
||||||
Database::update('config', [
|
Database::update('config', [['config_value' => time()], ['config_name' => ['no_cron_last', '=']]]);
|
||||||
[
|
|
||||||
'config_value' => time(),
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'config_name' => ['no_cron_last', '='],
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,12 +204,12 @@ if (!defined('SAKURA_NO_TPL')) {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('global/information.tpl');
|
echo $template->render('global/information');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ban checking
|
// 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
|
// Additional render data
|
||||||
$renderData = array_merge($renderData, [
|
$renderData = array_merge($renderData, [
|
||||||
'ban' => [
|
'ban' => [
|
||||||
|
@ -231,7 +230,7 @@ if (!defined('SAKURA_NO_TPL')) {
|
||||||
$template->setVariables($renderData);
|
$template->setVariables($renderData);
|
||||||
|
|
||||||
// Print page contents
|
// Print page contents
|
||||||
echo $template->render('main/banned.tpl');
|
echo $template->render('main/banned');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
<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>
|
</ul>
|
||||||
</div>
|
</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">
|
<div id="content">
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="platform">
|
<div class="platform">
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="content homepage forum viewtopic">
|
<div class="content homepage forum viewtopic">
|
||||||
<div class="content-column">
|
<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' %}
|
{% include 'forum/forumBtns.tpl' %}
|
||||||
<table class="posts">
|
<table class="posts">
|
||||||
{% for post in posts[get.page|default(1) - 1] %}
|
{% for post in posts[get.page|default(1) - 1] %}
|
||||||
|
|
Reference in a new issue