HEX
Server: LiteSpeed
System: Linux d8 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: wbwebdes (3015)
PHP: 8.1.31
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/wbwebdes/domains/support.wb-webdesign.com/private_html/inc/htmlpurifier/HeskHTMLPurifier.php
<?php
/**
 *
 * This file is part of HESK - PHP Help Desk Software.
 *
 * (c) Copyright Klemen Stirn. All rights reserved.
 * https://www.hesk.com
 *
 * For the full copyright and license agreement information visit
 * https://www.hesk.com/eula.php
 *
 */

require(HESK_PATH . 'inc/htmlpurifier/HTMLPurifier.standalone.php');

class HeskHTMLPurifier extends HTMLPurifier
{
    private $allowIframes;
    private $cacheDir;

    public function __construct($cacheDir = 'cache', $allowIframes = 1)
    {
        $this->allowIframes = $allowIframes;
        $this->cacheDir = $this->setupCacheDir($cacheDir);
    }

    public function heskPurify($content)
    {
        $config = HTMLPurifier_Config::createDefault();
        $config->set('Attr.EnableID', true);
        $config->set('Attr.AllowedRel', array('follow', 'referrer', 'nofollow', 'noreferrer') );
        $config->set('Attr.AllowedFrameTargets', array('_blank', '_self', '_parent', '_top') );
        $config->set('Cache.SerializerPath', $this->cacheDir);
        $config->set('URI.AllowedSchemes', array(
                'http' => true,
                'https' => true,
                'mailto' => true,
                'ftp' => true,
                'nntp' => true,
                'news' => true,
                'tel' => true,
                'data' => true,
            )
        );

        if ($this->allowIframes)
        {
            require(HESK_PATH . 'inc/htmlpurifier/custom/heskIframe.php');
            $config->set('Filter.Custom', array(new HTMLPurifier_Filter_HeskIframe()));
        }

        $purifier = new HTMLPurifier($config);
        return $purifier->purify($content);
    }

    private function setupCacheDir($cache_dir)
    {
        $cache_dir = dirname(dirname(dirname(__FILE__))).'/'.$cache_dir.'/hp';

        if (is_dir($cache_dir) || ( @mkdir($cache_dir, 0777) && is_writable($cache_dir) ) )
        {
            return $cache_dir;
        }

        return null;
    }
}