use classes at beginning of web.php
All checks were successful
rvr-nextgen/pipeline/pr-master This commit looks good
All checks were successful
rvr-nextgen/pipeline/pr-master This commit looks good
This commit is contained in:
parent
41933ec510
commit
a7d3942d1f
94
web.php
94
web.php
@ -1,6 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Container;
|
||||
use SokoWeb\Response\HttpResponse;
|
||||
use SokoWeb\Routing\RouteCollection;
|
||||
use SokoWeb\Session\DatabaseSessionHandler;
|
||||
use SokoWeb\Request\Request;
|
||||
use RVR\Controller\HomeController;
|
||||
use RVR\Controller\LoginController;
|
||||
use RVR\Controller\OAuthAuthController;
|
||||
use RVR\Controller\OAuthController;
|
||||
use RVR\Controller\UserController;
|
||||
use RVR\Controller\UserSearchController;
|
||||
use RVR\Controller\CommunityController;
|
||||
use RVR\Repository\UserRepository;
|
||||
|
||||
require 'app.php';
|
||||
|
||||
@ -12,53 +24,53 @@ if (!empty($_ENV['DEV'])) {
|
||||
ini_set('display_errors', '0');
|
||||
}
|
||||
|
||||
Container::$routeCollection = new SokoWeb\Routing\RouteCollection();
|
||||
Container::$routeCollection = new RouteCollection();
|
||||
|
||||
Container::$routeCollection->get('home', '', [RVR\Controller\HomeController::class, 'getHome']);
|
||||
Container::$routeCollection->get('startSession', 'startSession.json', [RVR\Controller\HomeController::class, 'startSession']);
|
||||
Container::$routeCollection->group('login', function (SokoWeb\Routing\RouteCollection $routeCollection) {
|
||||
$routeCollection->get('login', '', [RVR\Controller\LoginController::class, 'getLoginForm']);
|
||||
$routeCollection->post('login-action', '', [RVR\Controller\LoginController::class, 'login']);
|
||||
$routeCollection->get('login-google', 'google', [RVR\Controller\LoginController::class, 'getGoogleLoginRedirect']);
|
||||
$routeCollection->get('login-google-action', 'google/code', [RVR\Controller\LoginController::class, 'loginWithGoogle']);
|
||||
Container::$routeCollection->get('home', '', [HomeController::class, 'getHome']);
|
||||
Container::$routeCollection->get('startSession', 'startSession.json', [HomeController::class, 'startSession']);
|
||||
Container::$routeCollection->group('login', function (RouteCollection $routeCollection) {
|
||||
$routeCollection->get('login', '', [LoginController::class, 'getLoginForm']);
|
||||
$routeCollection->post('login-action', '', [LoginController::class, 'login']);
|
||||
$routeCollection->get('login-google', 'google', [LoginController::class, 'getGoogleLoginRedirect']);
|
||||
$routeCollection->get('login-google-action', 'google/code', [LoginController::class, 'loginWithGoogle']);
|
||||
});
|
||||
Container::$routeCollection->group('oauth', function (SokoWeb\Routing\RouteCollection $routeCollection) {
|
||||
$routeCollection->get('oauth-auth', 'auth', [RVR\Controller\OAuthAuthController::class, 'auth']);
|
||||
$routeCollection->post('oauth-token', 'token', [RVR\Controller\OAuthController::class, 'getToken']);
|
||||
$routeCollection->get('oauth-userinfo', 'userinfo', [RVR\Controller\OAuthController::class, 'getUserInfo']);
|
||||
$routeCollection->get('oauth-config', '.well-known/openid-configuration', [RVR\Controller\OAuthController::class, 'getConfig']);
|
||||
$routeCollection->get('oauth-certs', 'certs', [RVR\Controller\OAuthController::class, 'getCerts']);
|
||||
Container::$routeCollection->group('oauth', function (RouteCollection $routeCollection) {
|
||||
$routeCollection->get('oauth-auth', 'auth', [OAuthAuthController::class, 'auth']);
|
||||
$routeCollection->post('oauth-token', 'token', [OAuthController::class, 'getToken']);
|
||||
$routeCollection->get('oauth-userinfo', 'userinfo', [OAuthController::class, 'getUserInfo']);
|
||||
$routeCollection->get('oauth-config', '.well-known/openid-configuration', [OAuthController::class, 'getConfig']);
|
||||
$routeCollection->get('oauth-certs', 'certs', [OAuthController::class, 'getCerts']);
|
||||
});
|
||||
Container::$routeCollection->group('password', function (SokoWeb\Routing\RouteCollection $routeCollection) {
|
||||
$routeCollection->get('password-requestReset', 'requestReset', [RVR\Controller\LoginController::class, 'getRequestPasswordResetForm']);
|
||||
$routeCollection->post('password-requestReset-action', 'requestReset', [RVR\Controller\LoginController::class, 'requestPasswordReset']);
|
||||
$routeCollection->get('password-requestReset.success', 'requestReset/success', [RVR\Controller\LoginController::class, 'getRequestPasswordResetSuccess']);
|
||||
$routeCollection->get('password-reset', 'reset/{token}', [RVR\Controller\LoginController::class, 'getResetPasswordForm']);
|
||||
$routeCollection->post('password-reset.action', 'reset/{token}', [RVR\Controller\LoginController::class, 'resetPassword']);
|
||||
Container::$routeCollection->group('password', function (RouteCollection $routeCollection) {
|
||||
$routeCollection->get('password-requestReset', 'requestReset', [LoginController::class, 'getRequestPasswordResetForm']);
|
||||
$routeCollection->post('password-requestReset-action', 'requestReset', [LoginController::class, 'requestPasswordReset']);
|
||||
$routeCollection->get('password-requestReset.success', 'requestReset/success', [LoginController::class, 'getRequestPasswordResetSuccess']);
|
||||
$routeCollection->get('password-reset', 'reset/{token}', [LoginController::class, 'getResetPasswordForm']);
|
||||
$routeCollection->post('password-reset.action', 'reset/{token}', [LoginController::class, 'resetPassword']);
|
||||
});
|
||||
Container::$routeCollection->get('logout', 'logout', [RVR\Controller\LoginController::class, 'logout']);
|
||||
Container::$routeCollection->group('account', function (SokoWeb\Routing\RouteCollection $routeCollection) {
|
||||
$routeCollection->get('account', '', [RVR\Controller\UserController::class, 'getAccount']);
|
||||
$routeCollection->post('account-action', '', [RVR\Controller\UserController::class, 'saveAccount']);
|
||||
$routeCollection->get('account.googleAuthenticate', 'googleAuthenticate', [RVR\Controller\UserController::class, 'getGoogleAuthenticateRedirect']);
|
||||
$routeCollection->get('account.googleAuthenticate-action', 'googleAuthenticate/code', [RVR\Controller\UserController::class, 'authenticateWithGoogle']);
|
||||
Container::$routeCollection->get('logout', 'logout', [LoginController::class, 'logout']);
|
||||
Container::$routeCollection->group('account', function (RouteCollection $routeCollection) {
|
||||
$routeCollection->get('account', '', [UserController::class, 'getAccount']);
|
||||
$routeCollection->post('account-action', '', [UserController::class, 'saveAccount']);
|
||||
$routeCollection->get('account.googleAuthenticate', 'googleAuthenticate', [UserController::class, 'getGoogleAuthenticateRedirect']);
|
||||
$routeCollection->get('account.googleAuthenticate-action', 'googleAuthenticate/code', [UserController::class, 'authenticateWithGoogle']);
|
||||
});
|
||||
Container::$routeCollection->get('searchUser', 'searchUser', [RVR\Controller\UserSearchController::class, 'searchUser']);
|
||||
Container::$routeCollection->group('communities', function (SokoWeb\Routing\RouteCollection $routeCollection) {
|
||||
$routeCollection->get('community-new', 'new', [RVR\Controller\CommunityController::class, 'getCommunityNew']);
|
||||
$routeCollection->post('community-new-action', 'new', [RVR\Controller\CommunityController::class, 'saveCommunity']);
|
||||
$routeCollection->group('{communityId}', function (SokoWeb\Routing\RouteCollection $routeCollection) {
|
||||
$routeCollection->get('community', '', [RVR\Controller\CommunityController::class, 'getCommunityHome']);
|
||||
$routeCollection->get('community-edit', 'edit', [RVR\Controller\CommunityController::class, 'getCommunityEdit']);
|
||||
$routeCollection->post('community-edit-action', 'edit', [RVR\Controller\CommunityController::class, 'saveCommunity']);
|
||||
$routeCollection->get('community-members', 'members', [RVR\Controller\CommunityController::class, 'getMembersEdit']);
|
||||
$routeCollection->post('community-members-new', 'newMember', [RVR\Controller\CommunityController::class, 'newMember']);
|
||||
$routeCollection->post('community-members-edit', 'editMember', [RVR\Controller\CommunityController::class, 'editMember']);
|
||||
$routeCollection->post('community-members-delete', 'deleteMember', [RVR\Controller\CommunityController::class, 'deleteMember']);
|
||||
Container::$routeCollection->get('searchUser', 'searchUser', [UserSearchController::class, 'searchUser']);
|
||||
Container::$routeCollection->group('communities', function (RouteCollection $routeCollection) {
|
||||
$routeCollection->get('community-new', 'new', [CommunityController::class, 'getCommunityNew']);
|
||||
$routeCollection->post('community-new-action', 'new', [CommunityController::class, 'saveCommunity']);
|
||||
$routeCollection->group('{communityId}', function (RouteCollection $routeCollection) {
|
||||
$routeCollection->get('community', '', [CommunityController::class, 'getCommunityHome']);
|
||||
$routeCollection->get('community-edit', 'edit', [CommunityController::class, 'getCommunityEdit']);
|
||||
$routeCollection->post('community-edit-action', 'edit', [CommunityController::class, 'saveCommunity']);
|
||||
$routeCollection->get('community-members', 'members', [CommunityController::class, 'getMembersEdit']);
|
||||
$routeCollection->post('community-members-new', 'newMember', [CommunityController::class, 'newMember']);
|
||||
$routeCollection->post('community-members-edit', 'editMember', [CommunityController::class, 'editMember']);
|
||||
$routeCollection->post('community-members-delete', 'deleteMember', [CommunityController::class, 'deleteMember']);
|
||||
});
|
||||
});
|
||||
|
||||
Container::$sessionHandler = new SokoWeb\Session\DatabaseSessionHandler();
|
||||
Container::$sessionHandler = new DatabaseSessionHandler();
|
||||
|
||||
session_set_save_handler(Container::$sessionHandler, true);
|
||||
session_start([
|
||||
@ -79,13 +91,13 @@ if (isset($_COOKIE[session_name()])) {
|
||||
]);
|
||||
}
|
||||
|
||||
Container::$request = new SokoWeb\Request\Request(
|
||||
Container::$request = new Request(
|
||||
$_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'],
|
||||
$_GET,
|
||||
$_POST,
|
||||
getallheaders(),
|
||||
$_SESSION,
|
||||
new RVR\Repository\UserRepository()
|
||||
new UserRepository()
|
||||
);
|
||||
|
||||
if (!Container::$request->session()->has('anti_csrf_token')) {
|
||||
|
Loading…
Reference in New Issue
Block a user