isTrustedResourceDir example

$protocol = strtolower(substr($params['file'], 0, $protocol));
    }
    
    if (isset($template->smarty->security_policy)) {
        if ($protocol) {
            // remote resource (or php stream, …)             if(!$template->smarty->security_policy->isTrustedUri($params['file'])) {
                return;
            }
        } else {
            // local file             if(!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) {
                return;
            }
        }
    }

    $content = '';
    if ($protocol == 'http') {
        // http fetch         if($uri_parts = parse_url($params['file'])) {
            // set defaults             $host = $server_name = $uri_parts['host'];
            

    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
    {
        $source->filepath = $this->buildFilepath($source$_template);

        if ($source->filepath !== false) {
            if (is_object($source->smarty->security_policy)) {
                $source->smarty->security_policy->isTrustedResourceDir($source->filepath);
            }

            $source->uid = sha1($source->filepath);
            if ($source->smarty->compile_check) {
                $source->timestamp = @filemtime($source->filepath);
                $source->exists = !!$source->timestamp;
            }
        }
    }

    /** * populate Source Object with timestamp and exists from Resource * * @param Smarty_Template_Source $source source object * @return void */
$protocol = strtolower(substr($params['file'], 0, $protocol));
    }
    
    if (isset($template->smarty->security_policy)) {
        if ($protocol) {
            // remote resource (or php stream, …)             if(!$template->smarty->security_policy->isTrustedUri($params['file'])) {
                return;
            }
        } else {
            // local file             if(!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) {
                return;
            }
        }
    }

    if (!isset($params['width']) || !isset($params['height'])) {
        // FIXME: (rodneyrehm) getimagesize() loads the complete file off a remote resource, use custom [jpg,png,gif]header reader!         if (!$_image_data = @getimagesize($_image_path)) {
            if (!file_exists($_image_path)) {
                trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE);
                return;
            }

    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
    {
        $source->filepath = $this->buildFilepath($source$_template);

        if ($source->filepath !== false) {
            if (is_object($source->smarty->security_policy)) {
                $source->smarty->security_policy->isTrustedResourceDir($source->filepath);
            }

            $source->uid = sha1($source->filepath);
            if ($source->smarty->compile_check && !isset($source->timestamp)) {
                $source->timestamp = @filemtime($source->filepath);
                $source->exists = !!$source->timestamp;
            }
        }
    }

    /** * populate Source Object with timestamp and exists from Resource * * @param Smarty_Template_Source $source source object */
Home | Imprint | This part of the site doesn't use cookies.