From 1d5710b587eb9b1a2948ed9ae2a4f628a6f54572 Mon Sep 17 00:00:00 2001 From: yasha4u Date: Tue, 26 Apr 2022 17:14:17 +0300 Subject: [PATCH 1/3] Update manager.php fix for issue - 8 --- classes/manager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/manager.php b/classes/manager.php index 3ae9426..5ce5d38 100644 --- a/classes/manager.php +++ b/classes/manager.php @@ -304,6 +304,6 @@ private function send_api_command($command, $params = null) { $this->curl = new \curl(); } - return json_decode($this->curl->get('https://api.telegram.org/bot'.$this->config('sitebottoken').'/'.$command, $params)); + return json_decode($this->curl->get('https://api.telegram.org/bot'.$this->config('sitebottoken').'/'.$command, $params, ["CURLOPT_RETURNTRANSFER" => true])); } -} \ No newline at end of file +} From 78bd1cbd5db7a22e0ade50f4e98630b146230421 Mon Sep 17 00:00:00 2001 From: Ivan Bobrov Date: Fri, 21 Oct 2022 13:29:05 +0300 Subject: [PATCH 2/3] Update manager.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit добавлено убирание лишних тэгов из текста сообщения в telegram --- classes/manager.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/classes/manager.php b/classes/manager.php index 5ce5d38..c155014 100644 --- a/classes/manager.php +++ b/classes/manager.php @@ -67,7 +67,12 @@ public function send_message($message, $userid) { return true; } - $response = $this->send_api_command('sendMessage', ['chat_id' => $chatid, 'text' => $message]); + /** + * remove

...

and ... + */ + $msg = preg_replace('/

((.|\n)*)<\/p>/', '${1}', $message); + $msg = preg_replace('/]*>(.*)<\/a>/','${1}',$msg); + $response = $this->send_api_command('sendMessage', ['chat_id' => $chatid, 'text' => $msg]); return (!empty($response) && isset($response->ok) && ($response->ok == true)); } From d5250654ffa40669873b38f0143b1b8d37710120 Mon Sep 17 00:00:00 2001 From: Ivan Bobrov Date: Thu, 3 Nov 2022 16:58:10 +0300 Subject: [PATCH 3/3] Update manager.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit удаляет '
' из текста перед отсылкой в TG --- classes/manager.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/manager.php b/classes/manager.php index c155014..dd19e3e 100644 --- a/classes/manager.php +++ b/classes/manager.php @@ -68,10 +68,11 @@ public function send_message($message, $userid) { } /** - * remove

...

and ... + * remove

...

, ...,
*/ $msg = preg_replace('/

((.|\n)*)<\/p>/', '${1}', $message); $msg = preg_replace('/]*>(.*)<\/a>/','${1}',$msg); + $msg = str_replace('
', '', $msg); $response = $this->send_api_command('sendMessage', ['chat_id' => $chatid, 'text' => $msg]); return (!empty($response) && isset($response->ok) && ($response->ok == true)); }