aboutsummaryrefslogtreecommitdiffstats
path: root/library/Smarty
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2015-12-06 23:12:37 +0100
committerMario Vavti <mario@mariovavti.com>2015-12-06 23:12:37 +0100
commita6cb25020bb5200cc3c00ecc941ddb751644fbcc (patch)
tree29811e6cf8d702746558186ee3b7c466de791d33 /library/Smarty
parent26c465ad0c1d5b6801507ed190430f44ac92c672 (diff)
downloadvolse-hubzilla-a6cb25020bb5200cc3c00ecc941ddb751644fbcc.tar.gz
volse-hubzilla-a6cb25020bb5200cc3c00ecc941ddb751644fbcc.tar.bz2
volse-hubzilla-a6cb25020bb5200cc3c00ecc941ddb751644fbcc.zip
add missing smarty files
Diffstat (limited to 'library/Smarty')
-rw-r--r--library/Smarty/NEW_FEATURES.txt128
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php224
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php46
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_extension_clear.php134
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_extension_handler.php157
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php51
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php42
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_append.php74
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_appendbyref.php50
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_assignbyref.php36
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_assignglobal.php43
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_clearallassign.php37
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_clearallcache.php43
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_clearassign.php44
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_clearcache.php46
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php132
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_clearconfig.php41
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php32
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php111
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_configload.php182
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_createdata.php44
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php37
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php58
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php35
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php35
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php44
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php51
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_gettags.php62
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php114
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_loadfilter.php77
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_loadplugin.php111
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_mustcompile.php49
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php39
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_registerclass.php46
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php42
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php43
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php72
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_registerfilter.php88
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_registerobject.php71
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_registerplugin.php50
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_registerresource.php44
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php70
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php41
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php38
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php42
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php40
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php42
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php40
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php41
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php40
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php67
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php88
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php69
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_foreach.php44
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php183
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_hhvm.php30
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php213
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_subtemplate.php203
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_tplfunc.php97
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php97
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php184
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php55
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_validatecompiled.php81
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_var.php33
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_runtime_writefile.php90
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_undefined.php48
-rw-r--r--library/Smarty/libs/sysplugins/smarty_template_resource_base.php162
67 files changed, 5003 insertions, 0 deletions
diff --git a/library/Smarty/NEW_FEATURES.txt b/library/Smarty/NEW_FEATURES.txt
new file mode 100644
index 000000000..67d391a52
--- /dev/null
+++ b/library/Smarty/NEW_FEATURES.txt
@@ -0,0 +1,128 @@
+
+
+This file contains a brief description of new features which have been added to Smarty 3.1
+
+Smarty 3.1.28
+
+ OPCACHE
+ =======
+ Smarty does now invalidate automatically updated and cleared compiled or cached template files in OPCACHE.
+ Correct operation is no longer dependent on OPCACHE configuration settings.
+
+ Template inheritance
+ ====================
+ Template inheritance is now processed in run time.
+ See the INHERITANCE_RELEASE_NOTES
+
+ Modifier regex_replace
+ ======================
+ An optional limit parameter was added
+
+ fetch() and display()
+ =====================
+ The fetch() and display() methods of the template object accept now optionally the same parameter
+ as the corresponding Smarty methods the get tne content of another template.
+
+ File: resource
+ ==============
+ Multiple template_dir entries can now be selected by a comma separated list of indices.
+ The template_dir array is searched in the order of the indices. (could be used to change the default search order)
+
+ Filter support
+ ==============
+ Optional filter names
+ An optional filter name was added to $smarty->registerFilter(). It can be used to unregister a filter by name.
+ - $smarty->registerFilter('output', $callback, 'name');
+ $smarty->unregister('output', 'name');
+
+ Closures
+ $smarty->registerFilter() does now accept closures.
+ - $smarty->registerFilter('pre', function($source) {return $source;});
+ If no optional filter name was specified it gets the default name 'closure'.
+ If you register multiple closures register each with a unique filter name.
+ - $smarty->registerFilter('pre', function($source) {return $source;}, 'clousre_1');
+ - $smarty->registerFilter('pre', function($source) {return $source;}, 'clousre_2');
+
+
+Smarty 3.1.22
+
+ Namespace support within templates
+ ==================================
+ Within templates you can now use namespace specifications on:
+ - Constants like foo\bar\FOO
+ - Class names like foo\bar\Baz::FOO, foo\bar\Baz::$foo, foo\bar\Baz::foo()
+ - PHP function names like foo\bar\baz()
+
+ Security
+ ========
+ - disable special $smarty variable -
+ The Smarty_Security class has the new property $disabled_special_smarty_vars.
+ It's an array which can be loaded with the $smarty special variable names like
+ 'template_object', 'template', 'current_dir' and others which will be disabled.
+ Note: That this security check is performed at compile time.
+
+ - limit template nesting -
+ Property $max_template_nesting of Smarty_Security does set the maximum template nesting level.
+ The main template is level 1. The nesting level is checked at run time. When the maximum will be exceeded
+ an Exception will be thrown. The default setting is 0 which does disable this check.
+
+ - trusted static methods -
+ The Smarty_Security class has the new property $trusted_static_methods to restrict access to static methods.
+ It's an nested array of trusted class and method names.
+ Format:
+ array (
+ 'class_1' => array('method_1', 'method_2'), // allowed methods
+ 'class_2' => array(), // all methods of class allowed
+ )
+ To disable access for all methods of all classes set $trusted_static_methods = null;
+ The default value is an empty array() which does enables all methods of all classes, but for backward compatibility
+ the setting of $static_classes will be checked.
+ Note: That this security check is performed at compile time.
+
+ - trusted static properties -
+ The Smarty_Security class has the new property $trusted_static_properties to restrict access to static properties.
+ It's an nested array of trusted class and property names.
+ Format:
+ array (
+ 'class_1' => array('prop_1', 'prop_2'), // allowed properties listed
+ 'class_2' => array(), // all properties of class allowed
+ }
+ To disable access for all properties of all classes set $trusted_static_properties = null;
+ The default value is an empty array() which does enables all properties of all classes, but for backward compatibility
+ the setting of $static_classes will be checked.
+ Note: That this security check is performed at compile time.
+
+ - trusted constants .
+ The Smarty_Security class has the new property $trusted_constants to restrict access to constants.
+ It's an array of trusted constant names.
+ Format:
+ array (
+ 'SMARTY_DIR' , // allowed constant
+ }
+ If the array is empty (default) the usage of constants can be controlled with the
+ Smarty_Security::$allow_constants property (default true)
+
+
+
+ Compiled Templates
+ ==================
+ Smarty does now automatically detects a change of the $merge_compiled_includes and $escape_html
+ property and creates different compiled templates files depending on the setting.
+
+ Same applies to config files and the $config_overwrite, $config_booleanize and
+ $config_read_hidden properties.
+
+ Debugging
+ =========
+ The layout of the debug window has been changed for better readability
+
+ New class constants
+ Smarty::DEBUG_OFF
+ Smarty::DEBUG_ON
+ Smarty::DEBUG_INDIVIDUAL
+ have been introduced for setting the $debugging property.
+
+ Smarty::DEBUG_INDIVIDUAL will create for each display() and fetch() call an individual debug window.
+
+ .
+ \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php b/library/Smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php
new file mode 100644
index 000000000..25b35e861
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php
@@ -0,0 +1,224 @@
+<?php
+/**
+ * Smarty Internal Plugin Compile ForeachSection
+ * Shared methods for {foreach} {section} tags
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile ForeachSection Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_CompileBase
+{
+
+ /**
+ * Preg search pattern
+ *
+ * @var string
+ */
+ private $propertyPreg = '';
+
+ /**
+ * Offsets in preg match result
+ *
+ * @var array
+ */
+ private $resultOffsets = array();
+
+ /**
+ * Start offset
+ *
+ * @var int
+ */
+ private $startOffset = 0;
+
+ /**
+ * Name of this tag
+ *
+ * @var string
+ */
+ public $tagName = '';
+
+ /**
+ * Valid properties of $smarty.xxx variable
+ *
+ * @var array
+ */
+ public static $nameProperties = array();
+
+ /**
+ * {section} tag has no item properties
+ *
+ * @var array
+ */
+ public $itemProperties = null;
+
+ /**
+ * {section} tag has always name attribute
+ *
+ * @var bool
+ */
+ public $isNamed = true;
+
+ /**
+ * @var array
+ */
+ public $matchResults = array();
+
+ /**
+ * Scan sources for used tag attributes
+ *
+ * @param array $attributes
+ * @param \Smarty_Internal_TemplateCompilerBase $compiler
+ */
+ public function scanForProperties($attributes, Smarty_Internal_TemplateCompilerBase $compiler)
+ {
+ $this->propertyPreg = '~(';
+ $this->startOffset = 0;
+ $this->resultOffsets = array();
+ $this->matchResults = array('named' => array(), 'item' => array());
+ if ($this->isNamed) {
+ $this->buildPropertyPreg(true, $attributes);
+ }
+ if (isset($this->itemProperties)) {
+ if ($this->isNamed) {
+ $this->propertyPreg .= '|';
+ }
+ $this->buildPropertyPreg(false, $attributes);
+ }
+ $this->propertyPreg .= ')\W~i';
+ // Template source
+ $this->matchTemplateSource($compiler);
+ // Parent template source
+ $this->matchParentTemplateSource($compiler);
+ // {block} source
+ $this->matchBlockSource($compiler);
+ }
+
+ /**
+ * Build property preg string
+ *
+ * @param bool $named
+ * @param array $attributes
+ */
+ public function buildPropertyPreg($named, $attributes)
+ {
+ if ($named) {
+ $this->resultOffsets['named'] = $this->startOffset + 3;
+ $this->propertyPreg .= "([\$]smarty[.]{$this->tagName}[.]{$attributes['name']}[.](";
+ $className = get_class($this);
+ $properties = $className::$nameProperties;
+ } else {
+ $this->resultOffsets['item'] = $this->startOffset + 3;
+ $this->propertyPreg .= "([\$]{$attributes['item']}[@](";
+ $properties = $this->itemProperties;
+ }
+ $this->startOffset += count($properties) + 2;
+ $propName = reset($properties);
+ while ($propName) {
+ $this->propertyPreg .= "({$propName})";
+ $propName = next($properties);
+ if ($propName) {
+ $this->propertyPreg .= '|';
+ }
+ }
+ $this->propertyPreg .= '))';
+ }
+
+ /**
+ * Find matches in source string
+ *
+ * @param string $source
+ */
+ public function matchProperty($source)
+ {
+ preg_match_all($this->propertyPreg, $source, $match, PREG_SET_ORDER);
+ foreach ($this->resultOffsets as $key => $offset) {
+ foreach ($match as $m) {
+ if (isset($m[$offset]) && !empty($m[$offset])) {
+ $this->matchResults[$key][strtolower($m[$offset])] = true;
+ }
+ }
+ }
+ }
+
+ /**
+ * Find matches in template source
+ *
+ * @param \Smarty_Internal_TemplateCompilerBase $compiler
+ */
+ public function matchTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler)
+ {
+ $this->matchProperty($compiler->parser->lex->data);
+ }
+
+ /**
+ * Find matches in all parent template source
+ *
+ * @param \Smarty_Internal_TemplateCompilerBase $compiler
+ */
+ public function matchParentTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler)
+ {
+ // search parent compiler template source
+ $nextCompiler = $compiler;
+ while ($nextCompiler !== $nextCompiler->parent_compiler) {
+ $nextCompiler = $nextCompiler->parent_compiler;
+ if ($compiler !== $nextCompiler) {
+ // get template source
+ $_content = $nextCompiler->template->source->getContent();
+ if ($_content != '') {
+ // run pre filter if required
+ if ((isset($nextCompiler->smarty->autoload_filters['pre']) ||
+ isset($nextCompiler->smarty->registered_filters['pre']))) {
+ $_content = $nextCompiler->smarty->ext->_filter_Handler->runFilter('pre', $_content, $nextCompiler->template);
+ }
+ $this->matchProperty($_content);
+ }
+ }
+ }
+ }
+
+ /**
+ * Find matches in {block} tag source
+ *
+ * @param \Smarty_Internal_TemplateCompilerBase $compiler
+ */
+ public function matchBlockSource(Smarty_Internal_TemplateCompilerBase $compiler)
+ {
+
+ }
+
+ /**
+ * Compiles code for the {$smarty.foreach.xxx} or {$smarty.section.xxx}tag
+ *
+ * @param array $args array with attributes from parser
+ * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
+ * @return string compiled code
+ * @throws \SmartyCompilerException
+ */
+ public static function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
+ {
+ // make all lower case
+ $parameter = array_map('strtolower', $parameter);
+ $tag = trim($parameter[0], '"\'');
+ if (!isset($parameter[1]) || false === $name = $compiler->getId($parameter[1])) {
+ $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true);
+ }
+ $className = 'Smarty_Internal_Compile_' . ucfirst($tag);
+ if ((!isset($parameter[2]) || false === $property = $compiler->getId($parameter[2])) ||
+ !in_array($property, $className::$nameProperties)
+ ) {
+ $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} property attribute", null, true);
+ }
+ $tagVar = "'__smarty_{$tag}_{$name}'";
+ return "(isset(\$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}']) ? \$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}'] : null)";
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php b/library/Smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php
new file mode 100644
index 000000000..c7bf1f8fb
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Smarty Internal Plugin Compile Shared Inheritance
+ * Shared methods for {extends} and {block} tags
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Shared Inheritance Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Shared_Inheritance extends Smarty_Internal_CompileBase
+{
+ /**
+ * Register post compile callback to compile inheritance initialization code
+ *
+ * @param \Smarty_Internal_TemplateCompilerBase $compiler
+ * @param bool|false $initChildSequence if true force child template
+ */
+ public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false)
+ {
+ if ($initChildSequence || !isset($compiler->_cache['inheritanceInit'])) {
+ $compiler->registerPostCompileCallback(array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'),
+ array($initChildSequence), 'inheritanceInit', $initChildSequence);
+
+ $compiler->_cache['inheritanceInit'] = true;
+ }
+ }
+
+ /**
+ * Compile inheritance initialization code as prefix
+ *
+ * @param \Smarty_Internal_TemplateCompilerBase $compiler
+ * @param bool|false $initChildSequence if true force child template
+ */
+ static function postCompile(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false)
+ {
+ $compiler->prefixCompiledCode .= "<?php \$_smarty_tpl->ext->_inheritance->init(\$_smarty_tpl, " .
+ var_export($initChildSequence, true) . ");\n?>\n";
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_extension_clear.php b/library/Smarty/libs/sysplugins/smarty_internal_extension_clear.php
new file mode 100644
index 000000000..c595214d8
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_extension_clear.php
@@ -0,0 +1,134 @@
+<?php
+
+/**
+ * Smarty Extension Clear
+ *
+ * $smarty->clear() method file cache file resource
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Extension_Clear
+{
+ /**
+ * Empty cache for a specific template
+ *
+ * @param Smarty $smarty
+ * @param string $resource_name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param integer $exp_time expiration time (number of seconds, not timestamp)
+ *
+ * @return integer number of cache files deleted
+ */
+ public static function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
+ {
+ $_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
+ $_compile_id = isset($compile_id) ? preg_replace('![^\w]+!', '_', $compile_id) : null;
+ $_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
+ $_compile_id_offset = $smarty->use_sub_dirs ? 3 : 0;
+ $_dir = $smarty->getCacheDir();
+ if ($_dir == '/') { //We should never want to delete this!
+ return 0;
+ }
+ $_dir_length = strlen($_dir);
+ if (isset($_cache_id)) {
+ $_cache_id_parts = explode('|', $_cache_id);
+ $_cache_id_parts_count = count($_cache_id_parts);
+ if ($smarty->use_sub_dirs) {
+ foreach ($_cache_id_parts as $id_part) {
+ $_dir .= $id_part . DS;
+ }
+ }
+ }
+ if (isset($resource_name)) {
+ $_save_stat = $smarty->caching;
+ $smarty->caching = true;
+ $tpl = new $smarty->template_class($resource_name, $smarty);
+ $smarty->caching = $_save_stat;
+
+ // remove from template cache
+ $tpl->source; // have the template registered before unset()
+
+ if ($tpl->source->exists) {
+ $_resourcename_parts = basename(str_replace('^', '/', $tpl->cached->filepath));
+ } else {
+ return 0;
+ }
+ }
+ $_count = 0;
+ $_time = time();
+ if (file_exists($_dir)) {
+ $_cacheDirs = new RecursiveDirectoryIterator($_dir);
+ $_cache = new RecursiveIteratorIterator($_cacheDirs, RecursiveIteratorIterator::CHILD_FIRST);
+ foreach ($_cache as $_file) {
+ if (substr(basename($_file->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
+ continue;
+ }
+ // directory ?
+ if ($_file->isDir()) {
+ if (!$_cache->isDot()) {
+ // delete folder if empty
+ @rmdir($_file->getPathname());
+ }
+ } else {
+ $_parts = explode($_dir_sep, str_replace('\\', '/', substr((string) $_file, $_dir_length)));
+ $_parts_count = count($_parts);
+ // check name
+ if (isset($resource_name)) {
+ if ($_parts[$_parts_count - 1] != $_resourcename_parts) {
+ continue;
+ }
+ }
+ // check compile id
+ if (isset($_compile_id) && (!isset($_parts[$_parts_count - 2 - $_compile_id_offset]) ||
+ $_parts[$_parts_count - 2 - $_compile_id_offset] != $_compile_id)
+ ) {
+ continue;
+ }
+ // check cache id
+ if (isset($_cache_id)) {
+ // count of cache id parts
+ $_parts_count = (isset($_compile_id)) ? $_parts_count - 2 - $_compile_id_offset :
+ $_parts_count - 1 - $_compile_id_offset;
+ if ($_parts_count < $_cache_id_parts_count) {
+ continue;
+ }
+ for ($i = 0; $i < $_cache_id_parts_count; $i ++) {
+ if ($_parts[$i] != $_cache_id_parts[$i]) {
+ continue 2;
+ }
+ }
+ }
+ // expired ?
+ if (isset($exp_time)) {
+ if ($exp_time < 0) {
+ preg_match('#\'cache_lifetime\' =>\s*(\d*)#', file_get_contents($_file), $match);
+ if ($_time < (@filemtime($_file) + $match[1])) {
+ continue;
+ }
+ } else {
+ if ($_time - @filemtime($_file) < $exp_time) {
+ continue;
+ }
+ }
+ }
+ // remove from template cache
+ if (isset($smarty->_cache['template_objects'])) {
+ foreach ($smarty->_cache['template_objects'] as $key => $tpl) {
+ if (isset($tpl->cached) && $tpl->cached->filepath == (string) $_file) {
+ unset($smarty->_cache['template_objects'][$key]);
+ }
+ }
+ }
+ $_count += @unlink((string) $_file) ? 1 : 0;
+ if (function_exists('opcache_invalidate')) {
+ opcache_invalidate((string) $_file);
+ }
+ }
+ }
+ }
+ return $_count;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_extension_handler.php b/library/Smarty/libs/sysplugins/smarty_internal_extension_handler.php
new file mode 100644
index 000000000..68012d86f
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_extension_handler.php
@@ -0,0 +1,157 @@
+<?php
+
+/**
+ * Smarty Extension handler
+ *
+ * Load extensions dynamically
+ *
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ *
+ * @property Smarty_Internal_Runtime_Inheritance $_inheritance
+ * @property Smarty_Internal_Runtime_SubTemplate $_subTemplate
+ * @property Smarty_Internal_Runtime_TplFunction $_tplFunction
+ * @property Smarty_Internal_Runtime_Var $_var
+ * @property Smarty_Internal_Runtime_Config $_config
+ * @property Smarty_Internal_Runtime_Foreach $_foreach
+ * @property Smarty_Internal_Runtime_Hhvm $_hhvm
+ * @property Smarty_Internal_Runtime_WriteFile $_writeFile
+ * @property Smarty_Internal_Runtime_ValidateCompiled $_validateCompiled
+ * @property Smarty_Internal_Runtime_CodeFrame $_codeFrame
+ * @property Smarty_Internal_Runtime_FilterHandler $_filterHandler
+ * @property Smarty_Internal_Runtime_GetIncludePath $_getIncludePath
+ * @property Smarty_Internal_Runtime_UpdateScope $_updateScope
+ * @property Smarty_Internal_Runtime_IsCached $_isCached
+ * @property Smarty_Internal_Runtime_CacheModify $_cacheModify
+ * @property Smarty_Internal_Runtime_UpdateCache $_updateCache
+ * @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
+ */
+class Smarty_Internal_Extension_Handler
+{
+
+ public $objType = null;
+
+ /**
+ * Cache for property information from generic getter/setter
+ * Preloaded with names which should not use with generic getter/setter
+ *
+ * @var array
+ */
+ private $_property_info = array('AutoloadFilters' => 0, 'DefaultModifiers' => 0, 'ConfigVars' => 0,
+ 'DebugTemplate' => 0, 'RegisteredObject' => 0, 'StreamVariable' => 0,
+ 'TemplateVars' => 0,);#
+
+ private $resolvedProperties = array();
+
+ /**
+ * Call external Method
+ *
+ * @param \Smarty_Internal_Data $data
+ * @param string $name external method names
+ * @param array $args argument array
+ *
+ * @return mixed
+ * @throws SmartyException
+ */
+ public function _callExternalMethod(Smarty_Internal_Data $data, $name, $args)
+ {
+ /* @var Smarty $data ->smarty */
+ $smarty = isset($data->smarty) ? $data->smarty : $data;
+ if (!isset($smarty->ext->$name)) {
+ $class = 'Smarty_Internal_Method_' . ucfirst($name);
+ if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) {
+ if (!isset($this->_property_info[$prop = $match[2]])) {
+ // convert camel case to underscored name
+ $this->resolvedProperties[$prop] = $pn = strtolower(join('_',
+ preg_split('/([A-Z][^A-Z]*)/', $prop, - 1,
+ PREG_SPLIT_NO_EMPTY |
+ PREG_SPLIT_DELIM_CAPTURE)));
+ $this->_property_info[$prop] = property_exists($data, $pn) ? 1 :
+ ($data->_objType == 2 && property_exists($smarty, $pn) ? 2 : 0);
+ }
+ if ($this->_property_info[$prop]) {
+ $pn = $this->resolvedProperties[$prop];
+ if ($match[1] == 'get') {
+ return $this->_property_info[$prop] == 1 ? $data->$pn : $data->smarty->$pn;
+ } else {
+ return $this->_property_info[$prop] == 1 ? $data->$pn = $args[0] :
+ $data->smarty->$pn = $args[0];
+ }
+ } elseif (!class_exists($class)) {
+ throw new SmartyException("property '$pn' does not exist.");
+ }
+ }
+ if (class_exists($class)) {
+ $callback = array($smarty->ext->$name = new $class(), $name);
+ }
+ } else {
+ $callback = array($smarty->ext->$name, $name);
+ }
+ array_unshift($args, $data);
+ 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);
+ }
+
+ /**
+ * set extension property
+ *
+ * @param string $property_name property name
+ * @param mixed $value value
+ *
+ * @throws SmartyException
+ */
+ public function __set($property_name, $value)
+ {
+ $this->$property_name = $value;
+ }
+
+ /**
+ * get extension object
+ *
+ * @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] == '_') {
+ $class = 'Smarty_Internal_Runtime_' . ucfirst(substr($property_name, 1));
+ } else {
+ $class = 'Smarty_Internal_Method_' . ucfirst($property_name);
+ }
+ if (class_exists($class)) {
+ return $this->$property_name = new $class();
+ }
+ return $this;
+ }
+
+ /**
+ * Call error handler for undefined method
+ *
+ * @param string $name unknown method-name
+ * @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), $args);
+ }
+
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php b/library/Smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php
new file mode 100644
index 000000000..b739f0e3e
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * Smarty Method AddAutoloadFilters
+ *
+ * Smarty::addAutoloadFilters() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_AddAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters
+{
+
+ /**
+ * Add autoload filters
+ *
+ * @api Smarty::setAutoloadFilters()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param array $filters filters to load automatically
+ * @param string $type "pre", "output", … specify the
+ * filter type to set. Defaults to
+ * none treating $filters' keys as
+ * the appropriate types
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function addAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if ($type !== null) {
+ $this->_checkFilterType($type);
+ if (!empty($smarty->autoload_filters[$type])) {
+ $smarty->autoload_filters[$type] = array_merge($smarty->autoload_filters[$type], (array) $filters);
+ } else {
+ $smarty->autoload_filters[$type] = (array) $filters;
+ }
+ } else {
+ foreach ((array) $filters as $type => $value) {
+ $this->_checkFilterType($type);
+ if (!empty($smarty->autoload_filters[$type])) {
+ $smarty->autoload_filters[$type] = array_merge($smarty->autoload_filters[$type], (array) $value);
+ } else {
+ $smarty->autoload_filters[$type] = (array) $value;
+ }
+ }
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php b/library/Smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php
new file mode 100644
index 000000000..55d2c9e71
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Smarty Method AddDefaultModifiers
+ *
+ * Smarty::addDefaultModifiers() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_AddDefaultModifiers
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Add default modifiers
+ *
+ * @api Smarty::addDefaultModifiers()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param array|string $modifiers modifier or list of modifiers
+ * to add
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function addDefaultModifiers(Smarty_Internal_TemplateBase $obj, $modifiers)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (is_array($modifiers)) {
+ $this->default_modifiers = array_merge($smarty->default_modifiers, $modifiers);
+ } else {
+ $smarty->default_modifiers[] = $modifiers;
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_append.php b/library/Smarty/libs/sysplugins/smarty_internal_method_append.php
new file mode 100644
index 000000000..43df8803f
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_append.php
@@ -0,0 +1,74 @@
+<?php
+
+/**
+ * Smarty Method Append
+ *
+ * Smarty::append() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_Append
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * appends values to template variables
+ *
+ * @api Smarty::append()
+ * @link http://www.smarty.net/docs/en/api.append.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param array|string $tpl_var the template variable name(s)
+ * @param mixed $value the value to append
+ * @param bool $merge flag if array elements shall be merged
+ * @param bool $nocache if true any output of this variable will
+ * be not cached
+ *
+ * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
+ */
+ public function append(Smarty_Internal_Data $data, $tpl_var, $value = null, $merge = false, $nocache = false)
+ {
+ if (is_array($tpl_var)) {
+ // $tpl_var is an array, ignore $value
+ foreach ($tpl_var as $_key => $_val) {
+ if ($_key != '') {
+ $this->append($data, $_key, $_val, $merge, $nocache);
+ }
+ }
+ } else {
+ if ($tpl_var != '' && isset($value)) {
+ if (!isset($data->tpl_vars[$tpl_var])) {
+ $tpl_var_inst = $data->ext->getTemplateVars->_getVariable($data, $tpl_var, null, true, false);
+ if ($tpl_var_inst instanceof Smarty_Undefined_Variable) {
+ $data->tpl_vars[$tpl_var] = new Smarty_Variable(null, $nocache);
+ } else {
+ $data->tpl_vars[$tpl_var] = clone $tpl_var_inst;
+ }
+ }
+ if (!(is_array($data->tpl_vars[$tpl_var]->value) ||
+ $data->tpl_vars[$tpl_var]->value instanceof ArrayAccess)
+ ) {
+ settype($data->tpl_vars[$tpl_var]->value, 'array');
+ }
+ if ($merge && is_array($value)) {
+ foreach ($value as $_mkey => $_mval) {
+ $data->tpl_vars[$tpl_var]->value[$_mkey] = $_mval;
+ }
+ } else {
+ $data->tpl_vars[$tpl_var]->value[] = $value;
+ }
+ }
+ if ($data->_objType == 2 && $data->scope) {
+ $data->ext->_updateScope->updateScope($data, $tpl_var);
+ }
+ }
+ return $data;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_appendbyref.php b/library/Smarty/libs/sysplugins/smarty_internal_method_appendbyref.php
new file mode 100644
index 000000000..124bb803a
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_appendbyref.php
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * Smarty Method AppendByRef
+ *
+ * Smarty::appendByRef() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_AppendByRef
+{
+
+ /**
+ * appends values to template variables by reference
+ *
+ * @api Smarty::appendByRef()
+ * @link http://www.smarty.net/docs/en/api.append.by.ref.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string $tpl_var the template variable name
+ * @param mixed &$value the referenced value to append
+ * @param bool $merge flag if array elements shall be merged
+ *
+ * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
+ */
+ public static function appendByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $merge = false)
+ {
+ if ($tpl_var != '' && isset($value)) {
+ if (!isset($data->tpl_vars[$tpl_var])) {
+ $data->tpl_vars[$tpl_var] = new Smarty_Variable();
+ }
+ if (!is_array($data->tpl_vars[$tpl_var]->value)) {
+ settype($data->tpl_vars[$tpl_var]->value, 'array');
+ }
+ if ($merge && is_array($value)) {
+ foreach ($value as $_key => $_val) {
+ $data->tpl_vars[$tpl_var]->value[$_key] = &$value[$_key];
+ }
+ } else {
+ $data->tpl_vars[$tpl_var]->value[] = &$value;
+ }
+ if ($data->_objType == 2 && $data->scope) {
+ $data->ext->_updateScope->updateScope($data, $tpl_var);
+ }
+ }
+ return $data;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_assignbyref.php b/library/Smarty/libs/sysplugins/smarty_internal_method_assignbyref.php
new file mode 100644
index 000000000..a97125e30
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_assignbyref.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * Smarty Method AssignByRef
+ *
+ * Smarty::assignByRef() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_AssignByRef
+{
+
+ /**
+ * assigns values to template variables by reference
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string $tpl_var the template variable name
+ * @param $value
+ * @param boolean $nocache if true any output of this variable will be not cached
+ *
+ * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
+ */
+ public function assignByRef(Smarty_Internal_Data $data, $tpl_var, &$value, $nocache)
+ {
+ if ($tpl_var != '') {
+ $data->tpl_vars[$tpl_var] = new Smarty_Variable(null, $nocache);
+ $data->tpl_vars[$tpl_var]->value = &$value;
+ if ($data->_objType == 2 && $data->scope) {
+ $data->ext->_updateScope->updateScope($data, $tpl_var);
+ }
+ }
+ return $data;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_assignglobal.php b/library/Smarty/libs/sysplugins/smarty_internal_method_assignglobal.php
new file mode 100644
index 000000000..23b13b3a2
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_assignglobal.php
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * Smarty Method AssignGlobal
+ *
+ * Smarty::assignGlobal() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_AssignGlobal
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * assigns a global Smarty variable
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string $varName the global variable name
+ * @param mixed $value the value to assign
+ * @param boolean $nocache if true any output of this variable will be not cached
+ *
+ * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
+ */
+ public function assignGlobal(Smarty_Internal_Data $data, $varName, $value = null, $nocache = false)
+ {
+ if ($varName != '') {
+ Smarty::$global_tpl_vars[$varName] = new Smarty_Variable($value, $nocache);
+ $ptr = $data;
+ while ($ptr->_objType == 2) {
+ $ptr->tpl_vars[$varName] = clone Smarty::$global_tpl_vars[$varName];
+ $ptr = $ptr->parent;
+ }
+ }
+ return $data;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_clearallassign.php b/library/Smarty/libs/sysplugins/smarty_internal_method_clearallassign.php
new file mode 100644
index 000000000..1e5fec4bd
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_clearallassign.php
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * Smarty Method ClearAllAssign
+ *
+ * Smarty::clearAllAssign() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_ClearAllAssign
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * clear all the assigned template variables.
+ *
+ * @api Smarty::clearAllAssign()
+ * @link http://www.smarty.net/docs/en/api.clear.all.assign.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ *
+ * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
+ */
+ public function clearAllAssign(Smarty_Internal_Data $data)
+ {
+ $data->tpl_vars = array();
+
+ return $data;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_clearallcache.php b/library/Smarty/libs/sysplugins/smarty_internal_method_clearallcache.php
new file mode 100644
index 000000000..1fe37892e
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_clearallcache.php
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * Smarty Method ClearAllCache
+ *
+ * Smarty::clearAllCache() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_ClearAllCache
+{
+ /**
+ * Valid for Smarty object
+ *
+ * @var int
+ */
+ public $objMap = 1;
+
+ /**
+ * Empty cache folder
+ *
+ * @api Smarty::clearAllCache()
+ * @link http://www.smarty.net/docs/en/api.clear.all.cache.tpl
+ *
+ * @param \Smarty $smarty
+ * @param integer $exp_time expiration time
+ * @param string $type resource type
+ *
+ * @return integer number of cache files deleted
+ */
+ public function clearAllCache(Smarty $smarty, $exp_time = null, $type = null)
+ {
+ // load cache resource and call clearAll
+ $_cache_resource = Smarty_CacheResource::load($smarty, $type);
+ if ($smarty->caching_type != 'file') {
+ $_cache_resource->invalidLoadedCache($smarty);
+ }
+
+ return $_cache_resource->clearAll($smarty, $exp_time);
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_clearassign.php b/library/Smarty/libs/sysplugins/smarty_internal_method_clearassign.php
new file mode 100644
index 000000000..3a7bd1e47
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_clearassign.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * Smarty Method ClearAssign
+ *
+ * Smarty::clearAssign() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_ClearAssign
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * clear the given assigned template variable(s).
+ *
+ * @api Smarty::clearAssign()
+ * @link http://www.smarty.net/docs/en/api.clear.assign.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string|array $tpl_var the template variable(s) to clear
+ *
+ * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
+ */
+ public function clearAssign(Smarty_Internal_Data $data, $tpl_var)
+ {
+ if (is_array($tpl_var)) {
+ foreach ($tpl_var as $curr_var) {
+ unset($data->tpl_vars[$curr_var]);
+ }
+ } else {
+ unset($data->tpl_vars[$tpl_var]);
+ }
+
+ return $data;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_clearcache.php b/library/Smarty/libs/sysplugins/smarty_internal_method_clearcache.php
new file mode 100644
index 000000000..a923b3ae1
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_clearcache.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * Smarty Method ClearCache
+ *
+ * Smarty::clearCache() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_ClearCache
+{
+ /**
+ * Valid for Smarty object
+ *
+ * @var int
+ */
+ public $objMap = 1;
+
+ /**
+ * Empty cache for a specific template
+ *
+ * @api Smarty::clearCache()
+ * @link http://www.smarty.net/docs/en/api.clear.cache.tpl
+ *
+ * @param \Smarty $smarty
+ * @param string $template_name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param integer $exp_time expiration time
+ * @param string $type resource type
+ *
+ * @return integer number of cache files deleted
+ */
+ public function clearCache(Smarty $smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
+ {
+ // load cache resource and call clear
+ $_cache_resource = Smarty_CacheResource::load($smarty, $type);
+ if ($smarty->caching_type != 'file' && !isset($template_name)) {
+ $_cache_resource->invalidLoadedCache($smarty);
+ }
+
+ return $_cache_resource->clear($smarty, $template_name, $cache_id, $compile_id, $exp_time);
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php b/library/Smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php
new file mode 100644
index 000000000..ae1003238
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php
@@ -0,0 +1,132 @@
+<?php
+
+/**
+ * Smarty Method ClearCompiledTemplate
+ *
+ * Smarty::clearCompiledTemplate() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_ClearCompiledTemplate
+{
+ /**
+ * Valid for Smarty object
+ *
+ * @var int
+ */
+ public $objMap = 1;
+
+ /**
+ * Delete compiled template file
+ *
+ * @api Smarty::clearCompiledTemplate()
+ * @link http://www.smarty.net/docs/en/api.clear.compiled.template.tpl
+ *
+ * @param \Smarty $smarty
+ * @param string $resource_name template name
+ * @param string $compile_id compile id
+ * @param integer $exp_time expiration time
+ *
+ * @return integer number of template files deleted
+ */
+ public function clearCompiledTemplate(Smarty $smarty, $resource_name = null, $compile_id = null, $exp_time = null)
+ {
+
+ $_compile_dir = $smarty->getCompileDir();
+ if ($_compile_dir == '/') { //We should never want to delete this!
+ return 0;
+ }
+ $_compile_id = isset($compile_id) ? preg_replace('![^\w]+!', '_', $compile_id) : null;
+ $_dir_sep = $smarty->use_sub_dirs ? DS : '^';
+ if (isset($resource_name)) {
+ $_save_stat = $smarty->caching;
+ $smarty->caching = false;
+ /* @var Smarty_Internal_Template $tpl */
+ $tpl = new $smarty->template_class($resource_name, $smarty);
+ $smarty->caching = $_save_stat;
+ if ($tpl->source->exists) {
+ // remove from compileds cache
+ $tpl->source->compileds = array();
+ $_resource_part_1 = basename(str_replace('^', DS, $tpl->compiled->filepath));
+ $_resource_part_1_length = strlen($_resource_part_1);
+ } else {
+ return 0;
+ }
+ $_resource_part_2 = str_replace('.php', '.cache.php', $_resource_part_1);
+ $_resource_part_2_length = strlen($_resource_part_2);
+ }
+ $_dir = $_compile_dir;
+ if ($smarty->use_sub_dirs && isset($_compile_id)) {
+ $_dir .= $_compile_id . $_dir_sep;
+ }
+ if (isset($_compile_id)) {
+ $_compile_id_part = $_compile_dir . $_compile_id . $_dir_sep;
+ $_compile_id_part_length = strlen($_compile_id_part);
+ }
+ $_count = 0;
+ try {
+ $_compileDirs = new RecursiveDirectoryIterator($_dir);
+ // NOTE: UnexpectedValueException thrown for PHP >= 5.3
+ }
+ catch (Exception $e) {
+ return 0;
+ }
+ $_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST);
+ foreach ($_compile as $_file) {
+ if (substr(basename($_file->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
+ continue;
+ }
+
+ $_filepath = (string) $_file;
+
+ if ($_file->isDir()) {
+ if (!$_compile->isDot()) {
+ // delete folder if empty
+ @rmdir($_file->getPathname());
+ }
+ } else {
+ $unlink = false;
+ if ((!isset($_compile_id) || (isset($_filepath[$_compile_id_part_length]) &&
+ $a = !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length))) &&
+ (!isset($resource_name) || (isset($_filepath[$_resource_part_1_length]) &&
+ substr_compare($_filepath, $_resource_part_1, - $_resource_part_1_length,
+ $_resource_part_1_length) == 0) ||
+ (isset($_filepath[$_resource_part_2_length]) &&
+ substr_compare($_filepath, $_resource_part_2, - $_resource_part_2_length,
+ $_resource_part_2_length) == 0))
+ ) {
+ if (isset($exp_time)) {
+ if (time() - @filemtime($_filepath) >= $exp_time) {
+ $unlink = true;
+ }
+ } else {
+ $unlink = true;
+ }
+ }
+
+ if ($unlink && @unlink($_filepath)) {
+ if (isset($smarty->_cache['template_objects'])) {
+ foreach ($smarty->_cache['template_objects'] as $key => $tpl) {
+ if (isset($tpl->compiled) && $tpl->compiled->filepath == $_filepath) {
+ unset($smarty->_cache['template_objects'][$key]);
+ }
+ }
+ }
+ $_count ++;
+ if (function_exists('opcache_invalidate')) {
+ opcache_invalidate($_filepath);
+ }
+ }
+ }
+ }
+ // clear compiled cache
+ if (!isset($resource_name) && isset($smarty->_cache['source_objects'])) {
+ foreach ($smarty->_cache['source_objects'] as $source) {
+ $source->compileds = array();
+ }
+ }
+ return $_count;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_clearconfig.php b/library/Smarty/libs/sysplugins/smarty_internal_method_clearconfig.php
new file mode 100644
index 000000000..9c6167f4d
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_clearconfig.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * Smarty Method ClearConfig
+ *
+ * Smarty::clearConfig() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_ClearConfig
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * clear a single or all config variables
+ *
+ * @api Smarty::clearConfig()
+ * @link http://www.smarty.net/docs/en/api.clear.config.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string|null $name variable name or null
+ *
+ * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty
+ */
+ public function clearConfig(Smarty_Internal_Data $data, $name = null)
+ {
+ if (isset($name)) {
+ unset($data->config_vars[$name]);
+ } else {
+ $data->config_vars = array();
+ }
+ return $data;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php b/library/Smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php
new file mode 100644
index 000000000..4d6be65c4
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * Smarty Method CompileAllConfig
+ *
+ * Smarty::compileAllConfig() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_CompileAllConfig extends Smarty_Internal_Method_CompileAllTemplates
+{
+
+ /**
+ * Compile all config files
+ *
+ * @api Smarty::compileAllConfig()
+ *
+ * @param \Smarty $smarty
+ * @param string $extension file extension
+ * @param bool $force_compile force all to recompile
+ * @param int $time_limit
+ * @param int $max_errors
+ *
+ * @return integer number of template files recompiled
+ */
+ public function compileAllConfig(Smarty $smarty, $extension = '.conf', $force_compile = false, $time_limit = 0, $max_errors = null)
+ {
+ return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors, true);
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php b/library/Smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php
new file mode 100644
index 000000000..685fc0c0d
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php
@@ -0,0 +1,111 @@
+<?php
+
+/**
+ * Smarty Method CompileAllTemplates
+ *
+ * Smarty::compileAllTemplates() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_CompileAllTemplates
+{
+ /**
+ * Valid for Smarty object
+ *
+ * @var int
+ */
+ public $objMap = 1;
+
+ /**
+ * Compile all template files
+ *
+ * @api Smarty::compileAllTemplates()
+ *
+ * @param \Smarty $smarty
+ * @param string $extension file extension
+ * @param bool $force_compile force all to recompile
+ * @param int $time_limit
+ * @param int $max_errors
+ *
+ * @return integer number of template files recompiled
+ */
+ public function compileAllTemplates(Smarty $smarty, $extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
+ {
+ return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors);
+ }
+
+ /**
+ * Compile all template or config files
+ *
+ * @param \Smarty $smarty
+ * @param string $extension template file name extension
+ * @param bool $force_compile force all to recompile
+ * @param int $time_limit set maximum execution time
+ * @param int $max_errors set maximum allowed errors
+ * @param bool $isConfig flag true if called for config files
+ *
+ * @return int number of template files compiled
+ */
+ protected function compileAll(Smarty $smarty, $extension, $force_compile, $time_limit, $max_errors, $isConfig = false)
+ {
+ // switch off time limit
+ if (function_exists('set_time_limit')) {
+ @set_time_limit($time_limit);
+ }
+ $_count = 0;
+ $_error_count = 0;
+ $sourceDir = $isConfig ? $smarty->getConfigDir() : $smarty->getTemplateDir();
+ // loop over array of source directories
+ foreach ($sourceDir as $_dir) {
+ $_dir_1 = new RecursiveDirectoryIterator($_dir);
+ $_dir_2 = new RecursiveIteratorIterator($_dir_1);
+ foreach ($_dir_2 as $_fileinfo) {
+ $_file = $_fileinfo->getFilename();
+ if (substr(basename($_fileinfo->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
+ continue;
+ }
+ if (!substr_compare($_file, $extension, - strlen($extension)) == 0) {
+ continue;
+ }
+ if ($_fileinfo->getPath() == !substr($_dir, 0, - 1)) {
+ $_file = substr($_fileinfo->getPath(), strlen($_dir)) . DS . $_file;
+ }
+ echo "\n<br>", $_dir, '---', $_file;
+ flush();
+ $_start_time = microtime(true);
+ $_smarty = clone $smarty;
+ $_smarty->force_compile = $force_compile;
+ try {
+ /* @var Smarty_Internal_Template $_tpl */
+ $_tpl = new $smarty->template_class($_file, $_smarty);
+ $_tpl->caching = Smarty::CACHING_OFF;
+ $_tpl->source = $isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl);
+ if ($_tpl->mustCompile()) {
+ $_tpl->compileTemplateSource();
+ $_count ++;
+ echo ' compiled in ', microtime(true) - $_start_time, ' seconds';
+ flush();
+ } else {
+ echo ' is up to date';
+ flush();
+ }
+ }
+ catch (Exception $e) {
+ echo "\n<br> ------>Error: ", $e->getMessage(), "<br><br>\n";
+ $_error_count ++;
+ }
+ // free memory
+ unset($_tpl);
+ $_smarty->_cache['template_objects'] = array();
+ if ($max_errors !== null && $_error_count == $max_errors) {
+ echo "\n<br><br>too many errors\n";
+ exit();
+ }
+ }
+ }
+ echo "\n<br>";
+ return $_count;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_configload.php b/library/Smarty/libs/sysplugins/smarty_internal_method_configload.php
new file mode 100644
index 000000000..ec023ec8f
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_configload.php
@@ -0,0 +1,182 @@
+<?php
+
+/**
+ * Smarty Method ConfigLoad
+ *
+ * Smarty::configLoad() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_ConfigLoad
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * load a config file, optionally load just selected sections
+ *
+ * @api Smarty::configLoad()
+ * @link http://www.smarty.net/docs/en/api.config.load.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string $config_file filename
+ * @param mixed $sections array of section names, single
+ * section or null
+ *
+ * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
+ * @throws \SmartyException
+ */
+ public function configLoad(Smarty_Internal_Data $data, $config_file, $sections = null)
+ {
+ $this->_loadConfigFile($data, $config_file, $sections, 0);
+ return $data;
+ }
+
+ /**
+ * load a config file, optionally load just selected sections
+ *
+ * @api Smarty::configLoad()
+ * @link http://www.smarty.net/docs/en/api.config.load.tpl
+ *
+ * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data
+ * @param string $config_file filename
+ * @param mixed $sections array of section names, single
+ * section or null
+ * @param int $scope scope into which config variables
+ * shall be loaded
+ *
+ * @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template
+ * @throws \SmartyException
+ */
+ public function _loadConfigFile(Smarty_Internal_Data $data, $config_file, $sections = null, $scope = 0)
+ {
+ /* @var \Smarty $smarty */
+ $smarty = isset($data->smarty) ? $data->smarty : $data;
+ /* @var \Smarty_Internal_Template $confObj */
+ $confObj = new Smarty_Internal_Template($config_file, $smarty, $data);
+ $confObj->caching = Smarty::CACHING_OFF;
+ $confObj->source = Smarty_Template_Config::load($confObj);
+ $confObj->source->config_sections = $sections;
+ $confObj->source->scope = $scope;
+ $confObj->compiled = Smarty_Template_Compiled::load($confObj);
+ $confObj->compiled->render($confObj);
+ if ($data->_objType == 2) {
+ $data->compiled->file_dependency[$confObj->source->uid] =
+ array($confObj->source->filepath, $confObj->source->getTimeStamp(), $confObj->source->type);
+ }
+ }
+
+ /**
+ * load config variables into template object
+ *
+ * @param \Smarty_Internal_Template $tpl
+ * @param array $_config_vars
+ *
+ */
+ public function _loadConfigVars(Smarty_Internal_Template $tpl, $_config_vars)
+ {
+ $this->_assignConfigVars($tpl->parent, $tpl, $_config_vars);
+ $scope = $tpl->source->scope;
+ if (!$scope && !$tpl->scope) {
+ return;
+ }
+ foreach (array($scope, $tpl->scope) as $s) {
+ $s = ($bubble_up = $s >= Smarty::SCOPE_BUBBLE_UP) ? $s - Smarty::SCOPE_BUBBLE_UP : $s;
+ if ($bubble_up && $s) {
+ $ptr = $tpl->parent->parent;
+ if (isset($ptr)) {
+ $this->_assignConfigVars($ptr, $tpl, $_config_vars);
+ $ptr = $ptr->parent;
+ }
+ if ($s == Smarty::SCOPE_PARENT) {
+ continue;
+ }
+ while (isset($ptr) && $ptr->_objType == 2) {
+ $this->_assignConfigVars($ptr, $tpl, $_config_vars);
+ $ptr = $ptr->parent;
+ }
+ if ($s == Smarty::SCOPE_TPL_ROOT) {
+ continue;
+ } elseif ($s == Smarty::SCOPE_SMARTY) {
+ $this->_assignConfigVars($tpl->smarty, $tpl, $_config_vars);
+ } elseif ($s == Smarty::SCOPE_GLOBAL) {
+ $this->_assignConfigVars($tpl->smarty, $tpl, $_config_vars);
+ } elseif ($s == Smarty::SCOPE_ROOT) {
+ while (isset($ptr->parent)) {
+ $ptr = $ptr->parent;
+ }
+ $this->_assignConfigVars($ptr, $tpl, $_config_vars);
+ }
+ }
+ }
+ }
+
+ /**
+ * Assign all config variables in given scope
+ *
+ * @param \Smarty_Internal_Data $scope_ptr
+ * @param \Smarty_Internal_Template $tpl
+ * @param array $_config_vars
+ */
+ public function _assignConfigVars(Smarty_Internal_Data $scope_ptr, Smarty_Internal_Template $tpl, $_config_vars)
+ {
+ // copy global config vars
+ foreach ($_config_vars['vars'] as $variable => $value) {
+ if ($tpl->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {
+ $scope_ptr->config_vars[$variable] = $value;
+ } else {
+ $scope_ptr->config_vars[$variable] =
+ array_merge((array) $scope_ptr->config_vars[$variable], (array) $value);
+ }
+ }
+ // scan sections
+ $sections = $tpl->source->config_sections;
+ if (!empty($sections)) {
+ foreach ((array) $sections as $tpl_section) {
+ if (isset($_config_vars['sections'][$tpl_section])) {
+ foreach ($_config_vars['sections'][$tpl_section]['vars'] as $variable => $value) {
+ if ($tpl->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {
+ $scope_ptr->config_vars[$variable] = $value;
+ } else {
+ $scope_ptr->config_vars[$variable] =
+ array_merge((array) $scope_ptr->config_vars[$variable], (array) $value);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * gets a config variable value
+ *
+ * @param \Smarty_Internal_Template $tpl template object
+ * @param string $varName the name of the config variable
+ * @param bool $errorEnable
+ *
+ * @return mixed the value of the config variable
+ */
+ public function _getConfigVariable(\Smarty_Internal_Template $tpl, $varName, $errorEnable = true)
+ {
+ $_ptr = $tpl;
+ while ($_ptr !== null) {
+ if (isset($_ptr->config_vars[$varName])) {
+ // found it, return it
+ return $_ptr->config_vars[$varName];
+ }
+ // not found, try at parent
+ $_ptr = $_ptr->parent;
+ }
+ if ($tpl->smarty->error_unassigned && $errorEnable) {
+ // force a notice
+ $x = $$varName;
+ }
+ return null;
+ }
+}
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_createdata.php b/library/Smarty/libs/sysplugins/smarty_internal_method_createdata.php
new file mode 100644
index 000000000..600bc777c
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_createdata.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * Smarty Method CreateData
+ *
+ * Smarty::createData() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_CreateData
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * creates a data object
+ *
+ * @api Smarty::createData()
+ * @link http://www.smarty.net/docs/en/api.create.data.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param \Smarty_Internal_Template|\Smarty_Internal_Data|\Smarty_Data|\Smarty $parent next higher level of Smarty
+ * variables
+ * @param string $name optional data block name
+ *
+ * @returns Smarty_Data data object
+ */
+ public function createData(Smarty_Internal_TemplateBase $obj, Smarty_Internal_Data $parent = null, $name = null)
+ {
+ /* @var Smarty $smarty */
+ $smarty = isset($this->smarty) ? $this->smarty : $obj;
+ $dataObj = new Smarty_Data($parent, $smarty, $name);
+ if ($smarty->debugging) {
+ Smarty_Internal_Debug::register_data($dataObj);
+ }
+ return $dataObj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php b/library/Smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php
new file mode 100644
index 000000000..e1a7801f7
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * Smarty Method GetAutoloadFilters
+ *
+ * Smarty::getAutoloadFilters() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetAutoloadFilters extends Smarty_Internal_Method_SetAutoloadFilters
+{
+
+ /**
+ * Get autoload filters
+ *
+ * @api Smarty::getAutoloadFilters()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type type of filter to get auto loads
+ * for. Defaults to all autoload
+ * filters
+ *
+ * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type
+ * was specified
+ */
+ public function getAutoloadFilters(Smarty_Internal_TemplateBase $obj, $type = null)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if ($type !== null) {
+ $this->_checkFilterType($type);
+ return isset($smarty->autoload_filters[$type]) ? $smarty->autoload_filters[$type] : array();
+ }
+ return $smarty->autoload_filters;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php b/library/Smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php
new file mode 100644
index 000000000..b15672168
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php
@@ -0,0 +1,58 @@
+<?php
+
+/**
+ * Smarty Method GetConfigVars
+ *
+ * Smarty::getConfigVars() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetConfigVars
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * Returns a single or all config variables
+ *
+ * @api Smarty::getConfigVars()
+ * @link http://www.smarty.net/docs/en/api.get.config.vars.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string $varname variable name or null
+ * @param bool $search_parents include parent templates?
+ *
+ * @return mixed variable value or or array of variables
+ */
+ public function getConfigVars(Smarty_Internal_Data $data, $varname = null, $search_parents = true)
+ {
+ $_ptr = $data;
+ $var_array = array();
+ while ($_ptr !== null) {
+ if (isset($varname)) {
+ if (isset($_ptr->config_vars[$varname])) {
+ return $_ptr->config_vars[$varname];
+ }
+ } else {
+ $var_array = array_merge($_ptr->config_vars, $var_array);
+ }
+ // not found, try at parent
+ if ($search_parents) {
+ $_ptr = $_ptr->parent;
+ } else {
+ $_ptr = null;
+ }
+ }
+ if (isset($varname)) {
+ return '';
+ } else {
+ return $var_array;
+ }
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php b/library/Smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php
new file mode 100644
index 000000000..3c3432ce1
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * Smarty Method GetDebugTemplate
+ *
+ * Smarty::getDebugTemplate() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetDebugTemplate
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * return name of debugging template
+ *
+ * @api Smarty::getDebugTemplate()
+
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ *
+ * @return string
+ */
+ public function getDebugTemplate(Smarty_Internal_TemplateBase $obj)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ return $smarty->debug_tpl;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php b/library/Smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php
new file mode 100644
index 000000000..32e0cc413
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * Smarty Method GetDefaultModifiers
+ *
+ * Smarty::getDefaultModifiers() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetDefaultModifiers
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Get default modifiers
+ *
+ * @api Smarty::getDefaultModifiers()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ *
+ * @return array list of default modifiers
+ */
+ public function getDefaultModifiers(Smarty_Internal_TemplateBase $obj)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ return $smarty->default_modifiers;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php b/library/Smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php
new file mode 100644
index 000000000..be0c0dba2
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * Smarty Method GetRegisteredObject
+ *
+ * Smarty::getRegisteredObject() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetRegisteredObject
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * return a reference to a registered object
+ *
+ * @api Smarty::getRegisteredObject()
+ * @link http://www.smarty.net/docs/en/api.get.registered.object.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $object_name object name
+ *
+ * @return object
+ * @throws \SmartyException if no such object is found
+ */
+ public function getRegisteredObject(Smarty_Internal_TemplateBase $obj, $object_name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (!isset($smarty->registered_objects[$object_name])) {
+ throw new SmartyException("'$object_name' is not a registered object");
+ }
+ if (!is_object($smarty->registered_objects[$object_name][0])) {
+ throw new SmartyException("registered '$object_name' is not an object");
+ }
+ return $smarty->registered_objects[$object_name][0];
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php b/library/Smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php
new file mode 100644
index 000000000..b922fd088
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * Smarty Method GetStreamVariable
+ *
+ * Smarty::getStreamVariable() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetStreamVariable
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * gets a stream variable
+ *
+ * @api Smarty::getStreamVariable()
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string $variable the stream of the variable
+ *
+ * @return mixed
+ * @throws \SmartyException
+ */
+ public function getStreamVariable(Smarty_Internal_Data $data, $variable)
+ {
+ $_result = '';
+ $fp = fopen($variable, 'r+');
+ if ($fp) {
+ while (!feof($fp) && ($current_line = fgets($fp)) !== false) {
+ $_result .= $current_line;
+ }
+ fclose($fp);
+
+ return $_result;
+ }
+ $smarty = isset($data->smarty) ? $data->smarty : $data;
+ if ($smarty->error_unassigned) {
+ throw new SmartyException('Undefined stream variable "' . $variable . '"');
+ } else {
+ return null;
+ }
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_gettags.php b/library/Smarty/libs/sysplugins/smarty_internal_method_gettags.php
new file mode 100644
index 000000000..dd9e8d1ca
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_gettags.php
@@ -0,0 +1,62 @@
+<?php
+
+/**
+ * Smarty Method GetTags
+ *
+ * Smarty::getTags() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetTags
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Return array of tag/attributes of all tags used by an template
+ *
+ * @api Smarty::getTags()
+ * @link http://www.smarty.net/docs/en/api.get.tags.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param null|string|Smarty_Internal_Template $template
+ *
+ * @return array of tag/attributes
+ * @throws \SmartyException
+ */
+ public function getTags(Smarty_Internal_TemplateBase $obj, $template = null)
+ {
+ /* @var Smarty $smarty */
+ $smarty = isset($this->smarty) ? $this->smarty : $obj;
+ if ($obj->_objType == 2 && !isset($template)) {
+ $tpl = clone $obj;
+ } elseif (isset($template) && $template->_objType == 2) {
+ $tpl = clone $template;
+ } elseif (isset($template) && is_string($template)) {
+ /* @var Smarty_Internal_Template $tpl */
+ $tpl = new $smarty->template_class($template, $smarty);
+ // checks if template exists
+ if (!$tpl->source->exists) {
+ throw new SmartyException("Unable to load template {$tpl->source->type} '{$tpl->source->name}'");
+ }
+ }
+ if (isset($tpl)) {
+ $tpl->smarty = clone $tpl->smarty;
+ $tpl->smarty->_cache['get_used_tags'] = true;
+ $tpl->_cache['used_tags'] = array();
+ $tpl->smarty->merge_compiled_includes = false;
+ $tpl->smarty->disableSecurity();
+ $tpl->caching = false;
+ $tpl->loadCompiler();
+ $tpl->compiler->compileTemplate($tpl);
+ return $tpl->_cache['used_tags'];
+ }
+ throw new SmartyException("Missing template specification");
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php b/library/Smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php
new file mode 100644
index 000000000..235bece46
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php
@@ -0,0 +1,114 @@
+<?php
+
+/**
+ * Smarty Method GetTemplateVars
+ *
+ * Smarty::getTemplateVars() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_GetTemplateVars
+{
+ /**
+ * Valid for all objects
+ *
+ * @var int
+ */
+ public $objMap = 7;
+
+ /**
+ * Returns a single or all template variables
+ *
+ * @api Smarty::getTemplateVars()
+ * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string $varName variable name or null
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object
+ * @param bool $searchParents include parent templates?
+ *
+ * @return mixed variable value or or array of variables
+ */
+ public function getTemplateVars(Smarty_Internal_Data $data, $varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true)
+ {
+ if (isset($varName)) {
+ $_var = $this->_getVariable($data, $varName, $_ptr, $searchParents, false);
+ if (is_object($_var)) {
+ return $_var->value;
+ } else {
+ return null;
+ }
+ } else {
+ $_result = array();
+ if ($_ptr === null) {
+ $_ptr = $data;
+ }
+ while ($_ptr !== null) {
+ foreach ($_ptr->tpl_vars AS $key => $var) {
+ if (!array_key_exists($key, $_result)) {
+ $_result[$key] = $var->value;
+ }
+ }
+ // not found, try at parent
+ if ($searchParents) {
+ $_ptr = $_ptr->parent;
+ } else {
+ $_ptr = null;
+ }
+ }
+ if ($searchParents && isset(Smarty::$global_tpl_vars)) {
+ foreach (Smarty::$global_tpl_vars AS $key => $var) {
+ if (!array_key_exists($key, $_result)) {
+ $_result[$key] = $var->value;
+ }
+ }
+ }
+ return $_result;
+ }
+ }
+
+ /**
+ * gets the object of a Smarty variable
+ *
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
+ * @param string $varName the name of the Smarty variable
+ * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object
+ * @param bool $searchParents search also in parent data
+ * @param bool $errorEnable
+ *
+ * @return \Smarty_Variable
+ */
+ public function _getVariable(Smarty_Internal_Data $data, $varName, Smarty_Internal_Data $_ptr = null, $searchParents = true, $errorEnable = true)
+ {
+ if ($_ptr === null) {
+ $_ptr = $data;
+ }
+ while ($_ptr !== null) {
+ if (isset($_ptr->tpl_vars[$varName])) {
+ // found it, return it
+ return $_ptr->tpl_vars[$varName];
+ }
+ // not found, try at parent
+ if ($searchParents) {
+ $_ptr = $_ptr->parent;
+ } else {
+ $_ptr = null;
+ }
+ }
+ if (isset(Smarty::$global_tpl_vars[$varName])) {
+ // found it, return it
+ return Smarty::$global_tpl_vars[$varName];
+ }
+ /* @var \Smarty $smarty */
+ $smarty = isset($data->smarty) ? $data->smarty : $data;
+ if ($smarty->error_unassigned && $errorEnable) {
+ // force a notice
+ $x = $$varName;
+ }
+
+ return new Smarty_Undefined_Variable;
+ }
+
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_loadfilter.php b/library/Smarty/libs/sysplugins/smarty_internal_method_loadfilter.php
new file mode 100644
index 000000000..7fb11179f
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_loadfilter.php
@@ -0,0 +1,77 @@
+<?php
+
+/**
+ * Smarty Method LoadFilter
+ *
+ * Smarty::loadFilter() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_LoadFilter
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Valid filter types
+ *
+ * @var array
+ */
+ private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
+
+ /**
+ * load a filter of specified type and name
+ *
+ * @api Smarty::loadFilter()
+ *
+ * @link http://www.smarty.net/docs/en/api.load.filter.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type filter type
+ * @param string $name filter name
+ *
+ * @return bool
+ * @throws SmartyException if filter could not be loaded
+ */
+ public function loadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $this->_checkFilterType($type);
+ $_plugin = "smarty_{$type}filter_{$name}";
+ $_filter_name = $_plugin;
+ if (is_callable($_plugin)) {
+ $smarty->registered_filters[$type][$_filter_name] = $_plugin;
+ return true;
+ }
+ if ($smarty->loadPlugin($_plugin)) {
+ if (class_exists($_plugin, false)) {
+ $_plugin = array($_plugin, 'execute');
+ }
+ if (is_callable($_plugin)) {
+ $smarty->registered_filters[$type][$_filter_name] = $_plugin;
+ return true;
+ }
+ }
+ throw new SmartyException("{$type}filter \"{$name}\" not found or callable");
+ }
+
+ /**
+ * Check if filter type is valid
+ *
+ * @param string $type
+ *
+ * @throws \SmartyException
+ */
+ public function _checkFilterType($type)
+ {
+ if (!isset($this->filterTypes[$type])) {
+ throw new SmartyException("Illegal filter type \"{$type}\"");
+ }
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_loadplugin.php b/library/Smarty/libs/sysplugins/smarty_internal_method_loadplugin.php
new file mode 100644
index 000000000..c153f55f0
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_loadplugin.php
@@ -0,0 +1,111 @@
+<?php
+
+/**
+ * Smarty Extension Loadplugin
+ *
+ * $smarty->loadPlugin() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_LoadPlugin
+{
+ /**
+ * Cache of searched plugin files
+ *
+ * @var array
+ */
+ public $plugin_files = array();
+
+ /**
+ * Takes unknown classes and loads plugin files for them
+ * class name format: Smarty_PluginType_PluginName
+ * plugin filename format: plugintype.pluginname.php
+ *
+ * @param \Smarty $smarty
+ * @param string $plugin_name class plugin name to load
+ * @param bool $check check if already loaded
+ *
+ * @return bool|string
+ * @throws \SmartyException
+ */
+ public function loadPlugin(Smarty $smarty, $plugin_name, $check)
+ {
+ // if function or class exists, exit silently (already loaded)
+ if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false))) {
+ return true;
+ }
+ if (!preg_match('#^smarty_((internal)|([^_]+))_(.+)$#i', $plugin_name, $match)) {
+ throw new SmartyException("plugin {$plugin_name} is not a valid name format");
+ }
+ if (!empty($match[2])) {
+ $file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';
+ if (isset($this->plugin_files[$file])) {
+ if ($this->plugin_files[$file] !== false) {
+ return $this->plugin_files[$file];
+ } else {
+ return false;
+ }
+ } else {
+ if (is_file($file)) {
+ $this->plugin_files[$file] = $file;
+ require_once($file);
+ return $file;
+ } else {
+ $this->plugin_files[$file] = false;
+ return false;
+ }
+ }
+ }
+ // plugin filename is expected to be: [type].[name].php
+ $_plugin_filename = "{$match[1]}.{$match[4]}.php";
+ $_lower_filename = strtolower($_plugin_filename);
+ if (isset($this->plugin_files)) {
+ if (isset($this->plugin_files['plugins_dir'][$_lower_filename])) {
+ if (!$smarty->use_include_path || $this->plugin_files['plugins_dir'][$_lower_filename] !== false) {
+ return $this->plugin_files['plugins_dir'][$_lower_filename];
+ }
+ }
+ if (!$smarty->use_include_path || $smarty->ext->_getIncludePath->isNewIncludePath($smarty)) {
+ unset($this->plugin_files['include_path']);
+ } else {
+ if (isset($this->plugin_files['include_path'][$_lower_filename])) {
+ return $this->plugin_files['include_path'][$_lower_filename];
+ }
+ }
+ }
+ $_file_names = array($_plugin_filename);
+ if ($_lower_filename != $_plugin_filename) {
+ $_file_names[] = $_lower_filename;
+ }
+ $_p_dirs = $smarty->getPluginsDir();
+ if (!isset($this->plugin_files['plugins_dir'][$_lower_filename])) {
+ // loop through plugin dirs and find the plugin
+ foreach ($_p_dirs as $_plugin_dir) {
+ foreach ($_file_names as $name) {
+ $file = $_plugin_dir . $name;
+ if (is_file($file)) {
+ $this->plugin_files['plugins_dir'][$_lower_filename] = $file;
+ require_once($file);
+ return $file;
+ }
+ $this->plugin_files['plugins_dir'][$_lower_filename] = false;
+ }
+ }
+ }
+ if ($smarty->use_include_path) {
+ foreach ($_file_names as $_file_name) {
+ // try PHP include_path
+ $file = $smarty->ext->_getIncludePath->getIncludePath($_p_dirs, $_file_name, $smarty);
+ $this->plugin_files['include_path'][$_lower_filename] = $file;
+ if ($file !== false) {
+ require_once($file);
+ return $file;
+ }
+ }
+ }
+ // no plugin loaded
+ return false;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_mustcompile.php b/library/Smarty/libs/sysplugins/smarty_internal_method_mustcompile.php
new file mode 100644
index 000000000..f28a68e6d
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_mustcompile.php
@@ -0,0 +1,49 @@
+<?php
+
+/**
+ * Smarty Method UnloadFilter
+ *
+ * Smarty_Internal_Template::mustCompile() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_MustCompile
+{
+ /**
+ * Valid for template object
+ *
+ * @var int
+ */
+ public $objMap = 2;
+
+ /**
+ * Returns if the current template must be compiled by the Smarty compiler
+ * It does compare the timestamps of template source and the compiled templates and checks the force compile
+ * configuration
+ *
+ * @param \Smarty_Internal_Template $_template
+ *
+ * @return bool
+ * @throws \SmartyException
+ */
+ public function mustCompile(Smarty_Internal_Template $_template)
+ {
+ if (!$_template->source->exists) {
+ if (isset($_template->parent) && $_template->parent->_objType == 2) {
+ $parent_resource = " in '$_template->parent->template_resource}'";
+ } else {
+ $parent_resource = '';
+ }
+ throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
+ }
+ if ($_template->mustCompile === null) {
+ $_template->mustCompile = (!$_template->source->handler->uncompiled &&
+ ($_template->smarty->force_compile || $_template->source->handler->recompiled || !$_template->compiled->exists ||
+ ($_template->smarty->compile_check && $_template->compiled->getTimeStamp() < $_template->source->getTimeStamp())));
+ }
+
+ return $_template->mustCompile;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php b/library/Smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php
new file mode 100644
index 000000000..55c5090ac
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php
@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * Smarty Method RegisterCacheResource
+ *
+ * Smarty::registerCacheResource() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterCacheResource
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers a resource to fetch a template
+ *
+ * @api Smarty::registerCacheResource()
+ * @link http://www.smarty.net/docs/en/api.register.cacheresource.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $name name of resource type
+ * @param \Smarty_CacheResource $resource_handler
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function registerCacheResource(Smarty_Internal_TemplateBase $obj, $name, Smarty_CacheResource $resource_handler)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $smarty->registered_cache_resources[$name] = $resource_handler;
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_registerclass.php b/library/Smarty/libs/sysplugins/smarty_internal_method_registerclass.php
new file mode 100644
index 000000000..d2e5e20bb
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_registerclass.php
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * Smarty Method RegisterClass
+ *
+ * Smarty::registerClass() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterClass
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers static classes to be used in templates
+ *
+ * @api Smarty::registerClass()
+ * @link http://www.smarty.net/docs/en/api.register.class.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $class_name
+ * @param string $class_impl the referenced PHP class to
+ * register
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws \SmartyException
+ */
+ public function registerClass(Smarty_Internal_TemplateBase $obj, $class_name, $class_impl)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ // test if exists
+ if (!class_exists($class_impl)) {
+ throw new SmartyException("Undefined class '$class_impl' in register template class");
+ }
+ // register the class
+ $smarty->registered_classes[$class_name] = $class_impl;
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php b/library/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php
new file mode 100644
index 000000000..370aa38dc
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Smarty Method RegisterDefaultConfigHandler
+ *
+ * Smarty::registerDefaultConfigHandler() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterDefaultConfigHandler
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Register config default handler
+ *
+ * @api Smarty::registerDefaultConfigHandler()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param callable $callback class/method name
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws SmartyException if $callback is not callable
+ */
+ public function registerDefaultConfigHandler(Smarty_Internal_TemplateBase $obj, $callback)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (is_callable($callback)) {
+ $smarty->default_config_handler_func = $callback;
+ } else {
+ throw new SmartyException("Default config handler not callable");
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php b/library/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php
new file mode 100644
index 000000000..80b801ce5
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * Smarty Method RegisterDefaultPluginHandler
+ *
+ * Smarty::registerDefaultPluginHandler() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterDefaultPluginHandler
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers a default plugin handler
+ *
+ * @api Smarty::registerDefaultPluginHandler()
+ * @link http://www.smarty.net/docs/en/api.register.default.plugin.handler.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param callable $callback class/method name
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws SmartyException if $callback is not callable
+ */
+ public function registerDefaultPluginHandler(Smarty_Internal_TemplateBase $obj, $callback)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (is_callable($callback)) {
+ $smarty->default_plugin_handler_func = $callback;
+ } else {
+ throw new SmartyException("Default plugin handler '$callback' not callable");
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php b/library/Smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php
new file mode 100644
index 000000000..40979e7a6
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php
@@ -0,0 +1,72 @@
+<?php
+
+/**
+ * Smarty Method RegisterDefaultTemplateHandler
+ *
+ * Smarty::registerDefaultTemplateHandler() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterDefaultTemplateHandler
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Register template default handler
+ *
+ * @api Smarty::registerDefaultTemplateHandler()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param callable $callback class/method name
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws SmartyException if $callback is not callable
+ */
+ public function registerDefaultTemplateHandler(Smarty_Internal_TemplateBase $obj, $callback)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (is_callable($callback)) {
+ $smarty->default_template_handler_func = $callback;
+ } else {
+ throw new SmartyException("Default template handler not callable");
+ }
+ return $obj;
+ }
+
+ /**
+ * get default content from template or config resource handler
+ *
+ * @param Smarty_Template_Source $source
+ */
+ public static function _getDefaultTemplate(Smarty_Template_Source $source)
+ {
+ if ($source->isConfig) {
+ $default_handler = $source->smarty->default_config_handler_func;
+ } else {
+ $default_handler = $source->smarty->default_template_handler_func;
+ }
+ $_content = $_timestamp = null;
+ $_return = call_user_func_array($default_handler, array($source->type, $source->name, &$_content, &$_timestamp,
+ $source->smarty));
+ if (is_string($_return)) {
+ $source->exists = is_file($_return);
+ if ($source->exists) {
+ $source->timestamp = filemtime($_return);
+ }
+ $source->filepath = $_return;
+ } elseif ($_return === true) {
+ $source->content = $_content;
+ $source->timestamp = $_timestamp;
+ $source->exists = true;
+ $source->handler->recompiled = true;
+ $source->filepath = false;
+ }
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_registerfilter.php b/library/Smarty/libs/sysplugins/smarty_internal_method_registerfilter.php
new file mode 100644
index 000000000..84b2c2630
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_registerfilter.php
@@ -0,0 +1,88 @@
+<?php
+
+/**
+ * Smarty Method RegisterFilter
+ *
+ * Smarty::registerFilter() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterFilter
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Valid filter types
+ *
+ * @var array
+ */
+ private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
+
+ /**
+ * Registers a filter function
+ *
+ * @api Smarty::registerFilter()
+ *
+ * @link http://www.smarty.net/docs/en/api.register.filter.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type filter type
+ * @param callback $callback
+ * @param string|null $name optional filter name
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws \SmartyException
+ */
+ public function registerFilter(Smarty_Internal_TemplateBase $obj, $type, $callback, $name = null)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $this->_checkFilterType($type);
+ $name = isset($name) ? $name : $this->_getFilterName($callback);
+ if (!is_callable($callback)) {
+ throw new SmartyException("{$type}filter \"{$name}\" not callable");
+ }
+ $smarty->registered_filters[$type][$name] = $callback;
+ return $obj;
+ }
+
+ /**
+ * Return internal filter name
+ *
+ * @param callback $function_name
+ *
+ * @return string internal filter name
+ */
+ public function _getFilterName($function_name)
+ {
+ if (is_array($function_name)) {
+ $_class_name = (is_object($function_name[0]) ? get_class($function_name[0]) : $function_name[0]);
+
+ return $_class_name . '_' . $function_name[1];
+ } elseif (is_string($function_name)) {
+ return $function_name;
+ } else {
+ return 'closure';
+ }
+ }
+
+ /**
+ * Check if filter type is valid
+ *
+ * @param string $type
+ *
+ * @throws \SmartyException
+ */
+ public function _checkFilterType($type)
+ {
+ if (!isset($this->filterTypes[$type])) {
+ throw new SmartyException("Illegal filter type \"{$type}\"");
+ }
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_registerobject.php b/library/Smarty/libs/sysplugins/smarty_internal_method_registerobject.php
new file mode 100644
index 000000000..f27f1720b
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_registerobject.php
@@ -0,0 +1,71 @@
+<?php
+
+/**
+ * Smarty Method RegisterObject
+ *
+ * Smarty::registerObject() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterObject
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers object to be used in templates
+ *
+ * @api Smarty::registerObject()
+ * @link http://www.smarty.net/docs/en/api.register.object.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $object_name
+ * @param object $object the
+ * referenced
+ * PHP object to
+ * register
+ * @param array $allowed_methods_properties list of
+ * allowed
+ * methods
+ * (empty = all)
+ * @param bool $format smarty
+ * argument
+ * format, else
+ * traditional
+ * @param array $block_methods list of
+ * block-methods
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws \SmartyException
+ */
+ public function registerObject(Smarty_Internal_TemplateBase $obj, $object_name, $object, $allowed_methods_properties = array(), $format = true, $block_methods = array())
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ // test if allowed methods callable
+ if (!empty($allowed_methods_properties)) {
+ foreach ((array) $allowed_methods_properties as $method) {
+ if (!is_callable(array($object, $method)) && !property_exists($object, $method)) {
+ throw new SmartyException("Undefined method or property '$method' in registered object");
+ }
+ }
+ }
+ // test if block methods callable
+ if (!empty($block_methods)) {
+ foreach ((array) $block_methods as $method) {
+ if (!is_callable(array($object, $method))) {
+ throw new SmartyException("Undefined method '$method' in registered object");
+ }
+ }
+ }
+ // register the object
+ $smarty->registered_objects[$object_name] = array($object, (array) $allowed_methods_properties,
+ (boolean) $format, (array) $block_methods);
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_registerplugin.php b/library/Smarty/libs/sysplugins/smarty_internal_method_registerplugin.php
new file mode 100644
index 000000000..95814581d
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_registerplugin.php
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * Smarty Method RegisterPlugin
+ *
+ * Smarty::registerPlugin() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterPlugin
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers plugin to be used in templates
+ *
+ * @api Smarty::registerPlugin()
+ * @link http://www.smarty.net/docs/en/api.register.plugin.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type plugin type
+ * @param string $name name of template tag
+ * @param callback $callback PHP callback to register
+ * @param bool $cacheable if true (default) this
+ * function is cache able
+ * @param mixed $cache_attr caching attributes if any
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws SmartyException when the plugin tag is invalid
+ */
+ public function registerPlugin(Smarty_Internal_TemplateBase $obj, $type, $name, $callback, $cacheable = true, $cache_attr = null)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (isset($smarty->registered_plugins[$type][$name])) {
+ throw new SmartyException("Plugin tag \"{$name}\" already registered");
+ } elseif (!is_callable($callback)) {
+ throw new SmartyException("Plugin \"{$name}\" not callable");
+ } else {
+ $smarty->registered_plugins[$type][$name] = array($callback, (bool) $cacheable, (array) $cache_attr);
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_registerresource.php b/library/Smarty/libs/sysplugins/smarty_internal_method_registerresource.php
new file mode 100644
index 000000000..43246ee9b
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_registerresource.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * Smarty Method RegisterResource
+ *
+ * Smarty::registerResource() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_RegisterResource
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers a resource to fetch a template
+ *
+ * @api Smarty::registerResource()
+ * @link http://www.smarty.net/docs/en/api.register.resource.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $name name of resource type
+ * @param Smarty_Resource|array $resource_handler or instance of
+ * Smarty_Resource, or
+ * array of callbacks to
+ * handle resource
+ * (deprecated)
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function registerResource(Smarty_Internal_TemplateBase $obj, $name, $resource_handler)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $smarty->registered_resources[$name] = $resource_handler instanceof
+ Smarty_Resource ? $resource_handler : array($resource_handler, false);
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php b/library/Smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php
new file mode 100644
index 000000000..b1f965cd9
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php
@@ -0,0 +1,70 @@
+<?php
+
+/**
+ * Smarty Method SetAutoloadFilters
+ *
+ * Smarty::setAutoloadFilters() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_SetAutoloadFilters
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Valid filter types
+ *
+ * @var array
+ */
+ private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
+
+ /**
+ * Set autoload filters
+ *
+ * @api Smarty::setAutoloadFilters()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param array $filters filters to load automatically
+ * @param string $type "pre", "output", … specify the
+ * filter type to set. Defaults to
+ * none treating $filters' keys as
+ * the appropriate types
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function setAutoloadFilters(Smarty_Internal_TemplateBase $obj, $filters, $type = null)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if ($type !== null) {
+ $this->_checkFilterType($type);
+ $smarty->autoload_filters[$type] = (array) $filters;
+ } else {
+ foreach ((array) $filters as $type => $value) {
+ $this->_checkFilterType($type);
+ }
+ $smarty->autoload_filters = (array) $filters;
+ }
+ return $obj;
+ }
+
+ /**
+ * Check if filter type is valid
+ *
+ * @param string $type
+ *
+ * @throws \SmartyException
+ */
+ public function _checkFilterType($type)
+ {
+ if (!isset($this->filterTypes[$type])) {
+ throw new SmartyException("Illegal filter type \"{$type}\"");
+ }
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php b/library/Smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php
new file mode 100644
index 000000000..4ff5d7f82
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * Smarty Method SetDebugTemplate
+ *
+ * Smarty::setDebugTemplate() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_SetDebugTemplate
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * set the debug template
+ *
+ * @api Smarty::setDebugTemplate()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $tpl_name
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ * @throws SmartyException if file is not readable
+ */
+ public function setDebugTemplate(Smarty_Internal_TemplateBase $obj, $tpl_name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (!is_readable($tpl_name)) {
+ throw new SmartyException("Unknown file '{$tpl_name}'");
+ }
+ $smarty->debug_tpl = $tpl_name;
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php b/library/Smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php
new file mode 100644
index 000000000..5a707287a
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * Smarty Method SetDefaultModifiers
+ *
+ * Smarty::setDefaultModifiers() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_SetDefaultModifiers
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Set default modifiers
+ *
+ * @api Smarty::setDefaultModifiers()
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param array|string $modifiers modifier or list of modifiers
+ * to set
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function setDefaultModifiers(Smarty_Internal_TemplateBase $obj, $modifiers)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $smarty->default_modifiers = (array) $modifiers;
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php b/library/Smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php
new file mode 100644
index 000000000..e3d966e1c
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Smarty Method UnloadFilter
+ *
+ * Smarty::unloadFilter() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFilter
+{
+ /**
+ * load a filter of specified type and name
+ *
+ * @api Smarty::unloadFilter()
+ *
+ * @link http://www.smarty.net/docs/en/api.unload.filter.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type filter type
+ * @param string $name filter name
+ *
+ * @return bool
+ */
+ public function unloadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $this->_checkFilterType($type);
+ if (isset($smarty->registered_filters[$type])) {
+ $_filter_name = "smarty_{$type}filter_{$name}";
+ if (isset($smarty->registered_filters[$type][$_filter_name])) {
+ unset ($smarty->registered_filters[$type][$_filter_name]);
+ if (empty($smarty->registered_filters[$type])) {
+ unset($smarty->registered_filters[$type]);
+ }
+ }
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php b/library/Smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php
new file mode 100644
index 000000000..80381015a
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ * Smarty Method UnregisterCacheResource
+ *
+ * Smarty::unregisterCacheResource() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_UnregisterCacheResource
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers a resource to fetch a template
+ *
+ * @api Smarty::unregisterCacheResource()
+ * @link http://www.smarty.net/docs/en/api.unregister.cacheresource.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type name of cache resource type
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function unregisterCacheResource(Smarty_Internal_TemplateBase $obj, $name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (isset($smarty->registered_cache_resources[$name])) {
+ unset($smarty->registered_cache_resources[$name]);
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php b/library/Smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php
new file mode 100644
index 000000000..c80ae9a65
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * Smarty Method UnregisterFilter
+ *
+ * Smarty::unregisterFilter() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_UnregisterFilter extends Smarty_Internal_Method_RegisterFilter
+{
+ /**
+ * Unregisters a filter function
+ *
+ * @api Smarty::unregisterFilter()
+ *
+ * @link http://www.smarty.net/docs/en/api.unregister.filter.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type filter type
+ * @param callback|string $callback
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function unregisterFilter(Smarty_Internal_TemplateBase $obj, $type, $callback)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ $this->_checkFilterType($type);
+ if (isset($smarty->registered_filters[$type])) {
+ $name = is_string($callback) ? $callback : $this->_getFilterName($callback);
+ if (isset($smarty->registered_filters[$type][$name])) {
+ unset($smarty->registered_filters[$type][$name]);
+ if (empty($smarty->registered_filters[$type])) {
+ unset($smarty->registered_filters[$type]);
+ }
+ }
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php b/library/Smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php
new file mode 100644
index 000000000..a94331683
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ * Smarty Method UnregisterObject
+ *
+ * Smarty::unregisterObject() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_UnregisterObject
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers plugin to be used in templates
+ *
+ * @api Smarty::unregisterObject()
+ * @link http://www.smarty.net/docs/en/api.unregister.object.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $object_name name of object
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function unregisterObject(Smarty_Internal_TemplateBase $obj, $object_name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (isset($smarty->registered_objects[$object_name])) {
+ unset($smarty->registered_objects[$object_name]);
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php b/library/Smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php
new file mode 100644
index 000000000..06cb2d354
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * Smarty Method UnregisterPlugin
+ *
+ * Smarty::unregisterPlugin() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_UnregisterPlugin
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers plugin to be used in templates
+ *
+ * @api Smarty::unregisterPlugin()
+ * @link http://www.smarty.net/docs/en/api.unregister.plugin.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type plugin type
+ * @param string $name name of template tag
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function unregisterPlugin(Smarty_Internal_TemplateBase $obj, $type, $name)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (isset($smarty->registered_plugins[$type][$name])) {
+ unset($smarty->registered_plugins[$type][$name]);
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php b/library/Smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php
new file mode 100644
index 000000000..767bd74ab
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ * Smarty Method UnregisterResource
+ *
+ * Smarty::unregisterResource() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Method_UnregisterResource
+{
+ /**
+ * Valid for Smarty and template object
+ *
+ * @var int
+ */
+ public $objMap = 3;
+
+ /**
+ * Registers a resource to fetch a template
+ *
+ * @api Smarty::unregisterResource()
+ * @link http://www.smarty.net/docs/en/api.unregister.resource.tpl
+ *
+ * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
+ * @param string $type name of resource type
+ *
+ * @return \Smarty|\Smarty_Internal_Template
+ */
+ public function unregisterResource(Smarty_Internal_TemplateBase $obj, $type)
+ {
+ $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
+ if (isset($smarty->registered_resources[$type])) {
+ unset($smarty->registered_resources[$type]);
+ }
+ return $obj;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php
new file mode 100644
index 000000000..4e2fb83e6
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php
@@ -0,0 +1,67 @@
+<?php
+
+/**
+ * Inline Runtime Methods render, setSourceByUid, setupSubTemplate
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ *
+ **/
+class Smarty_Internal_Runtime_CacheModify
+{
+ /**
+ * check client side cache
+ *
+ * @param Smarty_Internal_Template $_template
+ * @param string $content
+ */
+ public function cacheModifiedCheck(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
+ {
+ $_isCached = $_template->isCached() && !$_template->compiled->has_nocache_code;
+ $_last_modified_date =
+ @substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
+ if ($_isCached && $cached->timestamp <= strtotime($_last_modified_date)) {
+ switch (PHP_SAPI) {
+ case 'cgi': // php-cgi < 5.3
+ case 'cgi-fcgi': // php-cgi >= 5.3
+ case 'fpm-fcgi': // php-fpm >= 5.3.3
+ header('Status: 304 Not Modified');
+ break;
+
+ case 'cli':
+ if ( /* ^phpunit */
+ !empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS']) /* phpunit$ */
+ ) {
+ $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified';
+ }
+ break;
+
+ default:
+ if ( /* ^phpunit */
+ !empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS']) /* phpunit$ */
+ ) {
+ $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified';
+ } else {
+ header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
+ }
+ break;
+ }
+ } else {
+ switch (PHP_SAPI) {
+ case 'cli':
+ if ( /* ^phpunit */
+ !empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS']) /* phpunit$ */
+ ) {
+ $_SERVER['SMARTY_PHPUNIT_HEADERS'][] =
+ 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $cached->timestamp) . ' GMT';
+ }
+ break;
+ default:
+ header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $cached->timestamp) . ' GMT');
+ break;
+ }
+ echo $content;
+ }
+ }
+}
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php
new file mode 100644
index 000000000..a3be60d40
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php
@@ -0,0 +1,88 @@
+<?php
+/**
+ * Smarty Internal Extension
+ * This file contains the Smarty template extension to create a code frame
+ *
+ * @package Smarty
+ * @subpackage Template
+ * @author Uwe Tews
+ */
+
+/**
+ * Class Smarty_Internal_Extension_CodeFrame
+ * Create code frame for compiled and cached templates
+ */
+class Smarty_Internal_Runtime_CodeFrame
+{
+ /**
+ * Create code frame for compiled and cached templates
+ *
+ * @param Smarty_Internal_Template $_template
+ * @param string $content optional template content
+ * @param bool $cache flag for cache file
+ *
+ * @return string
+ */
+ public function create(Smarty_Internal_Template $_template, $content = '', $functions = '', $cache = false)
+ {
+ // build property code
+ $properties['has_nocache_code'] = $_template->compiled->has_nocache_code;
+ $properties['version'] = Smarty::SMARTY_VERSION;
+ $properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
+ if (!empty($_template->tpl_function)) {
+ $properties['tpl_function'] = $_template->tpl_function;
+ }
+ if (!$cache) {
+ $properties['file_dependency'] = $_template->compiled->file_dependency;
+ $properties['includes'] = $_template->compiled->includes;
+ } else {
+ $properties['file_dependency'] = $_template->cached->file_dependency;
+ $properties['cache_lifetime'] = $_template->cache_lifetime;
+ }
+ $output = "<?php\n";
+ $output .= "/* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") .
+ "\n from \"" . $_template->source->filepath . "\" */\n\n";
+
+ $dec = "\$_smarty_tpl->smarty->ext->_validateCompiled->decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' .
+ ($cache ? 'true' : 'false') . ")";
+ $output .= "if ({$dec}) {\n";
+ $output .= "function {$properties['unifunc']} (\$_smarty_tpl) {\n";
+ // include code for plugins
+ if (!$cache) {
+ if (!empty($_template->compiled->required_plugins['compiled'])) {
+ foreach ($_template->compiled->required_plugins['compiled'] as $tmp) {
+ foreach ($tmp as $data) {
+ $file = addslashes($data['file']);
+ if (is_array($data['function'])) {
+ $output .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n";
+ } else {
+ $output .= "if (!is_callable('{$data['function']}')) require_once '{$file}';\n";
+ }
+ }
+ }
+ }
+ if ($_template->caching && !empty($_template->compiled->required_plugins['nocache'])) {
+ $_template->compiled->has_nocache_code = true;
+ $output .= "echo '/*%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/<?php \$_smarty = \$_smarty_tpl->smarty; ";
+ foreach ($_template->compiled->required_plugins['nocache'] as $tmp) {
+ foreach ($tmp as $data) {
+ $file = addslashes($data['file']);
+ if (is_Array($data['function'])) {
+ $output .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n");
+ } else {
+ $output .= addslashes("if (!is_callable('{$data['function']}')) require_once '{$file}';\n");
+ }
+ }
+ }
+ $output .= "?>/*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/';\n";
+ }
+ }
+ $output .= "?>\n";
+ $output .= $content;
+ $output .= "<?php }\n?>";
+ $output .= $functions;
+ $output .= "<?php }\n";
+ // remove unneeded PHP tags
+ return preg_replace('/\s*\?>[\n]?<\?php\s*/', "\n", $output);
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php
new file mode 100644
index 000000000..9af266758
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Smarty Internal Plugin Filter Handler
+ * Smarty filter handler class
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+
+/**
+ * Class for filter processing
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ */
+class Smarty_Internal_Runtime_FilterHandler
+{
+ /**
+ * Run filters over content
+ * The filters will be lazy loaded if required
+ * class name format: Smarty_FilterType_FilterName
+ * plugin filename format: filtertype.filtername.php
+ * Smarty2 filter plugins could be used
+ *
+ * @param string $type the type of filter ('pre','post','output') which shall run
+ * @param string $content the content which shall be processed by the filters
+ * @param Smarty_Internal_Template $template template object
+ *
+ * @throws SmartyException
+ * @return string the filtered content
+ */
+ public function runFilter($type, $content, Smarty_Internal_Template $template)
+ {
+ // loop over autoload filters of specified type
+ if (!empty($template->smarty->autoload_filters[$type])) {
+ foreach ((array) $template->smarty->autoload_filters[$type] as $name) {
+ $plugin_name = "Smarty_{$type}filter_{$name}";
+ if (function_exists($plugin_name)) {
+ $callback = $plugin_name;
+ } elseif (class_exists($plugin_name, false) && is_callable(array($plugin_name, 'execute'))) {
+ $callback = array($plugin_name, 'execute');
+ } elseif ($template->smarty->loadPlugin($plugin_name, false)) {
+ if (function_exists($plugin_name)) {
+ // use loaded Smarty2 style plugin
+ $callback = $plugin_name;
+ } elseif (class_exists($plugin_name, false) && is_callable(array($plugin_name, 'execute'))) {
+ // loaded class of filter plugin
+ $callback = array($plugin_name, 'execute');
+ } else {
+ throw new SmartyException("Auto load {$type}-filter plugin method \"{$plugin_name}::execute\" not callable");
+ }
+ } else {
+ // nothing found, throw exception
+ throw new SmartyException("Unable to auto load {$type}-filter plugin \"{$plugin_name}\"");
+ }
+ $content = call_user_func($callback, $content, $template);
+ }
+ }
+ // loop over registered filters of specified type
+ if (!empty($template->smarty->registered_filters[$type])) {
+ foreach ($template->smarty->registered_filters[$type] as $key => $name) {
+ $content = call_user_func($template->smarty->registered_filters[$type][$key], $content, $template);
+ }
+ }
+ // return filtered output
+ return $content;
+ }
+}
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_foreach.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_foreach.php
new file mode 100644
index 000000000..87bb0cf4a
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_foreach.php
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * Foreach Runtime Methods count
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ *
+ **/
+class Smarty_Internal_Runtime_Foreach
+{
+ /**
+ * [util function] counts an array, arrayAccess/traversable or PDOStatement object
+ *
+ * @param mixed $value
+ *
+ * @return int the count for arrays and objects that implement countable, 1 for other objects that don't, and 0
+ * for empty elements
+ */
+ public function count($value)
+ {
+ if (is_array($value) === true || $value instanceof Countable) {
+ return count($value);
+ } elseif ($value instanceof IteratorAggregate) {
+ // Note: getIterator() returns a Traversable, not an Iterator
+ // thus rewind() and valid() methods may not be present
+ return iterator_count($value->getIterator());
+ } elseif ($value instanceof Iterator) {
+ return iterator_count($value);
+ } elseif ($value instanceof PDOStatement) {
+ return $value->rowCount();
+ } elseif ($value instanceof Traversable) {
+ return iterator_count($value);
+ } elseif ($value instanceof ArrayAccess) {
+ if ($value->offsetExists(0)) {
+ return 1;
+ }
+ } elseif (is_object($value)) {
+ return count($value);
+ }
+ return 0;
+ }
+}
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php
new file mode 100644
index 000000000..965c95f8b
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php
@@ -0,0 +1,183 @@
+<?php
+/**
+ * Smarty read include path plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Monte Ohrt
+ */
+
+/**
+ * Smarty Internal Read Include Path Class
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ */
+class Smarty_Internal_Runtime_GetIncludePath
+{
+ /**
+ * include path cache
+ *
+ * @var string
+ */
+ public $_include_path = '';
+
+ /**
+ * include path directory cache
+ *
+ * @var array
+ */
+ public $_include_dirs = array();
+
+ /**
+ * include path directory cache
+ *
+ * @var array
+ */
+ public $_user_dirs = array();
+
+ /**
+ * stream cache
+ *
+ * @var string[]
+ */
+ public $isFile = array();
+
+ /**
+ * stream cache
+ *
+ * @var string[]
+ */
+ public $isPath = array();
+
+ /**
+ * stream cache
+ *
+ * @var int[]
+ */
+ public $number = array();
+
+ /**
+ * status cache
+ *
+ * @var bool
+ */
+ public $_has_stream_include = null;
+
+ /**
+ * Number for array index
+ *
+ * @var int
+ */
+ public $counter = 0;
+
+ /**
+ * Check if include path was updated
+ *
+ * @param \Smarty $smarty
+ *
+ * @return bool
+ */
+ public function isNewIncludePath(Smarty $smarty)
+ {
+ $_i_path = get_include_path();
+ if ($this->_include_path != $_i_path) {
+ $this->_include_dirs = array();
+ $this->_include_path = $_i_path;
+ $_dirs = (array) explode(PATH_SEPARATOR, $_i_path);
+ foreach ($_dirs as $_path) {
+ if ($_path[0] != '/' && isset($dir[1]) && $dir[1] != ':') {
+ $_path = $smarty->_realpath($_path . DS, true);
+ }
+ if (is_dir($_path)) {
+ $this->_include_dirs[] = $smarty->_realpath($_path . DS, true);
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * return array with include path directories
+ *
+ * @param \Smarty $smarty
+ *
+ * @return array
+ */
+ public function getIncludePathDirs(Smarty $smarty)
+ {
+ $this->isNewIncludePath($smarty);
+ return $this->_include_dirs;
+ }
+
+ /**
+ * Return full file path from PHP include_path
+ *
+ * @param string[] $dirs
+ * @param string $file
+ * @param \Smarty $smarty
+ *
+ * @return bool|string full filepath or false
+ *
+ */
+ public function getIncludePath($dirs, $file, Smarty $smarty)
+ {
+ //if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : $this->_has_stream_include = false)) {
+ if (!(isset($this->_has_stream_include) ? $this->_has_stream_include : $this->_has_stream_include = function_exists('stream_resolve_include_path'))) {
+ $this->isNewIncludePath($smarty);
+ }
+ // try PHP include_path
+ foreach ($dirs as $dir) {
+ $dir_n = isset($this->number[$dir]) ? $this->number[$dir] : $this->number[$dir] = $this->counter ++;
+ if (isset($this->isFile[$dir_n][$file])) {
+ if ($this->isFile[$dir_n][$file]) {
+ return $this->isFile[$dir_n][$file];
+ } else {
+ continue;
+ }
+ }
+ if (isset($this->_user_dirs[$dir_n])) {
+ if (false === $this->_user_dirs[$dir_n]) {
+ continue;
+ } else {
+ $dir = $this->_user_dirs[$dir_n];
+ }
+ } else {
+ if ($dir[0] == '/' || $dir[1] == ':') {
+ $dir = str_ireplace(getcwd(), '.', $dir);
+ if ($dir[0] == '/' || $dir[1] == ':') {
+ $this->_user_dirs[$dir_n] = false;
+ continue;
+ }
+ }
+ $dir = substr($dir, 2);
+ $this->_user_dirs[$dir_n] = $dir;
+ }
+ if ($this->_has_stream_include) {
+ $path = stream_resolve_include_path($dir . (isset($file) ? $file : ''));
+ if ($path) {
+ return $this->isFile[$dir_n][$file] = $path;
+ }
+ } else {
+ foreach ($this->_include_dirs as $key => $_i_path) {
+ $path = isset($this->isPath[$key][$dir_n]) ? $this->isPath[$key][$dir_n] : $this->isPath[$key][$dir_n] = is_dir($_dir_path = $_i_path .
+ $dir) ? $_dir_path : false;
+ if ($path === false) {
+ continue;
+ }
+ if (isset($file)) {
+ $_file = $this->isFile[$dir_n][$file] = (is_file($path . $file)) ? $path . $file : false;
+ if ($_file) {
+ return $_file;
+ }
+ } else {
+ // no file was given return directory path
+ return $path;
+ }
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_hhvm.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_hhvm.php
new file mode 100644
index 000000000..117cd8166
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_hhvm.php
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * Runtime Extension Hhvm
+ *
+ * include patch for modified compiled or cached templates
+ * HHVM does not check if file was modified when including same file multiple times
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Runtime_Hhvm
+{
+ /**
+ * @param \Smarty_Internal_Template $_template
+ * @param string $file file name
+ *
+ * @return mixed
+ */
+ static function includeHhvm(Smarty_Internal_Template $_template, $file)
+ {
+ $_smarty_tpl = $_template;
+ $tmp_file = $file . preg_replace('![^\w]+!', '_', uniqid(rand(), true)) . '.php';
+ file_put_contents($tmp_file, file_get_contents($file));
+ $result = @include $tmp_file;
+ @unlink($tmp_file);
+ return $result;
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php
new file mode 100644
index 000000000..ed21281d0
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php
@@ -0,0 +1,213 @@
+<?php
+
+/**
+ * Inheritance Runtime Methods processBlock, endChild, init
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ *
+ **/
+class Smarty_Internal_Runtime_Inheritance
+{
+
+ /**
+ * State machine
+ * - 0 idle next extends will create a new inheritance tree
+ * - 1 processing child template
+ * - 2 wait for next inheritance template
+ * - 3 assume parent template, if child will loaded goto state 1
+ * a call to a sub template resets the state to 0
+ *
+ * @var int
+ */
+ public $state = 0;
+
+ /**
+ * Array of block parameter of known {block} tags
+ *
+ * @var array
+ */
+ public $blockParameter = array();
+
+ /**
+ * inheritance template nesting level
+ *
+ * @var int
+ */
+ public $inheritanceLevel = 0;
+
+ /**
+ * inheritance template index
+ *
+ * @var int
+ */
+ public $tplIndex = - 1;
+
+ /**
+ * Array of compiled template file path
+ * - key template index
+ * only used when caching is enabled
+ *
+ * @var []string
+ */
+ public $compiledFilePath = array();
+
+ /**
+ * Current {block} nesting level
+ *
+ * @var int
+ */
+ public $blockNesting = 0;
+
+ /**
+ * Initialize inheritance
+ *
+ * @param \Smarty_Internal_Template $tpl template object of caller
+ * @param bool $initChild if true init for child template
+ * @param array $blockNames outer level block name
+ *
+ */
+ public function init(Smarty_Internal_Template $tpl, $initChild, $blockNames = array())
+ {
+ // if template was from an inner block or template is a parent template create new inheritance root
+ if ($initChild && ($this->blockNesting || $this->state == 3)) {
+ $tpl->ext->_inheritance = new Smarty_Internal_Runtime_Inheritance();
+ $tpl->ext->_inheritance->init($tpl, $initChild, $blockNames);
+ return;
+ }
+ // start of child sub template(s)
+ if ($initChild) {
+ $this->state = 1;
+ if (!$this->inheritanceLevel) {
+ //grab any output of child templates
+ ob_start();
+ }
+ $this->inheritanceLevel ++;
+ }
+ // in parent state {include} will not increment template index
+ if ($this->state != 3) {
+ $this->tplIndex ++;
+ }
+ // if state was waiting for parent change state to parent
+ if ($this->state == 2) {
+ $this->state = 3;
+ }
+ }
+
+ /**
+ * End of child template(s)
+ * - if outer level is reached flush output buffer and switch to wait for parent template state
+ *
+ * @param \Smarty_Internal_Template $tpl template object of caller
+ */
+ public function endChild(Smarty_Internal_Template $tpl)
+ {
+ $this->inheritanceLevel --;
+ if (!$this->inheritanceLevel) {
+ ob_end_clean();
+ $this->state = 2;
+ }
+ }
+
+ /**
+ * Process inheritance {block} tag
+ *
+ * $type 0 = {block}:
+ * - search in inheritance template hierarchy for child blocks
+ * if found call it, otherwise call current block
+ * - ignored for outer level blocks in child templates
+ *
+ * $type 1 = {block}:
+ * - nested {block}
+ * - search in inheritance template hierarchy for child blocks
+ * if found call it, otherwise call current block
+ *
+ * $type 2 = {$smarty.block.child}:
+ * - search in inheritance template hierarchy for child blocks
+ * if found call it, otherwise ignore
+ *
+ * $type 3 = {$smarty.block.parent}:
+ * - get block id from parent stack and call parent block
+ *
+ * @param \Smarty_Internal_Template $tpl template object of caller
+ * @param int $type call type see above
+ * @param string $name block name
+ * @param array $block block parameter
+ * @param array $callStack call stack with block parameters
+ *
+ * @throws \SmartyException
+ */
+ public function processBlock(Smarty_Internal_Template $tpl, $type = 0, $name, $block, $callStack = array())
+ {
+ if (!isset($this->blockParameter[$name])) {
+ $this->blockParameter[$name] = array();
+ }
+ if ($this->state == 1) {
+ $block[2] = count($this->blockParameter[$name]);
+ $block[3] = $this->tplIndex;
+ $this->blockParameter[$name][] = $block;
+ return;
+ }
+ if ($type == 3) {
+ if (!empty($callStack)) {
+ array_shift($callStack);
+ if (empty($callStack)) {
+ throw new SmartyException("inheritance: tag {\$smarty.block.parent} used in parent template block '{$name}'");
+ }
+ $block = array_shift($callStack);
+ } else {
+ return;
+ }
+ } else {
+ $blockParameter = &$this->blockParameter[$name];
+ if ($type == 0) {
+ $index = $block[2] = count($blockParameter);
+ $block[3] = $this->tplIndex;
+ $callStack = array(&$block);
+ } elseif ($type == 1) {
+ $block[3] = $callStack[0][3];
+ $index = 0;
+ for ($i = 0; $i < count($blockParameter); $i ++) {
+ if ($blockParameter[$i][3] <= $block[3]) {
+ $index = $blockParameter[$i][2];
+ }
+ }
+ $block[2] = $index;
+ $callStack = array(&$block);
+ } else {
+ $index = $callStack[0][2];
+ if ($index == 0) {
+ return;
+ }
+ $callStack = $block = array(1 => false);
+ }
+ $index --;
+ // find lowest level child block
+ while ($index >= 0 && ($type || !$block[1])) {
+ $block = &$blockParameter[$index];
+ array_unshift($callStack, $block);
+ if ($block[1]) {
+ break;
+ }
+ $index --;
+ }
+ if (isset($block['hide']) && $index <= 0) {
+ return;
+ }
+ }
+ $this->blockNesting ++;
+ if (isset($block['append'])) {
+ $this->processBlock($tpl, 3, $name, null, $callStack);
+ }
+ if (isset($block[6])) {
+ $block[6]($tpl, $callStack);
+ } else {
+ $block[0]($tpl, $callStack);
+ }
+ if (isset($block['prepend'])) {
+ $this->processBlock($tpl, 3, $name, null, $callStack);
+ }
+ $this->blockNesting --;
+ }
+}
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_subtemplate.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_subtemplate.php
new file mode 100644
index 000000000..2c7623f93
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_subtemplate.php
@@ -0,0 +1,203 @@
+<?php
+
+/**
+ * Sub Template Runtime Methods render, setupSubTemplate
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ *
+ **/
+class Smarty_Internal_Runtime_SubTemplate
+{
+
+ /**
+ * Subtemplate template object cache
+ *
+ * @var Smarty_Internal_Template[]
+ */
+ public $tplObjects = array();
+
+ /**
+ * Subtemplate call count
+ *
+ * @var int[]
+ */
+ public $subTplInfo = array();
+
+ /**
+ * Runtime function to render subtemplate
+ *
+ * @param \Smarty_Internal_Template $parent
+ * @param string $template template name
+ * @param mixed $cache_id cache id
+ * @param mixed $compile_id compile id
+ * @param integer $caching cache mode
+ * @param integer $cache_lifetime life time of cache data
+ * @param array $data passed parameter template variables
+ * @param int $scope scope in which {include} should execute
+ * @param bool $forceTplCache cache template object
+ * @param string $uid file dependency uid
+ * @param string $content_func function name
+ *
+ */
+ public function render(Smarty_Internal_Template $parent, $template, $cache_id, $compile_id, $caching,
+ $cache_lifetime, $data, $scope, $forceTplCache, $uid = null, $content_func = null)
+ {
+ // if there are cached template objects calculate $templateID
+ $_templateId =
+ !empty($this->tplObjects) ? $parent->smarty->_getTemplateId($template, $cache_id, $compile_id, $caching) :
+ null;
+ // already in template cache?
+ /* @var Smarty_Internal_Template $tpl */
+ if (isset($_templateId) && isset($this->tplObjects[$_templateId])) {
+ // clone cached template object because of possible recursive call
+ $tpl = clone $this->tplObjects[$_templateId];
+ $tpl->parent = $parent;
+ // if $caching mode changed the compiled resource is invalid
+ if ((bool) $tpl->caching !== (bool) $caching) {
+ unset($tpl->compiled);
+ }
+ // get variables from calling scope
+ $tpl->tpl_vars = $parent->tpl_vars;
+ $tpl->config_vars = $parent->config_vars;
+ // get template functions
+ $tpl->tpl_function = $parent->tpl_function;
+ // copy inheritance object?
+ if (isset($parent->ext->_inheritance)) {
+ $tpl->ext->_inheritance = $parent->ext->_inheritance;
+ } else {
+ unset($tpl->ext->_inheritance);
+ }
+ } else {
+ $tpl = clone $parent;
+ $tpl->parent = $parent;
+ if (!isset($tpl->templateId) || $tpl->templateId !== $_templateId) {
+ $tpl->templateId = $_templateId;
+ $tpl->template_resource = $template;
+ $tpl->cache_id = $cache_id;
+ $tpl->compile_id = $compile_id;
+ if (isset($uid)) {
+ // for inline templates we can get all resource information from file dependency
+ if (isset($tpl->compiled->file_dependency[$uid])) {
+ list($filepath, $timestamp, $resource) = $tpl->compiled->file_dependency[$uid];
+ $tpl->source =
+ new Smarty_Template_Source(isset($tpl->smarty->_cache['resource_handlers'][$resource]) ?
+ $tpl->smarty->_cache['resource_handlers'][$resource] :
+ Smarty_Resource::load($tpl->smarty, $resource), $tpl->smarty,
+ $filepath, $resource, $filepath);
+ $tpl->source->filepath = $filepath;
+ $tpl->source->timestamp = $timestamp;
+ $tpl->source->exists = true;
+ $tpl->source->uid = $uid;
+ } else {
+ $tpl->source = null;
+ }
+ } else {
+ $tpl->source = null;
+ }
+ if (!isset($tpl->source)) {
+ $tpl->source = Smarty_Template_Source::load($tpl);
+ unset($tpl->compiled);
+ }
+ unset($tpl->cached);
+ }
+ }
+ $tpl->caching = $caching;
+ $tpl->cache_lifetime = $cache_lifetime;
+ if ($caching == 9999) {
+ $tpl->cached = $parent->cached;
+ }
+ // set template scope
+ $tpl->scope = $scope;
+ $scopePtr = false;
+ if ($scope & ~Smarty::SCOPE_BUBBLE_UP) {
+ if ($scope == Smarty::SCOPE_GLOBAL) {
+ $tpl->tpl_vars = Smarty::$global_tpl_vars;
+ $tpl->config_vars = $tpl->smarty->config_vars;
+ $scopePtr = true;
+ } else {
+ if ($scope == Smarty::SCOPE_PARENT) {
+ $scopePtr = $parent;
+ } elseif ($scope == Smarty::SCOPE_SMARTY) {
+ $scopePtr = $tpl->smarty;
+ } else {
+ $scopePtr = $tpl;
+ while (isset($scopePtr->parent)) {
+ if ($scopePtr->parent->_objType != 2 && $scope & Smarty::SCOPE_TPL_ROOT) {
+ break;
+ }
+ $scopePtr = $scopePtr->parent;
+ }
+ }
+ $tpl->tpl_vars = $scopePtr->tpl_vars;
+ $tpl->config_vars = $scopePtr->config_vars;
+ }
+ }
+
+ if (!isset($this->tplObjects[$tpl->_getTemplateId()]) && !$tpl->source->handler->recompiled) {
+ // if template is called multiple times set flag to to cache template objects
+ $forceTplCache = $forceTplCache ||
+ (isset($this->subTplInfo[$tpl->template_resource]) && $this->subTplInfo[$tpl->template_resource] > 1);
+ // check if template object should be cached
+ if ($tpl->parent->_objType == 2 && isset($this->tplObjects[$tpl->parent->templateId]) ||
+ ($forceTplCache && $tpl->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_AUTOMATIC) ||
+ ($tpl->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_ON)
+ ) {
+ $this->tplObjects[$tpl->_getTemplateId()] = $tpl;
+ }
+ }
+
+ if (!empty($data)) {
+ // set up variable values
+ foreach ($data as $_key => $_val) {
+ $tpl->tpl_vars[$_key] = new Smarty_Variable($_val);
+ }
+ }
+ if (isset($uid)) {
+ if ($parent->smarty->debugging) {
+ $parent->smarty->_debug->start_template($tpl);
+ $parent->smarty->_debug->start_render($tpl);
+ }
+ $tpl->compiled->getRenderedTemplateCode($tpl, $content_func);
+ if ($parent->smarty->debugging) {
+ $parent->smarty->_debug->end_template($tpl);
+ $parent->smarty->_debug->end_render($tpl);
+ }
+ if ($tpl->caching == 9999 && $tpl->compiled->has_nocache_code) {
+ $parent->cached->hashes[$tpl->compiled->nocache_hash] = true;
+ }
+ } else {
+ if (isset($tpl->compiled)) {
+ $tpl->compiled->render($tpl);
+ } else {
+ $tpl->render();
+ }
+ }
+ if ($scopePtr) {
+ if ($scope == Smarty::SCOPE_GLOBAL) {
+ Smarty::$global_tpl_vars = $tpl->tpl_vars;
+ $tpl->smarty->config_vars = $tpl->config_vars;
+ } else {
+ $scopePtr->tpl_vars = $tpl->tpl_vars;
+ $scopePtr->config_vars = $tpl->config_vars;
+ }
+ }
+ }
+
+ /**
+ * Get called subtemplates from compiled template and save call count
+ *
+ * @param \Smarty_Internal_Template $tpl
+ */
+ public function registerSubTemplates(Smarty_Internal_Template $tpl)
+ {
+ foreach ($tpl->compiled->includes as $name => $count) {
+ if (isset($this->subTplInfo[$name])) {
+ $this->subTplInfo[$name] += $count;
+ } else {
+ $this->subTplInfo[$name] = $count;
+ }
+ }
+ }
+}
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_tplfunc.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_tplfunc.php
new file mode 100644
index 000000000..ec9d8da6b
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_tplfunc.php
@@ -0,0 +1,97 @@
+<?php
+
+/**
+ * Tplfunc Runtime Methods callTemplateFunction
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ *
+ **/
+class Smarty_Internal_Runtime_Tplfunc
+{
+ /**
+ * Call template function
+ *
+ * @param \Smarty_Internal_Template $tpl template object
+ * @param string $name template function name
+ * @param array $params parameter array
+ * @param bool $nocache true if called nocache
+ *
+ * @throws \SmartyException
+ */
+ public function callTemplateFunction(\Smarty_Internal_Template $tpl, $name, $params, $nocache)
+ {
+ if (isset($tpl->tpl_function[$name])) {
+ if (!$tpl->caching || ($tpl->caching && $nocache)) {
+ $function = $tpl->tpl_function[$name]['call_name'];
+ } else {
+ if (isset($tpl->tpl_function[$name]['call_name_caching'])) {
+ $function = $tpl->tpl_function[$name]['call_name_caching'];
+ } else {
+ $function = $tpl->tpl_function[$name]['call_name'];
+ }
+ }
+ if (function_exists($function)) {
+ $function ($tpl, $params);
+ return;
+ }
+ // try to load template function dynamically
+ if ($this->addTplFuncToCache($tpl, $name, $function)) {
+ $function ($tpl, $params);
+ return;
+ }
+ }
+ throw new SmartyException("Unable to find template function '{$name}'");
+ }
+
+ /**
+ *
+ * Add template function to cache file for nocache calls
+ *
+ * @param Smarty_Internal_Template $tpl
+ * @param string $_name template function name
+ * @param string $_function PHP function name
+ *
+ * @return bool
+ */
+ public function addTplFuncToCache(Smarty_Internal_Template $tpl, $_name, $_function)
+ {
+ $funcParam = $tpl->tpl_function[$_name];
+ if (is_file($funcParam['compiled_filepath'])) {
+ // read compiled file
+ $code = file_get_contents($funcParam['compiled_filepath']);
+ // grab template function
+ if (preg_match("/\/\* {$_function} \*\/([\S\s]*?)\/\*\/ {$_function} \*\//", $code, $match)) {
+ // grab source info from file dependency
+ preg_match("/\s*'{$funcParam['uid']}'([\S\s]*?)\),/", $code, $match1);
+ unset($code);
+ // make PHP function known
+ eval($match[0]);
+ if (function_exists($_function)) {
+ // search cache file template
+ $tplPtr = $tpl;
+ while (!isset($tplPtr->cached) && isset($tplPtr->parent)) {
+ $tplPtr = $tplPtr->parent;
+ }
+ // add template function code to cache file
+ if (isset($tplPtr->cached)) {
+ $cache = $tplPtr->cached;
+ $content = $cache->read($tplPtr);
+ if ($content) {
+ // check if we must update file dependency
+ if (!preg_match("/'{$funcParam['uid']}'(.*?)'nocache_hash'/", $content, $match2)) {
+ $content = preg_replace("/('file_dependency'(.*?)\()/", "\\1{$match1[0]}", $content);
+ }
+ $cache->write($tplPtr, preg_replace('/\s*\?>\s*$/', "\n", $content) . "\n" .
+ preg_replace(array('/^\s*<\?php\s+/', '/\s*\?>\s*$/'), "\n",
+ $match[0]));
+ }
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php
new file mode 100644
index 000000000..cc529c633
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php
@@ -0,0 +1,97 @@
+<?php
+
+/**
+ * Tplfunc Runtime Methods callTemplateFunction
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ *
+ **/
+class Smarty_Internal_Runtime_TplFunction
+{
+ /**
+ * Call template function
+ *
+ * @param \Smarty_Internal_Template $tpl template object
+ * @param string $name template function name
+ * @param array $params parameter array
+ * @param bool $nocache true if called nocache
+ *
+ * @throws \SmartyException
+ */
+ public function callTemplateFunction(\Smarty_Internal_Template $tpl, $name, $params, $nocache)
+ {
+ if (isset($tpl->tpl_function[$name])) {
+ if (!$tpl->caching || ($tpl->caching && $nocache)) {
+ $function = $tpl->tpl_function[$name]['call_name'];
+ } else {
+ if (isset($tpl->tpl_function[$name]['call_name_caching'])) {
+ $function = $tpl->tpl_function[$name]['call_name_caching'];
+ } else {
+ $function = $tpl->tpl_function[$name]['call_name'];
+ }
+ }
+ if (function_exists($function)) {
+ $function ($tpl, $params);
+ return;
+ }
+ // try to load template function dynamically
+ if ($this->addTplFuncToCache($tpl, $name, $function)) {
+ $function ($tpl, $params);
+ return;
+ }
+ }
+ throw new SmartyException("Unable to find template function '{$name}'");
+ }
+
+ /**
+ *
+ * Add template function to cache file for nocache calls
+ *
+ * @param Smarty_Internal_Template $tpl
+ * @param string $_name template function name
+ * @param string $_function PHP function name
+ *
+ * @return bool
+ */
+ public function addTplFuncToCache(Smarty_Internal_Template $tpl, $_name, $_function)
+ {
+ $funcParam = $tpl->tpl_function[$_name];
+ if (is_file($funcParam['compiled_filepath'])) {
+ // read compiled file
+ $code = file_get_contents($funcParam['compiled_filepath']);
+ // grab template function
+ if (preg_match("/\/\* {$_function} \*\/([\S\s]*?)\/\*\/ {$_function} \*\//", $code, $match)) {
+ // grab source info from file dependency
+ preg_match("/\s*'{$funcParam['uid']}'([\S\s]*?)\),/", $code, $match1);
+ unset($code);
+ // make PHP function known
+ eval($match[0]);
+ if (function_exists($_function)) {
+ // search cache file template
+ $tplPtr = $tpl;
+ while (!isset($tplPtr->cached) && isset($tplPtr->parent)) {
+ $tplPtr = $tplPtr->parent;
+ }
+ // add template function code to cache file
+ if (isset($tplPtr->cached)) {
+ $cache = $tplPtr->cached;
+ $content = $cache->read($tplPtr);
+ if ($content) {
+ // check if we must update file dependency
+ if (!preg_match("/'{$funcParam['uid']}'(.*?)'nocache_hash'/", $content, $match2)) {
+ $content = preg_replace("/('file_dependency'(.*?)\()/", "\\1{$match1[0]}", $content);
+ }
+ $tplPtr->smarty->ext->_updateCache->write($cache, $tplPtr, preg_replace('/\s*\?>\s*$/', "\n", $content) . "\n" .
+ preg_replace(array('/^\s*<\?php\s+/', '/\s*\?>\s*$/'), "\n",
+ $match[0]));
+ }
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php
new file mode 100644
index 000000000..73de954f3
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php
@@ -0,0 +1,184 @@
+<?php
+
+/**
+ * Inline Runtime Methods render, setSourceByUid, setupSubTemplate
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ *
+ **/
+class Smarty_Internal_Runtime_UpdateCache
+{
+ /**
+ * check client side cache
+ *
+ * @param \Smarty_Template_Cached $cached
+ * @param Smarty_Internal_Template $_template
+ * @param string $content
+ */
+ public function cacheModifiedCheck(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
+ {
+ }
+
+ /**
+ * Sanitize content and write it to cache resource
+ *
+ * @param \Smarty_Template_Cached $cached
+ * @param Smarty_Internal_Template $_template
+ * @param bool $no_output_filter
+ *
+ * @throws \SmartyException
+ */
+ public function removeNoCacheHash(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template,
+ $no_output_filter)
+ {
+ $content = ob_get_clean();
+ unset($cached->hashes[$_template->compiled->nocache_hash]);
+ if (!empty($cached->hashes)) {
+ $hash_array = array();
+ foreach ($cached->hashes as $hash => $foo) {
+ $hash_array[] = "/{$hash}/";
+ }
+ $content = preg_replace($hash_array, $_template->compiled->nocache_hash, $content);
+ }
+ $_template->cached->has_nocache_code = false;
+ // get text between non-cached items
+ $cache_split =
+ preg_split("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
+ $content);
+ // get non-cached items
+ preg_match_all("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
+ $content, $cache_parts);
+ $content = '';
+ // loop over items, stitch back together
+ foreach ($cache_split as $curr_idx => $curr_split) {
+ // escape PHP tags in template content
+ $content .= preg_replace('/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/',
+ "<?php echo '\$1'; ?>\n", $curr_split);
+ if (isset($cache_parts[0][$curr_idx])) {
+ $_template->cached->has_nocache_code = true;
+ $content .= $cache_parts[1][$curr_idx];
+ }
+ }
+ if (!$no_output_filter && !$_template->compiled->has_nocache_code &&
+ (isset($_template->smarty->autoload_filters['output']) ||
+ isset($_template->smarty->registered_filters['output']))
+ ) {
+ $content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
+ }
+ // write cache file content
+ $this->writeCachedContent($cached, $_template, $content);
+ }
+
+ /**
+ * Cache was invalid , so render from compiled and write to cache
+ *
+ * @param \Smarty_Template_Cached $cached
+ * @param \Smarty_Internal_Template $_template
+ * @param $no_output_filter
+ *
+ * @throws \Exception
+ */
+ public function updateCache(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $no_output_filter)
+ {
+ if ($_template->source->handler->uncompiled) {
+ ob_start();
+ $_template->source->render($_template);
+ } else {
+ ob_start();
+ if (!isset($_template->compiled)) {
+ $_template->loadCompiled();
+ }
+ $_template->compiled->render($_template);
+ }
+ if ($_template->smarty->debugging) {
+ $_template->smarty->_debug->start_cache($_template);
+ }
+ $this->removeNoCacheHash($cached, $_template, $no_output_filter);
+ $compile_check = $_template->smarty->compile_check;
+ $_template->smarty->compile_check = false;
+ if (isset($_template->parent) && $_template->parent->_objType == 2) {
+ $_template->compiled->unifunc = $_template->parent->compiled->unifunc;
+ }
+ if (!$_template->cached->processed) {
+ $_template->cached->process($_template, true);
+ }
+ $_template->smarty->compile_check = $compile_check;
+ $cached->getRenderedTemplateCode($_template);
+ if ($_template->smarty->debugging) {
+ $_template->smarty->_debug->end_cache($_template);
+ }
+ }
+
+ /**
+ * Writes the content to cache resource
+ *
+ * @param \Smarty_Template_Cached $cached
+ * @param Smarty_Internal_Template $_template
+ * @param string $content
+ *
+ * @return bool
+ */
+ public function writeCachedContent(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
+ {
+ if ($_template->source->handler->recompiled || !($_template->caching == Smarty::CACHING_LIFETIME_CURRENT ||
+ $_template->caching == Smarty::CACHING_LIFETIME_SAVED)
+ ) {
+ // don't write cache file
+ return false;
+ }
+ $content = $_template->smarty->ext->_codeFrame->create($_template, $content, '', true);
+ if (!empty($_template->cached->tpl_function)) {
+ foreach ($_template->cached->tpl_function as $funcParam) {
+ if (is_file($funcParam['compiled_filepath'])) {
+ // read compiled file
+ $code = file_get_contents($funcParam['compiled_filepath']);
+ // grab template function
+ if (preg_match("/\/\* {$funcParam['call_name']} \*\/([\S\s]*?)\/\*\/ {$funcParam['call_name']} \*\//",
+ $code, $match)) {
+ unset($code);
+ $content .= "<?php " . $match[0] . "?>\n";
+ }
+ }
+ }
+ }
+ return $this->write($cached, $_template, $content);
+ }
+
+ /**
+ * Write this cache object to handler
+ *
+ * @param \Smarty_Template_Cached $cached
+ * @param Smarty_Internal_Template $_template template object
+ * @param string $content content to cache
+ *
+ * @return bool success
+ */
+ public function write(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $content)
+ {
+ if (!$_template->source->handler->recompiled) {
+ if ($cached->handler->writeCachedContent($_template, $content)) {
+ $cached->content = null;
+ $cached->timestamp = time();
+ $cached->exists = true;
+ $cached->valid = true;
+ $cached->cache_lifetime = $_template->cache_lifetime;
+ $cached->processed = false;
+ if ($_template->smarty->cache_locking) {
+ $cached->handler->releaseLock($_template->smarty, $cached);
+ }
+
+ return true;
+ }
+ $cached->content = null;
+ $cached->timestamp = false;
+ $cached->exists = false;
+ $cached->valid = false;
+ $cached->processed = false;
+ }
+
+ return false;
+ }
+
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php
new file mode 100644
index 000000000..3d80c859a
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php
@@ -0,0 +1,55 @@
+<?php
+
+/**
+ * Runtime Methods updateScope
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ *
+ **/
+class Smarty_Internal_Runtime_UpdateScope
+{
+ /**
+ * Update new assigned template variable in other effected scopes
+ *
+ * @param \Smarty_Internal_Template $tpl template object
+ * @param string $varName variable name
+ * @param int $scope scope to which bubble up variable value
+ */
+ public function updateScope(\Smarty_Internal_Template $tpl, $varName, $scope = Smarty::SCOPE_LOCAL)
+ {
+ if (!$scope && !$tpl->scope) {
+ return;
+ }
+ foreach (array($scope, $tpl->scope) as $s) {
+ $s = ($bubble_up = $s >= Smarty::SCOPE_BUBBLE_UP) ? $s - Smarty::SCOPE_BUBBLE_UP : $s;
+ if ($bubble_up && $s) {
+ $ptr = $tpl->parent;
+ if (isset($ptr)) {
+ $ptr->tpl_vars[$varName] = $tpl->tpl_vars[$varName];
+ $ptr = $ptr->parent;
+ }
+ if ($s == Smarty::SCOPE_PARENT) {
+ continue;
+ }
+ while (isset($ptr) && $ptr->_objType == 2) {
+ $ptr->tpl_vars[$varName] = $tpl->tpl_vars[$varName];
+ $ptr = $ptr->parent;
+ }
+ if ($s == Smarty::SCOPE_TPL_ROOT) {
+ continue;
+ } elseif ($s == Smarty::SCOPE_SMARTY) {
+ $tpl->smarty->tpl_vars[$varName] = $tpl->tpl_vars[$varName];
+ } elseif ($s == Smarty::SCOPE_GLOBAL) {
+ Smarty::$global_tpl_vars[$varName] = $tpl->tpl_vars[$varName];
+ } elseif ($s == Smarty::SCOPE_ROOT) {
+ while (isset($ptr->parent)) {
+ $ptr = $ptr->parent;
+ }
+ $ptr->tpl_vars[$varName] = $tpl->tpl_vars[$varName];
+ }
+ }
+ }
+ }
+}
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_validatecompiled.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_validatecompiled.php
new file mode 100644
index 000000000..6624eb0bf
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_validatecompiled.php
@@ -0,0 +1,81 @@
+<?php
+
+/**
+ * Runtime Methods decodeProperties
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ *
+ **/
+class Smarty_Internal_Runtime_ValidateCompiled
+{
+ /**
+ * This function is executed automatically when a compiled or cached template file is included
+ * - Decode saved properties from compiled template and cache files
+ * - Check if compiled or cache file is valid
+ *
+ * @param array $properties special template properties
+ * @param bool $cache flag if called from cache file
+ *
+ * @return bool flag if compiled or cache file is valid
+ */
+ public function decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false)
+ {
+ $is_valid = true;
+ if (Smarty::SMARTY_VERSION != $properties['version']) {
+ // new version must rebuild
+ $is_valid = false;
+ } elseif ($is_valid && !empty($properties['file_dependency']) &&
+ ((!$cache && $tpl->smarty->compile_check) || $tpl->smarty->compile_check == 1)
+ ) {
+ // check file dependencies at compiled code
+ foreach ($properties['file_dependency'] as $_file_to_check) {
+ if ($_file_to_check[2] == 'file' || $_file_to_check[2] == 'extends' || $_file_to_check[2] == 'php') {
+ if ($tpl->source->filepath == $_file_to_check[0]) {
+ // do not recheck current template
+ continue;
+ //$mtime = $tpl->source->getTimeStamp();
+ } else {
+ // file and php types can be checked without loading the respective resource handlers
+ $mtime = is_file($_file_to_check[0]) ? filemtime($_file_to_check[0]) : false;
+ }
+ } elseif ($_file_to_check[2] == 'string') {
+ continue;
+ } else {
+ $source = Smarty_Template_Source::load(null, $tpl->smarty, $_file_to_check[0]);
+ $mtime = $source->getTimeStamp();
+ }
+ if (!$mtime || $mtime > $_file_to_check[1]) {
+ $is_valid = false;
+ break;
+ }
+ }
+ }
+ if ($cache) {
+ // CACHING_LIFETIME_SAVED cache expiry has to be validated here since otherwise we'd define the unifunc
+ if ($tpl->caching === Smarty::CACHING_LIFETIME_SAVED && $properties['cache_lifetime'] >= 0 &&
+ (time() > ($tpl->cached->timestamp + $properties['cache_lifetime']))
+ ) {
+ $is_valid = false;
+ }
+ $tpl->cached->cache_lifetime = $properties['cache_lifetime'];
+ $tpl->cached->valid = $is_valid;
+ $resource = $tpl->cached;
+ } else {
+ $tpl->mustCompile = !$is_valid;
+ $resource = $tpl->compiled;
+ $resource->includes = isset($properties['includes']) ? $properties['includes'] : array();
+ }
+ if ($is_valid) {
+ $resource->unifunc = $properties['unifunc'];
+ $resource->has_nocache_code = $properties['has_nocache_code'];
+ // $tpl->compiled->nocache_hash = $properties['nocache_hash'];
+ $resource->file_dependency = $properties['file_dependency'];
+ if (isset($properties['tpl_function'])) {
+ $tpl->tpl_function = $properties['tpl_function'];
+ }
+ }
+ return $is_valid && !function_exists($properties['unifunc']);
+ }
+}
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_var.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_var.php
new file mode 100644
index 000000000..fe4f94d91
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_var.php
@@ -0,0 +1,33 @@
+<?php
+
+/**
+ * Runtime Methods createLocalArrayVariable
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ *
+ **/
+class Smarty_Internal_Runtime_Var
+{
+ /**
+ * Template code runtime function to create a local Smarty variable for array assignments
+ *
+ * @param \Smarty_Internal_Template $tpl template object
+ * @param string $varName template variable name
+ * @param bool $nocache cache mode of variable
+ */
+ public function createLocalArrayVariable(\Smarty_Internal_Template $tpl, $varName, $nocache = false)
+ {
+ if (!isset($tpl->tpl_vars[$varName])) {
+ $tpl->tpl_vars[$varName] = new Smarty_Variable(array(), $nocache);
+ } else {
+ $tpl->tpl_vars[$varName] = clone $tpl->tpl_vars[$varName];
+ if (!(is_array($tpl->tpl_vars[$varName]->value) ||
+ $tpl->tpl_vars[$varName]->value instanceof ArrayAccess)
+ ) {
+ settype($tpl->tpl_vars[$varName]->value, 'array');
+ }
+ }
+ }
+}
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_runtime_writefile.php b/library/Smarty/libs/sysplugins/smarty_internal_runtime_writefile.php
new file mode 100644
index 000000000..05c973783
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_runtime_writefile.php
@@ -0,0 +1,90 @@
+<?php
+/**
+ * Smarty write file plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Monte Ohrt
+ */
+
+/**
+ * Smarty Internal Write File Class
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ */
+class Smarty_Internal_Runtime_WriteFile
+{
+ /**
+ * Writes file in a safe way to disk
+ *
+ * @param string $_filepath complete filepath
+ * @param string $_contents file content
+ * @param Smarty $smarty smarty instance
+ *
+ * @throws SmartyException
+ * @return boolean true
+ */
+ public function writeFile($_filepath, $_contents, Smarty $smarty)
+ {
+ $_error_reporting = error_reporting();
+ error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING);
+ $_file_perms = property_exists($smarty, '_file_perms') ? $smarty->_file_perms : 0644;
+ $_dir_perms = property_exists($smarty, '_dir_perms') ? (isset($smarty->_dir_perms) ? $smarty->_dir_perms : 0777) : 0771;
+ if ($_file_perms !== null) {
+ $old_umask = umask(0);
+ }
+
+ $_dirpath = dirname($_filepath);
+ // if subdirs, create dir structure
+ if ($_dirpath !== '.' && !file_exists($_dirpath)) {
+ mkdir($_dirpath, $_dir_perms, true);
+ }
+
+ // write to tmp file, then move to overt file lock race condition
+ $_tmp_file = $_dirpath . DS . str_replace(array('.', ','), '_', uniqid('wrt', true));
+ if (!file_put_contents($_tmp_file, $_contents)) {
+ error_reporting($_error_reporting);
+ throw new SmartyException("unable to write file {$_tmp_file}");
+ }
+
+ /*
+ * Windows' rename() fails if the destination exists,
+ * Linux' rename() properly handles the overwrite.
+ * Simply unlink()ing a file might cause other processes
+ * currently reading that file to fail, but linux' rename()
+ * seems to be smart enough to handle that for us.
+ */
+ if (Smarty::$_IS_WINDOWS) {
+ // remove original file
+ if (is_file($_filepath)) {
+ @unlink($_filepath);
+ }
+ // rename tmp file
+ $success = @rename($_tmp_file, $_filepath);
+ } else {
+ // rename tmp file
+ $success = @rename($_tmp_file, $_filepath);
+ if (!$success) {
+ // remove original file
+ if (is_file($_filepath)) {
+ @unlink($_filepath);
+ }
+ // rename tmp file
+ $success = @rename($_tmp_file, $_filepath);
+ }
+ }
+ if (!$success) {
+ error_reporting($_error_reporting);
+ throw new SmartyException("unable to write file {$_filepath}");
+ }
+ if ($_file_perms !== null) {
+ // set file permissions
+ chmod($_filepath, $_file_perms);
+ umask($old_umask);
+ }
+ error_reporting($_error_reporting);
+
+ return true;
+ }
+}
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_undefined.php b/library/Smarty/libs/sysplugins/smarty_internal_undefined.php
new file mode 100644
index 000000000..93fca8ec1
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_internal_undefined.php
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * Smarty Method AppendByRef
+ *
+ * Smarty::appendByRef() method
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+class Smarty_Internal_Undefined
+{
+
+ /**
+ * This function is executed automatically when a compiled or cached template file is included
+ * - Decode saved properties from compiled template and cache files
+ * - Check if compiled or cache file is valid
+ *
+ * @param array $properties special template properties
+ * @param bool $cache flag if called from cache file
+ *
+ * @return bool flag if compiled or cache file is valid
+ */
+ public function decodeProperties($tpl, $properties, $cache = false)
+ {
+ if ($cache) {
+ $tpl->cached->valid = false;
+ } else {
+ $tpl->mustCompile = true;
+ }
+ return false;
+ }
+
+ /**
+ * Call error handler for undefined method
+ *
+ * @param string $name unknown method-name
+ * @param array $args argument array
+ *
+ * @return mixed
+ * @throws SmartyException
+ */
+ public function __call($name, $args)
+ {
+ throw new SmartyException(get_class($args[0]) . "->{$name}() undefined method");
+ }
+} \ No newline at end of file
diff --git a/library/Smarty/libs/sysplugins/smarty_template_resource_base.php b/library/Smarty/libs/sysplugins/smarty_template_resource_base.php
new file mode 100644
index 000000000..b9e2e2830
--- /dev/null
+++ b/library/Smarty/libs/sysplugins/smarty_template_resource_base.php
@@ -0,0 +1,162 @@
+<?php
+
+/**
+ * Smarty Template Resource Base Object
+ *
+ * @package Smarty
+ * @subpackage TemplateResources
+ * @author Rodney Rehm
+ */
+abstract class Smarty_Template_Resource_Base
+{
+ /**
+ * Compiled Filepath
+ *
+ * @var string
+ */
+ public $filepath = null;
+
+ /**
+ * Compiled Timestamp
+ *
+ * @var integer
+ */
+ public $timestamp = null;
+
+ /**
+ * Compiled Existence
+ *
+ * @var boolean
+ */
+ public $exists = false;
+
+ /**
+ * Template Compile Id (Smarty_Internal_Template::$compile_id)
+ *
+ * @var string
+ */
+ public $compile_id = null;
+
+ /**
+ * Compiled Content Loaded
+ *
+ * @var boolean
+ */
+ public $processed = false;
+
+ /**
+ * unique function name for compiled template code
+ *
+ * @var string
+ */
+ public $unifunc = '';
+
+ /**
+ * flag if template does contain nocache code sections
+ *
+ * @var bool
+ */
+ public $has_nocache_code = false;
+
+ /**
+ * resource file dependency
+ *
+ * @var array
+ */
+ public $file_dependency = array();
+
+ /**
+ * Content buffer
+ *
+ * @var string
+ */
+ public $content = null;
+
+ /**
+ * required plugins
+ *
+ * @var array
+ */
+ public $required_plugins = array();
+
+ /**
+ * Known template functions
+ *
+ * @var array
+ */
+ public $tpl_function = array();
+
+ /**
+ * Included subtemplates
+ *
+ * @var array
+ */
+ public $includes = array();
+
+ /**
+ * Process resource
+ *
+ * @param Smarty_Internal_Template $_template template object
+ */
+ abstract public function process(Smarty_Internal_Template $_template);
+
+ /**
+ * get rendered template content by calling compiled or cached template code
+ *
+ * @param string $unifunc function with template code
+ *
+ * @return string
+ * @throws \Exception
+ */
+ public function getRenderedTemplateCode(Smarty_Internal_Template $_template, $unifunc = null)
+ {
+ $unifunc = isset($unifunc) ? $unifunc : $this->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;
+ }
+}