1
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2025-08-09 05:02:44 +03:00

update smarty (4.1.1 -> 4.3.0) (add PHP 8.2 support, fixes for PHP 8.1; also fixes #541 where using a Turkish locale broke smarty's autoloader)

This commit is contained in:
David Goodwin
2022-12-04 19:35:33 +00:00
parent 58e9538e6a
commit b76260d3d3
45 changed files with 514 additions and 285 deletions

View File

@@ -19,6 +19,7 @@
/**
* This class does contain the security settings
*/
#[\AllowDynamicProperties]
class Smarty_Security
{
@@ -105,7 +106,7 @@ class Smarty_Security
*
* @var array
*/
public $php_modifiers = array('escape', 'count', 'nl2br',);
public $php_modifiers = array('escape', 'count', 'sizeof', 'nl2br',);
/**
* This is an array of allowed tags.
@@ -328,7 +329,7 @@ class Smarty_Security
*
* @param string $modifier_name
* @param object $compiler compiler object
*
* @deprecated
* @return boolean true if modifier is trusted
*/
public function isTrustedPhpModifier($modifier_name, $compiler)
@@ -555,35 +556,6 @@ class Smarty_Security
throw new SmartyException("URI '{$uri}' not allowed by security setting");
}
/**
* Check if directory of file resource is trusted.
*
* @param string $filepath
*
* @return boolean true if directory is trusted
* @throws SmartyException if PHP directory is not trusted
*/
public function isTrustedPHPDir($filepath)
{
if (empty($this->trusted_dir)) {
throw new SmartyException("directory '{$filepath}' not allowed by security setting (no trusted_dir specified)");
}
// check if index is outdated
if (!$this->_trusted_dir || $this->_trusted_dir !== $this->trusted_dir) {
$this->_php_resource_dir = array();
$this->_trusted_dir = $this->trusted_dir;
foreach ((array)$this->trusted_dir as $directory) {
$directory = $this->smarty->_realpath($directory . '/', true);
$this->_php_resource_dir[ $directory ] = true;
}
}
$addPath = $this->_checkDir($filepath, $this->_php_resource_dir);
if ($addPath !== false) {
$this->_php_resource_dir = array_merge($this->_php_resource_dir, $addPath);
}
return true;
}
/**
* Remove old directories and its sub folders, add new directories
*