HTML escaping bugfixes
This commit is contained in:
parent
a23d71b44f
commit
949bd194ed
1
bot.php
1
bot.php
|
@ -44,7 +44,6 @@ class EventHandler extends \danog\MadelineProto\EventHandler
|
||||||
|
|
||||||
try {
|
try {
|
||||||
yield $this->messages->sendMessage(['peer' => $update, 'message' => "<code>$res</code>", 'reply_to_msg_id' => isset($update['message']['id']) ? $update['message']['id'] : null, 'parse_mode' => 'HTML']); //'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]);
|
yield $this->messages->sendMessage(['peer' => $update, 'message' => "<code>$res</code>", 'reply_to_msg_id' => isset($update['message']['id']) ? $update['message']['id'] : null, 'parse_mode' => 'HTML']); //'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]);
|
||||||
yield $this->messages->sendMessage(['peer' => $update, 'message' => "<blockquote>owo uwu</blockquote>", 'reply_to_msg_id' => isset($update['message']['id']) ? $update['message']['id'] : null, 'parse_mode' => 'HTML']); //'entities' => [['_' => 'messageEntityPre', 'offset' => 0, 'length' => strlen($res), 'language' => 'json']]]);
|
|
||||||
if (isset($update['message']['media']) && $update['message']['media']['_'] !== 'messageMediaGame') {
|
if (isset($update['message']['media']) && $update['message']['media']['_'] !== 'messageMediaGame') {
|
||||||
yield $this->messages->sendMedia(['peer' => $update, 'message' => $update['message']['message'], 'media' => $update]);
|
yield $this->messages->sendMedia(['peer' => $update, 'message' => $update['message']['message'], 'media' => $update]);
|
||||||
//yield $this->download_to_dir($update, '/tmp');
|
//yield $this->download_to_dir($update, '/tmp');
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"danog/magicalserializer": "^1.0",
|
"danog/magicalserializer": "^1.0",
|
||||||
"phpseclib/phpseclib": "dev-master#5e7d39153270dfd19d585504b0a29ac65a62adf9 as 2.0.15",
|
"phpseclib/phpseclib": "dev-master#5e7d39153270dfd19d585504b0a29ac65a62adf9 as 2.0.15",
|
||||||
"vlucas/phpdotenv": "^3",
|
"vlucas/phpdotenv": "^3",
|
||||||
"erusev/parsedown": "^1.6",
|
"erusev/parsedown": "^1.7",
|
||||||
"ext-mbstring": "*",
|
"ext-mbstring": "*",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-xml": "*",
|
"ext-xml": "*",
|
||||||
|
|
|
@ -50,6 +50,7 @@ function getUrl($constructor, $type)
|
||||||
{
|
{
|
||||||
$changed = str_replace('.', '_', $constructor);
|
$changed = str_replace('.', '_', $constructor);
|
||||||
|
|
||||||
|
return "[$constructor](https://github.com/danog/MadelineProtoDocs/blob/geochats/docs/API_docs/$type/$changed.md)";
|
||||||
return "[$constructor](https://docs.madelineproto.xyz/API_docs/$type/$changed.html)";
|
return "[$constructor](https://docs.madelineproto.xyz/API_docs/$type/$changed.html)";
|
||||||
}
|
}
|
||||||
$old = getTL($argv[1]);
|
$old = getTL($argv[1]);
|
||||||
|
|
|
@ -688,7 +688,7 @@ trait BotAPI
|
||||||
public function html_fixtags($text)
|
public function html_fixtags($text)
|
||||||
{
|
{
|
||||||
$diff = 0;
|
$diff = 0;
|
||||||
preg_match_all('#(.*?)(<(u|s|a|b|\bstrong\b|\bblockquote\b|\bstrike\b|\bdel\b|\bem\b|i|\bcode\b|\bpre\b)[^>]*>)(.*?)(<\s*/\s*\3>)#is', $text, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
|
preg_match_all('#(.*?)(<(\bu\b|\bs\b|\ba\b|\bb\b|\bstrong\b|\bblockquote\b|\bstrike\b|\bdel\b|\bem\b|i|\bcode\b|\bpre\b)[^>]*>)(.*?)([<]\s*/\s*\3[>])#is', $text, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
|
||||||
if ($matches) {
|
if ($matches) {
|
||||||
foreach ($matches as $match) {
|
foreach ($matches as $match) {
|
||||||
if (trim($match[1][0]) != '') {
|
if (trim($match[1][0]) != '') {
|
||||||
|
|
Loading…
Reference in New Issue