You've already forked postfixadmin
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:
@@ -6,7 +6,6 @@
|
||||
* @package Smarty
|
||||
* @subpackage PluginsInternal
|
||||
* @author Uwe Tews
|
||||
*
|
||||
**/
|
||||
class Smarty_Internal_Runtime_UpdateCache
|
||||
{
|
||||
@@ -15,7 +14,7 @@ class Smarty_Internal_Runtime_UpdateCache
|
||||
*
|
||||
* @param \Smarty_Template_Cached $cached
|
||||
* @param Smarty_Internal_Template $_template
|
||||
* @param string $content
|
||||
* @param string $content
|
||||
*/
|
||||
public function cacheModifiedCheck(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
|
||||
{
|
||||
@@ -65,35 +64,44 @@ class Smarty_Internal_Runtime_UpdateCache
|
||||
*
|
||||
* @throws \SmartyException
|
||||
*/
|
||||
public function removeNoCacheHash(Smarty_Template_Cached $cached,
|
||||
Smarty_Internal_Template $_template,
|
||||
$no_output_filter)
|
||||
{
|
||||
public function removeNoCacheHash(
|
||||
Smarty_Template_Cached $cached,
|
||||
Smarty_Internal_Template $_template,
|
||||
$no_output_filter
|
||||
) {
|
||||
$php_pattern = '/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/';
|
||||
$content = ob_get_clean();
|
||||
$hash_array = $cached->hashes;
|
||||
$hash_array[$_template->compiled->nocache_hash] = true;
|
||||
$hash_array[ $_template->compiled->nocache_hash ] = true;
|
||||
$hash_array = array_keys($hash_array);
|
||||
$nocache_hash = '(' . implode('|', $hash_array) . ')';
|
||||
$_template->cached->has_nocache_code = false;
|
||||
// get text between non-cached items
|
||||
$cache_split =
|
||||
preg_split("!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s",
|
||||
$content);
|
||||
preg_split(
|
||||
"!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s",
|
||||
$content
|
||||
);
|
||||
// get non-cached items
|
||||
preg_match_all("!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s",
|
||||
$content,
|
||||
$cache_parts);
|
||||
preg_match_all(
|
||||
"!/\*%%SmartyNocache:{$nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$nocache_hash}%%\*/!s",
|
||||
$content,
|
||||
$cache_parts
|
||||
);
|
||||
$content = '';
|
||||
// loop over items, stitch back together
|
||||
foreach ($cache_split as $curr_idx => $curr_split) {
|
||||
if (preg_match($php_pattern, $curr_split)) {
|
||||
// escape PHP tags in template content
|
||||
$php_split = preg_split($php_pattern,
|
||||
$curr_split);
|
||||
preg_match_all($php_pattern,
|
||||
$curr_split,
|
||||
$php_parts);
|
||||
$php_split = preg_split(
|
||||
$php_pattern,
|
||||
$curr_split
|
||||
);
|
||||
preg_match_all(
|
||||
$php_pattern,
|
||||
$curr_split,
|
||||
$php_parts
|
||||
);
|
||||
foreach ($php_split as $idx_php => $curr_php) {
|
||||
$content .= $curr_php;
|
||||
if (isset($php_parts[ 0 ][ $idx_php ])) {
|
||||
@@ -108,9 +116,9 @@ class Smarty_Internal_Runtime_UpdateCache
|
||||
$content .= $cache_parts[ 2 ][ $curr_idx ];
|
||||
}
|
||||
}
|
||||
if (!$no_output_filter && !$_template->cached->has_nocache_code &&
|
||||
(isset($_template->smarty->autoload_filters[ 'output' ]) ||
|
||||
isset($_template->smarty->registered_filters[ 'output' ]))
|
||||
if (!$no_output_filter && !$_template->cached->has_nocache_code
|
||||
&& (isset($_template->smarty->autoload_filters[ 'output' ])
|
||||
|| isset($_template->smarty->registered_filters[ 'output' ]))
|
||||
) {
|
||||
$content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
|
||||
}
|
||||
@@ -162,7 +170,6 @@ class Smarty_Internal_Runtime_UpdateCache
|
||||
if ($_template->smarty->cache_locking) {
|
||||
$cached->handler->releaseLock($_template->smarty, $cached);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
$cached->content = null;
|
||||
@@ -171,7 +178,6 @@ class Smarty_Internal_Runtime_UpdateCache
|
||||
$cached->valid = false;
|
||||
$cached->processed = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user