From ee0fa1906cf7064e8956a6721bbb66eec804574e Mon Sep 17 00:00:00 2001 From: flashwave Date: Sun, 14 Feb 2016 23:46:07 +0100 Subject: [PATCH] r20160214 --- libraries/Controllers/Auth.php | 2 +- libraries/Controllers/Forums.php | 4 ++-- libraries/Controllers/Meta.php | 10 +++++----- libraries/Controllers/Premium.php | 4 ++-- libraries/Controllers/User.php | 8 ++++---- libraries/Router.php | 2 +- routes.php | 30 ++++++++++++++-------------- sakura.php | 2 +- templates/yuuno/main/memberlist.twig | 3 +-- 9 files changed, 32 insertions(+), 33 deletions(-) diff --git a/libraries/Controllers/Auth.php b/libraries/Controllers/Auth.php index f5f1c09..7b8bd65 100644 --- a/libraries/Controllers/Auth.php +++ b/libraries/Controllers/Auth.php @@ -17,7 +17,7 @@ use Sakura\Template; */ class Auth { - public static function login() + public function login() { return Template::render('main/login'); } diff --git a/libraries/Controllers/Forums.php b/libraries/Controllers/Forums.php index 049c5d3..8836103 100644 --- a/libraries/Controllers/Forums.php +++ b/libraries/Controllers/Forums.php @@ -29,7 +29,7 @@ class Forums * * @return mixed HTML for the forum index. */ - public static function index() + public function index() { // Merge index specific stuff with the global render data Template::vars([ @@ -51,7 +51,7 @@ class Forums return Template::render('forum/index'); } - public static function forum($id = 0) + public function forum($id = 0) { global $currentUser; diff --git a/libraries/Controllers/Meta.php b/libraries/Controllers/Meta.php index 14512ef..31e05f8 100644 --- a/libraries/Controllers/Meta.php +++ b/libraries/Controllers/Meta.php @@ -28,7 +28,7 @@ class Meta * * @return mixed HTML for the index. */ - public static function index() + public function index() { // Merge index specific stuff with the global render data Template::vars([ @@ -56,7 +56,7 @@ class Meta * * @return mixed HTML for the correct news section. */ - public static function news() + public function news() { // Get arguments $args = func_get_args(); @@ -85,7 +85,7 @@ class Meta * * @return mixed HTML for the FAQ. */ - public static function faq() + public function faq() { // Set parse variables Template::vars([ @@ -106,7 +106,7 @@ class Meta * * @return mixed HTML for the info page. */ - public static function infoPage($id = null) + public function infoPage($id = null) { // Set default variables $renderData['page'] = [ @@ -138,7 +138,7 @@ class Meta * * @return mixed HTML for the search page. */ - public static function search() + public function search() { // Set parse variables Template::vars([ diff --git a/libraries/Controllers/Premium.php b/libraries/Controllers/Premium.php index 22ef76f..43aed3e 100644 --- a/libraries/Controllers/Premium.php +++ b/libraries/Controllers/Premium.php @@ -25,7 +25,7 @@ use Sakura\Perms\Site; */ class Premium { - public static function index() + public function index() { global $currentUser, $urls; @@ -155,7 +155,7 @@ class Premium return Template::render('main/support'); } - public static function tracker() + public function tracker() { // Set parse variables Template::vars([ diff --git a/libraries/Controllers/User.php b/libraries/Controllers/User.php index 6e02f7d..4521ac6 100644 --- a/libraries/Controllers/User.php +++ b/libraries/Controllers/User.php @@ -29,7 +29,7 @@ class User * * @return bool|string The profile page. */ - public static function profile($id = 0) + public function profile($id = 0) { global $currentUser; @@ -93,7 +93,7 @@ class User * * @return bool|string The memberlist. */ - public static function members($rank = 0) + public function members($rank = 0) { global $currentUser; @@ -106,8 +106,8 @@ class User Template::vars([ 'memberlist' => [ 'ranks' => ($_MEMBERLIST_RANKS = \Sakura\Users::getAllRanks()), - 'active' => ($_MEMBERLIST_ACTIVE = (array_key_exists($rank, $_MEMBERLIST_RANKS) ? $rank : 0)), - 'users' => ($_MEMBERLIST_ACTIVE ? Rank::construct($_MEMBERLIST_ACTIVE)->users() : \Sakura\Users::getAllUsers(false)), + 'active' => ($_MEMBERLIST_ACTIVE = (array_key_exists($rank, $_MEMBERLIST_RANKS) ? $rank : 2)), + 'users' => Rank::construct($_MEMBERLIST_ACTIVE)->users(), 'membersPerPage' => Config::get('members_per_page'), ] ]); diff --git a/libraries/Router.php b/libraries/Router.php index 4bcda5e..2921572 100644 --- a/libraries/Router.php +++ b/libraries/Router.php @@ -67,7 +67,7 @@ class Router // Check if the method exists if (in_array($name = strtoupper($name), self::$methods)) { $path = isset($args[2]) && $args !== null ? [$args[0], $args[2]] : $args[0]; - $handler = is_callable($args[1]) || is_array($args[1]) ? $args[1] : explode('@', $args[1]); + $handler = is_callable($args[1]) || is_array($args[1]) ? $args[1] : explode('@', ('Sakura\Controllers\\' . $args[1])); $filter = isset($args[3]) ? $args[3] : []; self::$router->addRoute($name, $path, $handler, $filter); diff --git a/routes.php b/routes.php index 375d55c..f24dcb8 100644 --- a/routes.php +++ b/routes.php @@ -7,33 +7,33 @@ namespace Sakura; // Meta pages -Router::get('/', 'Sakura\Controllers\Meta@index', 'main.index'); -Router::get('/faq', 'Sakura\Controllers\Meta@faq', 'main.faq'); -Router::get('/search', 'Sakura\Controllers\Meta@search', 'main.search'); -Router::get('/p/{id}', 'Sakura\Controllers\Meta@infoPage', 'main.infopage'); +Router::get('/', 'Meta@index', 'main.index'); +Router::get('/faq', 'Meta@faq', 'main.faq'); +Router::get('/search', 'Meta@search', 'main.search'); +Router::get('/p/{id}', 'Meta@infoPage', 'main.infopage'); // Auth -Router::get('/login', 'Sakura\Controllers\Auth@login', 'auth.login'); +Router::get('/login', 'Auth@login', 'auth.login'); // News -Router::get('/news', 'Sakura\Controllers\Meta@news', 'news.index'); -Router::get('/news/{category}', 'Sakura\Controllers\Meta@news', 'news.category'); -Router::get('/news/{category}/{id}', 'Sakura\Controllers\Meta@news', 'news.post'); +Router::get('/news', 'Meta@news', 'news.index'); +Router::get('/news/{category}', 'Meta@news', 'news.category'); +Router::get('/news/{category}/{id}', 'Meta@news', 'news.post'); // Forum -Router::get('/forum', 'Sakura\Controllers\Forums@index', 'forums.index'); -Router::get('/forum/{id}', 'Sakura\Controllers\Forums@forum', 'forums.forum'); +Router::get('/forum', 'Forums@index', 'forums.index'); +Router::get('/forum/{id}', 'Forums@forum', 'forums.forum'); // Members -Router::get('/members', 'Sakura\Controllers\User@members', 'members.all'); -Router::get('/members/{rank}', 'Sakura\Controllers\User@members', 'members.rank'); +Router::get('/members', 'User@members', 'members.all'); +Router::get('/members/{rank}', 'User@members', 'members.rank'); // User -Router::get('/u/{id}', 'Sakura\Controllers\User@profile', 'user.profile'); +Router::get('/u/{id}', 'User@profile', 'user.profile'); // Premium -Router::get('/support', 'Sakura\Controllers\Premium@index', 'premium.index'); -Router::get('/support/tracker', 'Sakura\Controllers\Premium@tracker', 'premium.tracker'); +Router::get('/support', 'Premium@index', 'premium.index'); +Router::get('/support/tracker', 'Premium@tracker', 'premium.tracker'); // Redirections Router::any('/index.php', function () { diff --git a/sakura.php b/sakura.php index 9c6e069..8c2ccce 100644 --- a/sakura.php +++ b/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20160213'); +define('SAKURA_VERSION', '20160214'); define('SAKURA_VLABEL', 'Amethyst'); define('SAKURA_COLOUR', '#9966CC'); diff --git a/templates/yuuno/main/memberlist.twig b/templates/yuuno/main/memberlist.twig index cce42d2..9078213 100644 --- a/templates/yuuno/main/memberlist.twig +++ b/templates/yuuno/main/memberlist.twig @@ -31,10 +31,9 @@