- Fix: Notifiable-Trait zum User-Model hinzugefuegt (behebt notify()-500er) - Installer: SMTP-Verbindungstest mit EsmtpTransport + Ueberspringen-Link - Admin: Neuer E-Mail-Tab mit SMTP-Konfiguration + Verbindungstest - Admin: Lazy Quill-Initialisierung (nur sichtbare Locale wird geladen) - Uebersetzungen: 17 neue Mail-Keys in allen 6 Sprachen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
917 B
PHP
Executable File
31 lines
917 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use HTMLPurifier;
|
|
use HTMLPurifier_Config;
|
|
|
|
class HtmlSanitizerService
|
|
{
|
|
private HTMLPurifier $purifier;
|
|
|
|
public function __construct()
|
|
{
|
|
$config = HTMLPurifier_Config::createDefault();
|
|
$config->set('HTML.Allowed', 'p,br,strong,b,em,i,u,ul,ol,li,a[href|target],h2[id],h3[id],h4[id],blockquote,span[style]');
|
|
$config->set('CSS.AllowedProperties', 'color,background-color');
|
|
$config->set('HTML.TargetBlank', true);
|
|
$config->set('AutoFormat.RemoveEmpty', true);
|
|
// DOM-Clobbering-Schutz: IDs in User-Content prefixen (V18)
|
|
$config->set('Attr.IDPrefix', 'uc-');
|
|
$config->set('Cache.SerializerPath', storage_path('app/purifier'));
|
|
|
|
$this->purifier = new HTMLPurifier($config);
|
|
}
|
|
|
|
public function sanitize(string $dirtyHtml): string
|
|
{
|
|
return $this->purifier->purify($dirtyHtml);
|
|
}
|
|
}
|