Skip to content

Commit

Permalink
Set cache path for HTMLPurifier
Browse files Browse the repository at this point in the history
  • Loading branch information
endelwar committed Sep 10, 2024
1 parent 1bee4e8 commit 4b45d7f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mailscanner/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
// ForceUTF8
require_once __DIR__ . '/lib/ForceUTF8/Encoding.php';

// HTLMPurifier
// HTMLPurifier
require_once __DIR__ . '/lib/htmlpurifier/HTMLPurifier.standalone.php';

// Enforce SSL if SSL_ONLY=true
Expand Down Expand Up @@ -1100,6 +1100,10 @@ function dbquerydebug($link, $sql)
function sanitizeInput($string)
{
$config = HTMLPurifier_Config::createDefault();
$cachePath = rtrim(sys_get_temp_dir(), '/') . '/MailWatch';
if (is_dir($cachePath) || mkdir($cachePath)) {
$config->set('Cache.SerializerPath', $cachePath);
}
$purifier = new HTMLPurifier($config);

return $purifier->purify($string);
Expand Down

0 comments on commit 4b45d7f

Please sign in to comment.