From b174022f9a6de8ab51d1f4ec765d3a91b876169f Mon Sep 17 00:00:00 2001 From: JonatanRek Date: Wed, 29 Jul 2020 08:44:11 +0200 Subject: [PATCH] Tweeks of new Log System --- app/Bootstrap.php | 2 +- app/models/managers/LogManager.php | 2 +- app/models/managers/NotificationManager.php | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/Bootstrap.php b/app/Bootstrap.php index 267f939..9faf5db 100644 --- a/app/Bootstrap.php +++ b/app/Bootstrap.php @@ -51,7 +51,7 @@ class ErrorHandler { 'message' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), - 'trace' => $exception->getTraceAsString(), + 'trace' => $exception->getTrace(), ]; echo json_encode($message); diff --git a/app/models/managers/LogManager.php b/app/models/managers/LogManager.php index 7937e0a..082c646 100644 --- a/app/models/managers/LogManager.php +++ b/app/models/managers/LogManager.php @@ -24,7 +24,7 @@ class LogManager } public function setLevel($type = LogRecordTypess::WARNING){ - $logLevel = $type['level']; + $this->logLevel = $type['level']; } public function write($value, $type = LogRecordTypess::ERROR){ diff --git a/app/models/managers/NotificationManager.php b/app/models/managers/NotificationManager.php index dcb73d6..822792c 100644 --- a/app/models/managers/NotificationManager.php +++ b/app/models/managers/NotificationManager.php @@ -5,14 +5,16 @@ //TODO: Working timestamp to $title class NotificationManager { - public static function addSubscriber($userID = '', $token = ''){ - $notificationSubscriber = $subDeviceId = Db::loadOne('SELECT id FROM notifications WHERE token = ?;', array($token)); - if ($notificationSubscriber == ''){ - $notification = array ( - 'user_id' => $userID, - 'token' => $token, - ); - Db::add ('notifications', $notification); + public static function addSubscriber($userID, $token){ + if (!empty($userID) && !empty($token)) { + $notificationSubscriber = $subDeviceId = Db::loadOne('SELECT id FROM notifications WHERE token = ?;', array($token)); + if ($notificationSubscriber == ''){ + $notification = array ( + 'user_id' => $userID, + 'token' => $token, + ); + Db::add ('notifications', $notification); + } } }