diff --git a/libraries/Bans.php b/libraries/Bans.php
deleted file mode 100644
index 436e13d..0000000
--- a/libraries/Bans.php
+++ /dev/null
@@ -1,60 +0,0 @@
-
- */
-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;
- }
-}
diff --git a/libraries/Comment.php b/libraries/Comment.php
index 89396bf..0a8ad3d 100644
--- a/libraries/Comment.php
+++ b/libraries/Comment.php
@@ -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);
diff --git a/libraries/Controllers/CommentsController.php b/libraries/Controllers/CommentsController.php
new file mode 100644
index 0000000..eec2ad8
--- /dev/null
+++ b/libraries/Controllers/CommentsController.php
@@ -0,0 +1,38 @@
+
+ */
+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();
+ }
+}
diff --git a/libraries/Controllers/FileController.php b/libraries/Controllers/FileController.php
index c4617b3..0a80162 100644
--- a/libraries/Controllers/FileController.php
+++ b/libraries/Controllers/FileController.php
@@ -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']);
diff --git a/libraries/Controllers/ForumController.php b/libraries/Controllers/ForumController.php
index 63d59e9..52a69ae 100644
--- a/libraries/Controllers/ForumController.php
+++ b/libraries/Controllers/ForumController.php
@@ -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');
}
/**
diff --git a/libraries/Controllers/MetaController.php b/libraries/Controllers/MetaController.php
index 98f7487..d2b3fa3 100644
--- a/libraries/Controllers/MetaController.php
+++ b/libraries/Controllers/MetaController.php
@@ -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');
}
}
diff --git a/libraries/Controllers/NewsController.php b/libraries/Controllers/NewsController.php
new file mode 100644
index 0000000..e16f7dc
--- /dev/null
+++ b/libraries/Controllers/NewsController.php
@@ -0,0 +1,64 @@
+
+ */
+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');
+ }
+}
diff --git a/libraries/Controllers/NotificationsController.php b/libraries/Controllers/NotificationsController.php
new file mode 100644
index 0000000..ea430ee
--- /dev/null
+++ b/libraries/Controllers/NotificationsController.php
@@ -0,0 +1,71 @@
+
+ */
+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';
+ }
+}
diff --git a/libraries/Controllers/PremiumController.php b/libraries/Controllers/PremiumController.php
index ba886df..124501f 100644
--- a/libraries/Controllers/PremiumController.php
+++ b/libraries/Controllers/PremiumController.php
@@ -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');
}
}
diff --git a/libraries/Controllers/UserController.php b/libraries/Controllers/UserController.php
index 57bc04f..02c7eaa 100644
--- a/libraries/Controllers/UserController.php
+++ b/libraries/Controllers/UserController.php
@@ -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');
}
}
diff --git a/libraries/News.php b/libraries/News.php
deleted file mode 100644
index ce5d601..0000000
--- a/libraries/News.php
+++ /dev/null
@@ -1,76 +0,0 @@
-
- */
-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;
- }
-}
diff --git a/libraries/News/Category.php b/libraries/News/Category.php
index 66ce400..dafa3dc 100644
--- a/libraries/News/Category.php
+++ b/libraries/News/Category.php
@@ -1 +1,46 @@
-donderdag
+
+ */
+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;
+ }
+}
diff --git a/libraries/News/Post.php b/libraries/News/Post.php
index 746397b..3958d8b 100644
--- a/libraries/News/Post.php
+++ b/libraries/News/Post.php
@@ -1 +1,117 @@
-vrijdag
+
+ */
+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;
+ }
+}
diff --git a/libraries/Notification.php b/libraries/Notification.php
index 15aca3f..68d0387 100644
--- a/libraries/Notification.php
+++ b/libraries/Notification.php
@@ -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
diff --git a/libraries/Template.php b/libraries/Template.php
index e11d177..cefbada 100644
--- a/libraries/Template.php
+++ b/libraries/Template.php
@@ -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;
diff --git a/libraries/User.php b/libraries/User.php
index 47c2fd5..773b5cd 100644
--- a/libraries/User.php
+++ b/libraries/User.php
@@ -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;
}
/**
diff --git a/public/settings.php b/public/settings.php
index 3975d00..afc8cb6 100644
--- a/public/settings.php
+++ b/public/settings.php
@@ -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);
diff --git a/routes.php b/routes.php
index 3f95bfb..e60955b 100644
--- a/routes.php
+++ b/routes.php
@@ -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
/*
diff --git a/sakura.php b/sakura.php
index 4fe1eb8..4b794fd 100644
--- a/sakura.php
+++ b/sakura.php
@@ -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;
- }
}
diff --git a/templates/misaki/main/profile.twig b/templates/misaki/main/profile.twig
index 05d62a2..414a18d 100644
--- a/templates/misaki/main/profile.twig
+++ b/templates/misaki/main/profile.twig
@@ -145,8 +145,6 @@
Account Standing
{% if profileHidden %}
Unknown
- {% elseif profile.checkBan %}
- Banned
{% elseif profile.permission(constant('Sakura\\Perms\\Site::RESTRICTED')) %}
Restricted
{% else %}
diff --git a/templates/yuuno/elements/comment.twig b/templates/yuuno/elements/comment.twig
index 5fd1a9e..8b12986 100644
--- a/templates/yuuno/elements/comment.twig
+++ b/templates/yuuno/elements/comment.twig
@@ -1,28 +1,28 @@
-
- {% if comment.comment_poster.id == user.id %} -
+ {% if comment.userData.id == user.id %}
+
{% else %}
-
+
{% endif %}
-
- - {{ comment.comment_likes }}
- - {{ comment.comment_dislikes }}
+
+ - {{ comment.upvotes }}
+ - {{ comment.downvotes }}