From fa10e0945ecd45bfe78a2c8fb015a43092b4944b Mon Sep 17 00:00:00 2001 From: plegall Date: Thu, 10 Dec 2015 14:02:22 +0100 Subject: bug #385 update to smarty-3.1.28-dev (from Github) --- .../sysplugins/smarty_template_resource_base.php | 162 +++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 include/smarty/libs/sysplugins/smarty_template_resource_base.php (limited to 'include/smarty/libs/sysplugins/smarty_template_resource_base.php') diff --git a/include/smarty/libs/sysplugins/smarty_template_resource_base.php b/include/smarty/libs/sysplugins/smarty_template_resource_base.php new file mode 100644 index 000000000..b9e2e2830 --- /dev/null +++ b/include/smarty/libs/sysplugins/smarty_template_resource_base.php @@ -0,0 +1,162 @@ +unifunc; + $level = ob_get_level(); + try { + if (empty($unifunc) || !is_callable($unifunc)) { + throw new SmartyException("Invalid compiled template for '{$_template->template_resource}'"); + } + if (isset($_template->smarty->security_policy)) { + $_template->smarty->security_policy->startTemplate($_template); + } + // + // render compiled or saved template code + // + if (!isset($_template->_cache['capture_stack'])) { + $_template->_cache['capture_stack'] = array(); + } + $_saved_capture_level = count($_template->_cache['capture_stack']); + $unifunc($_template); + // any unclosed {capture} tags ? + if ($_saved_capture_level != count($_template->_cache['capture_stack'])) { + $_template->capture_error(); + } + if (isset($_template->smarty->security_policy)) { + $_template->smarty->security_policy->exitTemplate(); + } + return null; + } + catch (Exception $e) { + while (ob_get_level() > $level) { + ob_end_clean(); + } + if (isset($_template->smarty->security_policy)) { + $_template->smarty->security_policy->exitTemplate(); + } + throw $e; + } + } + + /** + * Get compiled time stamp + * + * @return int + */ + public function getTimeStamp() + { + if ($this->exists && !isset($this->timestamp)) { + $this->timestamp = @filemtime($this->filepath); + } + return $this->timestamp; + } +} -- cgit v1.2.3