mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 17:45:31 +00:00
init MVC framework refactory #14
This commit is contained in:
parent
c4f5409ffa
commit
a600a08a28
28 changed files with 1235 additions and 925 deletions
96
src/app/controller/submit.php
Normal file
96
src/app/controller/submit.php
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
|
||||
class AppControllerSubmit
|
||||
{
|
||||
private function _response(string $title, string $h1, string $text, int $code = 200)
|
||||
{
|
||||
require_once __DIR__ . '/response.php';
|
||||
|
||||
$appControllerResponse = new AppControllerResponse(
|
||||
$title,
|
||||
$h1,
|
||||
$text,
|
||||
$code
|
||||
);
|
||||
|
||||
$appControllerResponse->render();
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
require_once __DIR__ . '/user.php';
|
||||
|
||||
$appControllerUser = new AppControllerUser(
|
||||
$_SERVER['REMOTE_ADDR']
|
||||
);
|
||||
|
||||
// Get user info
|
||||
if (!$user = $appControllerUser->getUser())
|
||||
{
|
||||
$this->_response(
|
||||
sprintf(
|
||||
_('Error - %s'),
|
||||
WEBSITE_NAME
|
||||
),
|
||||
_('500'),
|
||||
_('Could not init user'),
|
||||
500
|
||||
);
|
||||
}
|
||||
|
||||
// Require account type selection
|
||||
if (is_null($user->public))
|
||||
{
|
||||
header(
|
||||
sprintf('Location: %s/welcome', trim(WEBSITE_URL, '/'))
|
||||
);
|
||||
}
|
||||
|
||||
// Render
|
||||
require_once __DIR__ . '/module/head.php';
|
||||
|
||||
$appControllerModuleHead = new AppControllerModuleHead(
|
||||
WEBSITE_URL,
|
||||
sprintf(
|
||||
_('Submit - %s'),
|
||||
WEBSITE_NAME
|
||||
),
|
||||
[
|
||||
[
|
||||
'rel' => 'stylesheet',
|
||||
'type' => 'text/css',
|
||||
'href' => sprintf(
|
||||
'assets/theme/default/css/common.css?%s',
|
||||
WEBSITE_CSS_VERSION
|
||||
),
|
||||
],
|
||||
[
|
||||
'rel' => 'stylesheet',
|
||||
'type' => 'text/css',
|
||||
'href' => sprintf(
|
||||
'assets/theme/default/css/framework.css?%s',
|
||||
WEBSITE_CSS_VERSION
|
||||
),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
require_once __DIR__ . '/module/profile.php';
|
||||
|
||||
$appControllerModuleProfile = new AppControllerModuleProfile(
|
||||
$appControllerUser
|
||||
);
|
||||
|
||||
require_once __DIR__ . '/module/header.php';
|
||||
|
||||
$appControllerModuleHeader = new AppControllerModuleHeader();
|
||||
|
||||
require_once __DIR__ . '/module/footer.php';
|
||||
|
||||
$appControllerModuleFooter = new AppControllerModuleFooter();
|
||||
|
||||
include __DIR__ . '../../view/theme/default/submit.phtml';
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue