From 46c1e38ea802e9a17de5e8cf2716fe66dfe9117c Mon Sep 17 00:00:00 2001 From: Maksym Date: Wed, 18 Jan 2023 18:24:00 +0100 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../class/DarksLight2/Training/TrainingManager.php | 6 +----- api/index.php | 2 +- main.php | 9 +++------ modules_data/_umenie.php | 13 +++++++++---- modules_data/steps/step.php | 6 +----- 5 files changed, 15 insertions(+), 21 deletions(-) diff --git a/_incl_data/class/DarksLight2/Training/TrainingManager.php b/_incl_data/class/DarksLight2/Training/TrainingManager.php index e61df599..1cb3060a 100644 --- a/_incl_data/class/DarksLight2/Training/TrainingManager.php +++ b/_incl_data/class/DarksLight2/Training/TrainingManager.php @@ -14,8 +14,6 @@ use DarksLight2\Training\Steps\MyUserThirdQuest; use DarksLight2\Training\Steps\MyUserThirdStep; use DarksLight2\Traits\Singleton; use PassGen; -use PDO; -use stdClass; use User; class TrainingManager @@ -147,10 +145,8 @@ class TrainingManager private function generateToken($length = 16) { - $token = PassGen::new($length); - Db::run('UPDATE user_training SET api_token = ? WHERE user_id = ?', [ - $token, + PassGen::new($length), $this->user_id ]); } diff --git a/api/index.php b/api/index.php index 190c528b..408a93a0 100644 --- a/api/index.php +++ b/api/index.php @@ -63,7 +63,7 @@ if(!empty($user->info)) { case 'go_back': $training->previousStep(); $training->store(); - die(json_encode(['status' => 'ok', 'message' => 'Вы указал не верный ответ!'])); + die(json_encode(['status' => 'ok', 'message' => 'Вы указали не верный ответ!'])); } } diff --git a/main.php b/main.php index ec4a2d6c..54dcf0cf 100644 --- a/main.php +++ b/main.php @@ -36,7 +36,6 @@ if (!defined('GAME_VERSION')) { } use Core\{Config, Database, Db}; -use DarksLight2\Training\TrainingException; use DarksLight2\Training\TrainingManager; $training_manager = TrainingManager::getInstance(User::start()->info['id']); @@ -60,6 +59,8 @@ $u = User::start(); $filter = new Filter(); $q = new Quests; +$training_manager = TrainingManager::getInstance($u->info['id']); + /** Восстанавливаем всем ботам, которые не в бою здоровье до максимума. */ Db::exec( 'update stats set hpNow = hpAll, mpNow = mpAll @@ -562,11 +563,7 @@ $spl = $spl['exp']; echo ' '; -try { - $training_manager->render(); -} catch (TrainingException $e) { - echo $e->getMessage(); -} +$training_manager->render(); ?>