diff --git a/database/yggtracker.mwb b/database/yggtracker.mwb index daba455..db3e6bb 100644 Binary files a/database/yggtracker.mwb and b/database/yggtracker.mwb differ diff --git a/src/app/controller/index.php b/src/app/controller/index.php index 381d63d..3634268 100644 --- a/src/app/controller/index.php +++ b/src/app/controller/index.php @@ -80,17 +80,6 @@ class AppControllerIndex 403 ); } - - // Require account type selection - if (is_null($user->public)) - { - header( - sprintf( - 'Location: %s/welcome', - trim($this->_website->getUrl(), '/') - ) - ); - } } public function render() diff --git a/src/app/controller/page.php b/src/app/controller/page.php index f9ed37c..a84c09c 100644 --- a/src/app/controller/page.php +++ b/src/app/controller/page.php @@ -107,17 +107,6 @@ class AppControllerPage 403 ); } - - // Require account type selection - if (is_null($user->public)) - { - header( - sprintf( - 'Location: %s/welcome', - trim($this->_website->getUrl(), '/') - ) - ); - } } private function _initLocale(string $value) diff --git a/src/app/controller/welcome.php b/src/app/controller/welcome.php deleted file mode 100644 index e499e73..0000000 --- a/src/app/controller/welcome.php +++ /dev/null @@ -1,177 +0,0 @@ -_database = $database; - $this->_validator = $validator; - $this->_website = $website; - $this->_session = $session; - } - - private function _response(string $title, string $h1, mixed $data, int $code = 200) - { - require_once __DIR__ . '/response.php'; - - if (is_array($data)) - { - $data = implode('
', $data); - } - - $appControllerResponse = new AppControllerResponse( - $title, - $h1, - $data, - $code - ); - - $appControllerResponse->render(); - - exit; - } - - public function render() - { - $error = []; - if (!$this->_validator->host($this->_session->getAddress(), $error)) - { - $this->_response( - sprintf( - _('Error - %s'), - $this->_website->getName() - ), - _('406'), - $error, - 406 - ); - } - - try - { - $this->_database->beginTransaction(); - - $user = $this->_database->getUser( - $this->_database->initUserId( - $this->_session->getAddress(), - $this->_website->getDefaultUserStatus(), - $this->_website->getDefaultUserApproved(), - time() - ) - ); - - $this->_database->commit(); - } - - catch (Exception $error) - { - $this->_database->rollback(); - - $this->_response( - sprintf( - _('Error - %s'), - $this->_website->getName() - ), - _('500'), - $error, - 500 - ); - } - - // Access denied - if (!$user->status) - { - $this->_response( - sprintf( - _('Error - %s'), - $this->_website->getName() - ), - _('403'), - _('Access denied'), - 403 - ); - } - - if (!is_null($user->public)) - { - $this->_response( - sprintf( - _('Welcome back - %s'), - $this->_website->getName() - ), - _('Welcome back!'), - sprintf( - _('You already have selected account type to %s'), - $user->public ? _('Distributed') : _('Local') - ), - 405 - ); - } - - if (isset($_POST['public'])) - { - if ($this->_database->updateUserPublic($user->userId, (bool) $_POST['public'], time())) - { - $this->_response( - sprintf( - _('Success - %s'), - $this->_website->getName() - ), - _('Success!'), - sprintf( - _('Account type successfully changed to %s'), - $_POST['public'] ? _('Distributed') : _('Local') - ), - ); - } - } - - require_once __DIR__ . '/module/head.php'; - - $appControllerModuleHead = new AppControllerModuleHead( - $this->_website->getUrl(), - sprintf( - _('Welcome to %s'), - $this->_website->getName() - ), - [ - [ - 'rel' => 'stylesheet', - 'type' => 'text/css', - 'href' => sprintf( - 'assets/theme/default/css/common.css?%s', - CSS_VERSION - ), - ], - [ - 'rel' => 'stylesheet', - 'type' => 'text/css', - 'href' => sprintf( - 'assets/theme/default/css/framework.css?%s', - CSS_VERSION - ), - ], - ] - ); - - require_once __DIR__ . '/module/header.php'; - - $appControllerModuleHeader = new AppControllerModuleHeader(); - - require_once __DIR__ . '/module/footer.php'; - - $appControllerModuleFooter = new AppControllerModuleFooter(); - - include __DIR__ . '../../view/theme/default/welcome.phtml'; - } -} \ No newline at end of file diff --git a/src/app/view/theme/default/welcome.phtml b/src/app/view/theme/default/welcome.phtml deleted file mode 100644 index af9aa03..0000000 --- a/src/app/view/theme/default/welcome.phtml +++ /dev/null @@ -1,39 +0,0 @@ - - - render() ?> - - render() ?> -
-
-
-
-
-
-

-
-

-

-

address ?>

-
-
- - -
-
- -
-
-
-
-
-
-
- render() ?> - - \ No newline at end of file diff --git a/src/config/bootstrap.php b/src/config/bootstrap.php index 7b41fd6..c2e56e6 100644 --- a/src/config/bootstrap.php +++ b/src/config/bootstrap.php @@ -76,34 +76,6 @@ if (isset($request['_route_'])) break; - case 'welcome': - - require_once __DIR__ . '/../app/model/database.php'; - require_once __DIR__ . '/../app/model/validator.php'; - require_once __DIR__ . '/../app/model/website.php'; - require_once __DIR__ . '/../app/model/session.php'; - - require_once __DIR__ . '/../app/controller/welcome.php'; - - $appControllerWelcome = new AppControllerWelcome( - new AppModelDatabase( - Environment::config('database') - ), - new AppModelValidator( - Environment::config('validator') - ), - new AppModelWebsite( - Environment::config('website') - ), - new AppModelSession( - $_SERVER['REMOTE_ADDR'] - ) - ); - - $appControllerWelcome->render(); - - break; - case 'submit': require_once __DIR__ . '/../app/model/database.php';