1
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2025-08-07 17:42:53 +03:00

update Smarty to v3.1.33 - "This release does cover security issue CVE-2018-16831, other bug fixes (see changelog.txt) and adds a new feature of the {capture} tag (see NEW_FEATURES.txt)."

This commit is contained in:
David Goodwin
2019-09-25 13:55:07 +01:00
parent 7360407b73
commit 907bd7ee46
199 changed files with 5335 additions and 4857 deletions

View File

@@ -5,41 +5,39 @@
*
* Load extensions dynamically
*
*
* @package Smarty
* @subpackage PluginsInternal
* @author Uwe Tews
*
* Runtime extensions
* @property Smarty_Internal_Runtime_CacheModify $_cacheModify
* @property Smarty_Internal_Runtime_CacheResourceFile $_cacheResourceFile
* @property Smarty_Internal_Runtime_Capture $_capture
* @property Smarty_Internal_Runtime_CodeFrame $_codeFrame
* @property Smarty_Internal_Runtime_FilterHandler $_filterHandler
* @property Smarty_Internal_Runtime_Foreach $_foreach
* @property Smarty_Internal_Runtime_GetIncludePath $_getIncludePath
* @property Smarty_Internal_Runtime_Make_Nocache $_make_nocache
* @property Smarty_Internal_Runtime_UpdateCache $_updateCache
* @property Smarty_Internal_Runtime_UpdateScope $_updateScope
* @property Smarty_Internal_Runtime_TplFunction $_tplFunction
* @property Smarty_Internal_Runtime_WriteFile $_writeFile
* @property Smarty_Internal_Runtime_CacheModify $_cacheModify
* @property Smarty_Internal_Runtime_CacheResourceFile $_cacheResourceFile
* @property Smarty_Internal_Runtime_Capture $_capture
* @property Smarty_Internal_Runtime_CodeFrame $_codeFrame
* @property Smarty_Internal_Runtime_FilterHandler $_filterHandler
* @property Smarty_Internal_Runtime_Foreach $_foreach
* @property Smarty_Internal_Runtime_GetIncludePath $_getIncludePath
* @property Smarty_Internal_Runtime_Make_Nocache $_make_nocache
* @property Smarty_Internal_Runtime_UpdateCache $_updateCache
* @property Smarty_Internal_Runtime_UpdateScope $_updateScope
* @property Smarty_Internal_Runtime_TplFunction $_tplFunction
* @property Smarty_Internal_Runtime_WriteFile $_writeFile
*
* Method extensions
* @property Smarty_Internal_Method_GetTemplateVars $getTemplateVars
* @property Smarty_Internal_Method_Append $append
* @property Smarty_Internal_Method_AppendByRef $appendByRef
* @property Smarty_Internal_Method_AssignGlobal $assignGlobal
* @property Smarty_Internal_Method_AssignByRef $assignByRef
* @property Smarty_Internal_Method_LoadFilter $loadFilter
* @property Smarty_Internal_Method_LoadPlugin $loadPlugin
* @property Smarty_Internal_Method_RegisterFilter $registerFilter
* @property Smarty_Internal_Method_RegisterObject $registerObject
* @property Smarty_Internal_Method_RegisterPlugin $registerPlugin
* @property mixed|\Smarty_Template_Cached configLoad
* @property Smarty_Internal_Method_GetTemplateVars $getTemplateVars
* @property Smarty_Internal_Method_Append $append
* @property Smarty_Internal_Method_AppendByRef $appendByRef
* @property Smarty_Internal_Method_AssignGlobal $assignGlobal
* @property Smarty_Internal_Method_AssignByRef $assignByRef
* @property Smarty_Internal_Method_LoadFilter $loadFilter
* @property Smarty_Internal_Method_LoadPlugin $loadPlugin
* @property Smarty_Internal_Method_RegisterFilter $registerFilter
* @property Smarty_Internal_Method_RegisterObject $registerObject
* @property Smarty_Internal_Method_RegisterPlugin $registerPlugin
* @property mixed|\Smarty_Template_Cached configLoad
*/
class Smarty_Internal_Extension_Handler
{
public $objType = null;
/**
@@ -48,9 +46,11 @@ class Smarty_Internal_Extension_Handler
*
* @var array
*/
private $_property_info = array('AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0,
'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0,
'TemplateVars' => 0, 'Literals' => 'Literals',);#
private $_property_info = array(
'AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0,
'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0,
'TemplateVars' => 0, 'Literals' => 'Literals',
);//
private $resolvedProperties = array();
@@ -62,7 +62,6 @@ class Smarty_Internal_Extension_Handler
* @param array $args argument array
*
* @return mixed
* @throws SmartyException
*/
public function _callExternalMethod(Smarty_Internal_Data $data, $name, $args)
{
@@ -70,9 +69,10 @@ class Smarty_Internal_Extension_Handler
$smarty = isset($data->smarty) ? $data->smarty : $data;
if (!isset($smarty->ext->$name)) {
if (preg_match('/^((set|get)|(.*?))([A-Z].*)$/', $name, $match)) {
$basename = $this->upperCase($match[4]);
if (!isset($smarty->ext->$basename) && isset($this->_property_info[ $basename ]) &&
is_string($this->_property_info[ $basename ])) {
$basename = $this->upperCase($match[ 4 ]);
if (!isset($smarty->ext->$basename) && isset($this->_property_info[ $basename ])
&& is_string($this->_property_info[ $basename ])
) {
$class = 'Smarty_Internal_Method_' . $this->_property_info[ $basename ];
if (class_exists($class)) {
$classObj = new $class();
@@ -82,40 +82,45 @@ class Smarty_Internal_Extension_Handler
}
}
}
if (!empty($match[2]) && !isset($smarty->ext->$name)) {
if (!empty($match[ 2 ]) && !isset($smarty->ext->$name)) {
$class = 'Smarty_Internal_Method_' . $this->upperCase($name);
if (!class_exists($class)) {
$objType = $data->_objType;
$propertyType = false;
if (!isset($this->resolvedProperties[ $match[0] ][ $objType ])) {
$property = isset($this->resolvedProperties['property'][ $basename ]) ?
$this->resolvedProperties['property'][ $basename ] :
$property = $this->resolvedProperties['property'][ $basename ] = strtolower(join('_',
preg_split('/([A-Z][^A-Z]*)/',
$basename,
-1,
PREG_SPLIT_NO_EMPTY |
PREG_SPLIT_DELIM_CAPTURE)));
if (!isset($this->resolvedProperties[ $match[ 0 ] ][ $objType ])) {
$property = isset($this->resolvedProperties[ 'property' ][ $basename ]) ?
$this->resolvedProperties[ 'property' ][ $basename ] :
$property = $this->resolvedProperties[ 'property' ][ $basename ] = strtolower(
join(
'_',
preg_split(
'/([A-Z][^A-Z]*)/',
$basename,
-1,
PREG_SPLIT_NO_EMPTY |
PREG_SPLIT_DELIM_CAPTURE
)
)
);
if ($property !== false) {
if (property_exists($data, $property)) {
$propertyType = $this->resolvedProperties[ $match[0] ][ $objType ] = 1;
} else if (property_exists($smarty, $property)) {
$propertyType = $this->resolvedProperties[ $match[0] ][ $objType ] = 2;
$propertyType = $this->resolvedProperties[ $match[ 0 ] ][ $objType ] = 1;
} elseif (property_exists($smarty, $property)) {
$propertyType = $this->resolvedProperties[ $match[ 0 ] ][ $objType ] = 2;
} else {
$this->resolvedProperties['property'][ $basename ] = $property = false;
$this->resolvedProperties[ 'property' ][ $basename ] = $property = false;
}
}
} else {
$propertyType = $this->resolvedProperties[ $match[0] ][ $objType ];
$property = $this->resolvedProperties['property'][ $basename ];
$propertyType = $this->resolvedProperties[ $match[ 0 ] ][ $objType ];
$property = $this->resolvedProperties[ 'property' ][ $basename ];
}
if ($propertyType) {
$obj = $propertyType === 1 ? $data : $smarty;
if ($match[2] === 'get') {
if ($match[ 2 ] === 'get') {
return $obj->$property;
} else if ($match[2] === 'set') {
return $obj->$property = $args[0];
} elseif ($match[ 2 ] === 'set') {
return $obj->$property = $args[ 0 ];
}
}
}
@@ -124,7 +129,7 @@ class Smarty_Internal_Extension_Handler
}
$callback = array($smarty->ext->$name, $name);
array_unshift($args, $data);
if (isset($callback) && $callback[0]->objMap | $data->_objType) {
if (isset($callback) && $callback[ 0 ]->objMap | $data->_objType) {
return call_user_func_array($callback, $args);
}
return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), $args);
@@ -150,12 +155,11 @@ class Smarty_Internal_Extension_Handler
* @param string $property_name property name
*
* @return mixed|Smarty_Template_Cached
* @throws SmartyException
*/
public function __get($property_name)
{
// object properties of runtime template extensions will start with '_'
if ($property_name[0] === '_') {
if ($property_name[ 0 ] === '_') {
$class = 'Smarty_Internal_Runtime' . $this->upperCase($property_name);
} else {
$class = 'Smarty_Internal_Method_' . $this->upperCase($property_name);
@@ -172,7 +176,6 @@ class Smarty_Internal_Extension_Handler
* @param string $property_name property name
* @param mixed $value value
*
* @throws SmartyException
*/
public function __set($property_name, $value)
{
@@ -186,11 +189,9 @@ class Smarty_Internal_Extension_Handler
* @param array $args argument array
*
* @return mixed
* @throws SmartyException
*/
public function __call($name, $args)
{
return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), array($this));
}
}
}