/
memoryspeak
/
MemoryspeakServer
Обзор
Документация
Войти
/
memoryspeak
/
MemoryspeakServer
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
controllers/InputController.php
38 строк
995 B
memoryspeak
refactor share note
14 дек 2025, 11:31
14 дек 2025, 11:31
3e63e9d
Код
Авторство
О чём код?
<?php require_once '../config.php'; require_once '../utils/AuthException.php'; require_once '../services/LoggerService.php'; require_once '../services/JWTService.php'; class InputController { public $input; public $deviceInfo; public $platform; public $user; public function __construct($input, $database, $headers) { try { $this->input = $input; $authHeader = $headers['Authorization'] ?? ''; $this->deviceInfo = $headers['Device-Info'] ?? ''; $this->platform = $headers['Platform'] ?? ''; $input_jwt = JWTService::extractJWT($authHeader); $verifyJWT = JWTService::verifyJWT($input_jwt, JWT_SECRET_KEY); $this->user = $database->getAuthenticatedUser($verifyJWT); if ($this->user['id'] === 0) { throw new AuthException($this->user['exception']); } } catch(Exception $e) { LoggerService::write(debug_backtrace(), $e->getMessage()); throw $e; } } } ?>