diff --git a/resources/views/yuuno/group/index.twig b/resources/views/yuuno/group/index.twig deleted file mode 100644 index fc530f2..0000000 --- a/resources/views/yuuno/group/index.twig +++ /dev/null @@ -1 +0,0 @@ -{% extends 'master.twig' %} diff --git a/resources/views/yuuno/settings/account/profile.twig b/resources/views/yuuno/settings/account/profile.twig index 1a1ef09..892a39a 100644 --- a/resources/views/yuuno/settings/account/profile.twig +++ b/resources/views/yuuno/settings/account/profile.twig @@ -113,21 +113,21 @@
Day: Month: Year:
diff --git a/routes.php b/routes.php index 990c01a..6e4e149 100644 --- a/routes.php +++ b/routes.php @@ -9,7 +9,7 @@ namespace Sakura; use Phroute\Phroute\Exception\HttpRouteNotFoundException; // Maintenance check -Routerv1::filter('maintenance', function () { +Router::filter('maintenance', function () { if (config('general.maintenance')) { CurrentSession::stop(); http_response_code(503); @@ -17,30 +17,30 @@ Routerv1::filter('maintenance', function () { } }); -Routerv1::group(['before' => 'maintenance'], function () { +Router::group(['before' => 'maintenance'], function () { // Meta pages - Routerv1::get('/', 'MetaController@index', 'main.index'); - Routerv1::get('/faq', 'MetaController@faq', 'main.faq'); - Routerv1::get('/search', 'MetaController@search', 'main.search'); + Router::get('/', 'MetaController@index', 'main.index'); + Router::get('/faq', 'MetaController@faq', 'main.faq'); + Router::get('/search', 'MetaController@search', 'main.search'); // Auth - Routerv1::get('/login', 'AuthController@login', 'auth.login'); - Routerv1::post('/login', 'AuthController@login', 'auth.login'); - Routerv1::get('/register', 'AuthController@register', 'auth.register'); - Routerv1::post('/register', 'AuthController@register', 'auth.register'); - Routerv1::get('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword'); - Routerv1::post('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword'); - Routerv1::get('/reactivate', 'AuthController@reactivate', 'auth.reactivate'); - Routerv1::post('/reactivate', 'AuthController@reactivate', 'auth.reactivate'); - Routerv1::get('/activate', 'AuthController@activate', 'auth.activate'); - Routerv1::get('/logout', 'AuthController@logout', 'auth.logout'); - Routerv1::post('/logout', 'AuthController@logout', 'auth.logout'); + Router::get('/login', 'AuthController@login', 'auth.login'); + Router::post('/login', 'AuthController@login', 'auth.login'); + Router::get('/register', 'AuthController@register', 'auth.register'); + Router::post('/register', 'AuthController@register', 'auth.register'); + Router::get('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword'); + Router::post('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword'); + Router::get('/reactivate', 'AuthController@reactivate', 'auth.reactivate'); + Router::post('/reactivate', 'AuthController@reactivate', 'auth.reactivate'); + Router::get('/activate', 'AuthController@activate', 'auth.activate'); + Router::get('/logout', 'AuthController@logout', 'auth.logout'); + Router::post('/logout', 'AuthController@logout', 'auth.logout'); // Link compatibility layer, prolly remove this in like a year - Routerv1::get('/r/{id}', function ($id) { + Router::get('/r/{id}', function ($id) { redirect("/p/{$id}"); }); - Routerv1::get('/p/{id}', function ($id) { + Router::get('/p/{id}', function ($id) { $resolve = [ 'terms' => 'info.terms', 'contact' => 'info.contact', @@ -68,199 +68,199 @@ Routerv1::group(['before' => 'maintenance'], function () { }); // Info - Routerv1::group(['prefix' => 'info'], function () { - Routerv1::get('/terms', 'InfoController@terms', 'info.terms'); - Routerv1::get('/privacy', 'InfoController@privacy', 'info.privacy'); - Routerv1::get('/contact', 'InfoController@contact', 'info.contact'); - Routerv1::get('/rules', 'InfoController@rules', 'info.rules'); - Routerv1::get('/welcome', 'InfoController@welcome', 'info.welcome'); + Router::group(['prefix' => 'info'], function () { + Router::get('/terms', 'InfoController@terms', 'info.terms'); + Router::get('/privacy', 'InfoController@privacy', 'info.privacy'); + Router::get('/contact', 'InfoController@contact', 'info.contact'); + Router::get('/rules', 'InfoController@rules', 'info.rules'); + Router::get('/welcome', 'InfoController@welcome', 'info.welcome'); }); // Status - Routerv1::group(['prefix' => 'status'], function () { - Routerv1::get('/', 'StatusController@index', 'status.index'); + Router::group(['prefix' => 'status'], function () { + Router::get('/', 'StatusController@index', 'status.index'); }); // News - Routerv1::group(['prefix' => 'news'], function () { - Routerv1::get('/{category:c}?', 'NewsController@category', 'news.category'); - Routerv1::get('/post/{id:i}', 'NewsController@post', 'news.post'); + Router::group(['prefix' => 'news'], function () { + Router::get('/{category:c}?', 'NewsController@category', 'news.category'); + Router::get('/post/{id:i}', 'NewsController@post', 'news.post'); }); // Chat - Routerv1::group(['prefix' => 'chat'], function () { - Routerv1::get('/redirect', 'ChatController@redirect', 'chat.redirect'); - Routerv1::get('/settings', 'ChatController@settings', 'chat.settings'); - Routerv1::get('/auth', 'ChatController@auth', 'chat.auth'); - Routerv1::get('/resolve', 'ChatController@resolve', 'chat.resolve'); - Routerv1::get('/irc', 'ChatController@irc', 'chat.irc'); + Router::group(['prefix' => 'chat'], function () { + Router::get('/redirect', 'ChatController@redirect', 'chat.redirect'); + Router::get('/settings', 'ChatController@settings', 'chat.settings'); + Router::get('/auth', 'ChatController@auth', 'chat.auth'); + Router::get('/resolve', 'ChatController@resolve', 'chat.resolve'); + Router::get('/irc', 'ChatController@irc', 'chat.irc'); }); // Authentication for the "old" chat - Routerv1::get('/web/sock-auth.php', 'ChatController@authLegacy'); + Router::get('/web/sock-auth.php', 'ChatController@authLegacy'); // Forum - Routerv1::group(['prefix' => 'forum'], function () { + Router::group(['prefix' => 'forum'], function () { // Post - Routerv1::group(['prefix' => 'post'], function () { - Routerv1::get('/{id:i}', 'Forum.PostController@find', 'forums.post'); - Routerv1::delete('/{id:i}', 'Forum.PostController@delete', 'forums.post.delete'); - Routerv1::get('/{id:i}/raw', 'Forum.PostController@raw', 'forums.post.raw'); - Routerv1::post('/{id:i}/edit', 'Forum.PostController@edit', 'forums.post.edit'); + Router::group(['prefix' => 'post'], function () { + Router::get('/{id:i}', 'Forum.PostController@find', 'forums.post'); + Router::delete('/{id:i}', 'Forum.PostController@delete', 'forums.post.delete'); + Router::get('/{id:i}/raw', 'Forum.PostController@raw', 'forums.post.raw'); + Router::post('/{id:i}/edit', 'Forum.PostController@edit', 'forums.post.edit'); }); // Topic - Routerv1::group(['prefix' => 'topic'], function () { - Routerv1::get('/{id:i}', 'Forum.TopicController@view', 'forums.topic'); - Routerv1::get('/{id:i}/sticky', 'Forum.TopicController@sticky', 'forums.topic.sticky'); - Routerv1::get('/{id:i}/announce', 'Forum.TopicController@announce', 'forums.topic.announce'); - Routerv1::get('/{id:i}/lock', 'Forum.TopicController@lock', 'forums.topic.lock'); - Routerv1::get('/{id:i}/delete', 'Forum.TopicController@delete', 'forums.topic.delete'); - Routerv1::get('/{id:i}/restore', 'Forum.TopicController@restore', 'forums.topic.restore'); - Routerv1::get('/{id:i}/move', 'Forum.TopicController@move', 'forums.topic.move'); - Routerv1::post('/{id:i}/reply', 'Forum.TopicController@reply', 'forums.topic.reply'); + Router::group(['prefix' => 'topic'], function () { + Router::get('/{id:i}', 'Forum.TopicController@view', 'forums.topic'); + Router::get('/{id:i}/sticky', 'Forum.TopicController@sticky', 'forums.topic.sticky'); + Router::get('/{id:i}/announce', 'Forum.TopicController@announce', 'forums.topic.announce'); + Router::get('/{id:i}/lock', 'Forum.TopicController@lock', 'forums.topic.lock'); + Router::get('/{id:i}/delete', 'Forum.TopicController@delete', 'forums.topic.delete'); + Router::get('/{id:i}/restore', 'Forum.TopicController@restore', 'forums.topic.restore'); + Router::get('/{id:i}/move', 'Forum.TopicController@move', 'forums.topic.move'); + Router::post('/{id:i}/reply', 'Forum.TopicController@reply', 'forums.topic.reply'); }); // Forum - Routerv1::get('/', 'Forum.ForumController@index', 'forums.index'); - Routerv1::get('/{id:i}', 'Forum.ForumController@forum', 'forums.forum'); - Routerv1::get('/{id:i}/mark', 'Forum.ForumController@markRead', 'forums.mark'); - Routerv1::get('/{id:i}/new', 'Forum.TopicController@create', 'forums.new'); - Routerv1::post('/{id:i}/new', 'Forum.TopicController@create', 'forums.new'); + Router::get('/', 'Forum.ForumController@index', 'forums.index'); + Router::get('/{id:i}', 'Forum.ForumController@forum', 'forums.forum'); + Router::get('/{id:i}/mark', 'Forum.ForumController@markRead', 'forums.mark'); + Router::get('/{id:i}/new', 'Forum.TopicController@create', 'forums.new'); + Router::post('/{id:i}/new', 'Forum.TopicController@create', 'forums.new'); }); // Members - Routerv1::group(['prefix' => 'members'], function () { - Routerv1::get('/', 'UserController@members', 'members.index'); - Routerv1::get('/{rank:i}', 'UserController@members', 'members.rank'); + Router::group(['prefix' => 'members'], function () { + Router::get('/', 'UserController@members', 'members.index'); + Router::get('/{rank:i}', 'UserController@members', 'members.rank'); }); // User - Routerv1::group(['prefix' => 'u'], function () { - Routerv1::get('/{id}', 'UserController@profile', 'user.profile'); - Routerv1::get('/{id}/report', 'UserController@report', 'user.report'); + Router::group(['prefix' => 'u'], function () { + Router::get('/{id}', 'UserController@profile', 'user.profile'); + Router::get('/{id}/report', 'UserController@report', 'user.report'); - Routerv1::get('/{id}/nowplaying', 'UserController@nowPlaying', 'user.nowplaying'); + Router::get('/{id}/nowplaying', 'UserController@nowPlaying', 'user.nowplaying'); - Routerv1::get('/{id}/avatar', 'FileController@avatar', 'user.avatar'); - Routerv1::post('/{id}/avatar', 'FileController@avatar', 'user.avatar'); - Routerv1::delete('/{id}/avatar', 'FileController@avatar', 'user.avatar'); + Router::get('/{id}/avatar', 'FileController@avatar', 'user.avatar'); + Router::post('/{id}/avatar', 'FileController@avatar', 'user.avatar'); + Router::delete('/{id}/avatar', 'FileController@avatar', 'user.avatar'); - Routerv1::get('/{id}/background', 'FileController@background', 'user.background'); - Routerv1::post('/{id}/background', 'FileController@background', 'user.background'); - Routerv1::delete('/{id}/background', 'FileController@background', 'user.background'); + Router::get('/{id}/background', 'FileController@background', 'user.background'); + Router::post('/{id}/background', 'FileController@background', 'user.background'); + Router::delete('/{id}/background', 'FileController@background', 'user.background'); - Routerv1::get('/{id}/header', 'FileController@header', 'user.header'); - Routerv1::post('/{id}/header', 'FileController@header', 'user.header'); - Routerv1::delete('/{id}/header', 'FileController@header', 'user.header'); + Router::get('/{id}/header', 'FileController@header', 'user.header'); + Router::post('/{id}/header', 'FileController@header', 'user.header'); + Router::delete('/{id}/header', 'FileController@header', 'user.header'); }); // Notifications - Routerv1::group(['prefix' => 'notifications'], function () { - Routerv1::get('/', 'NotificationsController@notifications', 'notifications.get'); - Routerv1::get('/{id}/mark', 'NotificationsController@mark', 'notifications.mark'); + Router::group(['prefix' => 'notifications'], function () { + Router::get('/', 'NotificationsController@notifications', 'notifications.get'); + Router::get('/{id}/mark', 'NotificationsController@mark', 'notifications.mark'); }); // Comments - Routerv1::group(['prefix' => 'comments'], function () { - Routerv1::post('/{category:c}/post/{reply:i}?', 'CommentsController@post', 'comments.category.post'); - Routerv1::post('/{id:i}/delete', 'CommentsController@delete', 'comments.comment.delete'); - Routerv1::post('/{id:i}/vote', 'CommentsController@vote', 'comments.comment.vote'); + Router::group(['prefix' => 'comments'], function () { + Router::post('/{category:c}/post/{reply:i}?', 'CommentsController@post', 'comments.category.post'); + Router::post('/{id:i}/delete', 'CommentsController@delete', 'comments.comment.delete'); + Router::post('/{id:i}/vote', 'CommentsController@vote', 'comments.comment.vote'); }); // Comments - Routerv1::group(['prefix' => 'friends'], function () { - Routerv1::post('/{id:i}/add', 'FriendsController@add', 'friends.add'); - Routerv1::post('/{id:i}/remove', 'FriendsController@remove', 'friends.remove'); + Router::group(['prefix' => 'friends'], function () { + Router::post('/{id:i}/add', 'FriendsController@add', 'friends.add'); + Router::post('/{id:i}/remove', 'FriendsController@remove', 'friends.remove'); }); // Premium - Routerv1::group(['prefix' => 'support'], function () { - Routerv1::get('/', 'PremiumController@index', 'premium.index'); - Routerv1::get('/error', 'PremiumController@error', 'premium.error'); - Routerv1::get('/handle', 'PremiumController@handle', 'premium.handle'); - Routerv1::get('/complete', 'PremiumController@complete', 'premium.complete'); - Routerv1::post('/purchase', 'PremiumController@purchase', 'premium.purchase'); + Router::group(['prefix' => 'support'], function () { + Router::get('/', 'PremiumController@index', 'premium.index'); + Router::get('/error', 'PremiumController@error', 'premium.error'); + Router::get('/handle', 'PremiumController@handle', 'premium.handle'); + Router::get('/complete', 'PremiumController@complete', 'premium.complete'); + Router::post('/purchase', 'PremiumController@purchase', 'premium.purchase'); }); // Helpers - Routerv1::group(['prefix' => 'helper'], function () { + Router::group(['prefix' => 'helper'], function () { // BBcode - Routerv1::group(['prefix' => 'bbcode'], function () { - Routerv1::post('/parse', 'HelperController@bbcodeParse', 'helper.bbcode.parse'); + Router::group(['prefix' => 'bbcode'], function () { + Router::post('/parse', 'HelperController@bbcodeParse', 'helper.bbcode.parse'); }); }); // Settings - Routerv1::group(['prefix' => 'settings'], function () { - Routerv1::get('/', function () { + Router::group(['prefix' => 'settings'], function () { + Router::get('/', function () { redirect(route('settings.account.profile')); }, 'settings.index'); // Account section - Routerv1::group(['prefix' => 'account'], function () { - Routerv1::get('/', function () { + Router::group(['prefix' => 'account'], function () { + Router::get('/', function () { redirect(route('settings.account.profile')); }); - Routerv1::get('/profile', 'Settings.AccountController@profile', 'settings.account.profile'); - Routerv1::post('/profile', 'Settings.AccountController@profile', 'settings.account.profile'); - Routerv1::get('/details', 'Settings.AccountController@details', 'settings.account.details'); - Routerv1::post('/details', 'Settings.AccountController@details', 'settings.account.details'); - Routerv1::get('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks'); - Routerv1::post('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks'); - Routerv1::get('/userpage', 'Settings.AccountController@userpage', 'settings.account.userpage'); - Routerv1::post('/userpage', 'Settings.AccountController@userpage', 'settings.account.userpage'); - Routerv1::get('/signature', 'Settings.AccountController@signature', 'settings.account.signature'); - Routerv1::post('/signature', 'Settings.AccountController@signature', 'settings.account.signature'); + Router::get('/profile', 'Settings.AccountController@profile', 'settings.account.profile'); + Router::post('/profile', 'Settings.AccountController@profile', 'settings.account.profile'); + Router::get('/details', 'Settings.AccountController@details', 'settings.account.details'); + Router::post('/details', 'Settings.AccountController@details', 'settings.account.details'); + Router::get('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks'); + Router::post('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks'); + Router::get('/userpage', 'Settings.AccountController@userpage', 'settings.account.userpage'); + Router::post('/userpage', 'Settings.AccountController@userpage', 'settings.account.userpage'); + Router::get('/signature', 'Settings.AccountController@signature', 'settings.account.signature'); + Router::post('/signature', 'Settings.AccountController@signature', 'settings.account.signature'); }); // Friends section - Routerv1::group(['prefix' => 'friends'], function () { - Routerv1::get('/', function () { + Router::group(['prefix' => 'friends'], function () { + Router::get('/', function () { redirect(route('settings.account.listing')); }); - Routerv1::get('/listing', 'Settings.FriendsController@listing', 'settings.friends.listing'); - Routerv1::get('/requests', 'Settings.FriendsController@requests', 'settings.friends.requests'); + Router::get('/listing', 'Settings.FriendsController@listing', 'settings.friends.listing'); + Router::get('/requests', 'Settings.FriendsController@requests', 'settings.friends.requests'); }); // Notifications section - Routerv1::group(['prefix' => 'notifications'], function () { - Routerv1::get('/', function () { + Router::group(['prefix' => 'notifications'], function () { + Router::get('/', function () { redirect(route('settings.account.history')); }); - Routerv1::get('/history', 'Settings.NotificationsController@history', 'settings.notifications.history'); + Router::get('/history', 'Settings.NotificationsController@history', 'settings.notifications.history'); }); // Advanced section - Routerv1::group(['prefix' => 'advanced'], function () { - Routerv1::get('/', function () { + Router::group(['prefix' => 'advanced'], function () { + Router::get('/', function () { redirect(route('settings.account.sessions')); }); - Routerv1::get('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions'); - Routerv1::post('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions'); - Routerv1::get('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate'); - Routerv1::post('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate'); + Router::get('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions'); + Router::post('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions'); + Router::get('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate'); + Router::post('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate'); }); }); // Settings - Routerv1::group(['prefix' => 'manage'], function () { - Routerv1::get('/', function () { + Router::group(['prefix' => 'manage'], function () { + Router::get('/', function () { redirect(route('manage.overview.index')); }, 'manage.index'); // Overview section - Routerv1::group(['prefix' => 'overview'], function () { - Routerv1::get('/', function () { + Router::group(['prefix' => 'overview'], function () { + Router::get('/', function () { redirect(route('manage.overview.index')); }); - Routerv1::get('/index', 'Manage.OverviewController@index', 'manage.overview.index'); - Routerv1::get('/data', 'Manage.OverviewController@data', 'manage.overview.data'); + Router::get('/index', 'Manage.OverviewController@index', 'manage.overview.index'); + Router::get('/data', 'Manage.OverviewController@data', 'manage.overview.data'); }); }); }); diff --git a/sakura.php b/sakura.php index 26f6f9b..f8394a4 100644 --- a/sakura.php +++ b/sakura.php @@ -12,5 +12,5 @@ ExceptionHandler::register(); Config::load(path('config/config.ini')); DB::connect(config('database')); -Routerv1::init(); +Router::init(); include_once path('routes.php'); diff --git a/utility.php b/utility.php index 09f48ea..b006c10 100644 --- a/utility.php +++ b/utility.php @@ -7,7 +7,7 @@ use Sakura\Config; use Sakura\Exceptions\ConfigValueNotFoundException; use Sakura\FileSystem; use Sakura\Net; -use Sakura\Routerv1; +use Sakura\Router; use Sakura\Template; // Sort of alias for Config::get @@ -28,10 +28,10 @@ function config($value) } } -// Alias for Routerv1::route +// Alias for Router::route function route($name, $args = null, $full = false) { - return ($full ? full_domain() : '') . Routerv1::route($name, $args); + return ($full ? full_domain() : '') . Router::route($name, $args); } // Getting the full domain (+protocol) of the current host, only works for http