141 changed files with 3246 additions and 4941 deletions
-
10.github/workflows/php.yml
-
2.php-cs-fixer.dist.php
-
1ADDITIONS/squirrelmail-plugin/common.php
-
1ADDITIONS/squirrelmail-plugin/postfixadmin_changepass.php
-
2ADDITIONS/squirrelmail-plugin/postfixadmin_vacation.php
-
1ADDITIONS/squirrelmail-plugin/setup.php
-
18DOCUMENTS/Password_Expiration.md
-
9common.php
-
2composer.json
-
166functions.inc.php
-
1languages/index.php
-
8lib/smarty/libs/Autoloader.php
-
93lib/smarty/libs/Smarty.class.php
-
477lib/smarty/libs/SmartyBC.class.php
-
2lib/smarty/libs/plugins/block.textformat.php
-
2lib/smarty/libs/plugins/function.counter.php
-
2lib/smarty/libs/plugins/function.cycle.php
-
2lib/smarty/libs/plugins/function.fetch.php
-
2lib/smarty/libs/plugins/function.html_checkboxes.php
-
2lib/smarty/libs/plugins/function.html_image.php
-
2lib/smarty/libs/plugins/function.html_options.php
-
2lib/smarty/libs/plugins/function.html_radios.php
-
2lib/smarty/libs/plugins/function.html_select_date.php
-
2lib/smarty/libs/plugins/function.html_select_time.php
-
2lib/smarty/libs/plugins/function.html_table.php
-
2lib/smarty/libs/plugins/function.mailto.php
-
6lib/smarty/libs/plugins/function.math.php
-
2lib/smarty/libs/plugins/modifier.date_format.php
-
10lib/smarty/libs/plugins/modifier.escape.php
-
2lib/smarty/libs/plugins/modifier.mb_wordwrap.php
-
2lib/smarty/libs/plugins/modifier.regex_replace.php
-
2lib/smarty/libs/plugins/modifier.replace.php
-
2lib/smarty/libs/plugins/modifier.spacify.php
-
8lib/smarty/libs/plugins/modifier.truncate.php
-
2lib/smarty/libs/plugins/modifiercompiler.cat.php
-
2lib/smarty/libs/plugins/modifiercompiler.count_characters.php
-
2lib/smarty/libs/plugins/modifiercompiler.count_paragraphs.php
-
2lib/smarty/libs/plugins/modifiercompiler.count_sentences.php
-
2lib/smarty/libs/plugins/modifiercompiler.count_words.php
-
4lib/smarty/libs/plugins/modifiercompiler.default.php
-
27lib/smarty/libs/plugins/modifiercompiler.escape.php
-
2lib/smarty/libs/plugins/modifiercompiler.indent.php
-
2lib/smarty/libs/plugins/modifiercompiler.lower.php
-
2lib/smarty/libs/plugins/modifiercompiler.string_format.php
-
2lib/smarty/libs/plugins/modifiercompiler.strip.php
-
2lib/smarty/libs/plugins/modifiercompiler.strip_tags.php
-
2lib/smarty/libs/plugins/modifiercompiler.upper.php
-
2lib/smarty/libs/plugins/modifiercompiler.wordwrap.php
-
2lib/smarty/libs/plugins/outputfilter.trimwhitespace.php
-
8lib/smarty/libs/plugins/shared.escape_special_chars.php
-
2lib/smarty/libs/plugins/shared.mb_str_replace.php
-
8lib/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php
-
4lib/smarty/libs/sysplugins/smarty_internal_compile_block.php
-
2lib/smarty/libs/sysplugins/smarty_internal_compile_for.php
-
4lib/smarty/libs/sysplugins/smarty_internal_compile_foreach.php
-
10lib/smarty/libs/sysplugins/smarty_internal_compile_function.php
-
4lib/smarty/libs/sysplugins/smarty_internal_compile_include.php
-
110lib/smarty/libs/sysplugins/smarty_internal_compile_include_php.php
-
4lib/smarty/libs/sysplugins/smarty_internal_compile_insert.php
-
253lib/smarty/libs/sysplugins/smarty_internal_compile_private_php.php
-
10lib/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php
-
24lib/smarty/libs/sysplugins/smarty_internal_data.php
-
117lib/smarty/libs/sysplugins/smarty_internal_errorhandler.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_append.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_clearallassign.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_clearassign.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_clearcache.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_clearconfig.php
-
4lib/smarty/libs/sysplugins/smarty_internal_method_configload.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_createdata.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_gettags.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_registerclass.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_registerobject.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php
-
15lib/smarty/libs/sysplugins/smarty_internal_method_registerresource.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php
-
2lib/smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php
-
138lib/smarty/libs/sysplugins/smarty_internal_parsetree_template.php
-
34lib/smarty/libs/sysplugins/smarty_internal_parsetree_text.php
-
101lib/smarty/libs/sysplugins/smarty_internal_resource_registered.php
-
2lib/smarty/libs/sysplugins/smarty_internal_resource_stream.php
-
9lib/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php
-
25lib/smarty/libs/sysplugins/smarty_internal_templatebase.php
-
62lib/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php
-
614lib/smarty/libs/sysplugins/smarty_internal_templatelexer.php
-
5287lib/smarty/libs/sysplugins/smarty_internal_templateparser.php
@ -1,477 +0,0 @@ |
|||
<?php |
|||
/** |
|||
* Project: Smarty: the PHP compiling template engine |
|||
* File: SmartyBC.class.php |
|||
* SVN: $Id: $ |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 3.0 of the License, or (at your option) any later version. |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|||
* For questions, help, comments, discussion, etc., please join the |
|||
* Smarty mailing list. Send a blank e-mail to |
|||
* smarty-discussion-subscribe@googlegroups.com |
|||
* |
|||
* @link http://www.smarty.net/ |
|||
* @copyright 2008 New Digital Group, Inc. |
|||
* @author Monte Ohrt <monte at ohrt dot com> |
|||
* @author Uwe Tews |
|||
* @author Rodney Rehm |
|||
* @package Smarty |
|||
*/ |
|||
/** |
|||
* @ignore |
|||
*/ |
|||
require_once dirname(__FILE__) . '/Smarty.class.php'; |
|||
|
|||
/** |
|||
* Smarty Backward Compatibility Wrapper Class |
|||
* |
|||
* @package Smarty |
|||
*/ |
|||
class SmartyBC extends Smarty |
|||
{ |
|||
/** |
|||
* Smarty 2 BC |
|||
* |
|||
* @var string |
|||
*/ |
|||
public $_version = self::SMARTY_VERSION; |
|||
|
|||
/** |
|||
* This is an array of directories where trusted php scripts reside. |
|||
* |
|||
* @var array |
|||
*/ |
|||
public $trusted_dir = array(); |
|||
|
|||
/** |
|||
* Initialize new SmartyBC object |
|||
*/ |
|||
public function __construct() |
|||
{ |
|||
parent::__construct(); |
|||
} |
|||
|
|||
/** |
|||
* wrapper for assign_by_ref |
|||
* |
|||
* @param string $tpl_var the template variable name |
|||
* @param mixed &$value the referenced value to assign |
|||
*/ |
|||
public function assign_by_ref($tpl_var, &$value) |
|||
{ |
|||
$this->assignByRef($tpl_var, $value); |
|||
} |
|||
|
|||
/** |
|||
* wrapper for append_by_ref |
|||
* |
|||
* @param string $tpl_var the template variable name |
|||
* @param mixed &$value the referenced value to append |
|||
* @param boolean $merge flag if array elements shall be merged |
|||
*/ |
|||
public function append_by_ref($tpl_var, &$value, $merge = false) |
|||
{ |
|||
$this->appendByRef($tpl_var, $value, $merge); |
|||
} |
|||
|
|||
/** |
|||
* clear the given assigned template variable. |
|||
* |
|||
* @param string $tpl_var the template variable to clear |
|||
*/ |
|||
public function clear_assign($tpl_var) |
|||
{ |
|||
$this->clearAssign($tpl_var); |
|||
} |
|||
|
|||
/** |
|||
* Registers custom function to be used in templates |
|||
* |
|||
* @param string $function the name of the template function
|
|||
* @param string $function_impl the name of the PHP function to register |
|||
* @param bool $cacheable |
|||
* @param mixed $cache_attrs |
|||
* |
|||
* @throws \SmartyException |
|||
*/ |
|||
public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null) |
|||
{ |
|||
$this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs); |
|||
} |
|||
|
|||
/** |
|||
* Unregister custom function
|
|||
* |
|||
* @param string $function name of template function
|
|||
*/ |
|||
public function unregister_function($function) |
|||
{ |
|||
$this->unregisterPlugin('function', $function); |
|||
} |
|||
|
|||
/** |
|||
* Registers object to be used in templates |
|||
* |
|||
* @param string $object name of template object |
|||
* @param object $object_impl the referenced PHP object to register |
|||
* @param array $allowed list of allowed methods (empty = all) |
|||
* @param boolean $smarty_args smarty argument format, else traditional |
|||
* @param array $block_methods list of methods that are block format |
|||
* |
|||
* @throws SmartyException |
|||
* @internal param array $block_functs list of methods that are block format |
|||
*/ |
|||
public function register_object( |
|||
$object, |
|||
$object_impl, |
|||
$allowed = array(), |
|||
$smarty_args = true, |
|||
$block_methods = array() |
|||
) { |
|||
settype($allowed, 'array'); |
|||
settype($smarty_args, 'boolean'); |
|||
$this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods); |
|||
} |
|||
|
|||
/** |
|||
* Unregister object |
|||
* |
|||
* @param string $object name of template object |
|||
*/ |
|||
public function unregister_object($object) |
|||
{ |
|||
$this->unregisterObject($object); |
|||
} |
|||
|
|||
/** |
|||
* Registers block function to be used in templates |
|||
* |
|||
* @param string $block name of template block |
|||
* @param string $block_impl PHP function to register |
|||
* @param bool $cacheable |
|||
* @param mixed $cache_attrs |
|||
* |
|||
* @throws \SmartyException |
|||
*/ |
|||
public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null) |
|||
{ |
|||
$this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs); |
|||
} |
|||
|
|||
/** |
|||
* Unregister block function
|
|||
* |
|||
* @param string $block name of template function
|
|||
*/ |
|||
public function unregister_block($block) |
|||
{ |
|||
$this->unregisterPlugin('block', $block); |
|||
} |
|||
|
|||
/** |
|||
* Registers compiler function
|
|||
* |
|||
* @param string $function name of template function
|
|||
* @param string $function_impl name of PHP function to register |
|||
* @param bool $cacheable |
|||
* |
|||
* @throws \SmartyException |
|||
*/ |
|||
public function register_compiler_function($function, $function_impl, $cacheable = true) |
|||
{ |
|||
$this->registerPlugin('compiler', $function, $function_impl, $cacheable); |
|||
} |
|||
|
|||
/** |
|||
* Unregister compiler function
|
|||
* |
|||
* @param string $function name of template function
|
|||
*/ |
|||
public function unregister_compiler_function($function) |
|||
{ |
|||
$this->unregisterPlugin('compiler', $function); |
|||
} |
|||
|
|||
/** |
|||
* Registers modifier to be used in templates |
|||
* |
|||
* @param string $modifier name of template modifier |
|||
* @param string $modifier_impl name of PHP function to register |
|||
* |
|||
* @throws \SmartyException |
|||
*/ |
|||
public function register_modifier($modifier, $modifier_impl) |
|||
{ |
|||
$this->registerPlugin('modifier', $modifier, $modifier_impl); |
|||
} |
|||
|
|||
/** |
|||
* Unregister modifier |
|||
* |
|||
* @param string $modifier name of template modifier |
|||
*/ |
|||
public function unregister_modifier($modifier) |
|||
{ |
|||
$this->unregisterPlugin('modifier', $modifier); |
|||
} |
|||
|
|||
/** |
|||
* Registers a resource to fetch a template |
|||
* |
|||
* @param string $type name of resource |
|||
* @param array $functions array of functions to handle resource |
|||
*/ |
|||
public function register_resource($type, $functions) |
|||
{ |
|||
$this->registerResource($type, $functions); |
|||
} |
|||
|
|||
/** |
|||
* Unregister a resource |
|||
* |
|||
* @param string $type name of resource |
|||
*/ |
|||
public function unregister_resource($type) |
|||
{ |
|||
$this->unregisterResource($type); |
|||
} |
|||
|
|||
/** |
|||
* Registers a prefilter function to apply |
|||
* to a template before compiling |
|||
* |
|||
* @param callable $function |
|||
* |
|||
* @throws \SmartyException |
|||
*/ |
|||
public function register_prefilter($function) |
|||
{ |
|||
$this->registerFilter('pre', $function); |
|||
} |
|||
|
|||
/** |
|||
* Unregister a prefilter function
|
|||
* |
|||
* @param callable $function |
|||
*/ |
|||
public function unregister_prefilter($function) |
|||
{ |
|||
$this->unregisterFilter('pre', $function); |
|||
} |
|||
|
|||
/** |
|||
* Registers a postfilter function to apply |
|||
* to a compiled template after compilation |
|||
* |
|||
* @param callable $function |
|||
* |
|||
* @throws \SmartyException |
|||
*/ |
|||
public function register_postfilter($function) |
|||
{ |
|||
$this->registerFilter('post', $function); |
|||
} |
|||
|
|||
/** |
|||
* Unregister a postfilter function
|
|||
* |
|||
* @param callable $function |
|||
*/ |
|||
public function unregister_postfilter($function) |
|||
{ |
|||
$this->unregisterFilter('post', $function); |
|||
} |
|||
|
|||
/** |
|||
* Registers an output filter function to apply |
|||
* to a template output |
|||
* |
|||
* @param callable $function |
|||
* |
|||
* @throws \SmartyException |
|||
*/ |
|||
public function register_outputfilter($function) |
|||
{ |
|||
$this->registerFilter('output', $function); |
|||
} |
|||
|
|||
/** |
|||
* Unregister an outputfilter function
|
|||
* |
|||
* @param callable $function |
|||
*/ |
|||
public function unregister_outputfilter($function) |
|||
{ |
|||
$this->unregisterFilter('output', $function); |
|||
} |
|||
|
|||
/** |
|||
* load a filter of specified type and name |
|||
* |
|||
* @param string $type filter type |
|||
* @param string $name filter name |
|||
* |
|||
* @throws \SmartyException |
|||
*/ |
|||
public function load_filter($type, $name) |
|||
{ |
|||
$this->loadFilter($type, $name); |
|||
} |
|||
|
|||
/** |
|||
* clear cached content for the given template and cache id |
|||
* |
|||
* @param string $tpl_file name of template file |
|||
* @param string $cache_id name of cache_id |
|||
* @param string $compile_id name of compile_id |
|||
* @param string $exp_time expiration time |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null) |
|||
{ |
|||
return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time); |
|||
} |
|||
|
|||
/** |
|||
* clear the entire contents of cache (all templates) |
|||
* |
|||
* @param string $exp_time expire time |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function clear_all_cache($exp_time = null) |
|||
{ |
|||
return $this->clearCache(null, null, null, $exp_time); |
|||
} |
|||
|
|||
/** |
|||
* test to see if valid cache exists for this template |
|||
* |
|||
* @param string $tpl_file name of template file |
|||
* @param string $cache_id |
|||
* @param string $compile_id |
|||
* |
|||
* @return bool |
|||
* @throws \Exception |
|||
* @throws \SmartyException |
|||
*/ |
|||
public function is_cached($tpl_file, $cache_id = null, $compile_id = null) |
|||
{ |
|||
return $this->isCached($tpl_file, $cache_id, $compile_id); |
|||
} |
|||
|
|||
/** |
|||
* clear all the assigned template variables. |
|||
*/ |
|||
public function clear_all_assign() |
|||
{ |
|||
$this->clearAllAssign(); |
|||
} |
|||
|
|||
/** |
|||
* clears compiled version of specified template resource, |
|||
* or all compiled template files if one is not specified. |
|||
* This function is for advanced use only, not normally needed. |
|||
* |
|||
* @param string $tpl_file |
|||
* @param string $compile_id |
|||
* @param string $exp_time |
|||
* |
|||
* @return boolean results of {@link smarty_core_rm_auto()} |
|||
*/ |
|||
public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null) |
|||
{ |
|||
return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time); |
|||
} |
|||
|
|||
/** |
|||
* Checks whether requested template exists. |
|||
* |
|||
* @param string $tpl_file |
|||
* |
|||
* @return bool |
|||
* @throws \SmartyException |
|||
*/ |
|||
public function template_exists($tpl_file) |
|||
{ |
|||
return $this->templateExists($tpl_file); |
|||
} |
|||
|
|||
/** |
|||
* Returns an array containing template variables |
|||
* |
|||
* @param string $name |
|||
* |
|||
* @return array |
|||
*/ |
|||
public function get_template_vars($name = null) |
|||
{ |
|||
return $this->getTemplateVars($name); |
|||
} |
|||
|
|||
/** |
|||
* Returns an array containing config variables |
|||
* |
|||
* @param string $name |
|||
* |
|||
* @return array |
|||
*/ |
|||
public function get_config_vars($name = null) |
|||
{ |
|||
return $this->getConfigVars($name); |
|||
} |
|||
|
|||
/** |
|||
* load configuration values |
|||
* |
|||
* @param string $file |
|||
* @param string $section |
|||
* @param string $scope |
|||
*/ |
|||
public function config_load($file, $section = null, $scope = 'global') |
|||
{ |
|||
$this->ConfigLoad($file, $section, $scope); |
|||
} |
|||
|
|||
/** |
|||
* return a reference to a registered object |
|||
* |
|||
* @param string $name |
|||
* |
|||
* @return object |
|||
*/ |
|||
public function get_registered_object($name) |
|||
{ |
|||
return $this->getRegisteredObject($name); |
|||
} |
|||
|
|||
/** |
|||
* clear configuration values |
|||
* |
|||
* @param string $var |
|||
*/ |
|||
public function clear_config($var = null) |
|||
{ |
|||
$this->clearConfig($var); |
|||
} |
|||
|
|||
/** |
|||
* trigger Smarty error |
|||
* |
|||
* @param string $error_msg |
|||
* @param integer $error_type |
|||
*/ |
|||
public function trigger_error($error_msg, $error_type = E_USER_WARNING) |
|||
{ |
|||
trigger_error("Smarty error: $error_msg", $error_type); |
|||
} |
|||
} |
|||
@ -1,110 +0,0 @@ |
|||
<?php |
|||
/** |
|||
* Smarty Internal Plugin Compile Include PHP |
|||
* Compiles the {include_php} tag |
|||
* |
|||
* @package Smarty |
|||
* @subpackage Compiler |
|||
* @author Uwe Tews |
|||
*/ |
|||
|
|||
/** |
|||
* Smarty Internal Plugin Compile Insert Class |
|||
* |
|||
* @package Smarty |
|||
* @subpackage Compiler |
|||
*/ |
|||
class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase |
|||
{ |
|||
/** |
|||
* Attribute definition: Overwrites base class. |
|||
* |
|||
* @var array |
|||
* @see Smarty_Internal_CompileBase |
|||
*/ |
|||
public $required_attributes = array('file'); |
|||
|
|||
/** |
|||
* Attribute definition: Overwrites base class. |
|||
* |
|||
* @var array |
|||
* @see Smarty_Internal_CompileBase |
|||
*/ |
|||
public $shorttag_order = array('file'); |
|||
|
|||
/** |
|||
* Attribute definition: Overwrites base class. |
|||
* |
|||
* @var array |
|||
* @see Smarty_Internal_CompileBase |
|||
*/ |
|||
public $optional_attributes = array('once', 'assign'); |
|||
|
|||
/** |
|||
* Compiles code for the {include_php} tag |
|||
* |
|||
* @param array $args array with attributes from parser |
|||
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|||
* |
|||
* @return string |
|||
* @throws \SmartyCompilerException |
|||
* @throws \SmartyException |
|||
*/ |
|||
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) |
|||
{ |
|||
if (!($compiler->smarty instanceof SmartyBC)) { |
|||
throw new SmartyException("{include_php} is deprecated, use SmartyBC class to enable"); |
|||
} |
|||
// check and get attributes
|
|||
$_attr = $this->getAttributes($compiler, $args); |
|||
/** |
|||
* |
|||
* |
|||
* @var Smarty_Internal_Template $_smarty_tpl |
|||
* used in evaluated code |
|||
*/ |
|||
$_smarty_tpl = $compiler->template; |
|||
$_filepath = false; |
|||
$_file = null; |
|||
eval('$_file = @' . $_attr[ 'file' ] . ';'); |
|||
if (!isset($compiler->smarty->security_policy) && file_exists($_file)) { |
|||
$_filepath = $compiler->smarty->_realpath($_file, true); |
|||
} else { |
|||
if (isset($compiler->smarty->security_policy)) { |
|||
$_dir = $compiler->smarty->security_policy->trusted_dir; |
|||
} else { |
|||
$_dir = $compiler->smarty->trusted_dir; |
|||
} |
|||
if (!empty($_dir)) { |
|||
foreach ((array)$_dir as $_script_dir) { |
|||
$_path = $compiler->smarty->_realpath($_script_dir . DIRECTORY_SEPARATOR . $_file, true); |
|||
if (file_exists($_path)) { |
|||
$_filepath = $_path; |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
if ($_filepath === false) { |
|||
$compiler->trigger_template_error("{include_php} file '{$_file}' is not readable", null, true); |
|||
} |
|||
if (isset($compiler->smarty->security_policy)) { |
|||
$compiler->smarty->security_policy->isTrustedPHPDir($_filepath); |
|||
} |
|||
if (isset($_attr[ 'assign' ])) { |
|||
// output will be stored in a smarty variable instead of being displayed
|
|||
$_assign = $_attr[ 'assign' ]; |
|||
} |
|||
$_once = '_once'; |
|||
if (isset($_attr[ 'once' ])) { |
|||
if ($_attr[ 'once' ] === 'false') { |
|||
$_once = ''; |
|||
} |
|||
} |
|||
if (isset($_assign)) { |
|||
return "<?php ob_start();\ninclude{$_once} ('{$_filepath}');\n\$_smarty_tpl->assign({$_assign},ob_get_clean());\n?>"; |
|||
} else { |
|||
return "<?php include{$_once} ('{$_filepath}');?>\n"; |
|||
} |
|||
} |
|||
} |
|||
@ -1,253 +0,0 @@ |
|||
<?php |
|||
/** |
|||
* Smarty Internal Plugin Compile PHP Expression |
|||
* Compiles any tag which will output an expression or variable |
|||
* |
|||
* @package Smarty |
|||
* @subpackage Compiler |
|||
* @author Uwe Tews |
|||
*/ |
|||
|
|||
/** |
|||
* Smarty Internal Plugin Compile PHP Expression Class |
|||
* |
|||
* @package Smarty |
|||
* @subpackage Compiler |
|||
*/ |
|||
class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase |
|||
{ |
|||
/** |
|||
* Attribute definition: Overwrites base class. |
|||
* |
|||
* @var array |
|||
* @see Smarty_Internal_CompileBase |
|||
*/ |
|||
public $required_attributes = array('code', 'type'); |
|||
|
|||
/** |
|||
* Compiles code for generating output from any expression |
|||
* |
|||
* @param array $args array with attributes from parser |
|||
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object |
|||
* @param array $parameter array with compilation parameter |
|||
* |
|||
* @return string |
|||
* @throws \SmartyException |
|||
*/ |
|||
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) |
|||
{ |
|||
// check and get attributes
|
|||
$_attr = $this->getAttributes($compiler, $args); |
|||
$compiler->has_code = false; |
|||
if ($_attr[ 'type' ] === 'xml') { |
|||
$compiler->tag_nocache = true; |
|||
$output = addcslashes($_attr[ 'code' ], "'\\"); |
|||
$compiler->parser->current_buffer->append_subtree( |
|||
$compiler->parser, |
|||
new Smarty_Internal_ParseTree_Tag( |
|||
$compiler->parser, |
|||
$compiler->processNocacheCode( |
|||
"<?php echo '{$output}';?>\n", |
|||
true |
|||
) |
|||
) |
|||
); |
|||
return ''; |
|||
} |
|||
if ($_attr[ 'type' ] !== 'tag') { |
|||
if ($compiler->php_handling === Smarty::PHP_REMOVE) { |
|||
return ''; |
|||
} elseif ($compiler->php_handling === Smarty::PHP_QUOTE) { |
|||
$output = |
|||
preg_replace_callback( |
|||
'#(<\?(?:php|=)?)|(<%)|(<script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*>)|(\?>)|(%>)|(<\/script>)#i', |
|||
array($this, 'quote'), |
|||
$_attr[ 'code' ] |
|||
); |
|||
$compiler->parser->current_buffer->append_subtree( |
|||
$compiler->parser, |
|||
new Smarty_Internal_ParseTree_Text($output) |
|||
); |
|||
return ''; |
|||
} elseif ($compiler->php_handling === Smarty::PHP_PASSTHRU || $_attr[ 'type' ] === 'unmatched') { |
|||
$compiler->tag_nocache = true; |
|||
$output = addcslashes($_attr[ 'code' ], "'\\"); |
|||
$compiler->parser->current_buffer->append_subtree( |
|||
$compiler->parser, |
|||
new Smarty_Internal_ParseTree_Tag( |
|||
$compiler->parser, |
|||
$compiler->processNocacheCode( |
|||
"<?php echo '{$output}';?>\n", |
|||
true |
|||
) |
|||
) |
|||
); |
|||
return ''; |
|||
} elseif ($compiler->php_handling === Smarty::PHP_ALLOW) { |
|||
if (!($compiler->smarty instanceof SmartyBC)) { |
|||
$compiler->trigger_template_error( |
|||
'$smarty->php_handling PHP_ALLOW not allowed. Use SmartyBC to enable it', |
|||
null, |
|||
true |
|||
); |
|||
} |
|||
$compiler->has_code = true; |
|||
return $_attr[ 'code' ]; |
|||
} else { |
|||
$compiler->trigger_template_error('Illegal $smarty->php_handling value', null, true); |
|||
} |
|||
} else { |
|||
$compiler->has_code = true; |
|||
if (!($compiler->smarty instanceof SmartyBC)) { |
|||
$compiler->trigger_template_error( |
|||
'{php}{/php} tags not allowed. Use SmartyBC to enable them', |
|||
null, |
|||
true |
|||
); |
|||
} |
|||
$ldel = preg_quote($compiler->smarty->left_delimiter, '#'); |
|||
$rdel = preg_quote($compiler->smarty->right_delimiter, '#'); |
|||
preg_match("#^({$ldel}php\\s*)((.)*?)({$rdel})#", $_attr[ 'code' ], $match); |
|||
if (!empty($match[ 2 ])) { |
|||
if ('nocache' === trim($match[ 2 ])) { |
|||
$compiler->tag_nocache = true; |
|||
} else { |
|||
$compiler->trigger_template_error("illegal value of option flag '{$match[2]}'", null, true); |
|||
} |
|||
} |
|||
return preg_replace( |
|||
array("#^{$ldel}\\s*php\\s*(.)*?{$rdel}#", "#{$ldel}\\s*/\\s*php\\s*{$rdel}$#"), |
|||
array('<?php ', '?>'), |
|||
$_attr[ 'code' ] |
|||
); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Lexer code for PHP tags |
|||
* |
|||
* This code has been moved from lexer here fo easier debugging and maintenance |
|||
* |
|||
* @param Smarty_Internal_Templatelexer $lex |
|||
* |
|||
* @throws \SmartyCompilerException |
|||
*/ |
|||
public function parsePhp(Smarty_Internal_Templatelexer $lex) |
|||
{ |
|||
$lex->token = Smarty_Internal_Templateparser::TP_PHP; |
|||
$close = 0; |
|||
$lex->taglineno = $lex->line; |
|||
$closeTag = '?>'; |
|||
if (strpos($lex->value, '<?xml') === 0) { |
|||
$lex->is_xml = true; |
|||
$lex->phpType = 'xml'; |
|||
return; |
|||
} elseif (strpos($lex->value, '<?') === 0) { |
|||
$lex->phpType = 'php'; |
|||
} elseif (strpos($lex->value, '<%') === 0) { |
|||
$lex->phpType = 'asp'; |
|||
$closeTag = '%>'; |
|||
} elseif (strpos($lex->value, '%>') === 0) { |
|||
$lex->phpType = 'unmatched'; |
|||
} elseif (strpos($lex->value, '?>') === 0) { |
|||
if ($lex->is_xml) { |
|||
$lex->is_xml = false; |
|||
$lex->phpType = 'xml'; |
|||
return; |
|||
} |
|||
$lex->phpType = 'unmatched'; |
|||
} elseif (strpos($lex->value, '<s') === 0) { |
|||
$lex->phpType = 'script'; |
|||
$closeTag = '</script>'; |
|||
} elseif (strpos($lex->value, $lex->smarty->left_delimiter) === 0) { |
|||
if ($lex->isAutoLiteral()) { |
|||
$lex->token = Smarty_Internal_Templateparser::TP_TEXT; |
|||
return; |
|||
} |
|||
$closeTag = "{$lex->smarty->left_delimiter}/php{$lex->smarty->right_delimiter}"; |
|||
if ($lex->value === $closeTag) { |
|||
$lex->compiler->trigger_template_error("unexpected closing tag '{$closeTag}'"); |
|||
} |
|||
$lex->phpType = 'tag'; |
|||
} |
|||
if ($lex->phpType === 'unmatched') { |
|||
return; |
|||
} |
|||
if (($lex->phpType === 'php' || $lex->phpType === 'asp') |
|||
&& |
|||
($lex->compiler->php_handling === Smarty::PHP_PASSTHRU || |
|||
$lex->compiler->php_handling === Smarty::PHP_QUOTE) |
|||
) { |
|||
return; |
|||
} |
|||
$start = $lex->counter + strlen($lex->value); |
|||
$body = true; |
|||
if (preg_match('~' . preg_quote($closeTag, '~') . '~i', $lex->data, $match, PREG_OFFSET_CAPTURE, $start)) { |
|||
$close = $match[ 0 ][ 1 ]; |
|||
} else { |
|||
$lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'"); |
|||
} |
|||
while ($body) { |
|||
if (preg_match( |
|||
'~([/][*])|([/][/][^\n]*)|(\'[^\'\\\\]*(?:\\.[^\'\\\\]*)*\')|("[^"\\\\]*(?:\\.[^"\\\\]*)*")~', |
|||
$lex->data, |
|||
$match, |
|||
PREG_OFFSET_CAPTURE, |
|||
$start |
|||
) |
|||
) { |
|||
$value = $match[ 0 ][ 0 ]; |
|||
$from = $pos = $match[ 0 ][ 1 ]; |
|||
if ($pos > $close) { |
|||
$body = false; |
|||
} else { |
|||
$start = $pos + strlen($value); |
|||
$phpCommentStart = $value === '/*'; |
|||
if ($phpCommentStart) { |
|||
$phpCommentEnd = preg_match('~([*][/])~', $lex->data, $match, PREG_OFFSET_CAPTURE, $start); |
|||
if ($phpCommentEnd) { |
|||
$pos2 = $match[ 0 ][ 1 ]; |
|||
$start = $pos2 + strlen($match[ 0 ][ 0 ]); |
|||
} |
|||
} |
|||
while ($close > $pos && $close < $start) { |
|||
if (preg_match( |
|||
'~' . preg_quote($closeTag, '~') . '~i', |
|||
$lex->data, |
|||
$match, |
|||
PREG_OFFSET_CAPTURE, |
|||
$from |
|||
) |
|||
) { |
|||
$close = $match[ 0 ][ 1 ]; |
|||
$from = $close + strlen($match[ 0 ][ 0 ]); |
|||
} else { |
|||
$lex->compiler->trigger_template_error("missing closing tag '{$closeTag}'"); |
|||
} |
|||
} |
|||
if ($phpCommentStart && (!$phpCommentEnd || $pos2 > $close)) { |
|||
$lex->taglineno = $lex->line + substr_count(substr($lex->data, $lex->counter, $start), "\n"); |
|||
$lex->compiler->trigger_template_error("missing PHP comment closing tag '*/'"); |
|||
} |
|||
} |
|||
} else { |
|||
$body = false; |
|||
} |
|||
} |
|||
$lex->value = substr($lex->data, $lex->counter, $close + strlen($closeTag) - $lex->counter); |
|||
} |
|||
|
|||
/* |
|||
* Call back function for $php_handling = PHP_QUOTE |
|||
* |
|||
*/ |
|||
/** |
|||
* @param $match |
|||
* |
|||
* @return string |
|||
*/ |
|||
private function quote($match) |
|||
{ |
|||
return htmlspecialchars($match[ 0 ], ENT_QUOTES); |
|||
} |
|||
} |
|||
@ -1,101 +0,0 @@ |
|||
<?php |
|||
/** |
|||
* Smarty Internal Plugin Resource Registered |
|||
* |
|||
* @package Smarty |
|||
* @subpackage TemplateResources |
|||
* @author Uwe Tews |
|||
* @author Rodney Rehm |
|||
*/ |
|||
|
|||
/** |
|||
* Smarty Internal Plugin Resource Registered |
|||
* Implements the registered resource for Smarty template |
|||
* |
|||
* @package Smarty |
|||
* @subpackage TemplateResources |
|||
* @deprecated |
|||
*/ |
|||
class Smarty_Internal_Resource_Registered extends Smarty_Resource |
|||
{ |
|||
/** |
|||
* populate Source Object with meta data from Resource |
|||
* |
|||
* @param Smarty_Template_Source $source source object |
|||
* @param Smarty_Internal_Template $_template template object |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) |
|||
{ |
|||
$source->filepath = $source->type . ':' . $source->name; |
|||
$source->uid = sha1($source->filepath . $source->smarty->_joined_template_dir); |
|||
$source->timestamp = $this->getTemplateTimestamp($source); |
|||
$source->exists = !!$source->timestamp; |
|||
} |
|||
|
|||
/** |
|||
* populate Source Object with timestamp and exists from Resource |
|||
* |
|||
* @param Smarty_Template_Source $source source object |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function populateTimestamp(Smarty_Template_Source $source) |
|||
{ |
|||
$source->timestamp = $this->getTemplateTimestamp($source); |
|||
$source->exists = !!$source->timestamp; |
|||
} |
|||
|
|||
/** |
|||
* Get timestamp (epoch) the template source was modified |
|||
* |
|||
* @param Smarty_Template_Source $source source object |
|||
* |
|||
* @return integer|boolean timestamp (epoch) the template was modified, false if resources has no timestamp |
|||
*/ |
|||
public function getTemplateTimestamp(Smarty_Template_Source $source) |
|||
{ |
|||
// return timestamp
|
|||
$time_stamp = false; |
|||
call_user_func_array( |
|||
$source->smarty->registered_resources[ $source->type ][ 0 ][ 1 ], |
|||
array($source->name, &$time_stamp, $source->smarty) |
|||
); |
|||
return is_numeric($time_stamp) ? (int)$time_stamp : $time_stamp; |
|||
} |
|||
|
|||
/** |
|||
* Load template's source by invoking the registered callback into current template object |
|||
* |
|||
* @param Smarty_Template_Source $source source object |
|||
* |
|||
* @return string template source |
|||
* @throws SmartyException if source cannot be loaded |
|||
*/ |
|||
public function getContent(Smarty_Template_Source $source) |
|||
{ |
|||
// return template string
|
|||
$content = null; |
|||
$t = call_user_func_array( |
|||
$source->smarty->registered_resources[ $source->type ][ 0 ][ 0 ], |
|||
array($source->name, &$content, $source->smarty) |
|||
); |
|||
if (is_bool($t) && !$t) { |
|||
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'"); |
|||
} |
|||
return $content; |
|||
} |
|||
|
|||
/** |
|||
* Determine basename for compiled filename |
|||
* |
|||
* @param Smarty_Template_Source $source source object |
|||
* |
|||
* @return string resource's basename |
|||
*/ |
|||
public function getBasename(Smarty_Template_Source $source) |
|||
{ |
|||
return basename($source->name); |
|||
} |
|||
} |
|||
614
lib/smarty/libs/sysplugins/smarty_internal_templatelexer.php
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
5287
lib/smarty/libs/sysplugins/smarty_internal_templateparser.php
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue