preparations
This commit is contained in:
parent
98ac5512aa
commit
dc2a475af1
2 changed files with 37 additions and 87 deletions
|
@ -70,7 +70,10 @@ class AdvancedController extends Controller
|
||||||
*/
|
*/
|
||||||
public function deactivate()
|
public function deactivate()
|
||||||
{
|
{
|
||||||
// Check permission
|
if (CurrentSession::$user->permission(Site::DEACTIVATED)) {
|
||||||
|
return view('settings/advanced/deactivate_bye');
|
||||||
|
}
|
||||||
|
|
||||||
if (!CurrentSession::$user->permission(Site::DEACTIVATE_ACCOUNT)) {
|
if (!CurrentSession::$user->permission(Site::DEACTIVATE_ACCOUNT)) {
|
||||||
throw new HttpMethodNotAllowedException();
|
throw new HttpMethodNotAllowedException();
|
||||||
}
|
}
|
||||||
|
|
119
routes.php
119
routes.php
|
@ -6,23 +6,8 @@
|
||||||
// Define namespace
|
// Define namespace
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
use Phroute\Phroute\Exception\HttpMethodNotAllowedException;
|
|
||||||
use Phroute\Phroute\Exception\HttpRouteNotFoundException;
|
use Phroute\Phroute\Exception\HttpRouteNotFoundException;
|
||||||
|
|
||||||
// Check if logged out
|
|
||||||
Routerv1::filter('logoutCheck', function () {
|
|
||||||
if (CurrentSession::$user->isActive()) {
|
|
||||||
throw new HttpRouteNotFoundException();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Check if logged in
|
|
||||||
Routerv1::filter('loginCheck', function () {
|
|
||||||
if (!CurrentSession::$user->isActive()) {
|
|
||||||
throw new HttpMethodNotAllowedException();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Maintenance check
|
// Maintenance check
|
||||||
Routerv1::filter('maintenance', function () {
|
Routerv1::filter('maintenance', function () {
|
||||||
if (config('general.maintenance')) {
|
if (config('general.maintenance')) {
|
||||||
|
@ -39,25 +24,21 @@ Routerv1::group(['before' => 'maintenance'], function () {
|
||||||
Routerv1::get('/search', 'MetaController@search', 'main.search');
|
Routerv1::get('/search', 'MetaController@search', 'main.search');
|
||||||
|
|
||||||
// Auth
|
// Auth
|
||||||
Routerv1::group(['before' => 'logoutCheck'], function () {
|
Routerv1::get('/login', 'AuthController@login', 'auth.login');
|
||||||
Routerv1::get('/login', 'AuthController@login', 'auth.login');
|
Routerv1::post('/login', 'AuthController@login', 'auth.login');
|
||||||
Routerv1::post('/login', 'AuthController@login', 'auth.login');
|
Routerv1::get('/register', 'AuthController@register', 'auth.register');
|
||||||
Routerv1::get('/register', 'AuthController@register', 'auth.register');
|
Routerv1::post('/register', 'AuthController@register', 'auth.register');
|
||||||
Routerv1::post('/register', 'AuthController@register', 'auth.register');
|
Routerv1::get('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword');
|
||||||
Routerv1::get('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword');
|
Routerv1::post('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword');
|
||||||
Routerv1::post('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword');
|
Routerv1::get('/reactivate', 'AuthController@reactivate', 'auth.reactivate');
|
||||||
Routerv1::get('/reactivate', 'AuthController@reactivate', 'auth.reactivate');
|
Routerv1::post('/reactivate', 'AuthController@reactivate', 'auth.reactivate');
|
||||||
Routerv1::post('/reactivate', 'AuthController@reactivate', 'auth.reactivate');
|
Routerv1::get('/activate', 'AuthController@activate', 'auth.activate');
|
||||||
Routerv1::get('/activate', 'AuthController@activate', 'auth.activate');
|
Routerv1::get('/logout', 'AuthController@logout', 'auth.logout');
|
||||||
});
|
Routerv1::post('/logout', 'AuthController@logout', 'auth.logout');
|
||||||
Routerv1::group(['before' => 'loginCheck'], function () {
|
|
||||||
Routerv1::get('/logout', 'AuthController@logout', 'auth.logout');
|
|
||||||
Routerv1::post('/logout', 'AuthController@logout', 'auth.logout');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Link compatibility layer, prolly remove this in like a year
|
// Link compatibility layer, prolly remove this in like a year
|
||||||
Routerv1::get('/r/{id}', function ($id) {
|
Routerv1::get('/r/{id}', function ($id) {
|
||||||
header("Location: /p/{$id}");
|
redirect("/p/{$id}");
|
||||||
});
|
});
|
||||||
Routerv1::get('/p/{id}', function ($id) {
|
Routerv1::get('/p/{id}', function ($id) {
|
||||||
$resolve = [
|
$resolve = [
|
||||||
|
@ -83,7 +64,7 @@ Routerv1::group(['before' => 'maintenance'], function () {
|
||||||
|
|
||||||
$link = $resolve[$id];
|
$link = $resolve[$id];
|
||||||
|
|
||||||
header("Location: " . (substr($link, 0, 4) === 'http' ? $link : route($link)));
|
redirect(substr($link, 0, 4) === 'http' ? $link : route($link));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
|
@ -123,11 +104,9 @@ Routerv1::group(['before' => 'maintenance'], function () {
|
||||||
// Post
|
// Post
|
||||||
Routerv1::group(['prefix' => 'post'], function () {
|
Routerv1::group(['prefix' => 'post'], function () {
|
||||||
Routerv1::get('/{id:i}', 'Forum.PostController@find', 'forums.post');
|
Routerv1::get('/{id:i}', 'Forum.PostController@find', 'forums.post');
|
||||||
Routerv1::group(['before' => 'loginCheck'], function () {
|
Routerv1::delete('/{id:i}', 'Forum.PostController@delete', 'forums.post.delete');
|
||||||
Routerv1::delete('/{id:i}', 'Forum.PostController@delete', 'forums.post.delete');
|
Routerv1::get('/{id:i}/raw', 'Forum.PostController@raw', 'forums.post.raw');
|
||||||
Routerv1::get('/{id:i}/raw', 'Forum.PostController@raw', 'forums.post.raw');
|
Routerv1::post('/{id:i}/edit', 'Forum.PostController@edit', 'forums.post.edit');
|
||||||
Routerv1::post('/{id:i}/edit', 'Forum.PostController@edit', 'forums.post.edit');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Topic
|
// Topic
|
||||||
|
@ -145,15 +124,13 @@ Routerv1::group(['before' => 'maintenance'], function () {
|
||||||
// Forum
|
// Forum
|
||||||
Routerv1::get('/', 'Forum.ForumController@index', 'forums.index');
|
Routerv1::get('/', 'Forum.ForumController@index', 'forums.index');
|
||||||
Routerv1::get('/{id:i}', 'Forum.ForumController@forum', 'forums.forum');
|
Routerv1::get('/{id:i}', 'Forum.ForumController@forum', 'forums.forum');
|
||||||
Routerv1::group(['before' => 'loginCheck'], function () {
|
Routerv1::get('/{id:i}/mark', 'Forum.ForumController@markRead', 'forums.mark');
|
||||||
Routerv1::get('/{id:i}/mark', 'Forum.ForumController@markRead', 'forums.mark');
|
Routerv1::get('/{id:i}/new', 'Forum.TopicController@create', 'forums.new');
|
||||||
Routerv1::get('/{id:i}/new', 'Forum.TopicController@create', 'forums.new');
|
Routerv1::post('/{id:i}/new', 'Forum.TopicController@create', 'forums.new');
|
||||||
Routerv1::post('/{id:i}/new', 'Forum.TopicController@create', 'forums.new');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
Routerv1::group(['prefix' => 'members', 'before' => 'loginCheck'], function () {
|
Routerv1::group(['prefix' => 'members'], function () {
|
||||||
Routerv1::get('/', 'UserController@members', 'members.index');
|
Routerv1::get('/', 'UserController@members', 'members.index');
|
||||||
Routerv1::get('/{rank:i}', 'UserController@members', 'members.rank');
|
Routerv1::get('/{rank:i}', 'UserController@members', 'members.rank');
|
||||||
});
|
});
|
||||||
|
@ -185,20 +162,20 @@ Routerv1::group(['before' => 'maintenance'], function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Comments
|
// Comments
|
||||||
Routerv1::group(['prefix' => 'comments', 'before' => 'loginCheck'], function () {
|
Routerv1::group(['prefix' => 'comments'], function () {
|
||||||
Routerv1::post('/{category:c}/post/{reply:i}?', 'CommentsController@post', 'comments.category.post');
|
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}/delete', 'CommentsController@delete', 'comments.comment.delete');
|
||||||
Routerv1::post('/{id:i}/vote', 'CommentsController@vote', 'comments.comment.vote');
|
Routerv1::post('/{id:i}/vote', 'CommentsController@vote', 'comments.comment.vote');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Comments
|
// Comments
|
||||||
Routerv1::group(['prefix' => 'friends', 'before' => 'loginCheck'], function () {
|
Routerv1::group(['prefix' => 'friends'], function () {
|
||||||
Routerv1::post('/{id:i}/add', 'FriendsController@add', 'friends.add');
|
Routerv1::post('/{id:i}/add', 'FriendsController@add', 'friends.add');
|
||||||
Routerv1::post('/{id:i}/remove', 'FriendsController@remove', 'friends.remove');
|
Routerv1::post('/{id:i}/remove', 'FriendsController@remove', 'friends.remove');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Premium
|
// Premium
|
||||||
Routerv1::group(['prefix' => 'support', 'before' => 'loginCheck'], function () {
|
Routerv1::group(['prefix' => 'support'], function () {
|
||||||
Routerv1::get('/', 'PremiumController@index', 'premium.index');
|
Routerv1::get('/', 'PremiumController@index', 'premium.index');
|
||||||
Routerv1::get('/error', 'PremiumController@error', 'premium.error');
|
Routerv1::get('/error', 'PremiumController@error', 'premium.error');
|
||||||
Routerv1::get('/handle', 'PremiumController@handle', 'premium.handle');
|
Routerv1::get('/handle', 'PremiumController@handle', 'premium.handle');
|
||||||
|
@ -209,23 +186,21 @@ Routerv1::group(['before' => 'maintenance'], function () {
|
||||||
// Helpers
|
// Helpers
|
||||||
Routerv1::group(['prefix' => 'helper'], function () {
|
Routerv1::group(['prefix' => 'helper'], function () {
|
||||||
// BBcode
|
// BBcode
|
||||||
Routerv1::group(['prefix' => 'bbcode', 'before' => 'loginCheck'], function () {
|
Routerv1::group(['prefix' => 'bbcode'], function () {
|
||||||
Routerv1::post('/parse', 'HelperController@bbcodeParse', 'helper.bbcode.parse');
|
Routerv1::post('/parse', 'HelperController@bbcodeParse', 'helper.bbcode.parse');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
Routerv1::group(['prefix' => 'settings', 'before' => 'loginCheck'], function () {
|
Routerv1::group(['prefix' => 'settings'], function () {
|
||||||
Routerv1::get('/', function () {
|
Routerv1::get('/', function () {
|
||||||
$route = Routerv1::route('settings.account.profile');
|
redirect(route('settings.account.profile'));
|
||||||
return header("Location: {$route}");
|
|
||||||
}, 'settings.index');
|
}, 'settings.index');
|
||||||
|
|
||||||
// Account section
|
// Account section
|
||||||
Routerv1::group(['prefix' => 'account'], function () {
|
Routerv1::group(['prefix' => 'account'], function () {
|
||||||
Routerv1::get('/', function () {
|
Routerv1::get('/', function () {
|
||||||
$route = Routerv1::route('settings.account.profile');
|
redirect(route('settings.account.profile'));
|
||||||
return header("Location: {$route}");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Routerv1::get('/profile', 'Settings.AccountController@profile', 'settings.account.profile');
|
Routerv1::get('/profile', 'Settings.AccountController@profile', 'settings.account.profile');
|
||||||
|
@ -243,8 +218,7 @@ Routerv1::group(['before' => 'maintenance'], function () {
|
||||||
// Friends section
|
// Friends section
|
||||||
Routerv1::group(['prefix' => 'friends'], function () {
|
Routerv1::group(['prefix' => 'friends'], function () {
|
||||||
Routerv1::get('/', function () {
|
Routerv1::get('/', function () {
|
||||||
$route = Routerv1::route('settings.friends.listing');
|
redirect(route('settings.account.listing'));
|
||||||
return header("Location: {$route}");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Routerv1::get('/listing', 'Settings.FriendsController@listing', 'settings.friends.listing');
|
Routerv1::get('/listing', 'Settings.FriendsController@listing', 'settings.friends.listing');
|
||||||
|
@ -254,8 +228,7 @@ Routerv1::group(['before' => 'maintenance'], function () {
|
||||||
// Notifications section
|
// Notifications section
|
||||||
Routerv1::group(['prefix' => 'notifications'], function () {
|
Routerv1::group(['prefix' => 'notifications'], function () {
|
||||||
Routerv1::get('/', function () {
|
Routerv1::get('/', function () {
|
||||||
$route = Routerv1::route('settings.notifications.history');
|
redirect(route('settings.account.history'));
|
||||||
return header("Location: {$route}");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Routerv1::get('/history', 'Settings.NotificationsController@history', 'settings.notifications.history');
|
Routerv1::get('/history', 'Settings.NotificationsController@history', 'settings.notifications.history');
|
||||||
|
@ -264,8 +237,7 @@ Routerv1::group(['before' => 'maintenance'], function () {
|
||||||
// Advanced section
|
// Advanced section
|
||||||
Routerv1::group(['prefix' => 'advanced'], function () {
|
Routerv1::group(['prefix' => 'advanced'], function () {
|
||||||
Routerv1::get('/', function () {
|
Routerv1::get('/', function () {
|
||||||
$route = Routerv1::route('settings.advanced.sessions');
|
redirect(route('settings.account.sessions'));
|
||||||
return header("Location: {$route}");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Routerv1::get('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
|
Routerv1::get('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
|
||||||
|
@ -276,44 +248,19 @@ Routerv1::group(['before' => 'maintenance'], function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
Routerv1::group(['prefix' => 'manage', 'before' => 'loginCheck'], function () {
|
Routerv1::group(['prefix' => 'manage'], function () {
|
||||||
Routerv1::get('/', function () {
|
Routerv1::get('/', function () {
|
||||||
$route = Routerv1::route('manage.overview.index');
|
redirect(route('manage.overview.index'));
|
||||||
return header("Location: {$route}");
|
|
||||||
}, 'manage.index');
|
}, 'manage.index');
|
||||||
|
|
||||||
// Overview section
|
// Overview section
|
||||||
Routerv1::group(['prefix' => 'overview'], function () {
|
Routerv1::group(['prefix' => 'overview'], function () {
|
||||||
Routerv1::get('/', function () {
|
Routerv1::get('/', function () {
|
||||||
$route = Routerv1::route('manage.overview.index');
|
redirect(route('manage.overview.index'));
|
||||||
return header("Location: {$route}");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Routerv1::get('/index', 'Manage.OverviewController@index', 'manage.overview.index');
|
Routerv1::get('/index', 'Manage.OverviewController@index', 'manage.overview.index');
|
||||||
Routerv1::get('/data', 'Manage.OverviewController@data', 'manage.overview.data');
|
Routerv1::get('/data', 'Manage.OverviewController@data', 'manage.overview.data');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// Management
|
|
||||||
/*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue