This commit is contained in:
JoshyPHP 2025-05-18 22:47:50 +02:00 committed by GitHub
commit ec4edc642d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -76,20 +76,16 @@ abstract class base implements reparser_interface
} }
// Those BBCodes are disabled based on context and user permissions and that value is never // Those BBCodes are disabled based on context and user permissions and that value is never
// stored in the database. Here we test whether they were used in the original text. // stored in the database. However, when a user attempts to post a message that contains an
$bbcodes = array('flash', 'img', 'quote', 'url'); // unauthorized BBCode, the message is rejected. Therefore, messages found in the database
foreach ($bbcodes as $bbcode) // should not contain any unauthorized BBCodes, which means it should be safe to enable all
{ // of them in bulk if they are not explicitly disabled in the record.
$field_name = 'enable_' . $bbcode . '_bbcode'; $record += [
$record[$field_name] = $this->guess_bbcode($record, $bbcode); 'enable_flash_bbcode' => true,
} 'enable_img_bbcode' => true,
'enable_quote_bbcode' => true,
// Magic URLs are tied to the URL BBCode, that's why if magic URLs are enabled we make sure 'enable_url_bbcode' => true,
// that the URL BBCode is also enabled ];
if ($record['enable_magic_url'])
{
$record['enable_url_bbcode'] = true;
}
return $record; return $record;
} }