mirror of
https://github.com/grocy/grocy.git
synced 2025-04-30 10:05:45 +00:00
Allow img style attribute in HTML filter (fixes #2011)
This commit is contained in:
parent
121050960c
commit
fa49b449dd
@ -211,12 +211,13 @@ class BaseController
|
|||||||
{
|
{
|
||||||
$htmlPurifierConfig = \HTMLPurifier_Config::createDefault();
|
$htmlPurifierConfig = \HTMLPurifier_Config::createDefault();
|
||||||
$htmlPurifierConfig->set('Cache.SerializerPath', GROCY_DATAPATH . '/viewcache');
|
$htmlPurifierConfig->set('Cache.SerializerPath', GROCY_DATAPATH . '/viewcache');
|
||||||
$htmlPurifierConfig->set('HTML.Allowed', 'div,b,strong,i,em,u,a[href|title|target],iframe[src|width|height|frameborder],ul,ol,li,p[style],br,span[style],img[width|height|alt|src],table[border|width|style],tbody,tr,td,th,blockquote,*[style|class|id],h1,h2,h3,h4,h5,h6');
|
$htmlPurifierConfig->set('HTML.Allowed', 'div,b,strong,i,em,u,a[href|title|target],iframe[src|width|height|frameborder],ul,ol,li,p[style],br,span[style],img[style|width|height|alt|src],table[border|width|style],tbody,tr,td,th,blockquote,*[style|class|id],h1,h2,h3,h4,h5,h6');
|
||||||
$htmlPurifierConfig->set('Attr.EnableID', true);
|
$htmlPurifierConfig->set('Attr.EnableID', true);
|
||||||
$htmlPurifierConfig->set('HTML.SafeIframe', true);
|
$htmlPurifierConfig->set('HTML.SafeIframe', true);
|
||||||
$htmlPurifierConfig->set('CSS.AllowedProperties', 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align');
|
$htmlPurifierConfig->set('CSS.AllowedProperties', 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align,width,height');
|
||||||
$htmlPurifierConfig->set('URI.AllowedSchemes', ['data' => true, 'http' => true, 'https' => true]);
|
$htmlPurifierConfig->set('URI.AllowedSchemes', ['data' => true, 'http' => true, 'https' => true]);
|
||||||
$htmlPurifierConfig->set('URI.SafeIframeRegexp', '%^.*%'); // Allow any iframe source
|
$htmlPurifierConfig->set('URI.SafeIframeRegexp', '%^.*%'); // Allow any iframe source
|
||||||
|
$htmlPurifierConfig->set('CSS.MaxImgLength', null);
|
||||||
|
|
||||||
self::$htmlPurifierInstance = new \HTMLPurifier($htmlPurifierConfig);
|
self::$htmlPurifierInstance = new \HTMLPurifier($htmlPurifierConfig);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user