[*] новые фичи 2

This commit is contained in:
rsgrinko committed 2022-04-27 12:58:49 +03:00
1 parent 98f3b1416d
commit 436839ac9a
2 files changed
+27 -14

No files matched your search

+22 -1
View File
@@ -3,6 +3,8 @@
use Core\Models\User;
use Core\Helpers\Cache;
use Core\Template;
use Core\ExternalServices\Telegram;
use Core\CoreException;
if (session_status() == PHP_SESSION_NONE) {
session_start();
@@ -41,7 +43,26 @@
Cache::init(ROOT_PATH . '/core/cache/', true);
// очистка кэша
if(isset($_REQUEST['clear_cache']) && $_REQUEST['clear_cache'] === CODE_VALUE_Y) {
Cache::flush();
}
// выход из системы
if (isset($_REQUEST['logout']) && $_REQUEST['logout'] === CODE_VALUE_Y) {
User::logout();
}
Telegram::init('5232660453:AAGfMWu6EcRfBGSSURJsEEvGPmAqhCyzYHU', './');
$userId = User::getCurrentUserId();
if(!empty($userId)) {
try {
$USER = new User($userId);
} catch (CoreException $e) {
$USER = null;
}
} else {
$USER = null;
}
+5 -13
View File
@@ -45,24 +45,16 @@
</div>
</nav>
<div class="container">
<div class="row justify-content-md-center">
<div class="col-md">
<?php
Telegram::init('5232660453:AAGfMWu6EcRfBGSSURJsEEvGPmAqhCyzYHU', './');
$userId = User::getCurrentUserId();
try {
$user = new User($userId);
User::authorize((int)$userId);
echo 'Current user id: ' . $userId . '<br>';
} catch (CoreException $e) {
echo $e->showTrace();
}
echo '<br><br>';
if (User::isAuthorized()) {
echo str_replace('<table style="', '<table style="width:100%;', SystemFunctions::arrayToTable($user->getAllUserData(), 'Информация о пользователе'));
global $USER;
echo str_replace('<table style="', '<table style="width:100%;', SystemFunctions::arrayToTable($USER->getAllUserData(), 'Информация о пользователе'));
}
//echo str_replace('<table style="', '<table style="width:100%;', SystemFunctions::arrayToTable(Cache::getCacheInfo(), 'Информация о кэше'));