From 48f64d9a567ee4514c74b072466b0bf0986cff23 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Sat, 7 Dec 2019 11:40:30 +0000 Subject: [PATCH] add config value, fix warning if user_id is not found --- include/config/global.inc.dist.php | 3 ++- include/pages/tghook.inc.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/config/global.inc.dist.php b/include/config/global.inc.dist.php index e6c7095..1ae617f 100644 --- a/include/config/global.inc.dist.php +++ b/include/config/global.inc.dist.php @@ -317,6 +317,7 @@ $config['system']['load']['max'] = 10.0; /** * Telegram notificator configuration - * To use push notifications via Telegram you need create bot and set here its API key + * To use push notifications via Telegram you need create bot and set here its API key and username (without '@') **/ $config['push']['telegram']['api_key'] = ''; +$config['push']['telegram']['bot_username'] = ''; diff --git a/include/pages/tghook.inc.php b/include/pages/tghook.inc.php index 0af1e49..f28f95e 100644 --- a/include/pages/tghook.inc.php +++ b/include/pages/tghook.inc.php @@ -42,7 +42,8 @@ $prepareResponse = function ($message) use ($chatID, $api, $bitcoin, $block, $se // Get userID in MPOS by chatID $stmt = $mysqli->prepare("SELECT account_id as user_id FROM user_settings WHERE value LIKE '%".$chatID."%' LIMIT 1"); if($stmt && $stmt->execute() && $result = $stmt->get_result()) - $user_id = $result->fetch_object()->user_id; + $row = $result->fetch_object(); + $user_id = (!empty($row->user_id)) ? $row->user_id : 0; if ( ! $interval = $setting->getValue('statistics_ajax_data_interval')) $interval = 300; $response = '';