HTML escaping bugfixes

This commit is contained in:
Daniil Gentili 2019-06-24 16:28:54 +02:00
parent a23d71b44f
commit 949bd194ed
4 changed files with 3 additions and 3 deletions

View File

@ -44,7 +44,6 @@ class EventHandler extends \danog\MadelineProto\EventHandler
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' => "<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') {
yield $this->messages->sendMedia(['peer' => $update, 'message' => $update['message']['message'], 'media' => $update]);
//yield $this->download_to_dir($update, '/tmp');

View File

@ -14,7 +14,7 @@
"danog/magicalserializer": "^1.0",
"phpseclib/phpseclib": "dev-master#5e7d39153270dfd19d585504b0a29ac65a62adf9 as 2.0.15",
"vlucas/phpdotenv": "^3",
"erusev/parsedown": "^1.6",
"erusev/parsedown": "^1.7",
"ext-mbstring": "*",
"ext-json": "*",
"ext-xml": "*",

View File

@ -50,6 +50,7 @@ function getUrl($constructor, $type)
{
$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)";
}
$old = getTL($argv[1]);

View File

@ -688,7 +688,7 @@ trait BotAPI
public function html_fixtags($text)
{
$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) {
foreach ($matches as $match) {
if (trim($match[1][0]) != '') {