2016-01-30 00:18:23 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* Router paths
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Define namespace
|
|
|
|
namespace Sakura;
|
2016-01-30 13:25:18 +00:00
|
|
|
|
2016-03-26 16:36:58 +00:00
|
|
|
// Check if logged out
|
|
|
|
Router::filter('logoutCheck', function () {
|
2016-04-02 15:59:45 +00:00
|
|
|
if (ActiveUser::$user->isActive()) {
|
2016-03-26 16:36:58 +00:00
|
|
|
$message = "You must be logged out to do that!";
|
|
|
|
|
2016-04-03 21:29:46 +00:00
|
|
|
Template::vars(compact('message'));
|
2016-03-26 16:36:58 +00:00
|
|
|
|
|
|
|
return Template::render('global/information');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Check if logged in
|
|
|
|
Router::filter('loginCheck', function () {
|
2016-04-02 15:59:45 +00:00
|
|
|
if (!ActiveUser::$user->isActive()) {
|
2016-03-26 16:36:58 +00:00
|
|
|
$message = "You must be logged in to do that!";
|
|
|
|
|
2016-04-03 21:29:46 +00:00
|
|
|
Template::vars(compact('message'));
|
2016-03-26 16:36:58 +00:00
|
|
|
|
|
|
|
return Template::render('global/information');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Maintenance check
|
|
|
|
Router::filter('maintenance', function () {
|
2016-07-26 17:29:53 +00:00
|
|
|
if (config('general.maintenance')) {
|
2016-04-25 02:01:14 +00:00
|
|
|
ActiveUser::$session->destroy();
|
2016-02-05 12:26:31 +00:00
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
http_response_code(503);
|
2016-01-30 13:25:18 +00:00
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
return Template::render('global/maintenance');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Router::group(['before' => 'maintenance'], function () {
|
|
|
|
// Meta pages
|
|
|
|
Router::get('/', 'MetaController@index', 'main.index');
|
|
|
|
Router::get('/faq', 'MetaController@faq', 'main.faq');
|
|
|
|
Router::get('/search', 'MetaController@search', 'main.search');
|
|
|
|
|
|
|
|
// Auth
|
|
|
|
Router::group(['before' => 'logoutCheck'], function () {
|
|
|
|
Router::get('/login', 'AuthController@loginGet', 'auth.login');
|
|
|
|
Router::post('/login', 'AuthController@loginPost', 'auth.login');
|
|
|
|
Router::get('/register', 'AuthController@registerGet', 'auth.register');
|
|
|
|
Router::post('/register', 'AuthController@registerPost', 'auth.register');
|
|
|
|
Router::get('/resetpassword', 'AuthController@resetPasswordGet', 'auth.resetpassword');
|
|
|
|
Router::post('/resetpassword', 'AuthController@resetPasswordPost', 'auth.resetpassword');
|
|
|
|
Router::get('/reactivate', 'AuthController@reactivateGet', 'auth.reactivate');
|
|
|
|
Router::post('/reactivate', 'AuthController@reactivatePost', 'auth.reactivate');
|
|
|
|
Router::get('/activate', 'AuthController@activate', 'auth.activate');
|
|
|
|
});
|
2016-03-28 14:47:43 +00:00
|
|
|
Router::group(['before' => 'loginCheck'], function () {
|
2016-04-25 02:01:14 +00:00
|
|
|
Router::get('/logout', 'AuthController@logout', 'auth.logout');
|
2016-03-28 14:47:43 +00:00
|
|
|
});
|
2016-02-04 20:56:40 +00:00
|
|
|
|
2016-07-31 01:32:37 +00:00
|
|
|
// Link compatibility layer, prolly remove this in like a year
|
|
|
|
Router::get('/r/{id}', function ($id) {
|
|
|
|
header("Location: /p/{$id}");
|
|
|
|
});
|
|
|
|
Router::get('/p/{id}', function ($id) {
|
|
|
|
$resolve = [
|
|
|
|
'terms' => 'info.terms',
|
|
|
|
'contact' => 'info.contact',
|
|
|
|
'rules' => 'info.rules',
|
|
|
|
'welcome' => 'info.welcome',
|
|
|
|
//'profileapi' => 'api.manage.index',
|
|
|
|
'chat' => 'chat.redirect',
|
|
|
|
//'irc' => 'chat.irc',
|
|
|
|
'feedback' => 'forums.index',
|
|
|
|
//'mcp' => 'manage.index',
|
|
|
|
//'mcptest' => 'manage.index',
|
|
|
|
//'report' => 'report.something',
|
|
|
|
//'osu' => 'eventual link to flashii team',
|
|
|
|
//'filehost' => '???',
|
|
|
|
//'fhscript' => '???',
|
|
|
|
//'fhmanager' => '???',
|
|
|
|
'everlastingness' => 'https://i.flash.moe/18661469927746.txt',
|
|
|
|
'fuckingdone' => 'https://i.flash.moe/18671469927761.txt',
|
|
|
|
];
|
|
|
|
|
|
|
|
if (!array_key_exists($id, $resolve)) {
|
|
|
|
throw new \Phroute\Phroute\Exception\HttpRouteNotFoundException();
|
|
|
|
}
|
|
|
|
|
|
|
|
$link = $resolve[$id];
|
|
|
|
|
|
|
|
header("Location: " . (substr($link, 0, 4) === 'http' ? $link : route($link)));
|
|
|
|
});
|
|
|
|
|
|
|
|
// Info
|
|
|
|
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');
|
|
|
|
});
|
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// News
|
|
|
|
Router::group(['prefix' => 'news'], function () {
|
|
|
|
Router::get('/{category:c}?', 'NewsController@category', 'news.category');
|
|
|
|
Router::get('/post/{id:i}', 'NewsController@post', 'news.post');
|
|
|
|
});
|
2016-02-04 20:56:40 +00:00
|
|
|
|
2016-07-29 19:31:36 +00:00
|
|
|
// Chat
|
|
|
|
Router::group(['prefix' => 'chat'], function () {
|
2016-07-31 01:32:37 +00:00
|
|
|
Router::get('/redirect', 'ChatController@redirect', 'chat.redirect');
|
|
|
|
Router::get('/settings', 'ChatController@settings', 'chat.settings');
|
2016-07-29 19:31:36 +00:00
|
|
|
});
|
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Forum
|
|
|
|
Router::group(['prefix' => 'forum'], function () {
|
|
|
|
// Post
|
|
|
|
Router::group(['prefix' => 'post'], function () {
|
|
|
|
Router::get('/{id:i}', 'ForumController@post', 'forums.post');
|
|
|
|
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');
|
|
|
|
});
|
|
|
|
});
|
2016-03-28 14:47:43 +00:00
|
|
|
|
2016-07-30 13:48:09 +00:00
|
|
|
// Topic
|
|
|
|
Router::group(['prefix' => 'topic'], function () {
|
2016-07-31 01:32:37 +00:00
|
|
|
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');
|
2016-04-25 02:01:14 +00:00
|
|
|
});
|
2016-03-28 14:47:43 +00:00
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Forum
|
|
|
|
Router::get('/', 'ForumController@index', 'forums.index');
|
|
|
|
Router::get('/{id:i}', 'ForumController@forum', 'forums.forum');
|
|
|
|
Router::group(['before' => 'loginCheck'], function () {
|
|
|
|
Router::get('/{id:i}/mark', 'ForumController@markForumRead', 'forums.mark');
|
2016-07-30 13:48:09 +00:00
|
|
|
Router::get('/{id:i}/new', 'ForumController@createTopic', 'forums.new');
|
|
|
|
Router::post('/{id:i}/new', 'ForumController@createTopic', 'forums.new');
|
2016-04-25 02:01:14 +00:00
|
|
|
});
|
|
|
|
});
|
2016-03-30 21:30:15 +00:00
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Members
|
|
|
|
Router::group(['prefix' => 'members', 'before' => 'loginCheck'], function () {
|
|
|
|
Router::get('/', 'UserController@members', 'members.index');
|
|
|
|
Router::get('/{rank:i}', 'UserController@members', 'members.rank');
|
|
|
|
});
|
2016-02-15 21:20:46 +00:00
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// User
|
|
|
|
Router::group(['prefix' => 'u'], function () {
|
|
|
|
Router::get('/{id}', 'UserController@profile', 'user.profile');
|
|
|
|
Router::get('/{id}/report', 'UserController@report', 'user.report');
|
|
|
|
Router::get('/{id}/header', 'FileController@header', 'user.header');
|
|
|
|
});
|
2016-01-30 13:25:18 +00:00
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Notifications
|
|
|
|
Router::group(['prefix' => 'notifications'], function () {
|
|
|
|
Router::get('/', 'NotificationsController@notifications', 'notifications.get');
|
|
|
|
Router::get('/{id}/mark', 'NotificationsController@mark', 'notifications.mark');
|
|
|
|
});
|
2016-02-13 13:36:21 +00:00
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Comments
|
|
|
|
Router::group(['prefix' => 'comments', 'before' => 'loginCheck'], 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');
|
2016-03-25 01:31:57 +00:00
|
|
|
});
|
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Comments
|
|
|
|
Router::group(['prefix' => 'friends', 'before' => 'loginCheck'], function () {
|
|
|
|
Router::post('/{id:i}/add', 'FriendsController@add', 'friends.add');
|
|
|
|
Router::post('/{id:i}/remove', 'FriendsController@remove', 'friends.remove');
|
|
|
|
});
|
2016-03-28 01:18:59 +00:00
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Files
|
|
|
|
Router::get('/a/{id}', 'FileController@avatar', 'file.avatar');
|
|
|
|
Router::get('/bg/{id}', 'FileController@background', 'file.background');
|
2016-03-28 01:18:59 +00:00
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Premium
|
|
|
|
Router::group(['prefix' => 'support', 'before' => 'loginCheck'], function () {
|
|
|
|
Router::get('/', 'PremiumController@index', 'premium.index');
|
|
|
|
Router::get('/handle', 'PremiumController@handle', 'premium.handle');
|
|
|
|
Router::get('/complete', 'PremiumController@complete', 'premium.complete');
|
|
|
|
Router::post('/purchase', 'PremiumController@purchase', 'premium.purchase');
|
2016-03-28 01:18:59 +00:00
|
|
|
});
|
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Helpers
|
|
|
|
Router::group(['prefix' => 'helper'], function () {
|
|
|
|
// BBcode
|
|
|
|
Router::group(['prefix' => 'bbcode', 'before' => 'loginCheck'], function () {
|
|
|
|
Router::post('/parse', 'HelperController@bbcodeParse', 'helper.bbcode.parse');
|
2016-03-28 01:18:59 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Settings
|
|
|
|
Router::group(['prefix' => 'settings', 'before' => 'loginCheck'], function () {
|
2016-03-28 01:18:59 +00:00
|
|
|
Router::get('/', function () {
|
2016-04-25 02:01:14 +00:00
|
|
|
$route = Router::route('settings.general.home');
|
2016-03-28 01:18:59 +00:00
|
|
|
return header("Location: {$route}");
|
2016-04-25 02:01:14 +00:00
|
|
|
}, 'settings.index');
|
|
|
|
|
|
|
|
// General section
|
|
|
|
Router::group(['prefix' => 'general'], function () {
|
|
|
|
Router::get('/', function () {
|
|
|
|
$route = Router::route('settings.general.home');
|
|
|
|
return header("Location: {$route}");
|
|
|
|
});
|
|
|
|
|
|
|
|
Router::get('/home', 'Settings.GeneralController@home', 'settings.general.home');
|
|
|
|
Router::get('/profile', 'Settings.GeneralController@profile', 'settings.general.profile');
|
|
|
|
Router::post('/profile', 'Settings.GeneralController@profile', 'settings.general.profile');
|
|
|
|
Router::get('/options', 'Settings.GeneralController@options', 'settings.general.options');
|
|
|
|
Router::post('/options', 'Settings.GeneralController@options', 'settings.general.options');
|
2016-03-28 01:18:59 +00:00
|
|
|
});
|
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Friends section
|
|
|
|
Router::group(['prefix' => 'friends'], function () {
|
|
|
|
Router::get('/', function () {
|
|
|
|
$route = Router::route('settings.friends.listing');
|
|
|
|
return header("Location: {$route}");
|
|
|
|
});
|
2016-03-28 01:18:59 +00:00
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
Router::get('/listing', 'Settings.FriendsController@listing', 'settings.friends.listing');
|
|
|
|
Router::get('/requests', 'Settings.FriendsController@requests', 'settings.friends.requests');
|
2016-03-28 01:18:59 +00:00
|
|
|
});
|
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Groups section
|
|
|
|
Router::group(['prefix' => 'groups'], function () {
|
|
|
|
Router::get('/', function () {
|
|
|
|
$route = Router::route('settings.groups.listing');
|
|
|
|
return header("Location: {$route}");
|
|
|
|
});
|
2016-03-28 01:18:59 +00:00
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
Router::get('/listing', 'Settings.GroupsController@listing', 'settings.groups.listing');
|
|
|
|
Router::get('/invites', 'Settings.GroupsController@invites', 'settings.groups.invites');
|
2016-03-28 01:18:59 +00:00
|
|
|
});
|
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Notifications section
|
|
|
|
Router::group(['prefix' => 'notifications'], function () {
|
|
|
|
Router::get('/', function () {
|
|
|
|
$route = Router::route('settings.notifications.history');
|
|
|
|
return header("Location: {$route}");
|
|
|
|
});
|
2016-03-28 01:18:59 +00:00
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
Router::get('/history', 'Settings.NotificationsController@history', 'settings.notifications.history');
|
2016-03-28 01:18:59 +00:00
|
|
|
});
|
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Appearance section
|
|
|
|
Router::group(['prefix' => 'appearance'], function () {
|
|
|
|
Router::get('/', function () {
|
|
|
|
$route = Router::route('settings.appearance.avatar');
|
|
|
|
return header("Location: {$route}");
|
|
|
|
});
|
|
|
|
|
|
|
|
Router::get('/avatar', 'Settings.AppearanceController@avatar', 'settings.appearance.avatar');
|
|
|
|
Router::post('/avatar', 'Settings.AppearanceController@avatar', 'settings.appearance.avatar');
|
|
|
|
Router::get('/background', 'Settings.AppearanceController@background', 'settings.appearance.background');
|
|
|
|
Router::post('/background', 'Settings.AppearanceController@background', 'settings.appearance.background');
|
|
|
|
Router::get('/header', 'Settings.AppearanceController@header', 'settings.appearance.header');
|
|
|
|
Router::post('/header', 'Settings.AppearanceController@header', 'settings.appearance.header');
|
|
|
|
Router::get('/userpage', 'Settings.AppearanceController@userpage', 'settings.appearance.userpage');
|
|
|
|
Router::post('/userpage', 'Settings.AppearanceController@userpage', 'settings.appearance.userpage');
|
|
|
|
Router::get('/signature', 'Settings.AppearanceController@signature', 'settings.appearance.signature');
|
|
|
|
Router::post('/signature', 'Settings.AppearanceController@signature', 'settings.appearance.signature');
|
|
|
|
});
|
2016-03-28 01:18:59 +00:00
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Account section
|
|
|
|
Router::group(['prefix' => 'account'], function () {
|
|
|
|
Router::get('/', function () {
|
|
|
|
$route = Router::route('settings.account.email');
|
|
|
|
return header("Location: {$route}");
|
|
|
|
});
|
|
|
|
|
|
|
|
Router::get('/email', 'Settings.AccountController@email', 'settings.account.email');
|
|
|
|
Router::post('/email', 'Settings.AccountController@email', 'settings.account.email');
|
|
|
|
Router::get('/username', 'Settings.AccountController@username', 'settings.account.username');
|
|
|
|
Router::post('/username', 'Settings.AccountController@username', 'settings.account.username');
|
|
|
|
Router::get('/title', 'Settings.AccountController@title', 'settings.account.title');
|
|
|
|
Router::post('/title', 'Settings.AccountController@title', 'settings.account.title');
|
|
|
|
Router::get('/password', 'Settings.AccountController@password', 'settings.account.password');
|
|
|
|
Router::post('/password', 'Settings.AccountController@password', 'settings.account.password');
|
|
|
|
Router::get('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
|
|
|
|
Router::post('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
|
2016-03-28 01:18:59 +00:00
|
|
|
});
|
|
|
|
|
2016-04-25 02:01:14 +00:00
|
|
|
// Advanced section
|
|
|
|
Router::group(['prefix' => 'advanced'], function () {
|
|
|
|
Router::get('/', function () {
|
|
|
|
$route = Router::route('settings.advanced.sessions');
|
|
|
|
return header("Location: {$route}");
|
|
|
|
});
|
|
|
|
|
|
|
|
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');
|
|
|
|
});
|
2016-03-28 01:18:59 +00:00
|
|
|
});
|
2016-03-11 19:13:14 +00:00
|
|
|
|
2016-02-15 21:20:46 +00:00
|
|
|
// Management
|
2016-04-25 02:01:14 +00:00
|
|
|
/*
|
2016-02-15 21:20:46 +00:00
|
|
|
* General
|
|
|
|
* - Dashboard
|
|
|
|
* - Info pages (possibly deprecate with wiki)
|
|
|
|
* Configuration
|
|
|
|
* - General
|
|
|
|
* - Files
|
|
|
|
* - User
|
|
|
|
* - Mail
|
|
|
|
* Forums
|
|
|
|
* - Manage
|
|
|
|
* - Settings
|
|
|
|
* Comments
|
|
|
|
* - Manage
|
|
|
|
* Users
|
|
|
|
* - Manage users
|
|
|
|
* - Manage ranks
|
|
|
|
* - Profile fields
|
|
|
|
* - Option fields
|
|
|
|
* - Bans and restrictions
|
|
|
|
* - Warnings
|
|
|
|
* Permissions
|
|
|
|
* - Site
|
|
|
|
* - Management
|
|
|
|
* - Forum
|
|
|
|
* Logs
|
|
|
|
* - Actions
|
|
|
|
* - Management
|
|
|
|
* - Errors
|
|
|
|
*/
|
2016-04-25 02:01:14 +00:00
|
|
|
});
|