mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-01-11 15:37:57 +00:00
update dependencies
This commit is contained in:
parent
0d840a5ab5
commit
8b8eb74835
@ -2,57 +2,15 @@
|
||||
|
||||
class AppControllerIndex
|
||||
{
|
||||
private $_db;
|
||||
private $_sphinx;
|
||||
private $_memory;
|
||||
private $_user;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
require_once __DIR__ . '/../../library/database.php';
|
||||
require_once __DIR__ . '/../../library/sphinx.php';
|
||||
require_once __DIR__ . '/../../library/scrapeer.php';
|
||||
require_once __DIR__ . '/../../library/time.php';
|
||||
require_once __DIR__ . '/../../library/curl.php';
|
||||
require_once __DIR__ . '/../../library/valid.php';
|
||||
require_once __DIR__ . '/../../library/filter.php';
|
||||
require_once __DIR__ . '/user.php';
|
||||
|
||||
require_once __DIR__ . '/../../../vendor/autoload.php';
|
||||
|
||||
try
|
||||
{
|
||||
$this->_db = new Database(
|
||||
DB_HOST,
|
||||
DB_PORT,
|
||||
DB_NAME,
|
||||
DB_USERNAME,
|
||||
DB_PASSWORD
|
||||
$this->_user = new AppControllerUser(
|
||||
$_SERVER['REMOTE_ADDR']
|
||||
);
|
||||
|
||||
$this->_sphinx = new Sphinx(
|
||||
SPHINX_HOST,
|
||||
SPHINX_PORT
|
||||
);
|
||||
|
||||
$this->_memory = new \Yggverse\Cache\Memory(
|
||||
MEMCACHED_HOST,
|
||||
MEMCACHED_PORT,
|
||||
MEMCACHED_NAMESPACE,
|
||||
MEMCACHED_TIMEOUT + time()
|
||||
);
|
||||
}
|
||||
|
||||
catch (Exception $error)
|
||||
{
|
||||
require_once __DIR__ . '/error/500.php';
|
||||
|
||||
$controller = new AppControllerError500(
|
||||
print_r($error, true)
|
||||
);
|
||||
|
||||
$controller->render();
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
@ -68,16 +26,16 @@ class AppControllerIndex
|
||||
require_once __DIR__ . '/module/head.php';
|
||||
|
||||
$appControllerModuleHead = new AppControllerModuleHead(
|
||||
WEBSITE_URL,
|
||||
Environment::config('website')->url,
|
||||
$page > 1 ?
|
||||
sprintf(
|
||||
_('Page %s - BitTorrent Registry for Yggdrasil - %s'),
|
||||
$page,
|
||||
WEBSITE_NAME
|
||||
Environment::config('website')->name
|
||||
) :
|
||||
sprintf(
|
||||
_('%s - BitTorrent Registry for Yggdrasil'),
|
||||
WEBSITE_NAME
|
||||
Environment::config('website')->name
|
||||
),
|
||||
[
|
||||
[
|
||||
@ -101,7 +59,9 @@ class AppControllerIndex
|
||||
|
||||
require_once __DIR__ . '/module/profile.php';
|
||||
|
||||
$appControllerModuleProfile = new AppControllerModuleProfile($user->userId);
|
||||
$appControllerModuleProfile = new AppControllerModuleProfile(
|
||||
$this->_user
|
||||
);
|
||||
|
||||
require_once __DIR__ . '/module/header.php';
|
||||
|
||||
|
@ -30,7 +30,7 @@ class AppControllerResponse
|
||||
require_once __DIR__ . '/module/head.php';
|
||||
|
||||
$appControllerModuleHead = new AppControllerModuleHead(
|
||||
WEBSITE_URL,
|
||||
Environment::config('website')->url,
|
||||
$this->_title,
|
||||
[
|
||||
[
|
||||
|
@ -6,13 +6,14 @@ class AppControllerWelcome
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
require_once __DIR__ . '/../model/user.php';
|
||||
require_once __DIR__ . '/user.php';
|
||||
|
||||
$this->_user = new AppModelUser(
|
||||
$this->_user = new AppControllerUser(
|
||||
$_SERVER['REMOTE_ADDR']
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private function _response(string $title, string $h1, string $text, int $code = 200)
|
||||
{
|
||||
require_once __DIR__ . '/response.php';
|
||||
@ -31,12 +32,12 @@ class AppControllerWelcome
|
||||
|
||||
public function render()
|
||||
{
|
||||
if (!$user = $this->_user->get())
|
||||
if (!$address = $this->_user->getAddress())
|
||||
{
|
||||
$this->_response(
|
||||
sprintf(
|
||||
_('Error - %s'),
|
||||
WEBSITE_NAME
|
||||
Environment::config('website')->name
|
||||
),
|
||||
_('500'),
|
||||
_('Could not init user'),
|
||||
@ -44,17 +45,17 @@ class AppControllerWelcome
|
||||
);
|
||||
}
|
||||
|
||||
if (!is_null($user->public))
|
||||
if (!is_null($this->_user->getPublic()))
|
||||
{
|
||||
$this->_response(
|
||||
sprintf(
|
||||
_('Welcome back - %s'),
|
||||
WEBSITE_NAME
|
||||
Environment::config('website')->name
|
||||
),
|
||||
_('Welcome back!'),
|
||||
sprintf(
|
||||
_('You already have selected account type to %s'),
|
||||
$user->public ? _('Distributed') : _('Local')
|
||||
$this->_user->getPublic() ? _('Distributed') : _('Local')
|
||||
),
|
||||
405
|
||||
);
|
||||
@ -67,7 +68,7 @@ class AppControllerWelcome
|
||||
$this->_response(
|
||||
sprintf(
|
||||
_('Success - %s'),
|
||||
WEBSITE_NAME
|
||||
Environment::config('website')->name
|
||||
),
|
||||
_('Success!'),
|
||||
sprintf(
|
||||
@ -81,10 +82,10 @@ class AppControllerWelcome
|
||||
require_once __DIR__ . '/module/head.php';
|
||||
|
||||
$appControllerModuleHead = new AppControllerModuleHead(
|
||||
WEBSITE_URL,
|
||||
Environment::config('website')->url,
|
||||
sprintf(
|
||||
_('Welcome to %s'),
|
||||
WEBSITE_NAME
|
||||
Environment::config('website')->name
|
||||
),
|
||||
[
|
||||
[
|
||||
|
@ -13,7 +13,7 @@
|
||||
</div>
|
||||
<p class="margin-b-8"><?php echo _('YGGtracker uses Yggdrasil address to identify users without registration') ?></p>
|
||||
<p class="margin-b-16"><?php echo _('address below could be shared with independent nodes to allow you manage own content everywhere') ?></p>
|
||||
<h2 class="margin-b-16"><?php echo $user->address ?></h2>
|
||||
<h2 class="margin-b-16"><?php echo $address ?></h2>
|
||||
<form name="public" action="welcome" method="post">
|
||||
<div class="margin-b-16">
|
||||
<label class="text-color-green margin-y-8 margin-x-4" for="public-1">
|
||||
|
Loading…
Reference in New Issue
Block a user