Add telegram as source type in logger

This commit is contained in:
Matteo Gheza 2022-01-05 23:10:13 +01:00
parent 2fab02a23e
commit 5fb3401191
2 changed files with 6 additions and 0 deletions

View File

@ -78,6 +78,8 @@ function yesOrNo($value)
function telegramBotRouter() {
global $Bot;
define("running_telegram_bot_webhook", true);
initializeBot();
$Bot->addErrorHandler(function ($e) {
@ -102,6 +104,7 @@ function telegramBotRouter() {
['tmp_login_token' => $args[0]]
);
if($response === 1) {
logger("Utente collegato ad account telegram (".$message->from->id.")");
$message->chat->sendMessage(
"✅ Login avvenuto con successo!".
"\nPer ottenere informazioni sul profilo, utilizzare il comando /info".

View File

@ -95,6 +95,9 @@ function logger($action, $changed=null, $editor=null, $timestamp=null, $source_t
} else {
$ip = null;
}
if(defined("running_telegram_bot_webhook")) {
$source_type = "telegram";
}
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? mb_strimwidth($_SERVER['HTTP_USER_AGENT'], 0, 200, "...") : null;
$db->insert(
DB_PREFIX."_log",